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 c80e7bf25b002bd6bc4d527101997765d958ca50..9a3ee95b6a147742078fec31cc615414a1b333db 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 fb98fb05e88773c992ea015e6e642e01541b8435..dfbdb4003e158c69707b86880e88af6f42a2dc35 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