From 8cee56cb9fab6e1a1625189b0c5049fd972a7957 Mon Sep 17 00:00:00 2001 From: wtwanga Date: Wed, 6 Jul 2022 11:19:50 +0800 Subject: [PATCH] edit wifi testcase Signed-off-by: wtwanga --- .../wifi_p2p/src/main/js/default/test/WifiP2P.test.js | 10 ++++++++++ .../src/main/js/default/test/WifiSta.test.js | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/communication/wifi_p2p/src/main/js/default/test/WifiP2P.test.js b/communication/wifi_p2p/src/main/js/default/test/WifiP2P.test.js index c80e7bf25..9a3ee95b6 100644 --- a/communication/wifi_p2p/src/main/js/default/test/WifiP2P.test.js +++ b/communication/wifi_p2p/src/main/js/default/test/WifiP2P.test.js @@ -22,6 +22,15 @@ function sleep(delay) { } function checkWifiPowerOn(){ + let enable = wifi.enableWifi(); + console.info("enableWifi result0000123:" + enable); + wifi.on('wifiStateChange', state => { + console.info("wifiStateLisener state:" +state) + if (state === 1) { // 1: wifi is enable, 0:wifi is disable + wifi.scan() + wifi.getLinkedInfo() + } + }) console.info("wifi_test/wifi status:" + wifi.isWifiActive()); expect(wifi.isWifiActive()).assertTrue(); } @@ -34,6 +43,7 @@ let GroupOwnerBand = { describe('ACTS_WifiTest', function () { beforeEach(function () { + checkWifiPowerOn(); }) afterEach(function () { diff --git a/communication/wifi_standard/src/main/js/default/test/WifiSta.test.js b/communication/wifi_standard/src/main/js/default/test/WifiSta.test.js index fb98fb05e..dfbdb4003 100755 --- a/communication/wifi_standard/src/main/js/default/test/WifiSta.test.js +++ b/communication/wifi_standard/src/main/js/default/test/WifiSta.test.js @@ -31,6 +31,15 @@ let WifiSecurityType = { } function checkWifiPowerOn(){ + let enable = wifi.enableWifi(); + console.info("enableWifi result0000123:" + enable); + wifi.on('wifiStateChange', state => { + console.info("wifiStateLisener state:" +state) + if (state === 1) { // 1: wifi is enable, 0:wifi is disable + wifi.scan() + wifi.getLinkedInfo() + } + }) console.info("wifi_test/wifi status:" + wifi.isWifiActive()); expect(wifi.isWifiActive()).assertTrue(); } @@ -53,12 +62,14 @@ let ConnState = { } describe('ACTS_WifiTest', function() { + beforeEach(function() { checkWifiPowerOn(); }) afterEach(function() {}) + /** * @tc.number open_0001 * @tc.name SUB_Communication_WiFi_Sta_Open_0001 -- GitLab