From dda7e4a3b4c77966de03960b57827786c40b1815 Mon Sep 17 00:00:00 2001 From: quanli Date: Thu, 25 May 2023 18:06:00 +0800 Subject: [PATCH] quanli1@huawei.com Signed-off-by: quanli --- communication/bluetooth_ble/Test.json | 1 - .../src/main/js/test/BleGattManager.test.js | 77 ++++--- communication/bluetooth_manager/Test.json | 1 - .../src/main/js/test/BleGattManager.test.js | 51 +++-- communication/bluetooth_on/Test.json | 1 - communication/bluetooth_profile/Test.json | 1 - communication/bluetooth_standard/Test.json | 1 - communication/bluetooth_switchoff/Test.json | 3 +- communication/nfc_Controller/Test.json | 1 - ...nfc.ATagSession.js => ATagSession.test.js} | 21 +- ...c.ConnectedTag.js => ConnectedTag.test.js} | 8 +- .../{nfc.Controller.js => Controller.test.js} | 6 +- .../{nfc.IsoDepTag.js => IsoDepTag.test.js} | 0 .../src/main/js/test/List.test.js | 18 +- ...ClassicTag.js => MifareClassicTag.test.js} | 0 ...ightTag.js => MifareUltralightTag.test.js} | 0 .../test/{nfc.NDEFTag.js => NDEFTag.test.js} | 0 .../test/{nfc.TagABFV.js => TagABFV.test.js} | 199 ++++++++++++++++-- .../{error.IsoDepTag.js => IsoDepTag.test.js} | 0 .../src/main/js/test/List.test.js | 10 +- ...ClassicTag.js => MifareClassicTag.test.js} | 0 ...ightTag.js => MifareUltralightTag.test.js} | 0 .../{error.NDEFTag.js => NDEFTag.test.js} | 0 .../{error.TagABFV.js => TagABFV.test.js} | 0 communication/wifi_ErrorCode201/Test.json | 1 - communication/wifi_ErrorCode202/Test.json | 1 - communication/wifi_ErrorCode401/Test.json | 1 - communication/wifi_p2p/Test.json | 1 - communication/wifi_standard/Test.json | 1 - .../js/test/WifiManagerStationEvent.test.js | 44 ++-- location/geolocation_errorCode/Test.json | 2 +- location/geolocation_standard/Test.json | 2 +- .../src/main/js/test/GeocoderMTest.test.js | 30 ++- 33 files changed, 329 insertions(+), 153 deletions(-) rename communication/nfc_Controller/src/main/js/test/{nfc.ATagSession.js => ATagSession.test.js} (97%) rename communication/nfc_Controller/src/main/js/test/{nfc.ConnectedTag.js => ConnectedTag.test.js} (99%) rename communication/nfc_Controller/src/main/js/test/{nfc.Controller.js => Controller.test.js} (99%) rename communication/nfc_Controller/src/main/js/test/{nfc.IsoDepTag.js => IsoDepTag.test.js} (100%) rename communication/nfc_Controller/src/main/js/test/{nfc.MifareClassicTag.js => MifareClassicTag.test.js} (100%) rename communication/nfc_Controller/src/main/js/test/{nfc.MifareUltralightTag.js => MifareUltralightTag.test.js} (100%) rename communication/nfc_Controller/src/main/js/test/{nfc.NDEFTag.js => NDEFTag.test.js} (100%) rename communication/nfc_Controller/src/main/js/test/{nfc.TagABFV.js => TagABFV.test.js} (75%) rename communication/nfc_ErrorCode/src/main/js/test/{error.IsoDepTag.js => IsoDepTag.test.js} (100%) rename communication/nfc_ErrorCode/src/main/js/test/{error.MifareClassicTag.js => MifareClassicTag.test.js} (100%) rename communication/nfc_ErrorCode/src/main/js/test/{error.MifareUltralightTag.js => MifareUltralightTag.test.js} (100%) rename communication/nfc_ErrorCode/src/main/js/test/{error.NDEFTag.js => NDEFTag.test.js} (100%) rename communication/nfc_ErrorCode/src/main/js/test/{error.TagABFV.js => TagABFV.test.js} (100%) diff --git a/communication/bluetooth_ble/Test.json b/communication/bluetooth_ble/Test.json index 0e6b3f65b..69aefab58 100644 --- a/communication/bluetooth_ble/Test.json +++ b/communication/bluetooth_ble/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "svc bluetooth enable" ] } diff --git a/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js b/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js index 3fcc1d880..0e8cc094e 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js +++ b/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js @@ -143,28 +143,34 @@ describe('bluetoothBLETest', function() { let ret = gattClient.connect(); console.info('[bluetooth_js] gattClient getrssi connect:' + JSON.stringify(ret)) expect(ret).assertTrue(); - try { - await gattClient.getRssiValue().then((data) => { - console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data)); - let rssiLength = Object.keys(data).length; - expect(rssiLength).assertEqual(0); - done(); - }).catch(error => { - console.info('bluetooth getRssiValue has error: '+ JSON.stringify(error)); - expect(error.code).assertEqual('2900099'); - done(); - }); - }catch (error) { - console.error(`[bluetooth_js]GetRssiValue_0100 error, code is ${error.code}, - message is ${error.message}`); - } - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getrssi disconnect:' + disconnect); - expect(disconnect).assertEqual(false); + try { + await gattClient.getRssiValue().then((data) => { + console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data)); + let rssiLength = Object.keys(data).length; + expect(rssiLength).assertEqual(0); + done(); + }).catch(error => { + console.info('bluetooth getRssiValue has error: '+ JSON.stringify(error)); + let b=false; + if(err.code==2900099||err.code==-1) + { + b=true + } + expect(true).assertEqual(b); + done(); + }); + let disconnect = gattClient.disconnect(); + console.info('[bluetooth_js] gatt getrssi disconnect:' + disconnect); + expect(disconnect).assertEqual(false); + }catch (error) { + console.error(`[bluetooth_js]GetRssiValue_0100 error, code is ${error.code}, + message is ${error.message}`); + } done() - }) - /** + + + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200 * @tc.name testgetRssiValue * @tc.desc Test testGetDeviceName api by callback. @@ -177,17 +183,28 @@ describe('bluetoothBLETest', function() { let ret = gattClient.connect(); console.info('[bluetooth_js] gattClient getRssi connect' + JSON.stringify(ret)) expect(ret).assertTrue(); - let promise = new Promise((resolve) => { - gattClient.getRssiValue((err, data)=> { + gattClient.getRssiValue((err, data)=> { + if(err) + { + console.info('[bluetooth_js]getRssi value:'+JSON.stringify(err)); + let b=false; + if(err.code==2900099||err.code==-1) + { + b=true + } + expect(true).assertEqual(b); + } + else + { console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data)); - expect(data).assertNull(); - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getrssi1 disconnect:' + disconnect); - expect(disconnect).assertEqual(false); - }); - resolve() - }) - await promise.then(done) + expect(true).assertEqual(data!=null) + } + }); + let disconnect = gattClient.disconnect(); + console.info('[bluetooth_js] gatt getrssi1 disconnect:' + disconnect); + expect(disconnect).assertEqual(false); + await sleep(3000); + done() }) /** diff --git a/communication/bluetooth_manager/Test.json b/communication/bluetooth_manager/Test.json index 7f69715aa..7f0bc3716 100644 --- a/communication/bluetooth_manager/Test.json +++ b/communication/bluetooth_manager/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "svc bluetooth enable" ] } diff --git a/communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js b/communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js index 0d7b75f6d..23791fba8 100644 --- a/communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js +++ b/communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js @@ -157,18 +157,23 @@ describe('bluetoothBLETest', function() { try { await gattClient.getRssiValue().then((data) => { console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data)); - let rssiLength = Object.keys(data).length; - console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(rssiLength)); - expect(rssiLength).assertEqual(0); + expect(true).assertEqual(data!=null); done(); }).catch(err => { console.info('bluetooth getRssiValue has error: '+ JSON.stringify(err)); + // expect(true).assertEqual(error.code==2900099||error.code==-1); + let b=false; + if(err.code==2900099||err.code==-1) + { + b=true + } + expect(true).assertEqual(b); done(); }); } catch (error) { console.error(`[bluetooth_js]GetRssiValue_0100 error, code is ${error.code}, message is ${error.message}`); - expect(error.code).assertEqual('2900099'); + expect(false).assertEqual(true); done() } @@ -185,23 +190,35 @@ describe('bluetoothBLETest', function() { */ it('COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200', 0, async function (done) { try { - let promise = new Promise((resolve) => { - gattClient.getRssiValue((err, data)=> { - if (err) { - console.error('getRssi failed '); - } - console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data)); - expect(true).assertFalse(); + function getRssi() { + return new Promise((resolve,reject) => { + gattClient.getRssiValue((err, data)=> { + if (err) { + console.error('getRssi failed '); + let b=false; + if(err.code==2900099||err.code==-1) + { + b=true + } + expect(true).assertEqual(b); + } + else + { + console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data)); + expect(true).assertEqual(data!=null ); + } + resolve(); + }); }); - resolve() - }) - await promise.then(done) + } + await getRssi(); } catch (error) { console.error(`[bluetooth_js]GetRssiValue_0200 error, code is ${error.code}, message is ${error.message}`); - expect(error.code).assertEqual('2900099'); - done() - } + expect(false).assertEqual(true); + } + await sleep(2000); + done(); }) /** diff --git a/communication/bluetooth_on/Test.json b/communication/bluetooth_on/Test.json index 9ab4c1c6d..52107048f 100644 --- a/communication/bluetooth_on/Test.json +++ b/communication/bluetooth_on/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "svc bluetooth enable" ] } diff --git a/communication/bluetooth_profile/Test.json b/communication/bluetooth_profile/Test.json index 2cc34ccdd..98c25cf1f 100644 --- a/communication/bluetooth_profile/Test.json +++ b/communication/bluetooth_profile/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "svc bluetooth enable" ] } diff --git a/communication/bluetooth_standard/Test.json b/communication/bluetooth_standard/Test.json index 1ce5fbf7b..3e7429cae 100644 --- a/communication/bluetooth_standard/Test.json +++ b/communication/bluetooth_standard/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "svc bluetooth enable" ] } diff --git a/communication/bluetooth_switchoff/Test.json b/communication/bluetooth_switchoff/Test.json index 91dc25978..bd65ac1a6 100644 --- a/communication/bluetooth_switchoff/Test.json +++ b/communication/bluetooth_switchoff/Test.json @@ -19,9 +19,8 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "svc bluetooth disable" ] } ] -} \ No newline at end of file +} diff --git a/communication/nfc_Controller/Test.json b/communication/nfc_Controller/Test.json index 5195c5fdc..f4bcf9aec 100644 --- a/communication/nfc_Controller/Test.json +++ b/communication/nfc_Controller/Test.json @@ -20,7 +20,6 @@ "type": "ShellKit", "run-command": [ "svc nfc enable", - "hilog -Q pidoff", "power-shell wakeup", "power-shell setmode 602" ] diff --git a/communication/nfc_Controller/src/main/js/test/nfc.ATagSession.js b/communication/nfc_Controller/src/main/js/test/ATagSession.test.js similarity index 97% rename from communication/nfc_Controller/src/main/js/test/nfc.ATagSession.js rename to communication/nfc_Controller/src/main/js/test/ATagSession.test.js index 4cb882f1d..f30b24333 100644 --- a/communication/nfc_Controller/src/main/js/test/nfc.ATagSession.js +++ b/communication/nfc_Controller/src/main/js/test/ATagSession.test.js @@ -245,7 +245,7 @@ export default function nfcATagSessionTest() { done(); }).catch((err)=> { console.info("[NFC_test] tagsession7 nfcAtage sendData1 err: " + err); - expect(3100201).assertEqual(error.code) + expect().assertFail(); done(); }); sleep(3500); @@ -316,14 +316,14 @@ export default function nfcATagSessionTest() { * @tc.level Level 2 */ it('SUB_Communication_NFC_nfcAtage_js_1000', 0, function () { - let settime; + let gettime; try { - settime = tag.getNfcATag(aTag).getTimeout(); - console.info("[NFC_test] tagsession10 getSendDataTimeout:" + settime); - expect(settime).assertInstanceOf('Number') + gettime = tag.getNfcATag(aTag).getTimeout(); + console.info("[NFC_test] tagsession10 getSendDataTimeout:" + gettime); + expect(gettime).assertInstanceOf('Number') } catch (error) { console.info('[NFC_test] tagsession10 getSendDataTimeout error' + error) - expect(3100201).assertEqual(error.code) + expect().assertFail(); } }) @@ -398,7 +398,7 @@ export default function nfcATagSessionTest() { }) /** - * @tc.number SUB_Communication_NFC_nfcAtage_js_0500 + * @tc.number SUB_Communication_NFC_nfcAtage_js_1400 * @tc.name testsetSendDataTimeout * @tc.desc Test setSendDataTimeout api. * @tc.size MEDIUM @@ -451,16 +451,15 @@ export default function nfcATagSessionTest() { }) /** - * @tc.number SUB_Communication_NFC_nfcAtage_js_0160 + * @tc.number SUB_Communication_NFC_nfcAtage_js_1600 * @tc.name connect * @tc.desc Test connect api. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_Communication_NFC_nfcAtage_js_0160', 0, function () { + it('SUB_Communication_NFC_nfcAtage_js_1600', 0, function () { if (getAtag != null && getAtag != undefined) { - let NfcConnect; try { getAtag.connect(); console.log("[NFC_test] tagsession16 NfcConnected pass"); @@ -477,4 +476,4 @@ export default function nfcATagSessionTest() { console.info("*************[nfc_test] start nfc js unit test end*************"); }) -} \ No newline at end of file +} diff --git a/communication/nfc_Controller/src/main/js/test/nfc.ConnectedTag.js b/communication/nfc_Controller/src/main/js/test/ConnectedTag.test.js similarity index 99% rename from communication/nfc_Controller/src/main/js/test/nfc.ConnectedTag.js rename to communication/nfc_Controller/src/main/js/test/ConnectedTag.test.js index 34730de00..b31f8a44a 100644 --- a/communication/nfc_Controller/src/main/js/test/nfc.ConnectedTag.js +++ b/communication/nfc_Controller/src/main/js/test/ConnectedTag.test.js @@ -363,14 +363,14 @@ export default function ConnectedTagTest() { }) /** - * @tc.number SUB_Communication_NFC_nfcConnectedTag_js_1200 + * @tc.number SUB_Communication_NFC_nfcConnectedTag_js_1300 * @tc.name Test write connectedTag * @tc.desc Write Content to Active Tags * @tc.size since 8 * @tc.type Function * @tc.level Level 2 */ - it('SUB_Communication_NFC_nfcConnectedTag_js_1200', 0, async function (done) { + it('SUB_Communication_NFC_nfcConnectedTag_js_1300', 0, async function (done) { var isAccessToken = canIUse("SystemCapability.Communication.ConnectedTag"); console.info("testSysCaps01 test.syscap.param.001 : " + isAccessToken); if (!isAccessToken) { @@ -395,6 +395,4 @@ export default function ConnectedTagTest() { console.info("*************[nfc_test] start nfc js unit test end*************"); }) -} - - +} \ No newline at end of file diff --git a/communication/nfc_Controller/src/main/js/test/nfc.Controller.js b/communication/nfc_Controller/src/main/js/test/Controller.test.js similarity index 99% rename from communication/nfc_Controller/src/main/js/test/nfc.Controller.js rename to communication/nfc_Controller/src/main/js/test/Controller.test.js index d630a8ada..720f74860 100644 --- a/communication/nfc_Controller/src/main/js/test/nfc.Controller.js +++ b/communication/nfc_Controller/src/main/js/test/Controller.test.js @@ -126,8 +126,4 @@ export default function nfcControllerTest() { console.info("*************[nfc_test] start nfc js unit test end*************"); }) -} - - - - +} \ No newline at end of file diff --git a/communication/nfc_Controller/src/main/js/test/nfc.IsoDepTag.js b/communication/nfc_Controller/src/main/js/test/IsoDepTag.test.js similarity index 100% rename from communication/nfc_Controller/src/main/js/test/nfc.IsoDepTag.js rename to communication/nfc_Controller/src/main/js/test/IsoDepTag.test.js diff --git a/communication/nfc_Controller/src/main/js/test/List.test.js b/communication/nfc_Controller/src/main/js/test/List.test.js index dba6f69f9..ae2d4c6e9 100644 --- a/communication/nfc_Controller/src/main/js/test/List.test.js +++ b/communication/nfc_Controller/src/main/js/test/List.test.js @@ -13,14 +13,14 @@ * limitations under the License. */ -import nfcATagSessionTest from './nfc.ATagSession.js' -import nfcControllerTest from './nfc.Controller.js' -import nfcIsoDepTagTest from './nfc.IsoDepTag.js' -import nfcMifareClassicTag from './nfc.MifareClassicTag.js' -import nfcMifareUltralightTag from './nfc.MifareUltralightTag.js' -import nfcTagABFVTest from './nfc.TagABFV.js' -import nfcNDEFTagTest from './nfc.NDEFTag.js' -import ConnectedTagTest from './nfc.ConnectedTag.js' +import nfcATagSessionTest from './ATagSession.test.js'; +import nfcControllerTest from './Controller.test.js'; +import nfcIsoDepTagTest from './IsoDepTag.test.js'; +import nfcMifareClassicTag from './MifareClassicTag.test.js'; +import nfcMifareUltralightTag from './MifareUltralightTag.test.js'; +import nfcTagABFVTest from './TagABFV.test.js'; +import nfcNDEFTagTest from './NDEFTag.test.js'; +import ConnectedTagTest from './ConnectedTag.test.js'; import parameter from '@ohos.systemparameter'; let info = parameter.getSync("const.SystemCapability.Communication.NFC.Core" ,"false"); export default function testsuite() { @@ -35,4 +35,4 @@ if (info != "false") nfcNDEFTagTest(); nfcTagABFVTest(); } -} +} \ No newline at end of file diff --git a/communication/nfc_Controller/src/main/js/test/nfc.MifareClassicTag.js b/communication/nfc_Controller/src/main/js/test/MifareClassicTag.test.js similarity index 100% rename from communication/nfc_Controller/src/main/js/test/nfc.MifareClassicTag.js rename to communication/nfc_Controller/src/main/js/test/MifareClassicTag.test.js diff --git a/communication/nfc_Controller/src/main/js/test/nfc.MifareUltralightTag.js b/communication/nfc_Controller/src/main/js/test/MifareUltralightTag.test.js similarity index 100% rename from communication/nfc_Controller/src/main/js/test/nfc.MifareUltralightTag.js rename to communication/nfc_Controller/src/main/js/test/MifareUltralightTag.test.js diff --git a/communication/nfc_Controller/src/main/js/test/nfc.NDEFTag.js b/communication/nfc_Controller/src/main/js/test/NDEFTag.test.js similarity index 100% rename from communication/nfc_Controller/src/main/js/test/nfc.NDEFTag.js rename to communication/nfc_Controller/src/main/js/test/NDEFTag.test.js diff --git a/communication/nfc_Controller/src/main/js/test/nfc.TagABFV.js b/communication/nfc_Controller/src/main/js/test/TagABFV.test.js similarity index 75% rename from communication/nfc_Controller/src/main/js/test/nfc.TagABFV.js rename to communication/nfc_Controller/src/main/js/test/TagABFV.test.js index 5fc5b8b39..f1ff31472 100644 --- a/communication/nfc_Controller/src/main/js/test/nfc.TagABFV.js +++ b/communication/nfc_Controller/src/main/js/test/TagABFV.test.js @@ -24,26 +24,6 @@ function sleep(delay) { // delay x ms } } -let NdefRecord = { - NFC_A : 1, - NFC_B : 2, - ISO_DEP : 3, - NFC_F : 4, - NFC_V : 5, - NDEF : 6, - MIFARE_CLASSIC : 8, - MIFARE_ULTRALIGHT : 9, - NDEF_FORMATABLE : 10, -}; - -let NfcForumType = { - NFC_FORUM_TYPE_1 : 1, - NFC_FORUM_TYPE_2 : 2, - NFC_FORUM_TYPE_3 : 3, - NFC_FORUM_TYPE_4 : 4, - MIFARE_CLASSIC : 101, -}; - let aTag = { "uid": [0x01, 0x02, 0x03, 0x04], "technology": [1], @@ -103,6 +83,76 @@ var Want = { ] } +let isoDepTaginfo = { + "uid": [0x01, 0x02, 0x03, 0x04], + "technology": [1, 3], + "extrasData": [ + { + "Sak": 0x08, "Atqa": "B000", + }, + { + "HistoricalBytes": "4D54000500308693695B", "HiLayerResponse": "", + }, + ], + "tagRfDiscId": 1, +}; + +let NDEFTaginfo = { + "uid": [0x01, 0x02, 0x03, 0x04], + "technology": [1, 6], + "extrasData": [ + { + "Sak": 0x08, "Atqa": "B000", + }, + { + "NdefMsg": "D4010354787473", "NdefForumType": 1, "NdefTagLength":255, "NdefTagMode": 1, + }, + ], + "tagRfDiscId": 1, +}; + +let mifareclassicTaginfo = { + "uid": [0x01, 0x02, 0x03, 0x04], + "technology": [1, 8], + "extrasData": [ + { + "Sak": 0x08, "Atqa": "B000", + }, + { + + }, + ], + "tagRfDiscId": 1, +}; + +let mifareUltralightTaginfo = { + "uid": [0x01, 0x02, 0x03, 0x04], + "technology": [1, 9], + "extrasData": [ + { + "Sak": 0x08, "Atqa": "B000", + }, + { + "MifareUltralightC": "ture", + }, + ], + "tagRfDiscId": 1, +}; + +let NdefFormatableTag = { + "uid": [0x01, 0x02, 0x03, 0x04], + "technology": [1, 7], + "extrasData": [ + { + "Sak": 0x08, "Atqa": "B000", + }, + { + + }, + ], + "tagRfDiscId": 1, +}; + export default function nfcTagABFVTest() { describe('nfcTagABFVTest', function () { beforeAll(function () { @@ -519,8 +569,111 @@ export default function nfcTagABFVTest() { expect(NfcVTag instanceof Object).assertTrue(); }) - console.info("*************[nfc_test] start nfc js unit test end*************"); - }) -} + /** + * @tc.number SUB_Communication_NFC_nfctage_js_1800 + * @tc.name Test getIsoDep + * @tc.desc This interface is used to obtain the isodep tag object. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_NFC_nfctage_js_1800', 0, function () { + let IsoDepTag ; + try{ + IsoDepTag = tag.getIsoDep(isoDepTaginfo); + console.info('[NFC_test] getIsoDep18 is--<-!!!->' + JSON.stringify(IsoDepTag)); + expect(IsoDepTag != null).assertTrue(); + expect(IsoDepTag instanceof Object).assertTrue(); + }catch(error){ + console.info('nfc getIsoDep is ->' + error) + expect().assertFail(); + } + }) + + /** + * @tc.number SUB_Communication_NFC_nfctage_js_1900 + * @tc.name Test getNdef + * @tc.desc This interface is used to obtain the getNdef tag object. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_NFC_nfctage_js_1900', 0, function () { + let NdefTag ; + try { + NdefTag = tag.getNdef(NDEFTaginfo); + console.info('[NFC_test] getNdef19 is--<-!!!->' + JSON.stringify(NdefTag)); + expect(NdefTag != null).assertTrue(); + expect(NdefTag instanceof Object).assertTrue(); + } catch (error) { + console.info('nfc TagTest getNdef error' + error) + expect().assertFail(); + } + }) + + /** + * @tc.number SUB_Communication_NFC_nfctage_js_2000 + * @tc.name Test getMifareClassic + * @tc.desc This interface is used to obtain the getMifareClassic tag object. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_NFC_nfctage_js_2000', 0, function () { + let MifareClassicTag ; + try{ + MifareClassicTag = tag.getMifareClassic(mifareclassicTaginfo); + console.info('[NFC_test] mifareClassic20 is--<-!!!->' + JSON.stringify(MifareClassicTag)); + expect(MifareClassicTag != null).assertTrue(); + expect(MifareClassicTag instanceof Object).assertTrue(); + } catch (error) { + console.info('nfc mifareClassic20 error' + error) + expect().assertFail(); + } + }) + /** + * @tc.number SUB_Communication_NFC_nfctage_js_2100 + * @tc.name Test getMifareUltralight + * @tc.desc This interface is used to obtain the getMifareUltralight tag object. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_NFC_nfctage_js_2100', 0, function () { + let MifareUltralightTag ; + try { + MifareUltralightTag = tag.getMifareUltralight(mifareUltralightTaginfo); + console.info('[NFC_test] mifareUltralight21 is--<-!!!->' + JSON.stringify(MifareUltralightTag)); + expect(MifareUltralightTag != null).assertTrue(); + expect(MifareUltralightTag instanceof Object).assertTrue(); + } catch (error) { + console.info('nfc mifareUltralight21 error' + error) + expect().assertFail(); + } + }) + + /** + * @tc.number SUB_Communication_NFC_nfctage_js_2200 + * @tc.name Test getNdefFormatable + * @tc.desc This interface is used to obtain the getNdefFormatable tag object. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_NFC_nfctage_js_2200', 0, function () { + let NdefFormatable ; + try { + NdefFormatable = tag.getNdefFormatable(NdefFormatableTag); + console.info('[NFC_test] getNdefFormatable22 is--<-!!!->' + JSON.stringify(NdefFormatable)); + expect(NdefFormatable != null).assertTrue(); + expect(NdefFormatable instanceof Object).assertTrue(); + } catch (error) { + console.info('nfc getNdefFormatable error' + error) + expect().assertFail(); + } + }) + console.info("*************[nfc_test] start nfc js unit test end*************"); + }) +} \ No newline at end of file diff --git a/communication/nfc_ErrorCode/src/main/js/test/error.IsoDepTag.js b/communication/nfc_ErrorCode/src/main/js/test/IsoDepTag.test.js similarity index 100% rename from communication/nfc_ErrorCode/src/main/js/test/error.IsoDepTag.js rename to communication/nfc_ErrorCode/src/main/js/test/IsoDepTag.test.js diff --git a/communication/nfc_ErrorCode/src/main/js/test/List.test.js b/communication/nfc_ErrorCode/src/main/js/test/List.test.js index be05a32d2..ba946a562 100644 --- a/communication/nfc_ErrorCode/src/main/js/test/List.test.js +++ b/communication/nfc_ErrorCode/src/main/js/test/List.test.js @@ -14,11 +14,11 @@ */ -import nfcIsoDepErrorTest from './error.IsoDepTag.js' -import MifareClassicErrorTest from './error.MifareClassicTag.js' -import UltralightTagErrorTest from './error.MifareUltralightTag.js' -import nfcNDEFErrorTest from './error.NDEFTag.js' -import nfcTagABFVErrorTest from './error.TagABFV.js' +import nfcIsoDepErrorTest from './IsoDepTag.test.js' +import MifareClassicErrorTest from './MifareClassicTag.test.js' +import UltralightTagErrorTest from './MifareUltralightTag.test.js' +import nfcNDEFErrorTest from './NDEFTag.test.js' +import nfcTagABFVErrorTest from './TagABFV.test.js' import parameter from '@ohos.systemparameter'; let info = parameter.getSync("const.SystemCapability.Communication.NFC.Core" ,"false"); export default function testsuite() { diff --git a/communication/nfc_ErrorCode/src/main/js/test/error.MifareClassicTag.js b/communication/nfc_ErrorCode/src/main/js/test/MifareClassicTag.test.js similarity index 100% rename from communication/nfc_ErrorCode/src/main/js/test/error.MifareClassicTag.js rename to communication/nfc_ErrorCode/src/main/js/test/MifareClassicTag.test.js diff --git a/communication/nfc_ErrorCode/src/main/js/test/error.MifareUltralightTag.js b/communication/nfc_ErrorCode/src/main/js/test/MifareUltralightTag.test.js similarity index 100% rename from communication/nfc_ErrorCode/src/main/js/test/error.MifareUltralightTag.js rename to communication/nfc_ErrorCode/src/main/js/test/MifareUltralightTag.test.js diff --git a/communication/nfc_ErrorCode/src/main/js/test/error.NDEFTag.js b/communication/nfc_ErrorCode/src/main/js/test/NDEFTag.test.js similarity index 100% rename from communication/nfc_ErrorCode/src/main/js/test/error.NDEFTag.js rename to communication/nfc_ErrorCode/src/main/js/test/NDEFTag.test.js diff --git a/communication/nfc_ErrorCode/src/main/js/test/error.TagABFV.js b/communication/nfc_ErrorCode/src/main/js/test/TagABFV.test.js similarity index 100% rename from communication/nfc_ErrorCode/src/main/js/test/error.TagABFV.js rename to communication/nfc_ErrorCode/src/main/js/test/TagABFV.test.js diff --git a/communication/wifi_ErrorCode201/Test.json b/communication/wifi_ErrorCode201/Test.json index 2b0b78783..bc811c15d 100644 --- a/communication/wifi_ErrorCode201/Test.json +++ b/communication/wifi_ErrorCode201/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "power-shell wakeup", "power-shell setmode 602" ] diff --git a/communication/wifi_ErrorCode202/Test.json b/communication/wifi_ErrorCode202/Test.json index 67730a6cf..ad03f662d 100644 --- a/communication/wifi_ErrorCode202/Test.json +++ b/communication/wifi_ErrorCode202/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "power-shell wakeup", "power-shell setmode 602" ] diff --git a/communication/wifi_ErrorCode401/Test.json b/communication/wifi_ErrorCode401/Test.json index 78bc9aa39..04ebabdc2 100644 --- a/communication/wifi_ErrorCode401/Test.json +++ b/communication/wifi_ErrorCode401/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "power-shell wakeup", "power-shell setmode 602" ] diff --git a/communication/wifi_p2p/Test.json b/communication/wifi_p2p/Test.json index 3c1431b13..b260b348e 100644 --- a/communication/wifi_p2p/Test.json +++ b/communication/wifi_p2p/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "power-shell wakeup", "power-shell setmode 602" ] diff --git a/communication/wifi_standard/Test.json b/communication/wifi_standard/Test.json index 4f21a7271..0bde68876 100644 --- a/communication/wifi_standard/Test.json +++ b/communication/wifi_standard/Test.json @@ -19,7 +19,6 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", "power-shell wakeup", "power-shell setmode 602" ] diff --git a/communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js b/communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js index ed651334d..b6c9d7e63 100644 --- a/communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js +++ b/communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js @@ -208,8 +208,8 @@ export default function actsWifiManagerEventTest() { /** * @tc.number SUB_Communication_WiFi_SysCaps_Test_0010 - * @tc.name testgetSupportedPowerModel - * @tc.desc Test getSupportedPowerModel api. + * @tc.name testgetSupportedPowerMode + * @tc.desc Test getSupportedPowerMode api. * @tc.type Function */ it('SUB_Communication_WiFi_SysCaps_Test_0010', 0, async function (done) { @@ -219,9 +219,9 @@ export default function actsWifiManagerEventTest() { var isAccessToken = canIUse("SystemCapability.Communication.wifiMg.AP.Extension"); console.info("SUB_Communication_WiFi_SysCaps_Test_0010 test.syscap.param.001 : " + isAccessToken); if (isAccessToken) { - await wifiManagerExt.getSupportedPowerModel() + await wifiManagerExt.getSupportedPowerMode() .then(data => { - console.info("[wifi_test]getSupportedPowerModel promise result -> " + JSON.stringify(data)); + console.info("[wifi_test]getSupportedPowerMode promise result -> " + JSON.stringify(data)); }); done(); } @@ -235,8 +235,8 @@ export default function actsWifiManagerEventTest() { /** * @tc.number SUB_Communication_WiFi_SysCaps_Test_0011 - * @tc.name testgetSupportedPowerModel - * @tc.desc Test getSupportedPowerModel api. + * @tc.name testgetSupportedPowerMode + * @tc.desc Test getSupportedPowerMode api. * @tc.type Function */ it('SUB_Communication_WiFi_SysCaps_Test_0011', 0, async function (done) { @@ -246,20 +246,20 @@ export default function actsWifiManagerEventTest() { var isAccessToken = canIUse("SystemCapability.Communication.wifiMg.AP.Extension"); console.info("SUB_Communication_WiFi_SysCaps_Test_0011 test.syscap.param.001 : " + isAccessToken); if (isAccessToken) { - function getSupportedPowerModelResult(){ + function getSupportedPowerModeResult(){ return new Promise((resolve, reject) => { - wifiManagerExt.getSupportedPowerModel( + wifiManagerExt.getSupportedPowerMode( (err, result) => { if(err) { - console.info("[wifi_test]failed to getSupportedPowerModel:" + JSON.stringify(err)); + console.info("[wifi_test]failed to getSupportedPowerMode:" + JSON.stringify(err)); expect(true).assertTrue(); } - console.info("[wifi_test]getSupportedPowerModel callback:" + JSON.stringify(result)); + console.info("[wifi_test]getSupportedPowerMode callback:" + JSON.stringify(result)); resolve(); }); }); } - await getSupportedPowerModelResult(); + await getSupportedPowerModeResult(); done(); } expect(isAccessToken).assertFalse(); @@ -272,8 +272,8 @@ export default function actsWifiManagerEventTest() { /** * @tc.number SUB_Communication_WiFi_SysCaps_Test_0012 - * @tc.name testgetPowerModel - * @tc.desc Test getPowerModel api. + * @tc.name testgetPowerMode + * @tc.desc Test getPowerMode api. * @tc.type Function */ it('SUB_Communication_WiFi_SysCaps_Test_0012', 0, async function (done) { @@ -283,9 +283,9 @@ export default function actsWifiManagerEventTest() { var isAccessToken = canIUse("SystemCapability.Communication.wifiMg.AP.Extension"); console.info("SUB_Communication_WiFi_SysCaps_Test_0012 test.syscap.param.001 : " + isAccessToken); if (isAccessToken) { - await wifiManagerExt.getPowerModel() + await wifiManagerExt.getPowerMode() .then(data => { - console.info("[wifi_test]getPowerModel promise result -> " + JSON.stringify(data)); + console.info("[wifi_test]getPowerMode promise result -> " + JSON.stringify(data)); }); done(); } @@ -299,8 +299,8 @@ export default function actsWifiManagerEventTest() { /** * @tc.number SUB_Communication_WiFi_SysCaps_Test_0013 - * @tc.name testgetPowerModel - * @tc.desc Test getPowerModel api. + * @tc.name testgetPowerMode + * @tc.desc Test getPowerMode api. * @tc.type Function */ it('SUB_Communication_WiFi_SysCaps_Test_0013', 0, async function (done) { @@ -310,20 +310,20 @@ export default function actsWifiManagerEventTest() { var isAccessToken = canIUse("SystemCapability.Communication.wifiMg.AP.Extension"); console.info("SUB_Communication_WiFi_SysCaps_Test_0013 test.syscap.param.001 : " + isAccessToken); if (isAccessToken) { - function getPowerModelResult(){ + function getPowerModeResult(){ return new Promise((resolve, reject) => { - wifiManagerExt.getPowerModel( + wifiManagerExt.getPowerMode( (err, result) => { if(err) { - console.info("[wifi_test]failed to getPowerModel:" + JSON.stringify(err)); + console.info("[wifi_test]failed to getPowerMode:" + JSON.stringify(err)); expect(true).assertTrue(); } - console.info("[wifi_test]getPowerModel callback:" + JSON.stringify(result)); + console.info("[wifi_test]getPowerMode callback:" + JSON.stringify(result)); resolve(); }); }); } - await getPowerModelResult(); + await getPowerModeResult(); done(); } expect(isAccessToken).assertFalse(); diff --git a/location/geolocation_errorCode/Test.json b/location/geolocation_errorCode/Test.json index 26268f4ca..0975a571f 100644 --- a/location/geolocation_errorCode/Test.json +++ b/location/geolocation_errorCode/Test.json @@ -17,7 +17,7 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", + "settings put Secure high_accuracy_startup_comfirm 1", "settings put SECURE location_mode 3" ] } diff --git a/location/geolocation_standard/Test.json b/location/geolocation_standard/Test.json index 6a21c2db1..0f56149b8 100644 --- a/location/geolocation_standard/Test.json +++ b/location/geolocation_standard/Test.json @@ -19,7 +19,7 @@ { "type": "ShellKit", "run-command": [ - "hilog -Q pidoff", + "settings put Secure high_accuracy_startup_comfirm 1", "settings put SECURE location_mode 3" ] } diff --git a/location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js b/location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js index 779084d2b..9a63030ff 100644 --- a/location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js +++ b/location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js @@ -166,17 +166,25 @@ export default function geolocationTest_geo5() { console.info('[lbs_js] getAddressesFromLocation21 promise: ' + JSON.stringify(data)); if(data!="") { - console.info('addressUrl: ' + JSON.stringify(data)[0].addressUrl - + JSON.stringify(data)[0].administrativeArea + JSON.stringify(data)[0].countryCode - + JSON.stringify(data)[0].countryName + JSON.stringify(data)[0].descriptions - + JSON.stringify(data)[0].descriptionsSize + data[0].latitude - + JSON.stringify(data)[0].locale + JSON.stringify(data)[0].locality - + JSON.stringify(data)[0].longitude + JSON.stringify(data)[0].phoneNumber - + JSON.stringify(data)[0].placeName - + JSON.stringify(data)[0].postalCode + JSON.stringify(data)[0].premises - + JSON.stringify(data)[0].roadName + JSON.stringify(data)[0].subAdministrativeArea - + JSON.stringify(data)[0].subLocality + JSON.stringify(data)[0].subRoadName - + JSON.stringify(data)[0].isFromMock); + console.info('addressUrl: ' + JSON.stringify(data[0].addressUrl) + +',administrativeArea: '+ JSON.stringify(data[0].administrativeArea) + +',countryCode: '+ JSON.stringify(data[0].countryCode) + +'countryName: '+ JSON.stringify(data[0].countryName ) + +',descriptions: '+ JSON.stringify(data[0].descriptions) + +',descriptionsSize: '+JSON.stringify(data[0].descriptionsSize) + +',latitude: '+ JSON.stringify(data[0].latitude) + +',locale: '+ JSON.stringify(data[0].locale) + +',locality:'+ JSON.stringify(data[0].locality) + +',longitude:'+ JSON.stringify(data[0].longitude) + +',phoneNumber: '+ JSON.stringify(data[0].phoneNumber) + +',placeName:'+ JSON.stringify(data[0].placeName) + + ',postalCode: '+JSON.stringify(data[0].postalCode) + + ',premises:'+JSON.stringify(data[0].premises) + + ',roadName:'+JSON.stringify(data[0].roadName) + + ',subAdministrativeArea:'+JSON.stringify(data[0].subAdministrativeArea) + + ',subLocality:'+JSON.stringify(data[0].subLocality ) + +',subRoadName:'+ JSON.stringify(data[0].subRoadName) + + ',isFromMock:'+JSON.stringify(data[0].isFromMock)); } }).catch(error => { console.info("[lbs_js] getAddressesFromLocation21 promise then error." + JSON.stringify(error)); -- GitLab