From cca3e4b1d87d957afcca0fbfe0383c6612df536a Mon Sep 17 00:00:00 2001 From: shuxiong Date: Tue, 30 Nov 2021 14:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E8=AF=9D=E5=AD=90=E7=B3=BB=E7=BB=9FJS?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shuxiong --- telephony/telephonyjstest/BUILD.gn | 2 +- .../telephonyjstest/call_manager/BUILD.gn | 2 +- .../call_manager/call_manager_mmi/BUILD.gn | 2 +- .../src/main/js/test/CallManagerMMI.test.js | 70 +- .../call_manager_on_dail/BUILD.gn | 2 +- .../main/js/test/CallManagerOnDail.test.js | 1084 +++++++++++------ .../call_manager/call_manager_test/BUILD.gn | 2 +- .../src/main/js/test/CallManagerTest.test.js | 375 +++--- telephony/telephonyjstest/config.sh | 16 +- .../telephonyjstest/network_search/BUILD.gn | 2 +- .../network_search_information/BUILD.gn | 2 +- .../js/test/NetworkSearchInformation.test.js | 28 +- .../network_search_radio/BUILD.gn | 2 +- .../main/js/test/NetworkSearchRadio.test.js | 198 ++- .../network_search_selection_mode/BUILD.gn | 2 +- .../main/js/test/NetworkSelectionMode.test.js | 289 +++-- telephony/telephonyjstest/sim/BUILD.gn | 2 +- .../sim_file_manager_function_test/BUILD.gn | 2 +- .../js/test/SimFileManagerFunction.test.js | 55 +- .../sim/sim_manager_function_test/BUILD.gn | 2 +- .../main/js/test/SimManagerFunction.test.js | 57 +- .../sim/sim_no_sim_function_test/BUILD.gn | 31 + .../sim/sim_no_sim_function_test/Test.json | 19 + .../entry/package.json | 15 + .../entry/src/main/config.json | 61 + .../entry/src/main/js/default/app.js | 23 + .../entry/src/main/js/default/i18n/en-US.json | 8 + .../entry/src/main/js/default/i18n/zh-CN.json | 8 + .../src/main/js/default/pages/index/index.css | 9 + .../src/main/js/default/pages/index/index.hml | 5 + .../src/main/js/default/pages/index/index.js | 50 + .../main/js/default/utils/Constant.test.js | 21 + .../js/resources/base/element/string.json | 12 + .../src/main/js/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../entry/src/main/js/test/List.test.js | 16 + .../src/main/js/test/SimNoSimFunction.test.js | 63 + .../main/resources/base/element/string.json | 12 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../signature/openharmony_sx.p7b | Bin 0 -> 3437 bytes .../sim_state_manager_function_test/BUILD.gn | 2 +- .../js/test/SimStateManagerFunction.test.js | 77 +- .../entry/src/main/js/test/SmsMmsAdd.test.js | 273 +++-- .../src/main/js/test/SmsMmsConfig.test.js | 6 +- .../main/js/test/SmsMmsCreateMessage.test.js | 270 +++- .../src/main/js/test/SmsMmsDelSim.test.js | 7 +- .../src/main/js/test/SmsMmsFunction.test.js | 13 +- .../src/main/js/test/SmsMmsGetAll.test.js | 3 + .../sms_mms/sms_mms_radio/BUILD.gn | 31 + .../sms_mms/sms_mms_radio/Test.json | 19 + .../sms_mms_radio/entry/src/main/config.json | 61 + .../entry/src/main/js/default/app.js | 23 + .../entry/src/main/js/default/i18n/en-US.json | 6 + .../entry/src/main/js/default/i18n/zh-CN.json | 6 + .../src/main/js/default/pages/index/index.css | 9 + .../src/main/js/default/pages/index/index.hml | 5 + .../src/main/js/default/pages/index/index.js | 52 + .../js/resources/base/element/string.json | 12 + .../src/main/js/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../entry/src/main/js/test/List.test.js | 19 + .../src/main/js/test/SmsMmsRadio.test.js | 83 ++ .../main/resources/base/element/string.json | 12 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../signature/openharmony_sx.p7b | Bin 0 -> 3437 bytes .../entry/src/main/js/test/SmsMmsSmsc.test.js | 24 +- .../src/main/js/test/SmsMmsUpdataAsy.test.js | 168 ++- .../src/main/js/test/SmsMmsUpdataPro.test.js | 139 ++- 66 files changed, 2867 insertions(+), 1002 deletions(-) create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/BUILD.gn create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/Test.json create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/package.json create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/config.json create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/app.js create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/i18n/en-US.json create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/i18n/zh-CN.json create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.css create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.hml create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.js create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/utils/Constant.test.js create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/resources/base/element/string.json create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/resources/base/media/icon.png create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/test/List.test.js create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/test/SimNoSimFunction.test.js create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/resources/base/element/string.json create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/resources/base/media/icon.png create mode 100644 telephony/telephonyjstest/sim/sim_no_sim_function_test/signature/openharmony_sx.p7b create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/BUILD.gn create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/Test.json create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/config.json create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/app.js create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/i18n/en-US.json create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/i18n/zh-CN.json create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.css create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.hml create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.js create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/resources/base/element/string.json create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/resources/base/media/icon.png create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/test/List.test.js create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/test/SmsMmsRadio.test.js create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/resources/base/element/string.json create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/resources/base/media/icon.png create mode 100644 telephony/telephonyjstest/sms_mms/sms_mms_radio/signature/openharmony_sx.p7b diff --git a/telephony/telephonyjstest/BUILD.gn b/telephony/telephonyjstest/BUILD.gn index f3a1e4958..c5e3af1f1 100644 --- a/telephony/telephonyjstest/BUILD.gn +++ b/telephony/telephonyjstest/BUILD.gn @@ -21,4 +21,4 @@ group("telephonyjstest") { "sim:sim", "sms_mms:sms_mms", ] -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/call_manager/BUILD.gn b/telephony/telephonyjstest/call_manager/BUILD.gn index 37ac56a69..09e70c37b 100644 --- a/telephony/telephonyjstest/call_manager/BUILD.gn +++ b/telephony/telephonyjstest/call_manager/BUILD.gn @@ -22,4 +22,4 @@ group("call_manager") { "call_manager_test:CallManagerTest", ] } -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/call_manager/call_manager_mmi/BUILD.gn b/telephony/telephonyjstest/call_manager/call_manager_mmi/BUILD.gn index 00dd34b21..581030482 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_mmi/BUILD.gn +++ b/telephony/telephonyjstest/call_manager/call_manager_mmi/BUILD.gn @@ -28,4 +28,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/call_manager/call_manager_mmi/entry/src/main/js/test/CallManagerMMI.test.js b/telephony/telephonyjstest/call_manager/call_manager_mmi/entry/src/main/js/test/CallManagerMMI.test.js index 89d4fa803..adf067551 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_mmi/entry/src/main/js/test/CallManagerMMI.test.js +++ b/telephony/telephonyjstest/call_manager/call_manager_mmi/entry/src/main/js/test/CallManagerMMI.test.js @@ -27,6 +27,7 @@ describe('CallManagerMMI', function () { it('Telephony_CallManager_MMI_Async_0100', 0, async function (done) { call.dial('**21*12599*10#', (err, data) => { if (err) { + expect().assertFail(); console.log('Telephony_CallManager_MMI_Async_0100 fail'); done(); return; @@ -34,16 +35,17 @@ describe('CallManagerMMI', function () { expect(data).assertTrue(); console.log('Telephony_CallManager_MMI_Async_0100 finish data = ' + data); done(); - }) - call.dial('##002#', (err, data) => { - if (err) { - console.log('Telephony_CallManager_MMI_Async_0100 fail'); + call.dial('##002#', (err, data) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_MMI_Async_0100 fail'); + done(); + return; + } + expect(data).assertTrue(); + console.log('Telephony_CallManager_MMI_Async_0100 finish data = ' + data); done(); - return; - } - expect(data).assertTrue(); - console.log('Telephony_CallManager_MMI_Async_0100 finish data = ' + data); - done(); + }) }) }) @@ -56,22 +58,24 @@ describe('CallManagerMMI', function () { it('Telephony_CallManager_MMI_Async_0200', 0, async function (done) { call.dial('**33*0000#', (err, data) => { if (err) { + expect().assertFail(); console.log('Telephony_CallManager_MMI_Async_0200 fail'); done(); return; } expect(data).assertTrue(); console.log('Telephony_CallManager_MMI_Async_0200 finish data = ' + data); - }) - call.dial('#33*0000#', (err, data) => { - if (err) { - console.log('Telephony_CallManager_MMI_Async_0200 fail'); + call.dial('#33*0000#', (err, data) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_MMI_Async_0200 fail'); + done(); + return; + } + expect(data).assertTrue(); + console.log('Telephony_CallManager_MMI_Async_0200 finish data = ' + data); done(); - return; - } - expect(data).assertTrue(); - console.log('Telephony_CallManager_MMI_Async_0200 finish data = ' + data); - done(); + }) }) }) @@ -84,22 +88,24 @@ describe('CallManagerMMI', function () { it('Telephony_CallManager_MMI_Async_0300', 0, async function (done) { call.dial('*331*0000#', (err, data) => { if (err) { + expect().assertFail(); console.log('Telephony_CallManager_MMI_Async_0300 fail'); done(); return; } expect(data).assertTrue(); console.log('Telephony_CallManager_MMI_Async_0300 finish data = ' + data); - }) - call.dial('#331#0000#', (err, data) => { - if (err) { - console.log('Telephony_CallManager_MMI_Async_0300 fail'); + call.dial('#331#0000#', (err, data) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_MMI_Async_0300 fail'); + done(); + return; + } + expect(data).assertTrue(); + console.log('Telephony_CallManager_MMI_Async_0300 finish data = ' + data); done(); - return; - } - expect(data).assertTrue(); - console.log('Telephony_CallManager_MMI_Async_0300 finish data = ' + data); - done(); + }) }) }) @@ -112,6 +118,7 @@ describe('CallManagerMMI', function () { it('Telephony_CallManager_MMI_Async_0400', 0, async function (done) { call.dial('#35*0000#', (err, data) => { if (err) { + expect().assertFail(); console.log('Telephony_CallManager_MMI_Async_0400 fail'); done(); return; @@ -132,12 +139,12 @@ describe('CallManagerMMI', function () { var data = await call.dial('##330*0000#'); expect(data).assertTrue(); console.log('Telephony_CallManager_MMI_Promise_0100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_MMI_Promise_0100 fail'); expect().assertFail(); done(); } - done(); }) /* @@ -151,12 +158,12 @@ describe('CallManagerMMI', function () { var data = await call.dial('*#330#0000#'); expect(data).assertTrue(); console.log('Telephony_CallManager_MMI_Promise_0200 finish data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_MMI_Promise_0200 fail'); done(); } - done(); }) /* @@ -169,12 +176,12 @@ describe('CallManagerMMI', function () { var data = await call.dial('*#31#'); expect(data).assertTrue(); console.log('Telephony_CallManager_MMI_Promise_0300 finish data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_MMI_Promise_0300 fail'); done(); } - done(); }) /* @@ -191,16 +198,17 @@ describe('CallManagerMMI', function () { expect().assertFail(); console.log('Telephony_CallManager_MMI_Promise_0400 fail'); done(); + return; } try { var data = await call.dial('*31#'); expect(data).assertTrue(); console.log('Telephony_CallManager_MMI_Promise_0400 finish data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_MMI_Promise_0400 fail'); done(); } - done(); }) }) diff --git a/telephony/telephonyjstest/call_manager/call_manager_on_dail/BUILD.gn b/telephony/telephonyjstest/call_manager/call_manager_on_dail/BUILD.gn index 27f9b3925..f16051c0c 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_on_dail/BUILD.gn +++ b/telephony/telephonyjstest/call_manager/call_manager_on_dail/BUILD.gn @@ -28,4 +28,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/call_manager/call_manager_on_dail/entry/src/main/js/test/CallManagerOnDail.test.js b/telephony/telephonyjstest/call_manager/call_manager_on_dail/entry/src/main/js/test/CallManagerOnDail.test.js index 8953ca014..1c48a112a 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_on_dail/entry/src/main/js/test/CallManagerOnDail.test.js +++ b/telephony/telephonyjstest/call_manager/call_manager_on_dail/entry/src/main/js/test/CallManagerOnDail.test.js @@ -15,17 +15,32 @@ import call from '@ohos.telephony.call'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +class RejectMessageOptions { + constructor(str){ + this.messageContent = str; + } +} + describe('CallManagerOnDial', function () { - const TEST_PHONY_NUMBER = '10086'; + + const GETMAIN_CALLID_ERRO = -1; + const timeOut = 20000; + const waitTime = 200; + const INVALID_NUMBER = ''; + const CALLMANAGER_TEST_PHONY_NUMBER = ''; + const THE_THREE_NUMBER = ''; + const EIGHTEEN_DIGITS = ''; + const WITH_LETTER_NUMBER = ''; + const EIGHT_NUMBER = ''; + const EIGHT_NUMBER_WITH_AN_AREA_CODE = ''; + const REJECT_MESSAGE_NUM = 1234567890123456789012345678901234567890; + const REJECT_MESSAGE_STR = 'Hi,你好呀?'; var callId = 0; var callState = -1; - var timeOut = 0; + var timing = 0; var endTime = 0; - var onTime = 25000; - var newCallId = 0 - var waitTime = 200; - const INVALID_NUMBER = '13800000000' - const GETMAIN_CALLID_ERRO = -1; + var newCallId = 0; const sleep = (time) => { return new Promise((resolve, reject) => { @@ -38,6 +53,7 @@ describe('CallManagerOnDial', function () { beforeAll(async function () { call.on('callDetailsChange', (err, callStateInfo) => { if (err) { + expect().assertFail(); console.log('Telephony_CallManager_on_Async fail err = ' + err); return; } @@ -50,6 +66,7 @@ describe('CallManagerOnDial', function () { afterAll(async function () { call.off('callDetailsChange', (err) => { if (err) { + expect().assertFail(); console.log('Telephony_CallManager_off_Async fail err = ' + err); } }) @@ -57,6 +74,7 @@ describe('CallManagerOnDial', function () { afterEach(async function () { const startTime = new Date().getTime(); + let flag = false; while(true){ if (callId > newCallId) { if (callState === call.CALL_STATUS_DISCONNECTED) { @@ -64,19 +82,25 @@ describe('CallManagerOnDial', function () { } newCallId = callId console.log('Telephony_CallManager_hangup_Async callId = ' + callId); - call.hangup(callId, async (err) => { + call.hangup(callId, (err) => { if (err) { + expect().assertFail(); console.log('Telephony_CallManager_hangup_Async fail err = ' + err); return; } console.log('Telephony_CallManager_hangup_Async finish'); - return; + flag = true; }) + if(flag) + { + return; + } } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); console.log("Telephony_CallManager_hangup is out of time"); break; @@ -86,12 +110,12 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Async_0100 - * @tc.name Set the mandatory phone number to a normal number (10086) and call dial() as a callback, - * returning :true + * @tc.name Set the mandatory phone number to a normal number (CALLMANAGER_TEST_PHONY_NUMBER) and call dial() as + * a callback,returning :true * @tc.desc Function test */ it('Telephony_CallManager_dial_Async_0100', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, (err, data) => { if (err) { console.log('Telephony_CallManager_dial_Async_0100 fail' + err); expect().assertFail(); @@ -103,14 +127,16 @@ describe('CallManagerOnDial', function () { }) const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -127,6 +153,7 @@ describe('CallManagerOnDial', function () { call.dial('10086,1234567890123456789123', { accountId: 0 }, (err, data) => { if (err) { console.log('Telephony_CallManager_dial_Async_0400 fail err = ' + err); + expect().assertFail(); done(); return; } @@ -136,14 +163,16 @@ describe('CallManagerOnDial', function () { }) const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -152,12 +181,12 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Async_0500 - * @tc.name Set the mandatory phone number to an invalid number (abcDE123456), + * @tc.name Set the mandatory phone number to an invalid number (WITH_LETTER_NUMBER), * call dial() in callback mode, and return :true * @tc.desc Function test */ it('Telephony_CallManager_dial_Async_0500', 0, async function (done) { - call.dial('abcde123456', (err, data) => { + call.dial(WITH_LETTER_NUMBER, (err, data) => { if (err) { console.log('Telephony_CallManager_dial_Async_0500 fail err = ' + err); expect().assertFail(); @@ -169,14 +198,16 @@ describe('CallManagerOnDial', function () { }) const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -185,14 +216,14 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Async_0800 - * @tc.name Set the mandatory phone number to a normal number (10086) and the optional parameters options - * to {accountId: 0, videoState: 0, dialScene: 0, dialType: 0}. Dial () in callback mode and return - * :true + * @tc.name Set the mandatory phone number to a normal number (WITH_LETTER_NUMBER) and the optional parameters + * options to {accountId: 0, videoState: 0, dialScene: 0, dialType: 0}. Dial () in callback mode and + * return :true * @tc.desc Function test */ it('Telephony_CallManager_dial_Async_0800', 0, async function (done) { let obj = { accountId: 0, videoState: 0, dialScene: 0, dialType: 0 }; - call.dial('abcedf123456', obj, (err, data) => { + call.dial(WITH_LETTER_NUMBER, obj, (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_dial_Async_0800 fail err = ' + err); @@ -204,14 +235,16 @@ describe('CallManagerOnDial', function () { }) const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -236,14 +269,16 @@ describe('CallManagerOnDial', function () { }) const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -252,13 +287,14 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Async_1300 - * @tc.name Set the mandatory phone number to a normal number (112) and the optional parameters options to - * {accountId: 0, videoState: 0, dialScene: 0, dialType: 0}. Dial () in callback mode and return :true + * @tc.name Set the mandatory phone number to a normal number (THE_THREE_NUMBER) and the optional parameters + * options to {accountId: 0, videoState: 0, dialScene: 0, dialType: 0}. Dial () in callback mode and + * return :true * @tc.desc Function test */ it('Telephony_CallManager_dial_Async_1300', 0, async function (done) { let obj = { accountId: 0, videoState: 0, dialScene: 0, dialType: 0 }; - call.dial('112', obj, (err, data) => { + call.dial(THE_THREE_NUMBER, obj, (err, data) => { if (err) { console.log('Telephony_CallManager_dial_Async_1300 fail err = ' + err); expect().assertFail(); @@ -270,14 +306,16 @@ describe('CallManagerOnDial', function () { }) const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -286,25 +324,27 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_0100 - * @tc.name Set the mandatory phone number to a normal number (10086) and the optional parameters options to - * {accountId: 0, videoState: 0, dialScene: 0, dialType: 0}. Call dial() and return :true + * @tc.name Set the mandatory phone number to a normal number (EIGHTEEN_DIGITS) and the optional parameters + * options to {accountId: 0}. Call dial() and return :true * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_0100', 0, async function (done) { try { - var data = await call.dial('123456789123456789', { accountId: 0 }) + var data = await call.dial(EIGHTEEN_DIGITS, { accountId: 0 }) expect(data).assertTrue(); console.log('Telephony_CallManager_dial_Promise_0100 finish data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -318,13 +358,13 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_0300 - * @tc.name Set the mandatory phone number to abcDE123456 and optional parameters options to - * {accountId: 0, videoState: 0, dialScene: 0, dialType: 0},call dial() to dial, return :true + * @tc.name Set the mandatory phone number to WITH_LETTER_NUMBER and optional parameters options to + * {accountId: 0},call dial() to dial, return :true * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_0300', 0, async function (done) { try { - var data = await call.dial('abcde123456', { accountId: 0 }) + var data = await call.dial(WITH_LETTER_NUMBER, { accountId: 0 }) expect(data).assertTrue(); console.log('Telephony_CallManager_dial_Promise_0300 finish data = ' + data); } catch (err) { @@ -335,14 +375,16 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -351,13 +393,13 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_0600 - * @tc.name Set the required phone number to a normal number (10086) with no optional arguments and call - * dial() to dial, returning :true + * @tc.name Set the required phone number to a normal number (CALLMANAGER_TEST_PHONY_NUMBER) with no optional + * arguments and call dial() to dial, returning :true * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_0600', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER, { accountId: 0 }) + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER, { accountId: 0 }) console.log('Telephony_CallManager_dial_Promise_0600 finish data = ' + data); expect(data).assertTrue(); } catch (err) { @@ -368,14 +410,16 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -385,7 +429,7 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_0700 * @tc.name Example Set the required phone number to a normal number INVALID_NUMBER. Options are - * {accountId: 0, videoState: 0, dialScene: 0, dialType: 0}, call dial() to dial, returning :true. + * {accountId: 0 }, call dial() to dial, returning :true. * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_0700', 0, async function (done) { @@ -401,14 +445,16 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -417,13 +463,13 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_0800 - * @tc.name Set the required phone number to a normal number (112) without the optional parameters, + * @tc.name Set the required phone number to a normal number (THE_THREE_NUMBER) without the optional parameters, * and call dial() to dial, returning :true * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_0800', 0, async function (done) { try { - var data = await call.dial('112'); + var data = await call.dial(THE_THREE_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_dial_Promise_0800 finish data = ' + data); } catch (err) { @@ -434,14 +480,16 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -450,7 +498,7 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_1000 - * @tc.name Will choose parameter number add ', '(10086123567901345789123), with no optional parameters, + * @tc.name Will choose parameter number add ', '(10086,123567901345789123), with no optional parameters, * call dial () to dial, return: true * @tc.desc Function test */ @@ -467,14 +515,16 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -483,13 +533,13 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_1100 - * @tc.name This parameter is mandatory. The phone number is 00000000. + * @tc.name This parameter is mandatory. The phone number is EIGHT_NUMBER. * Dial () with no optional parameters returns true * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_1100', 0, async function (done) { try { - var data = await call.dial('00000000'); + var data = await call.dial(EIGHT_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_dial_Promise_1100 finish data = ' + data); } catch (err) { @@ -500,14 +550,16 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -516,13 +568,13 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_1200 - * @tc.name The phone number is 000000000000000000. Dial () without any optional parameters. + * @tc.name The phone number is EIGHTEEN_DIGITS. Dial () without any optional parameters. * True is returned * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_1200', 0, async function (done) { try { - var data = await call.dial('000000000000000000'); + var data = await call.dial(EIGHTEEN_DIGITS); expect(data).assertTrue(); console.log('Telephony_CallManager_dial_Promise_1200 finish data = ' + data); } catch (err) { @@ -533,14 +585,16 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -549,13 +603,13 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_dial_Promise_1300 - * @tc.name The phone number is the area code (0898) and the number is 0000 0000. Dial () without optional + * @tc.name The phone number is the area code and the number (0898 0000 0000). Dial () without optional * parameters returns true * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_1300', 0, async function (done) { try { - var data = await call.dial('0898 0000 0000'); + var data = await call.dial(EIGHT_NUMBER_WITH_AN_AREA_CODE); expect(data).assertTrue(); console.log('Telephony_CallManager_dial_Promise_1300 finish data = ' + data); } catch (err) { @@ -566,14 +620,16 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -587,7 +643,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_switchCall_Async_0400', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_switchCall_Async_0400 dial fail err = ' + err); @@ -598,7 +654,8 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_switchCall_Async_0400 dial finish data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.switchCall(callId, (err) => { if (err) { console.log( @@ -608,14 +665,16 @@ describe('CallManagerOnDial', function () { } expect().assertFail(); console.log('Telephony_CallManager_switchCall_Async_0400 switchCall fail'); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -631,7 +690,7 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_switchCall_Promise_0400', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_switchCall_Promise_0400 dial finish data = ' + data); } catch (err) { @@ -642,23 +701,25 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.switchCall(callId); expect().assertFail(); console.log('Telephony_CallManager_switchCall_Promise_0400 switchCall fail'); + done(); } catch (err) { console.log('Telephony_CallManager_switchCall_Promise_0400 switchCall finish err = ' + err.message); done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -672,7 +733,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_holdCall_Async_0400', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_holdCall_Async_0400 dial fail err = ' + err); @@ -692,14 +753,16 @@ describe('CallManagerOnDial', function () { return; } console.log('Telephony_CallManager_holdCall_Async_0400 finish'); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -715,7 +778,7 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_holdCall_Promise_0400', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_holdCall_Promise_0400 dial finish data = ' + data); } catch (err) { @@ -730,19 +793,20 @@ describe('CallManagerOnDial', function () { try { await call.holdCall(callId); console.log('Telephony_CallManager_holdCall_Promise_0400 holdCall finish'); + done(); } catch (err) { console.log('Telephony_CallManager_holdCall_Promise_0400 holdCall fail err = ' + err.message); expect().assertFail(); done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -756,7 +820,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_unholdCall_Async_0400', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_unholdCall_Async_0400 dial fail err = ' + err); @@ -766,45 +830,49 @@ describe('CallManagerOnDial', function () { expect(data).assertTrue(); console.log('Telephony_CallManager_unholdCall_Async_0400 dial finish data = ' + data); const startTime = new Date().getTime(); - let holdCallflig = true; - let unHoldCallflig = true; + let flag = false; + let holdCallflag = true; + let unHoldCallflag = false; while (true) { - if (callState === call.CALL_STATUS_ACTIVE && holdCallflig === true) { - holdCallflig = false; + if (callState === call.CALL_STATUS_ACTIVE && holdCallflag === true) { + holdCallflag = false; call.holdCall(callId, (err) => { if (err) { expect().assertFail(); console.log( - 'Telephony_CallManager_unholdCall_Async_0400 holdCall fail err = ' + err.message - ); + 'Telephony_CallManager_unholdCall_Async_0400 holdCall fail err = ' + err.message ); done(); return; } console.log('Telephony_CallManager_unholdCall_Async_0400 holdCall finish'); + unHoldCallflag = true; }) } await sleep(waitTime); - if (callState === call.CALL_STATUS_HOLDING && unHoldCallflig === true) { - unHoldCallflig = false; + if (callState === call.CALL_STATUS_HOLDING && unHoldCallflag === true) { + unHoldCallflag = false; call.unHoldCall(callId, (err) => { if (err) { expect().assertFail(); console.log( - 'Telephony_CallManager_unholdCall_Async_0400 unHoldCall fail err = ' + - err.message - ); + 'Telephony_CallManager_unholdCall_Async_0400 unHoldCall fail err = ' + err.message ); done(); return; } + flag = true; console.log('Telephony_CallManager_unholdCall_Async_0400 unHoldCall finish'); done(); + return; }) - return; + if (flag){ + return; + } } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -820,7 +888,7 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_unholdCall_Promise_0400', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_unholdCall_Promise_0400 dial finish data = ' + data); } catch (err) { @@ -829,12 +897,14 @@ describe('CallManagerOnDial', function () { done(); return; } - let holdCallflig = true; - let unHoldCallflig = true; + let flag = false; + let holdCallflag = true; + let unHoldCallflag = false; const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_ACTIVE && holdCallflig === true) { - holdCallflig = false; + if (callState === call.CALL_STATUS_ACTIVE && holdCallflag === true) { + unHoldCallflag = true; + holdCallflag = false; try { await call.holdCall(callId); console.log('Telephony_CallManager_unholdCall_Promise_0400 holdCall finish'); @@ -842,17 +912,19 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_unholdCall_Promise_0400 holdCall fail err = ' + err.message); expect().assertFail(); done(); + return; } } await sleep(waitTime); - if (callState === call.CALL_STATUS_HOLDING && unHoldCallflig === true) { - unHoldCallflig = false; + if (callState === call.CALL_STATUS_HOLDING && unHoldCallflag === true) { + unHoldCallflag = false; try { await call.unHoldCall(callId); console.log('Telephony_CallManager_unholdCall_Promise_0400 unHoldCall finish'); done(); return; } catch (err) { + flag = true; console.log( 'Telephony_CallManager_unholdCall_Promise_0400 unHoldCall fail err = ' + err.message ); @@ -861,23 +933,27 @@ describe('CallManagerOnDial', function () { return; } } - } - await sleep(waitTime); - endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { - done(); - return; + if (flag){ + return; + } + await sleep(waitTime); + endTime = new Date().getTime(); + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); + done(); + return; + } } }) /* * @tc.number Telephony_CallManager_hasCall_Async_0500 - * @tc.name Call 10086, hasCall() to confirm that there is a call, returns true + * @tc.name Call CALLMANAGER_TEST_PHONY_NUMBER, hasCall() to confirm that there is a call, returns true * @tc.desc Function test */ it('Telephony_CallManager_hasCall_Async_0500', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_hasCall_Async_0500 dial fail err = ' + err); @@ -888,7 +964,8 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_hasCall_Async_0500 dial finish data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.hasCall((err, data) => { if (err) { expect().assertFail(); @@ -898,14 +975,16 @@ describe('CallManagerOnDial', function () { } expect(data).assertTrue(); console.log('Telephony_CallManager_hasCall_Async_0500 finish data = ' + data); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -915,12 +994,12 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_hasCall_Promise_0500 - * @tc.name Call 10086, hasCall() to confirm that there is a call, returns true + * @tc.name Call CALLMANAGER_TEST_PHONY_NUMBER, hasCall() to confirm that there is a call, returns true * @tc.desc Function test */ it('Telephony_CallManager_hasCall_Promise_0500', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_hasCall_Promise_0500 dial finish data = ' + data); } catch (err) { @@ -931,24 +1010,26 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { data = await call.hasCall(); expect(data).assertTrue(); console.log('Telephony_CallManager_hasCall_Promise_0500 getCallState finish data = ' + data); + done(); + return; } catch (err) { console.log('Telephony_CallManager_hasCall_Promise_0500 getCallState fail err = ' + err); expect().assertFail(); done(); return; } - done(); - return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -962,7 +1043,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_getCallState_Async_0200', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_getCallState_Async_0200 dial fail err = ' + err); @@ -973,7 +1054,8 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_getCallState_Async_0200 dial finish data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.getCallState((err, data) => { if (err) { expect().assertFail(); @@ -983,14 +1065,16 @@ describe('CallManagerOnDial', function () { } expect(data === call.CALL_STATE_OFFHOOK).assertTrue(); console.log('Telephony_CallManager_getCallState_Async_0200 finish data = ' + data); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1006,7 +1090,7 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_getCallState_Promise_0200', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_getCallState_Promise_0200 dial finish data = ' + data); } catch (err) { @@ -1017,24 +1101,26 @@ describe('CallManagerOnDial', function () { } const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { data = await call.getCallState(); expect(data === call.CALL_STATE_OFFHOOK).assertTrue(); console.log('Telephony_CallManager_getCallState_Promise_0200 getCallState finish data = ' + data); + done(); + return; } catch (err) { console.log('Telephony_CallManager_getCallState_Promise_0200 getCallState fail err = ' + err); expect().assertFail(); done(); return; } - done(); - return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1047,7 +1133,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0100', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0100 dial fail err = ' + err); expect().assertFail(); @@ -1058,30 +1144,35 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0100 dial finish data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, '0', (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Async_0100 startDTMF fail err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0100 startDTMF finish data = ' + data); + call.stopDTMF(callId, (err) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_0100 stopDTMF fail err = ' + err); + done(); + return; + } + console.log('Telephony_CallManager_startDTMF_Async_0100 stopDTMF finish data = ' + data); + }) + done(); + return; }) - call.stopDTMF(callId, (err) => { - if (err) { - expect().assertFail(); - console.log('Telephony_CallManager_startDTMF_Async_0100 stopDTMF fail err = ' + err); - return; - } - console.log('Telephony_CallManager_startDTMF_Async_0100 stopDTMF finish data = ' + data); - }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1095,7 +1186,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0200', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0200 dial fail err = ' + err); expect().assertFail(); @@ -1106,30 +1197,35 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0200 dial finish data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, '5', (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Async_0200 startDTMF fail err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0200 startDTMF finish data = ' + data); + call.stopDTMF(callId, (err) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_0200 stopDTMF fail err = ' + err); + done(); + return; + } + console.log('Telephony_CallManager_startDTMF_Async_0200 stopDTMF finish data = ' + data); + }) + done(); + return; }) - call.stopDTMF(callId, (err) => { - if (err) { - expect().assertFail(); - console.log('Telephony_CallManager_startDTMF_Async_0200 stopDTMF fail err = ' + err); - return; - } - console.log('Telephony_CallManager_startDTMF_Async_0200 stopDTMF finish data = ' + data); - }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1143,7 +1239,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0300', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0300 dial fail err = ' + err); expect().assertFail(); @@ -1154,30 +1250,35 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0300 dial finish data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, '9', (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Async_0300 startDTMF fail err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0300 startDTMF finish data = ' + data); + call.stopDTMF(callId, (err) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_0300 stopDTMF fail err = ' + err); + done(); + return; + } + console.log('Telephony_CallManager_startDTMF_Async_0300 stopDTMF finish data = ' + data); + }) + done(); + return; }) - call.stopDTMF(callId, (err) => { - if (err) { - expect().assertFail(); - console.log('Telephony_CallManager_startDTMF_Async_0300 stopDTMF fail err = ' + err); - return; - } - console.log('Telephony_CallManager_startDTMF_Async_0300 stopDTMF finish data = ' + data); - }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1191,7 +1292,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0400', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0400 dial fail err = ' + err); expect().assertFail(); @@ -1202,30 +1303,35 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0400 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, 'A', (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Async_0400 startDTMF fail : err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0400 startDTMF finish : data = ' + data); + call.stopDTMF(callId, (err) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_0400 stopDTMF fail : err = ' + err); + done(); + return; + } + console.log('Telephony_CallManager_startDTMF_Async_0400 stopDTMF finish : data = ' + data); + }) + done(); + return; }) - call.stopDTMF(callId, (err) => { - if (err) { - expect().assertFail(); - console.log('Telephony_CallManager_startDTMF_Async_0400 stopDTMF fail : err = ' + err); - return; - } - console.log('Telephony_CallManager_startDTMF_Async_0400 stopDTMF finish : data = ' + data); - }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1239,7 +1345,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0500', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER,async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER,async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0500 dial fail : err = ' + err); expect().assertFail(); @@ -1250,30 +1356,35 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0500 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, 'C', (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Async_0500 startDTMF fail : err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0500 startDTMF finish : data = ' + data); + call.stopDTMF(callId, (err) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_0500 stopDTMF fail : err = ' + err); + done(); + return; + } + console.log('Telephony_CallManager_startDTMF_Async_0500 stopDTMF finish : data = ' + data); + }) + done(); + return; }) - call.stopDTMF(callId, (err) => { - if (err) { - expect().assertFail(); - console.log('Telephony_CallManager_startDTMF_Async_0500 stopDTMF fail : err = ' + err); - return; - } - console.log('Telephony_CallManager_startDTMF_Async_0500 stopDTMF finish : data = ' + data); - }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1287,7 +1398,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0600', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0600 dial fail : err = ' + err); expect().assertFail(); @@ -1298,30 +1409,35 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0600 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, 'D', (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Async_0600 startDTMF fail : err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0600 startDTMF finish : data = ' + data); + call.stopDTMF(callId, (err) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_0600 stopDTMF fail : err = ' + err); + done(); + return; + } + console.log('Telephony_CallManager_startDTMF_Async_0600 stopDTMF finish : data = ' + data); + }) + done(); + return; }) - call.stopDTMF(callId, (err) => { - if (err) { - expect().assertFail(); - console.log('Telephony_CallManager_startDTMF_Async_0600 stopDTMF fail : err = ' + err); - return; - } - console.log('Telephony_CallManager_startDTMF_Async_0600 stopDTMF finish : data = ' + data); - }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1335,7 +1451,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0700', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0700 dial fail : err = ' + err); expect().assertFail(); @@ -1346,22 +1462,26 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0700 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, 'd', (err) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0700 startDTMF finish : err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0700 startDTMF fail'); expect().assertFail(); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1375,7 +1495,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0800', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0800 dial fail : err = ' + err); expect().assertFail(); @@ -1386,30 +1506,35 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0800 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, '*', (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Async_0800 startDTMF fail : err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0800 startDTMF finish : data = ' + data); + call.stopDTMF(callId, (err) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_0800 stopDTMF fail : err = ' + err); + done(); + return; + } + console.log('Telephony_CallManager_startDTMF_Async_0800 stopDTMF finish : data = ' + data); + }) + done(); + return; }) - call.stopDTMF(callId, (err) => { - if (err) { - expect().assertFail(); - console.log('Telephony_CallManager_startDTMF_Async_0800 stopDTMF fail : err = ' + err); - return; - } - console.log('Telephony_CallManager_startDTMF_Async_0800 stopDTMF finish : data = ' + data); - }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1423,7 +1548,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_startDTMF_Async_0900', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { console.log('Telephony_CallManager_startDTMF_Async_0900 dial fail : err = ' + err); expect().assertFail(); @@ -1434,30 +1559,35 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_startDTMF_Async_0900 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.startDTMF(callId, '#', (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Async_0900 startDTMF fail : err = ' + err); + done(); return; } console.log('Telephony_CallManager_startDTMF_Async_0900 startDTMF finish : data = ' + data); + call.stopDTMF(callId, (err) => { + if (err) { + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_0900 stopDTMF fail : err = ' + err); + done(); + return; + } + console.log('Telephony_CallManager_startDTMF_Async_0900 stopDTMF finish : data = ' + data); + }) + done(); + return; }) - call.stopDTMF(callId, (err) => { - if (err) { - expect().assertFail(); - console.log('Telephony_CallManager_startDTMF_Async_0900 stopDTMF fail : err = ' + err); - return; - } - console.log('Telephony_CallManager_startDTMF_Async_0900 stopDTMF finish : data = ' + data); - }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1472,35 +1602,39 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0100', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0100 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, '1'); console.log('Telephony_CallManager_startDTMF_Promise_0100 startDTMF finish : data = ' + data); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0100 startDTMF fail : err = ' + err); + done(); return; } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0100 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0100 stopDTMF fail : err = ' + err); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1519,35 +1653,39 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0200', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, '4'); console.log('Telephony_CallManager_startDTMF_Promise_0200 startDTMF finish : data = ' + data); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0200 startDTMF fail : err = ' + err); + done(); return; } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0200 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0200 stopDTMF fail : err = ' + err); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1566,35 +1704,39 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0300', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0300 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, '8'); console.log('Telephony_CallManager_startDTMF_Promise_0300 startDTMF finish : data = ' + data); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0300 startDTMF fail : err = ' + err); + done(); return; } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0300 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0300 stopDTMF fail : err = ' + err); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1613,35 +1755,39 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0400', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0400 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, 'B'); console.log('Telephony_CallManager_startDTMF_Promise_0400 startDTMF finish : data = ' + data); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0400 startDTMF fail : err = ' + err); + done(); return; } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0400 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0400 stopDTMF fail : err = ' + err); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1660,35 +1806,39 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0500', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0500 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, '7'); console.log('Telephony_CallManager_startDTMF_Promise_0500 startDTMF finish : data = ' + data); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0500 startDTMF fail : err = ' + err); + done(); return; } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0500 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0500 stopDTMF fail : err = ' + err); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1707,32 +1857,38 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0600', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0600 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, 'Z'); console.log('Telephony_CallManager_startDTMF_Promise_0600 startDTMF fail'); + done(); + return; } catch (err) { console.log('Telephony_CallManager_startDTMF_Promise_0600 startDTMF finish : err = ' + err); } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0600 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0600 stopDTMF fail : err = ' + err); + done(); + return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1751,34 +1907,39 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0700', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0700 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, 'a'); expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0700 startDTMF fail'); + done(); + return; } catch (err) { console.log('Telephony_CallManager_startDTMF_Promise_0700 startDTMF finish : err = ' + err); } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0700 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0700 stopDTMF fail : err = ' + err); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1797,34 +1958,39 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0800', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0800 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, '*'); console.log('Telephony_CallManager_startDTMF_Promise_0800 startDTMF finish : data = ' + data); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0800 startDTMF fail : err = ' + err); + done(); return; } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0800 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0800 stopDTMF fail : err = ' + err); + done(); + return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1843,35 +2009,39 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_startDTMF_Promise_0900', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_startDTMF_Promise_0900 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.startDTMF(callId, '#'); console.log('Telephony_CallManager_startDTMF_Promise_0900 startDTMF finish : data = ' + data); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0900 startDTMF fail : err = ' + err); + done(); return; } try { await call.stopDTMF(callId); console.log('Telephony_CallManager_startDTMF_Promise_0900 stopDTMF finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_startDTMF_Promise_0900 stopDTMF fail : err = ' + err); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1889,7 +2059,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_stopDTMF_Async_0200', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_stopDTMF_Async_0200 dial fail : err = ' + err); @@ -1900,22 +2070,26 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_stopDTMF_Async_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.stopDTMF(callId, (err) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_stopDTMF_Async_0200 stopDTMF fail : err = ' + err); + done(); return; } console.log('Telephony_CallManager_stopDTMF_Async_0200 stopDTMF finish : data = ' + data); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1930,27 +2104,30 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_stopDTMF_Promise_0200', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_stopDTMF_Promise_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.stopDTMF(callId); console.log('Telephony_CallManager_stopDTMF_Promise_0200 stopDTMF finish : data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_stopDTMF_Promise_0200 stopDTMF fail : err = ' + err); expect().assertFail(); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -1968,7 +2145,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_combineConference_Async_0200', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_combineConference_Async_0200 dial fail : err = ' + err); @@ -1979,7 +2156,8 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_combineConference_Async_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.combineConference(callId, (err) => { if (err) { console.log('Telephony_CallManager_combineConference_Async_0200 finish : err = ' + err); @@ -1988,15 +2166,16 @@ describe('CallManagerOnDial', function () { } console.log('Telephony_CallManager_combineConference_Async_0200 fail'); expect().assertFail(); - console.log('Telephony_CallManager_combineConference_Async_0200 finish : err = ' + err); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2011,27 +2190,30 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_combineConference_Promise_0200', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_combineConference_Promise_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { await call.combineConference(callId); expect().assertFail(); console.log('Telephony_CallManager_combineConference_Promise_0200 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_combineConference_Promise_0200 finish : err = ' + err); done(); + return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2049,7 +2231,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_getMainCallId_Async_0200', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER,async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER,async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_getMainCallId_Async_0200 dial fail : err = ' + err); @@ -2060,22 +2242,27 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_getMainCallId_Async_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.getMainCallId(callId, (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_getMainCallId_Async_0200 fail : err = ' + err); + done(); + return; } expect(data === GETMAIN_CALLID_ERRO).assertTrue(); console.log('Telephony_CallManager_getMainCallId_Async_0200 finish : data = ' + data); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2090,28 +2277,31 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_getMainCallId_Promise_0200', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_getMainCallId_Promise_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { var data = await call.getMainCallId(callId); expect(data === GETMAIN_CALLID_ERRO).assertTrue(); console.log('Telephony_CallManager_getMainCallId_Promise_0200 finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_getMainCallId_Promise_0200 fail : err = ' + err); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2129,7 +2319,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_getSubCallIdList_Async_0200', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_getSubCallIdList_Async_0200 dial fail : err = ' + err); @@ -2140,23 +2330,27 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_getSubCallIdList_Async_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.getSubCallIdList(callId, (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_getSubCallIdList_Async_0200 fail : err = ' + err); + done(); return; } expect(data.length === 0).assertTrue(); console.log('Telephony_CallManager_getSubCallIdList_Async_0200 finish : data = ' + data); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2171,28 +2365,31 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_getSubCallIdList_Promise_0200', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_getSubCallIdList_Promise_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { var data = await call.getSubCallIdList(callId); expect(data.length === 0).assertTrue(); console.log('Telephony_CallManager_getSubCallIdList_Promise_0200 finish : data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_getSubCallIdList_Promise_0200 fail : err = ' + err); expect().assertFail(); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2211,7 +2408,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_getCallIdListForConference_Async_0200', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_getCallIdListForConference_Async_0200 dial fail : err = ' + err); @@ -2222,27 +2419,31 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_getCallIdListForConference_Async_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.getCallIdListForConference(callId, (err, data) => { if (err) { expect().assertFail(); console.log( 'Telephony_CallManager_getCallIdListForConference_Async_0200 fail : err = ' + err ); + done(); return; } expect(data.length === 0).assertTrue(); console.log( 'Telephony_CallManager_getCallIdListForConference_Async_0200 finish : data = ' + data ); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2258,32 +2459,36 @@ describe('CallManagerOnDial', function () { */ it('Telephony_CallManager_getCallIdListForConference_Promise_0200', 0, async function (done) { try { - var data = await call.dial(TEST_PHONY_NUMBER); + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_getCallIdListForConference_Promise_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { var data = await call.getCallIdListForConference(callId); expect(data.length === 0).assertTrue(); console.log( 'Telephony_CallManager_getCallIdListForConference_Promise_0200 finish : data = ' + data ); + done(); + return; } catch (err) { expect().assertFail(); console.log( 'Telephony_CallManager_getCallIdListForConference_Promise_0200 fail : err = ' + err ); + done(); return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2302,7 +2507,7 @@ describe('CallManagerOnDial', function () { * @tc.desc Function test */ it('Telephony_CallManager_isInEmergencyCall_Async_0100', 0, async function (done) { - call.dial(TEST_PHONY_NUMBER, async (err, data) => { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_isInEmergencyCall_Async_0100 dial fail : err = ' + err); @@ -2313,7 +2518,8 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_isInEmergencyCall_Async_0100 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { call.isInEmergencyCall((err, data) => { if (err) { console.log( @@ -2321,20 +2527,24 @@ describe('CallManagerOnDial', function () { err ); expect().assertFail(); + done(); + return; } expect(data === false).assertTrue(); console.log( 'Telephony_CallManager_isInEmergencyCall_Async_0100 isInEmrgencyCall finish : data = ' + data ); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2344,12 +2554,12 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_isInEmergencyCall_Async_0200 - * @tc.name Dial an emergency number (112) and call isInEmergencyCall() to determine whether an emergency - * call is made, returning true + * @tc.name Dial an emergency number (THE_THREE_NUMBER) and call isInEmergencyCall() to determine whether + * an emergency call is made, returning true * @tc.desc Function test */ it('Telephony_CallManager_isInEmergencyCall_Async_0200', 0, async function (done) { - call.dial('112', async (err, data) => { + call.dial(THE_THREE_NUMBER, async (err, data) => { if (err) { expect().assertFail(); console.log('Telephony_CallManager_isInEmergencyCall_Async_0200 dial fail : err = ' + err); @@ -2360,7 +2570,8 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_isInEmergencyCall_Async_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING ) { call.isInEmergencyCall((err, data) => { if (err) { console.log( @@ -2368,6 +2579,7 @@ describe('CallManagerOnDial', function () { err ); expect().assertFail(); + done(); return; } expect(data).assertTrue(); @@ -2375,14 +2587,16 @@ describe('CallManagerOnDial', function () { 'Telephony_CallManager_isInEmergencyCall_Async_0200 isInEmrgencyCall finish : data = ' + data ); + done(); + return; }) - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2403,22 +2617,26 @@ describe('CallManagerOnDial', function () { console.log('Telephony_CallManager_isInEmergencyCall_Promise_0100 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { var data = await call.isInEmergencyCall(); expect(data === false).assertTrue(); console.log('Telephony_CallManager_isInEmergencyCall_Promise_0100 finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_isInEmergencyCall_Promise_0100 fail : err = ' + err); + done(); + return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2432,33 +2650,37 @@ describe('CallManagerOnDial', function () { /* * @tc.number Telephony_CallManager_isInEmergencyCall_Promise_0200 - * @tc.name Dial an emergency number (112) and call isInEmergencyCall() to determine whether + * @tc.name Dial an emergency number (THE_THREE_NUMBER) and call isInEmergencyCall() to determine whether * an emergency call is made. The return value is true * @tc.desc Function test */ it('Telephony_CallManager_isInEmergencyCall_Promise_0200', 0, async function (done) { try { - var data = await call.dial('112'); + var data = await call.dial(THE_THREE_NUMBER); expect(data).assertTrue(); console.log('Telephony_CallManager_isInEmergencyCall_Promise_0200 dial finish : data = ' + data); const startTime = new Date().getTime(); while (true) { - if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { try { var data = await call.isInEmergencyCall(); expect(data).assertTrue(); console.log('Telephony_CallManager_isInEmergencyCall_Promise_0200 finish : data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_isInEmergencyCall_Promise_0200 fail : err = ' + err); + done(); + return; } - done(); return; } await sleep(waitTime); endTime = new Date().getTime(); - timeOut = endTime - startTime; - if (timeOut > onTime) { + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); done(); break; } @@ -2469,4 +2691,96 @@ describe('CallManagerOnDial', function () { done(); } }) + + /* + * @tc.number Telephony_CallManager_reject_Async_0400 + * @tc.name Make a call to a normal number (10086) and call reject with message REJECT_MESSAGE_NUM by callback, + * the function return error + * @tc.desc Function test + */ + it('Telephony_CallManager_reject_Async_0400', 0, async function (done) { + call.dial(CALLMANAGER_TEST_PHONY_NUMBER, async (err, data) => { + if (err) { + expect().assertFail(); + console.log(`Telephony_CallManager_reject_Async_0400 dial fail : err = ${err}`); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_reject_Async_0400 dial finish : data = ${data}`); + const startTime = new Date().getTime(); + while (true) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { + call.reject(call.callId, new RejectMessageOptions(REJECT_MESSAGE_NUM), (err, data) => { + if (err) { + console.log( + `Telephony_CallManager_reject_Async_0400 isInEmrgencyCall finish : err = ${ + err}` + ); + done(); + return; + } + console.log( + `Telephony_CallManager_reject_Async_0400 isInEmrgencyCall fail : data = ${ + data}` + ); + expect().assertFail(); + done(); + }); + return; + } + await sleep(waitTime); + endTime = new Date().getTime(); + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); + done(); + break; + } + } + }); + }); + + /* + * @tc.number Telephony_CallManager_reject_Promise_0400 + * @tc.name Make a call to a normal number (10086) and call reject with message by promise, + * the function return error + * @tc.desc Function test + */ + it('Telephony_CallManager_reject_Promise_0400', 0, async function (done) { + try { + var data = await call.dial(CALLMANAGER_TEST_PHONY_NUMBER); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_reject_Promise_0400 dial finish : data = ${data}`); + const startTime = new Date().getTime(); + while (true) { + if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE || + callState === call.CALL_STATUS_ALERTING) { + try { + var data = await call.reject(call.callId, new RejectMessageOptions(REJECT_MESSAGE_STR)); + expect().assertFail(); + console.log(`Telephony_CallManager_reject_Promise_0400 fail : data = ${data}`); + done(); + } catch (err) { + console.log(`Telephony_CallManager_reject_Promise_0400 finish : err = ${err}`); + done(); + } + return; + } + await sleep(waitTime); + endTime = new Date().getTime(); + timing = endTime - startTime; + if (timing > timeOut) { + expect().assertFail(); + done(); + break; + } + } + } catch (err) { + expect().assertFail(); + console.log(`Telephony_CallManager_reject_Promise_0400 dial fail : err = ${err}`); + done(); + } + }); }) \ No newline at end of file diff --git a/telephony/telephonyjstest/call_manager/call_manager_test/BUILD.gn b/telephony/telephonyjstest/call_manager/call_manager_test/BUILD.gn index 9ae38c44c..4c5d71c8d 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_test/BUILD.gn +++ b/telephony/telephonyjstest/call_manager/call_manager_test/BUILD.gn @@ -28,4 +28,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/call_manager/call_manager_test/entry/src/main/js/test/CallManagerTest.test.js b/telephony/telephonyjstest/call_manager/call_manager_test/entry/src/main/js/test/CallManagerTest.test.js index cd8df1deb..a0d970599 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_test/entry/src/main/js/test/CallManagerTest.test.js +++ b/telephony/telephonyjstest/call_manager/call_manager_test/entry/src/main/js/test/CallManagerTest.test.js @@ -18,9 +18,12 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' describe('CallManagerTest', function () { const ERROR_CALLID_999 = 999; const GETMAIN_CALLID_ERRO = -1; - const STATUS_ON = 1; const SLOT_0 = 0; const ERR_SLOT_ID = -1; + const MORE_THAN_30_NUMBERS = ''; + const INVALID_NUMBER = ''; + const ACTIVATE_TRUE = true; + const ACTIVATE_FALSE = false; /* * @tc.number Telephony_CallManager_getCallState_Async_0100 @@ -53,13 +56,13 @@ describe('CallManagerTest', function () { var data = await call.getCallState(); expect(data === call.CALL_STATE_IDLE).assertTrue(); console.log('Telephony_CallManager_getCallState_Promise_0100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_getCallState_Promise_0100 : err = ' + err.message); expect().assertFail(); done(); return; } - done(); }) /* @@ -68,7 +71,7 @@ describe('CallManagerTest', function () { * @tc.desc Function test */ it('Telephony_CallManager_dial_Async_0200', 0, async function (done) { - call.dial('', (err) => { + call.dial('', (err, data) => { if (err) { console.log('Telephony_CallManager_dial_Async_0200 finish err = ' + err.message); done(); @@ -83,12 +86,12 @@ describe('CallManagerTest', function () { /* * @tc.number Telephony_CallManager_dial_Async_0300 * @tc.name Set will choose parameter number phone number more than 30 characters - * (' 12345678901234567890012345678901 ', separate phone number did not take ', '), + * ( '12345678901234567890012345678901' , separate phone number did not take ', '), * the callback way call dial () to dial, capture err * @tc.desc Function test */ it('Telephony_CallManager_dial_Async_0300', 0, async function (done) { - call.dial('12345678901234567890012345678901', (err) => { + call.dial(MORE_THAN_30_NUMBERS, (err, data) => { if (err) { console.log('Telephony_CallManager_dial_Async_0300 finish err = ' + err.message); done(); @@ -103,7 +106,7 @@ describe('CallManagerTest', function () { /* * @tc.number Telephony_CallManager_dial_Promise_0200 * @tc.name Set mandatory phone number to empty (' ') and optional options to - * {accountId: 1, videoState: 0, dialScene: 0, dialType: 0}. Call dial() to dial and capture err + * {accountId: 1}. Call dial() to dial and capture err * @tc.desc Function test */ it('Telephony_CallManager_dial_Promise_0200', 0, async function (done) { @@ -111,12 +114,12 @@ describe('CallManagerTest', function () { await call.dial('', { accountId: 1 }) console.log('Telephony_CallManager_dial_Promise_0200 fail'); expect().assertFail(); + done(); } catch (err) { console.log('Telephony_CallManager_dial_Promise_0200 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -127,15 +130,15 @@ describe('CallManagerTest', function () { */ it('Telephony_CallManager_dial_Promise_0900', 0, async function (done) { try { - await call.dial('12345678901234567890012345678901'); + await call.dial(MORE_THAN_30_NUMBERS); expect().assertFail(); console.log('Telephony_CallManager_dial_Promise_0900 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_dial_Promise_0900 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -146,7 +149,7 @@ describe('CallManagerTest', function () { */ it('Telephony_CallManager_dial_Async_0900', 0, async function (done) { let obj = { accountId: 0, videoState: 0, dialScene: 0, dialType: 0 }; - call.dial('', obj, (err) => { + call.dial('', obj, (err, data) => { if (err) { console.log('Telephony_CallManager_dial_Async_0900 finish err = ' + err.message); done(); @@ -188,12 +191,12 @@ describe('CallManagerTest', function () { await call.holdCall(ERROR_CALLID_999); expect().assertFail(); console.log('Telephony_CallManager_holdCall_Promise_0100 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_holdCall_Promise_0100 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -263,42 +266,43 @@ describe('CallManagerTest', function () { await call.switchCall(ERROR_CALLID_999); expect().assertFail(); console.log('Telephony_CallManager_switchCall_Promise_0100 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_switchCall_Promise_0100 finish err = ' + err); done(); return; } - done(); }) - /* + /* * @tc.number Telephony_CallManager_hasCall_Async_0100 * @tc.name After an empty call is automatically hung up, the callback method calls hasCall() to confirm that * there is no current call, returning false * @tc.desc Function test */ - it('Telephony_CallManager_hasCall_Async_0100', 0, async function (done) { - call.dial('', (err) => { - if (err) { - console.log('Telephony_CallManager_hasCall_Async_0100 dial finish err = ' + err.message); - call.hasCall((err, data) => { - if (err) { - console.log('Telephony_CallManager_hasCall_Async_0400 fail'); - expect().assertFail(); - done(); - return; - } - expect(data === false).assertTrue(); - console.log('Telephony_CallManager_hasCall_Async_0100 finish data = ' + data); - }) - done(); - return; - } - expect().assertFail(); - console.log('Telephony_CallManager_hasCall_Async_0100 dial fail'); - done(); - }) - }) + it('Telephony_CallManager_hasCall_Async_0100', 0, async function (done) { + call.dial('', (err) => { + if (err) { + console.log('Telephony_CallManager_hasCall_Async_0100 dial finish err = ' + err.message); + call.hasCall((err, data) => { + if (err) { + console.log('Telephony_CallManager_hasCall_Async_0400 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === false).assertTrue(); + console.log('Telephony_CallManager_hasCall_Async_0100 finish data = ' + data); + done(); + return; + }) + return; + } + expect().assertFail(); + console.log('Telephony_CallManager_hasCall_Async_0100 dial fail'); + done(); + }) + }) /* * @tc.number Telephony_CallManager_hasCall_Async_0400 @@ -335,13 +339,13 @@ describe('CallManagerTest', function () { var data = await call.hasCall(); expect(data === false).assertTrue(); console.log('Telephony_CallManager_hasCall_Promise_0100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_hasCall_Promise_0100 fail'); expect().assertFail(); done(); return; } - done(); } }) @@ -355,13 +359,13 @@ describe('CallManagerTest', function () { var data = await call.hasCall(); expect(data === false).assertTrue(); console.log('Telephony_CallManager_hasCall_Promise_0400 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_hasCall_Promise_0400 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -392,12 +396,12 @@ describe('CallManagerTest', function () { await call.combineConference(ERROR_CALLID_999); console.log('Telephony_CallManager_combineConference_Promise_0100 fail'); expect().assertFail(); + done(); } catch (err) { console.log('Telephony_CallManager_combineConference_Promise_0100 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -429,13 +433,13 @@ describe('CallManagerTest', function () { var data = await call.getSubCallIdList(ERROR_CALLID_999); expect(data.length === 0).assertTrue(); console.log('Telephony_CallManager_getSubCallIdList_Promise_0100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_getSubCallIdList_Promise_0100 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -469,12 +473,12 @@ describe('CallManagerTest', function () { var data = await call.getCallIdListForConference(ERROR_CALLID_999); expect(data.length === 0).assertTrue(); console.log('Telephony_CallManager_getCallIdListForConference_Promise_0100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_getCallIdListForConference_Promise_0100 fail'); done(); return; } - done(); }) /* @@ -505,12 +509,12 @@ describe('CallManagerTest', function () { await call.startDTMF(ERROR_CALLID_999, 'C'); console.log('Telephony_CallManager_startDTMF_Promise_1000 fail'); expect().assertFail(); + done(); } catch (err) { console.log('Telephony_CallManager_startDTMF_Promise_1000 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -541,12 +545,12 @@ describe('CallManagerTest', function () { await call.stopDTMF(ERROR_CALLID_999); expect().assertFail(); console.log('Telephony_CallManager_stopDTMF_Promise_0100 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_stopDTMF_Promise_0100 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -576,12 +580,12 @@ describe('CallManagerTest', function () { await call.reject(ERROR_CALLID_999); expect().assertFail(); console.log('Telephony_CallManager_reject_Promise_0100 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_reject_Promise_0100 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -612,12 +616,12 @@ describe('CallManagerTest', function () { await call.hangup(ERROR_CALLID_999); expect().assertFail(); console.log('Telephony_CallManager_hangup_Promise_0100 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_hangup_Promise_0100 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -649,13 +653,13 @@ describe('CallManagerTest', function () { var data = await call.getMainCallId(ERROR_CALLID_999); expect(data === GETMAIN_CALLID_ERRO).assertTrue(); console.log('Telephony_CallManager_getMainCallId_Promise_0100 finish data = ' + data); + done(); } catch (err) { expect().assertFail(); console.log('Telephony_CallManager_getMainCallId_Promise_0100 fail'); done(); return; } - done(); }) /* @@ -842,13 +846,13 @@ describe('CallManagerTest', function () { var data = await call.formatPhoneNumber('2000000'); expect(data === '200 0000').assertTrue(); console.log('Telephony_CallManager_formatPhoneNumber_Promise_0100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumber_Promise_0100 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -861,12 +865,12 @@ describe('CallManagerTest', function () { await call.formatPhoneNumber('010-100-0000', { countryCode: 'CN' }); expect().assertFail(); console.log('Telephony_CallManager_formatPhoneNumber_Promise_0200 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumber_Promise_0200 finish err = ' + err); done(); return; } - done(); }) /* @@ -880,13 +884,13 @@ describe('CallManagerTest', function () { var data = await call.formatPhoneNumber('(010)00000000', { countryCode: 'CN' }); expect(data === '010 0000 0000').assertTrue(); console.log('Telephony_CallManager_formatPhoneNumber_Promise_0300 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumber_Promise_0300 fail'); expect().assertFail(); done(); return; } - done(); }) /* * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0400 @@ -899,13 +903,13 @@ describe('CallManagerTest', function () { var data = await call.formatPhoneNumber('200-0000', { countryCode: 'CN' }); expect(data === '200 0000').assertTrue(); console.log('Telephony_CallManager_formatPhoneNumber_Promise_0400 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumber_Promise_0400 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -919,12 +923,12 @@ describe('CallManagerTest', function () { await call.formatPhoneNumber('666666999999', { countryCode: 'CN' }); console.log('Telephony_CallManager_formatPhoneNumber_Promise_0500 fail'); expect().assertFail(); + done(); + return; } catch (err) { console.log('Telephony_CallManager_formatPhoneNumber_Promise_0500 finish err = ' + err.message); done(); - return; } - done(); }) /* @@ -938,12 +942,12 @@ describe('CallManagerTest', function () { await call.formatPhoneNumber('20000000', { countryCode: 'abcdefg' }); expect().assertFail(); console.log('Telephony_CallManager_formatPhoneNumber_Promise_0600 fail'); + done(); + return; } catch (err) { console.log('Telephony_CallManager_formatPhoneNumber_Promise_0600 finish err = ' + err.message); done(); - return; } - done(); }) /* @@ -956,12 +960,12 @@ describe('CallManagerTest', function () { var data = await call.formatPhoneNumber('20000000', { countryCode: '' }); expect().assertFail(); console.log('Telephony_CallManager_formatPhoneNumber_Promise_0700 fail'); + done(); + return; } catch (err) { console.log('Telephony_CallManager_formatPhoneNumber_Promise_0700 finish err = ' + err.message); done(); - return; } - done(); }) /* @@ -1092,13 +1096,13 @@ describe('CallManagerTest', function () { var data = await call.formatPhoneNumberToE164('52300000000', 'CN'); expect(data === '+8652300000000').assertTrue(); console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1113,13 +1117,13 @@ describe('CallManagerTest', function () { var data = await call.formatPhoneNumberToE164('(523)00000000', 'CN'); expect(data === '+8652300000000').assertTrue(); console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0200 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0200 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1133,13 +1137,13 @@ describe('CallManagerTest', function () { var data = await call.formatPhoneNumberToE164('523-0000-0000', 'CN'); expect(data === '+8652300000000').assertTrue(); console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0300 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0300 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1153,31 +1157,31 @@ describe('CallManagerTest', function () { await call.formatPhoneNumberToE164('999999', 'CN'); console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0400 fail'); expect().assertFail(); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0400 finish err = ' + err.message); done(); return; } - done(); }) /* * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0500 - * @tc.name PhoneNumber is 999999. Type non-existent options: abCDFG. Call formatPhoneNumberToE164() to + * @tc.name PhoneNumber is 52300000000. Type non-existent options: abCDFG. Call formatPhoneNumberToE164() to * format the number and capture err * @tc.desc Function test */ it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0500', 0, async function (done) { try { - await call.formatPhoneNumberToE164('999999', 'abcdefg'); + await call.formatPhoneNumberToE164('52300000000', 'abcdefg'); console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0500 fail'); expect().assertFail(); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0500 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -1191,12 +1195,12 @@ describe('CallManagerTest', function () { await call.formatPhoneNumberToE164('52300000000', ''); expect().assertFail(); console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0600 fail'); + done(); } catch (err) { console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0600 finish err = ' + err.message); done(); return; } - done(); }) /* @@ -1221,12 +1225,12 @@ describe('CallManagerTest', function () { /* * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 - * @tc.name PhoneNumber: 13766669999, options 1. Call isEmergencyPhoneNumber() to check whether it is an + * @tc.name PhoneNumber: INVALID_NUMBER, options 1. Call isEmergencyPhoneNumber() to check whether it is an * emergency number. The return value is false * @tc.desc Function test */ it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200', 0, async function (done) { - call.isEmergencyPhoneNumber('13766669999', { slotId: SLOT_0 }, (err, data) => { + call.isEmergencyPhoneNumber(INVALID_NUMBER, { slotId: SLOT_0 }, (err, data) => { if (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 fail'); expect().assertFail(); @@ -1429,33 +1433,33 @@ describe('CallManagerTest', function () { var data = await call.isEmergencyPhoneNumber('0+0+0', { slotId: SLOT_0 }); expect(data === false).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0100 fail'); expect().assertFail(); done(); return; } - done(); }) /* * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0200 - * @tc.name PhoneNumber: 13766669999, options 1. Call isEmergencyPhoneNumber() to check whether it is an + * @tc.name PhoneNumber: INVALID_NUMBER, options 1. Call isEmergencyPhoneNumber() to check whether it is an * emergency number. The return value is false * @tc.desc Function test */ it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0200', 0, async function (done) { try { - var data = await call.isEmergencyPhoneNumber('13766669999', { slotId: SLOT_0 }); + var data = await call.isEmergencyPhoneNumber('INVALID_NUMBER', { slotId: SLOT_0 }); expect(data === false).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0200 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0200 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1469,13 +1473,13 @@ describe('CallManagerTest', function () { var data = await call.isEmergencyPhoneNumber('000', { slotId: SLOT_0 }); expect(data).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0300 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0300 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1489,13 +1493,13 @@ describe('CallManagerTest', function () { var data = await call.isEmergencyPhoneNumber('112', { slotId: SLOT_0 }); expect(data).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0400 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0400 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1509,13 +1513,13 @@ describe('CallManagerTest', function () { var data = await call.isEmergencyPhoneNumber('911', { slotId: SLOT_0 }); expect(data).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0500 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0500 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1529,13 +1533,13 @@ describe('CallManagerTest', function () { var data = await call.isEmergencyPhoneNumber('08', { slotId: SLOT_0 }); expect(data).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0600 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0600 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1549,13 +1553,13 @@ describe('CallManagerTest', function () { var data = await call.isEmergencyPhoneNumber('118', { slotId: SLOT_0 }); expect(data).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0700 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0700 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1564,19 +1568,19 @@ describe('CallManagerTest', function () { * number. The return value is true * @tc.desc Function test */ - it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800', 0, async function (done) { - try { - var data = await call.isEmergencyPhoneNumber('999', { slotId: SLOT_0 }); - expect(data).assertTrue(); - console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800 finish data = ' + data); - } catch (err) { - console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800 fail'); - expect().assertFail(); - done(); - return; - } - done(); - }) + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('999', { slotId: SLOT_0 }); + expect(data).assertTrue(); + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800 finish data = ' + data); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800 fail'); + expect().assertFail(); + done(); + return; + } + }) /* * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1100 @@ -1589,13 +1593,13 @@ describe('CallManagerTest', function () { var data = await call.isEmergencyPhoneNumber('119'); expect(data).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1100 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1100 fail'); expect().assertFail(); done(); return; } - done(); }) /* @@ -1609,33 +1613,34 @@ describe('CallManagerTest', function () { var data = await call.isEmergencyPhoneNumber('110'); expect(data).assertTrue(); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1200 finish data = ' + data); + done(); } catch (err) { console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1200 fail'); expect().assertFail(); done(); return; } - done(); }) /* - * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 - * @tc.name PhoneNumber: 120 with options -1. Call isEmergencyPhoneNumber() to check whether it is an emergency - * number. The return value is err - * @tc.desc Function test - */ - it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300', 0, async function (done) { - try { - await call.isEmergencyPhoneNumber('120', { slotId: ERR_SLOT_ID }); - expect.assertFail(); - console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 fail'); - } catch (err) { - console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 finish err =' + err); - done(); - return; - } - done(); - }) + * @tc.number Telephony_CallManager_getCallWaitingStatus_Async_0100 + * @tc.name Call waiting is enabled, slotId is 1, getCallWaiting() is called to getCallWaiting, and status is 1 + * @tc.desc Function test + */ + it('Telephony_CallManager_getCallWaitingStatus_Async_0100', 0, async function (done) { + call.getCallWaitingStatus(SLOT_0, (err, data) => { + if (err) { + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0100 fail err = ${err}`); + expect().assertFail(); + done(); + return; + } + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0100 data = ${data}`); + expect(data === call.CALL_WAITING_ENABLE).assertTrue(); + console.log('Telephony_CallManager_getCallWaitingStatus_Async_0100 finish'); + done(); + }); + }); /* * @tc.number Telephony_CallManager_getCallWaitingStatus_Async_0200 @@ -1646,15 +1651,99 @@ describe('CallManagerTest', function () { it('Telephony_CallManager_getCallWaitingStatus_Async_0200', 0, async function (done) { call.getCallWaitingStatus(ERR_SLOT_ID, (err) => { if (err) { - console.log('Telephony_CallManager_getCallWaitingStatus_Async_0200 finish : ' + err.message); + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0200 finish : ${err.message}`); done(); return; } expect().assertFail(); console.log('Telephony_CallManager_getCallWaitingStatus_Async_0200 fail'); done(); - }) - }) + }); + }); + + /* + * @tc.number Telephony_CallManager_getCallWaitingStatus_Async_0300 + * @tc.name Run function setCallWaiting by args slotId SLOT_0,activate ACTIVATE_TRUE to set by callback, + * run function getCallWaiting by args slotId is 1 by callback, + * the function return status call.CALL_WAITING_ENABLE + * the funciton return void + * @tc.desc Function test + */ + it('Telephony_CallManager_getCallWaitingStatus_Async_0300', 0, async function (done) { + call.setCallWaiting(SLOT_0, ACTIVATE_TRUE, (err, data) => { + if (err) { + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0300 fail err = ${err}`); + expect().assertFail(); + done(); + return; + } + call.getCallWaitingStatus(SLOT_0, (err, data) => { + if (err) { + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0300 fail err = ${err}`); + expect().assertFail(); + done(); + return; + } + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0300 data = ${data}`); + expect(data === call.CALL_WAITING_ENABLE).assertTrue(); + console.log('Telephony_CallManager_getCallWaitingStatus_Async_0300 finish'); + done(); + }); + }); + }); + + /* + * @tc.number Telephony_CallManager_getCallWaitingStatus_Async_0400 + * @tc.name Run function setCallWaiting by args slotId SLOT_0,activate ACTIVATE_FALSE to set by callback, + * run function getCallWaiting by args slotId is by callback, + * the function return status call.CALL_WAITING_DISABLE + * the funciton return void,then Run function setCallWaiting by args slotId SLOT_0, + * activate ACTIVATE_TRUE to reset + * @tc.desc Function test + */ + it('Telephony_CallManager_getCallWaitingStatus_Async_0400', 0, async function (done) { + call.setCallWaiting(SLOT_0, ACTIVATE_FALSE, (err, data) => { + if (err) { + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0400 fail err = ${err}`); + expect().assertFail(); + done(); + return; + } + call.getCallWaitingStatus(SLOT_0, (err, data) => { + if (err) { + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0400 fail err = ${err}`); + expect().assertFail(); + } else { + console.log(`Telephony_CallManager_getCallWaitingStatus_Async_0400 data = ${data}`); + expect(data === call.CALL_WAITING_DISABLE).assertTrue(); + console.log('Telephony_CallManager_getCallWaitingStatus_Async_0400 finish'); + } + call.setCallWaiting(SLOT_0, ACTIVATE_TRUE, (err, data) => { + done(); + }); + }); + }); + }); + + /* + * @tc.number Telephony_CallManager_getCallWaitingStatus_Promise_0100 + * @tc.name When the call wait sate is on test call getCallWaiting() in callback is on + * @tc.desc Function test + */ + it('Telephony_CallManager_getCallWaitingStatus_Promise_0100', 0, async function (done) { + try { + let data = await call.getCallWaitingStatus(SLOT_0); + expect(data === call.CALL_WAITING_ENABLE).assertTrue(); + console.log(`Telephony_CallManager_getCallWaitingStatus_Promise_0100 data = ${data}`); + console.log('Telephony_CallManager_getCallWaitingStatus_Promise_0100 finish'); + done(); + } catch (err) { + expect().assertFail(); + console.log(`Telephony_CallManager_getCallWaitingStatus_Promise_0100 fail err =${err}`); + done(); + + } + }); /* * @tc.number Telephony_CallManager_getCallWaitingStatus_Promise_0200 @@ -1669,47 +1758,57 @@ describe('CallManagerTest', function () { done(); console.log('Telephony_CallManager_getCallWaitingStatus_Promise_0200 fail'); } catch (err) { - console.log('Telephony_CallManager_getCallWaitingStatus_Promise_0200 finish err =' + err.message); + console.log(`Telephony_CallManager_getCallWaitingStatus_Promise_0200 finish err =${err.message}`); done(); } - }) + }); /* - * @tc.number Telephony_CallManager_getCallWaitingStatus_Async_0100 - * @tc.name Call waiting is enabled, slotId is 1, getCallWaiting() is called to getCallWaiting, and status is 1 + * @tc.number Telephony_CallManager_getCallWaitingStatus_Promise_0300 + * @tc.name Run function setCallWaiting by args slotId SLOT_0,activate ACTIVATE_TRUE to set by promise, + * run function getCallWaiting by args slotId is SLOT_0 by promise, + * the function return status call.CALL_WAITING_ENABLE + * the funciton return void * @tc.desc Function test */ - it('Telephony_CallManager_getCallWaitingStatus_Async_0100', 0, async function (done) { - call.getCallWaitingStatus(SLOT_0, (err, data) => { - if (err) { - console.log('Telephony_CallManager_getCallWaitingStatus_Async_0100 fail err = ' + err); - expect().assertFail(); - done(); - return; - } - console.log('Telephony_CallManager_getCallWaitingStatus_Async_0100 data = ' + data); - expect(data === STATUS_ON).assertTrue(); - console.log('Telephony_CallManager_getCallWaitingStatus_Async_0100 finish'); - done(); - }) - }) + it('Telephony_CallManager_getCallWaitingStatus_Promise_0300', 0, async function (done) { + try { + await call.setCallWaiting(SLOT_0, ACTIVATE_TRUE); + let data = await call.getCallWaitingStatus(SLOT_0); + console.log(`Telephony_CallManager_getCallWaitingStatus_Promise_0300 data = ${data}`); + expect(data === call.CALL_WAITING_ENABLE).assertTrue(); + console.log('Telephony_CallManager_getCallWaitingStatus_Promise_0300 finish'); + } catch (error) { + console.log(`Telephony_CallManager_getCallWaitingStatus_Promise_0300 fail error = ${error}`); + expect().assertFail(); + } + done(); + }); /* - * @tc.number Telephony_CallManager_getCallWaitingStatus_Promise_0100 - * @tc.name When the call wait sate is on test call getCallWaiting() in callback is on + * @tc.number Telephony_CallManager_getCallWaitingStatus_Promise_0400 + * @tc.name Run function setCallWaiting by args slotId SLOT_0,activate ACTIVATE_FALSE to set by promise, + * run function getCallWaiting by args slotId SLOT_0 by promise, + * the function return status call.CALL_WAITING_DISABLE, + * then Run function setCallWaiting by args slotId SLOT_0,activate ACTIVATE_TRUE to reset * @tc.desc Function test */ - it('Telephony_CallManager_getCallWaitingStatus_Promise_0100', 0, async function (done) { + it('Telephony_CallManager_getCallWaitingStatus_Promise_0400', 0, async function (done) { try { + await call.setCallWaiting(SLOT_0, ACTIVATE_FALSE); let data = await call.getCallWaitingStatus(SLOT_0); - expect(data === STATUS_ON).assertTrue(); - console.log('Telephony_CallManager_getCallWaitingStatus_Promise_0100 data = ' + data); - console.log('Telephony_CallManager_getCallWaitingStatus_Promise_0100 finish'); - done(); - } catch (err) { + console.log(`Telephony_CallManager_getCallWaitingStatus_Promise_0400 data = ${data}`); + expect(data === call.CALL_WAITING_DISABLE).assertTrue(); + console.log('Telephony_CallManager_getCallWaitingStatus_Promise_0400 finish'); + } catch (error) { + console.log(`Telephony_CallManager_getCallWaitingStatus_Promise_0400 fail error = ${error}`); expect().assertFail(); - console.log('Telephony_CallManager_getCallWaitingStatus_Promise_0100 fail err =' + err); - done(); } - }) + try { + await call.setCallWaiting(SLOT_0, ACTIVATE_TRUE); + } catch (error) { + + } + done(); + }); }) diff --git a/telephony/telephonyjstest/config.sh b/telephony/telephonyjstest/config.sh index 59be0dbab..351ded15f 100644 --- a/telephony/telephonyjstest/config.sh +++ b/telephony/telephonyjstest/config.sh @@ -16,7 +16,21 @@ # 配置发送短信的电话号码 config_const_var[0]="const SMS_SEND_DST_NUMBER = '138xxxxxxxx';" +#配置通话管理自动接听号码 +config_const_var[1]="const CALLMANAGER_TEST_PHONY_NUMBER = '10086';" +# 短信测试中使用到的短信中心服务地址 +config_const_var[2]="const OTHER_SMSC_NUMBER = '+86138xxxxxxxx';" +config_const_var[3]="const USABLE_SMSC_NUMBER = '+86138xxxxxxxx';" + +#通话管理用例使用号码 +config_const_var[4]="const INVALID_NUMBER = '138xxxxxxxx';" +config_const_var[5]="const THE_THREE_NUMBER = '112';" +config_const_var[6]="const EIGHTEEN_DIGITS = '123456789123456789';" +config_const_var[7]="const WITH_LETTER_NUMBER = 'abcde123456';" +config_const_var[8]="const EIGHT_NUMBER = '00000000';" +config_const_var[9]="const EIGHT_NUMBER_WITH_AN_AREA_CODE = '0898 0000 0000';" +config_const_var[10]="const MORE_THAN_30_NUMBERS = '12345678901234567890012345678901';" for((i = 0; i < ${#config_const_var}; i++)) do @@ -27,7 +41,7 @@ do key=`echo ${config_const_var[i]}| awk -F= '{print $1}'` for line in `grep -nr "${key}"| sed 's/ //g'|grep -v "config.sh"` do - + file=`echo ${line}|awk -F: '{print $1}'` line_no=`echo ${line}|awk -F: '{print $2}'` echo $file $line_no diff --git a/telephony/telephonyjstest/network_search/BUILD.gn b/telephony/telephonyjstest/network_search/BUILD.gn index fd92605ad..14d5bee8e 100644 --- a/telephony/telephonyjstest/network_search/BUILD.gn +++ b/telephony/telephonyjstest/network_search/BUILD.gn @@ -23,4 +23,4 @@ group("network_search") { "network_search_selection_mode:NetworkSearchSelectionMoce", ] } -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/network_search/network_search_information/BUILD.gn b/telephony/telephonyjstest/network_search/network_search_information/BUILD.gn index 13676f0ce..22297bf60 100644 --- a/telephony/telephonyjstest/network_search/network_search_information/BUILD.gn +++ b/telephony/telephonyjstest/network_search/network_search_information/BUILD.gn @@ -27,4 +27,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/network_search/network_search_information/entry/src/main/js/test/NetworkSearchInformation.test.js b/telephony/telephonyjstest/network_search/network_search_information/entry/src/main/js/test/NetworkSearchInformation.test.js index 47fbf1df6..c1a537d28 100644 --- a/telephony/telephonyjstest/network_search/network_search_information/entry/src/main/js/test/NetworkSearchInformation.test.js +++ b/telephony/telephonyjstest/network_search/network_search_information/entry/src/main/js/test/NetworkSearchInformation.test.js @@ -65,7 +65,6 @@ describe('NetworkSearchTest', function () { const ISO_COUNTRY_CODE = 'cn'; const PLMN_SIZE = 5; - /** * @tc.number Telephony_NetworkSearch_getNetworkState_Async_0100 * @tc.name Test the getNetworkState() query function and return the default card 0 network registration status @@ -97,8 +96,8 @@ describe('NetworkSearchTest', function () { data.plmnNumeric != null ).assertTrue(); expect(data.plmnNumeric.length == 5 && data.plmnNumeric.substr(0, 3) === '460').assertTrue(); - expect(garrRegState).assertContain(data.regStatus); - expect(data.nsaState === 1).assertTrue(); + expect(data.regStatus === radio.REG_STATE_IN_SERVICE).assertTrue(); + expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue(); expect(data.isRoaming === false).assertTrue(); expect(data.isCaActive === false).assertTrue(); expect(data.isEmergency === false).assertTrue(); @@ -129,8 +128,8 @@ describe('NetworkSearchTest', function () { data.shortOperatorName != undefined && data.shortOperatorName != '' && data.shortOperatorName != null ).assertTrue(); expect(data.plmnNumeric.length === PLMN_SIZE && data.plmnNumeric.substr(0, 3) === '460').assertTrue(); - expect(garrRegState).assertContain(data.regStatus); - expect(data.nsaState === 1).assertTrue(); + expect(data.regStatus === radio.REG_STATE_IN_SERVICE).assertTrue(); + expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue(); expect(data.isRoaming === false).assertTrue(); expect(data.isCaActive === false).assertTrue(); expect(data.isEmergency === false).assertTrue(); @@ -174,8 +173,7 @@ describe('NetworkSearchTest', function () { done(); return; } - console.log(`Telephony_NetworkSearch_getRadioTech_Async_0100 finish psRadioTech: ${psRadioTech} - csRadioTech: ${csRadioTech}`); + console.log(`Telephony_NetworkSearch_getRadioTech_Async_0100 finish ps: ${psRadioTech} cs: ${csRadioTech}`); expect(garrRadioTech).assertContain(psRadioTech); expect(garrRadioTech).assertContain(csRadioTech); done(); @@ -249,7 +247,7 @@ describe('NetworkSearchTest', function () { return; } console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0400 finish data: ${JSON.stringify(data)}`); - expect(data === undefined || data.length === 0).assertTrue(); + expect(data.length === 0).assertTrue(); done(); }); }); @@ -271,8 +269,8 @@ describe('NetworkSearchTest', function () { data.shortOperatorName != undefined && data.shortOperatorName != '' && data.shortOperatorName != null ).assertTrue(); expect(data.plmnNumeric.length === PLMN_SIZE && data.plmnNumeric.substr(0, 3) === '460').assertTrue(); - expect(garrRegState).assertContain(data.regStatus); - expect(data.nsaState === 1).assertTrue(); + expect(data.regStatus === radio.REG_STATE_IN_SERVICE).assertTrue(); + expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue(); expect(data.isRoaming === false).assertTrue(); expect(data.isCaActive === false).assertTrue(); expect(data.isEmergency === false).assertTrue(); @@ -304,8 +302,8 @@ describe('NetworkSearchTest', function () { data.shortOperatorName != undefined && data.shortOperatorName != '' && data.shortOperatorName != null ).assertTrue(); expect(data.plmnNumeric.length === PLMN_SIZE && data.plmnNumeric.substr(0, 3) === '460').assertTrue(); - expect(garrRegState).assertContain(data.regStatus); - expect(data.nsaState === 1).assertTrue(); + expect(data.regStatus === radio.REG_STATE_IN_SERVICE).assertTrue(); + expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue(); expect(data.isRoaming === false).assertTrue(); expect(data.isCaActive === false).assertTrue(); expect(data.isEmergency === false).assertTrue(); @@ -419,7 +417,7 @@ describe('NetworkSearchTest', function () { let data = await radio.getSignalInformation(slotId); console.log( `Telephony_NetworkSearch_getSignalInformation_Promise_0400 finish data: ${JSON.stringify(data)}`); - expect(data === undefined || data.length === 0).assertTrue(); + expect(data.length === 0).assertTrue(); } catch (err) { console.log(`Telephony_NetworkSearch_getSignalInformation_Promise_0400 fail err: ${err}`); expect().assertFail(); @@ -485,7 +483,7 @@ describe('NetworkSearchTest', function () { } console.log( `Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 finish data: ${JSON.stringify(data)}`); - expect(data === undefined || data.length === 0).assertTrue(); + expect(data.length === 0).assertTrue(); done(); }); }); @@ -501,7 +499,7 @@ describe('NetworkSearchTest', function () { let data = await radio.getISOCountryCodeForNetwork(slotId); console.log( `Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 finish data:${JSON.stringify(data)}`); - expect(data === undefined || data.length === 0).assertTrue(); + expect(data.length === 0).assertTrue(); } catch (err) { console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err: ${err}`); expect().assertFail(); diff --git a/telephony/telephonyjstest/network_search/network_search_radio/BUILD.gn b/telephony/telephonyjstest/network_search/network_search_radio/BUILD.gn index b41b1e59d..60eee5da7 100644 --- a/telephony/telephonyjstest/network_search/network_search_radio/BUILD.gn +++ b/telephony/telephonyjstest/network_search/network_search_radio/BUILD.gn @@ -27,4 +27,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/network_search/network_search_radio/entry/src/main/js/test/NetworkSearchRadio.test.js b/telephony/telephonyjstest/network_search/network_search_radio/entry/src/main/js/test/NetworkSearchRadio.test.js index e8c344c21..261a51bdc 100644 --- a/telephony/telephonyjstest/network_search/network_search_radio/entry/src/main/js/test/NetworkSearchRadio.test.js +++ b/telephony/telephonyjstest/network_search/network_search_radio/entry/src/main/js/test/NetworkSearchRadio.test.js @@ -53,7 +53,7 @@ describe('NetworkSearchTest', function () { return; } console.log('Telephony_NetworkSearch_turnOnRadio_Async_0100 turnOn finish'); - radio.isRadioOn((err, data) => { + radio.isRadioOn(async (err, data) => { if (err) { console.log(`Telephony_NetworkSearch_turnOnRadio_Async_0100 isOn fail: ${err}`); expect().assertFail(); @@ -62,6 +62,15 @@ describe('NetworkSearchTest', function () { } console.log(`Telephony_NetworkSearch_turnOnRadio_Async_0100 finish data: ${data}`); expect(data).assertTrue(); + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); }); @@ -145,7 +154,7 @@ describe('NetworkSearchTest', function () { return; } console.log('Telephony_NetworkSearch_turnOffRadio_Async_0100 turnOff finish'); - radio.isRadioOn((err, data) => { + radio.isRadioOn(async (err, data) => { if (err) { console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0100 isOn fail: ${err}`); expect().assertFail(); @@ -154,6 +163,15 @@ describe('NetworkSearchTest', function () { } console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0100 finish data: ${data}`) expect(data).assertFalse(); + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); }); @@ -191,7 +209,7 @@ describe('NetworkSearchTest', function () { return; } console.log('Telephony_NetworkSearch_turnOffRadio_Async_0200 turnOff2 finish'); - radio.isRadioOn((err, data) => { + radio.isRadioOn(async (err, data) => { if (err) { console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0200 isOn fail: ${err}`); expect().assertFail(); @@ -200,6 +218,15 @@ describe('NetworkSearchTest', function () { } console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0200 finish data: ${data}`) expect(data).assertFalse(); + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); }); @@ -233,7 +260,7 @@ describe('NetworkSearchTest', function () { return; } console.log('Telephony_NetworkSearch_turnOffRadio_Async_0500 turnOff finish'); - radio.getNetworkState((err, data) => { + radio.getNetworkState(async (err, data) => { if (err) { console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0500 get fail err: ${err}`); expect().assertFail(); @@ -241,21 +268,23 @@ describe('NetworkSearchTest', function () { return; } console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0500 finish data: ${JSON.stringify(data)}`); - expect( - data.longOperatorName === undefined || data.longOperatorName === '' || - data.longOperatorName === null - ).assertTrue(); - expect( - data.shortOperatorName === undefined || data.shortOperatorName === '' || - data.shortOperatorName === null - ).assertTrue(); - expect(data.plmnNumeric === undefined || data.plmnNumeric === '' || - data.plmnNumeric === null).assertTrue(); + expect(data.longOperatorName === '').assertTrue(); + expect(data.shortOperatorName === '').assertTrue(); + expect(data.plmnNumeric === '').assertTrue(); expect(data.regStatus === radio.REG_STATE_POWER_OFF).assertTrue(); expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue(); expect(data.isRoaming === false).assertTrue(); expect(data.isCaActive === false).assertTrue(); expect(data.isEmergency === false).assertTrue(); + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); }); @@ -284,7 +313,7 @@ describe('NetworkSearchTest', function () { return; } console.log('Telephony_NetworkSearch_turnOffRadio_Async_0600 turnOff finish'); - radio.getSignalInformation(SLOT_0, (err, data) => { + radio.getSignalInformation(SLOT_0, async (err, data) => { if (err) { console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0600 get fail err: ${err}`); expect().assertFail(); @@ -294,6 +323,15 @@ describe('NetworkSearchTest', function () { console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0600 finish data: ${JSON.stringify(data)}`); expect(data != null && data != undefined).assertTrue(); expect(data.length === 0).assertTrue(); + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); }); @@ -323,7 +361,7 @@ describe('NetworkSearchTest', function () { return; } console.log('Telephony_NetworkSearch_turnOffRadio_Async_0700 turnOff finish'); - radio.getRadioTech(SLOT_0, (err, { psRadioTech, + radio.getRadioTech(SLOT_0, async (err, { psRadioTech, csRadioTech }) => { if (err) { console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0700 get fail err: ${err}`); @@ -331,10 +369,19 @@ describe('NetworkSearchTest', function () { done(); return; } - console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0700 finish psRadioTech: ${psRadioTech} - csRadioTech: ${csRadioTech}`); + console.log( + `Telephony_NetworkSearch_turnOffRadio_Async_0700 finish ps: ${psRadioTech} cs: ${csRadioTech}`); expect(psRadioTech === radio.RADIO_TECHNOLOGY_UNKNOWN).assertTrue(); expect(csRadioTech === radio.RADIO_TECHNOLOGY_UNKNOWN).assertTrue(); + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); }); @@ -342,7 +389,7 @@ describe('NetworkSearchTest', function () { /** * @tc.number Telephony_NetworkSearch_isRadioOn_Async_0100 - * @tc.name Turn off Radio, input slotId parameter as 1, test isRadioOn() returns 'false' + * @tc.name Turn off Radio, test isRadioOn() returns 'false' * @tc.desc Function test */ it('Telephony_NetworkSearch_isRadioOn_Async_0100', 0, async function (done) { @@ -363,7 +410,7 @@ describe('NetworkSearchTest', function () { return; } console.log('Telephony_NetworkSearch_isRadioOn_Async_0100 turnOff finish'); - radio.isRadioOn((err, data) => { + radio.isRadioOn(async (err, data) => { if (err) { console.log(`Telephony_NetworkSearch_isRadioOn_Async_0100 isOn fail err: ${err}`); expect().assertFail(); @@ -372,6 +419,15 @@ describe('NetworkSearchTest', function () { } console.log(`Telephony_NetworkSearch_isRadioOn_Async_0100 finish data: ${data}`); expect(data === false).assertTrue(); + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); @@ -380,7 +436,7 @@ describe('NetworkSearchTest', function () { /** * @tc.number Telephony_NetworkSearch_isRadioOn_Async_0200 - * @tc.name Turn on Radio, input slotId parameter as 1, test isRadioOn() returns 'true' + * @tc.name Turn on Radio, test isRadioOn() returns 'true' * @tc.desc Function test */ it('Telephony_NetworkSearch_isRadioOn_Async_0200', 0, async function (done) { @@ -458,7 +514,6 @@ describe('NetworkSearchTest', function () { done(); return; } - done(); }); @@ -532,6 +587,15 @@ describe('NetworkSearchTest', function () { done(); return; } + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); @@ -563,11 +627,11 @@ describe('NetworkSearchTest', function () { await radio.turnOffRadio(); console.log('Telephony_NetworkSearch_turnOffRadio_Promise_0200 turnOff2 finish'); done(); - return; } catch (err) { console.log(`Telephony_NetworkSearch_turnOffRadio_Promise_0200 turnOff2 fail: ${err}`); expect().assertFail(); done(); + return; } try { let data = await radio.isRadioOn(); @@ -579,6 +643,15 @@ describe('NetworkSearchTest', function () { done(); return; } + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); @@ -613,13 +686,9 @@ describe('NetworkSearchTest', function () { let data = await radio.getNetworkState(); console.log(`Telephony_NetworkSearch_turnOffRadio_Promise_0500 finish data: ${JSON.stringify(data)}`); expect(data != null && data != undefined).assertTrue(); - expect( - data.longOperatorName === undefined || data.longOperatorName === '' || data.longOperatorName === null - ).assertTrue(); - expect( - data.shortOperatorName === undefined || data.shortOperatorName === '' || data.shortOperatorName === null - ).assertTrue(); - expect(data.plmnNumeric === undefined || data.plmnNumeric === '' || data.plmnNumeric === null).assertTrue(); + expect(data.longOperatorName === '').assertTrue(); + expect(data.shortOperatorName === '').assertTrue(); + expect(data.plmnNumeric === '').assertTrue(); expect(data.regStatus === radio.REG_STATE_POWER_OFF).assertTrue(); expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue(); expect(data.isRoaming === false).assertTrue(); @@ -632,6 +701,15 @@ describe('NetworkSearchTest', function () { done(); return; } + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); @@ -661,7 +739,7 @@ describe('NetworkSearchTest', function () { } try { let data = await radio.getSignalInformation(SLOT_0); - console.log(`Telephony_NetworkSearch_turnOffRadio_Promise_0600 finish data: ${data}`); + console.log(`Telephony_NetworkSearch_turnOffRadio_Promise_0600 finish data: ${JSON.stringify(data)}`); expect(data != null && data != undefined).assertTrue(); expect(data.length === 0).assertTrue(); } catch (err) { @@ -670,6 +748,15 @@ describe('NetworkSearchTest', function () { done(); return; } + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); @@ -710,12 +797,21 @@ describe('NetworkSearchTest', function () { done(); return; } + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); /** * @tc.number Telephony_NetworkSearch_isRadioOn_Promise_0100 - * @tc.name Turn off Radio, input slotId parameter as 1, test isRadioOn() returns 'false' + * @tc.name Turn off Radio, test isRadioOn() returns 'false' * @tc.desc Function test */ it('Telephony_NetworkSearch_isRadioOn_Promise_0100', 0, async function (done) { @@ -747,12 +843,21 @@ describe('NetworkSearchTest', function () { done(); return; } + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); /** * @tc.number Telephony_NetworkSearch_isRadioOn_Promise_0200 - * @tc.name Turn on Radio, input slotId parameter as 1, test isRadioOn() returns 'true' + * @tc.name Turn on Radio, test isRadioOn() returns 'true' * @tc.desc Function test */ it('Telephony_NetworkSearch_isRadioOn_Promise_0200', 0, async function (done) { @@ -780,7 +885,7 @@ describe('NetworkSearchTest', function () { /** * @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 - * @tc.name Radio is off, test the getISOCountryCodeForNetwork() return the data is 'cn' + * @tc.name Radio is off, test the getISOCountryCodeForNetwork() return the data is not 'cn' * @tc.desc Function test */ it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500', 0, async function (done) { @@ -801,16 +906,25 @@ describe('NetworkSearchTest', function () { return; } console.log('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 turnOff finish'); - radio.getISOCountryCodeForNetwork(SLOT_0, (err, data) => { + radio.getISOCountryCodeForNetwork(SLOT_0, async (err, data) => { if (err) { console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 get fail: ${err}`); expect().assertFail(); done(); return; } - console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 finish - data: ${JSON.stringify(data)}`); - expect(data === "" || data === undefined || data === null).assertTrue(); + console.log( + `Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 finish data: ${JSON.stringify(data)}`); + expect(data === '').assertTrue(); + try { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_recoverRadioState success'); + } catch (err) { + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); + expect().assertFail(); + done(); + return; + } done(); }); }); @@ -818,7 +932,7 @@ describe('NetworkSearchTest', function () { /** * @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 - * @tc.name Radio is off, test the getISOCountryCodeForNetwork() return the data is 'cn' + * @tc.name Radio is off, test the getISOCountryCodeForNetwork() return the data is not 'cn' * @tc.desc Function test */ it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500', 0, async function (done) { @@ -843,7 +957,7 @@ describe('NetworkSearchTest', function () { try { let data = await radio.getISOCountryCodeForNetwork(SLOT_0); console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 finish: ${data}`); - expect(data === "" || data === undefined || data === null).assertTrue(); + expect(data === '').assertTrue(); } catch (err) { console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 fail: ${err}`); expect().assertFail(); @@ -852,9 +966,9 @@ describe('NetworkSearchTest', function () { } try { await radio.turnOnRadio(); - console.log('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 turnOn success'); + console.log('Telephony_NetworkSearch_recoverRadioState success'); } catch (err) { - console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 turnOff fail ${err}`); + console.log(`Telephony_NetworkSearch_recoverRadioState fail ${err}`); expect().assertFail(); done(); return; diff --git a/telephony/telephonyjstest/network_search/network_search_selection_mode/BUILD.gn b/telephony/telephonyjstest/network_search/network_search_selection_mode/BUILD.gn index a5af3ac60..04ad1fe67 100644 --- a/telephony/telephonyjstest/network_search/network_search_selection_mode/BUILD.gn +++ b/telephony/telephonyjstest/network_search/network_search_selection_mode/BUILD.gn @@ -27,4 +27,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/network_search/network_search_selection_mode/entry/src/main/js/test/NetworkSelectionMode.test.js b/telephony/telephonyjstest/network_search/network_search_selection_mode/entry/src/main/js/test/NetworkSelectionMode.test.js index 7cb5e82ec..271a27f02 100644 --- a/telephony/telephonyjstest/network_search/network_search_selection_mode/entry/src/main/js/test/NetworkSelectionMode.test.js +++ b/telephony/telephonyjstest/network_search/network_search_selection_mode/entry/src/main/js/test/NetworkSelectionMode.test.js @@ -18,14 +18,15 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from describe('NetworkSearchTest', function () { let gslot = 0; - let gradioTech = '2'; - let goperatorName = '46000'; + let gradioTech = radio.RADIO_TECHNOLOGY_GSM.toString(); + let goperatorName = ''; + let goperatorNumeric = ''; let gnetworkSMode = { slotId: gslot, selectMode: radio.NETWORK_SELECTION_AUTOMATIC, networkInformation: { - operatorName: '46000', - operatorNumeric: '46011', + operatorName: goperatorName, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -38,18 +39,16 @@ describe('NetworkSearchTest', function () { radio.NETWORK_CURRENT, radio.NETWORK_FORBIDDEN, ]; - //Network system + //NetworkRadioTech let garrNetworkRadioTech = [ - 'UNKNOWN','GSM','1XRTT','WCDMA', - 'HSPA','HSPAP', 'TD_SCDMA','EVDO', - 'EHRPD','LTE','LTE_CA','IWLAN','NR']; + 'UNKNOWN', 'GSM', '1XRTT', 'WCDMA', + 'HSPA', 'HSPAP', 'TD_SCDMA', 'EVDO', + 'EHRPD', 'LTE', 'LTE_CA', 'IWLAN', 'NR']; const SLOT_0 = 0; const OPERATOR_NUMERIC_SSSSS = 'SSSSS'; const ERR_VALUE_5 = 5; - - async function recoverNetworkSelectionMode() { try { await radio.setNetworkSelectionMode(gnetworkSMode); @@ -81,18 +80,19 @@ describe('NetworkSearchTest', function () { done(); return; } - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { console.log(`Telephony_NetworkSearch_getNetworkState fail`) expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { console.log(`Telephony_NetworkSearch_getNetworkSelectionMode_Async_0100 init err: ${err}`); expect().assertFail(); done(); @@ -103,7 +103,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_AUTOMATIC, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -140,18 +140,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0200', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); - console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`); + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -161,7 +162,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_MANUAL, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -218,18 +219,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0100', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); - console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`); + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -239,7 +241,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_AUTOMATIC, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -276,18 +278,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0200', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -297,7 +300,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_MANUAL, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -354,19 +357,20 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0100', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -377,7 +381,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_UNKNOWN, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -414,18 +418,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0200', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -436,7 +441,7 @@ describe('NetworkSearchTest', function () { selectMode: ERR_VALUE_5, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -474,18 +479,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0300', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -534,18 +540,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0400', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -556,7 +563,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_MANUAL, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -592,18 +599,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -614,7 +622,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_AUTOMATIC, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -642,37 +650,38 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0100', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { + expect().assertFail(); + done(); + return; + } + try { + await radio.setNetworkSelectionMode(gnetworkSMode); + console.log('Telephony_NetworkSearch_recoverNetworkSelectionMode success'); + } catch (err) { + console.log('Telephony_NetworkSearch_recoverNetworkSelectionMode fail'); expect().assertFail(); done(); return; } - try { - await radio.setNetworkSelectionMode(gnetworkSMode); - console.log('Telephony_NetworkSearch_recoverNetworkSelectionMode success'); - } catch (err) { - console.log('Telephony_NetworkSearch_recoverNetworkSelectionMode fail'); - expect().assertFail(); - done(); - return; - } let networkSMode = { slotId: SLOT_0, selectMode: radio.NETWORK_SELECTION_UNKNOWN, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -712,18 +721,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0200', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -742,7 +752,7 @@ describe('NetworkSearchTest', function () { selectMode: ERR_VALUE_5, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -775,23 +785,24 @@ describe('NetworkSearchTest', function () { /** * @tc.number Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0300 - * @tc.name Test the setNetworkSelectionMode() and enter an outlier operatorNumeric: '46001' + * @tc.name Test the setNetworkSelectionMode() and enter an outlier operatorNumeric * return value is 'False' and the network selection mode update fails * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0300', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -849,18 +860,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0400', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -879,7 +891,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_MANUAL, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -914,18 +926,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0700', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -944,7 +957,7 @@ describe('NetworkSearchTest', function () { selectMode: radio.NETWORK_SELECTION_AUTOMATIC, networkInformation: { operatorName: goperatorName, - operatorNumeric: gnetworkSMode.networkInformation.operatorNumeric, + operatorNumeric: goperatorNumeric, state: radio.NETWORK_AVAILABLE, radioTech: gradioTech, }, @@ -971,18 +984,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0100', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -1033,18 +1047,19 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0100', 0, async function (done) { - try{ + try { let data = await radio.getNetworkState(SLOT_0); console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) + if (data.plmnNumeric != '' && data.plmnNumeric != undefined) { + goperatorNumeric = data.plmnNumeric; + goperatorName = data.longOperatorName; + } else { + console.log(`Telephony_NetworkSearch_getNetworkState fail`); expect().assertFail(); done(); return; } - }catch(err){ + } catch (err) { expect().assertFail(); done(); return; @@ -1094,22 +1109,6 @@ describe('NetworkSearchTest', function () { * @tc.desc Function test */ it('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400', 0, async function (done) { - try{ - let data = await radio.getNetworkState(SLOT_0); - console.log(`Telephony_NetworkSearch_getNetworkState data: ${JSON.stringify(data)}`) - if(data.plmnNumeric != '' && data.plmnNumeric != undefined){ - gnetworkSMode.networkInformation.operatorNumeric = data.plmnNumeric; - }else{ - console.log(`Telephony_NetworkSearch_getNetworkState fail`) - expect().assertFail(); - done(); - return; - } - }catch(err){ - expect().assertFail(); - done(); - return; - } let slotId = 33; radio.getNetworkSearchInformation(slotId, (err, data) => { if (err) { diff --git a/telephony/telephonyjstest/sim/BUILD.gn b/telephony/telephonyjstest/sim/BUILD.gn index 15d6a3d32..e72e613b9 100644 --- a/telephony/telephonyjstest/sim/BUILD.gn +++ b/telephony/telephonyjstest/sim/BUILD.gn @@ -25,4 +25,4 @@ group("sim") { "sim_state_manager_function_test:SimStateManagerFunctionTest", ] } -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_file_manager_function_test/BUILD.gn b/telephony/telephonyjstest/sim/sim_file_manager_function_test/BUILD.gn index a24cfecae..066399ac0 100644 --- a/telephony/telephonyjstest/sim/sim_file_manager_function_test/BUILD.gn +++ b/telephony/telephonyjstest/sim/sim_file_manager_function_test/BUILD.gn @@ -28,4 +28,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_file_manager_function_test/entry/src/main/js/test/SimFileManagerFunction.test.js b/telephony/telephonyjstest/sim/sim_file_manager_function_test/entry/src/main/js/test/SimFileManagerFunction.test.js index 5e6a96698..b92df042b 100644 --- a/telephony/telephonyjstest/sim/sim_file_manager_function_test/entry/src/main/js/test/SimFileManagerFunction.test.js +++ b/telephony/telephonyjstest/sim/sim_file_manager_function_test/entry/src/main/js/test/SimFileManagerFunction.test.js @@ -49,6 +49,7 @@ describe('SimFileManagerFunction', function () { sim.getIMSI(simSlotId.SLOT_ID_4, (err, data) => { if (err) { // Enter the exception ID to enter err. + console.log(`Telephony_Sim_getIMSI_Async_0200, err: ${err.message}`); console.log('Telephony_Sim_getIMSI_Async_0200 finish'); done(); return; @@ -66,7 +67,7 @@ describe('SimFileManagerFunction', function () { */ it('Telephony_Sim_getIMSI_Promise_0100', 0, async function (done) { try { - var data = await sim.getIMSI(simSlotId.SLOT_ID_0); + let data = await sim.getIMSI(simSlotId.SLOT_ID_0); console.log(`Telephony_Sim_getIMSI_Promise_0100 data = ${data}`); expect(data !== '' || data !== undefined).assertTrue(); expect(data.length === IMSI_LENGTH).assertTrue(); @@ -86,8 +87,10 @@ describe('SimFileManagerFunction', function () { */ it('Telephony_Sim_getIMSI_Promise_0200', 0, async function (done) { try { - var data = await sim.getIMSI(simSlotId.SLOT_ID_4); + let data = await sim.getIMSI(simSlotId.SLOT_ID_4); } catch (err) { + // Enter the exception ID to enter err. + console.log(`Telephony_Sim_getIMSI_Promise_0200, err: ${err.message}`); console.log('Telephony_Sim_getIMSI_Promise_0200 finish'); done(); return; @@ -127,6 +130,7 @@ describe('SimFileManagerFunction', function () { sim.getSimIccId(simSlotId.SLOT_ID_4, (err, data) => { if (err) { // Enter the exception ID to enter err. + console.log(`Telephony_Sim_getSimIccId_Async_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimIccId_Async_0200 finish'); done(); return; @@ -144,7 +148,7 @@ describe('SimFileManagerFunction', function () { */ it('Telephony_Sim_getSimIccId_Promise_0100', 0, async function (done) { try { - var data = await sim.getSimIccId(simSlotId.SLOT_ID_0); + let data = await sim.getSimIccId(simSlotId.SLOT_ID_0); console.log(`Telephony_Sim_getSimIccId_Promise_0100 data${data}`); expect(data !== '' || data !== undefined).assertTrue(); expect(data.length === ICC_LENGTH).assertTrue(); @@ -164,8 +168,9 @@ describe('SimFileManagerFunction', function () { */ it('Telephony_Sim_getSimIccId_Promise_0200', 0, async function (done) { try { - var data = await sim.getSimIccId(simSlotId.SLOT_ID_4); + let data = await sim.getSimIccId(simSlotId.SLOT_ID_4); } catch (err) { + console.log(`Telephony_Sim_getSimIccId_Promise_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimIccId_Promise_0200 finish'); done(); return; @@ -182,7 +187,7 @@ describe('SimFileManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getISOCountryCodeForSim_Async_0100', 0, async function (done) { - var countryCode = 'cn'; + let countryCode = 'cn'; sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_0, (err, data) => { if (err) { console.log(`Telephony_Sim_getISOCountryCodeForSim_Async_0100 fail, err: ${err.message}`); @@ -208,6 +213,7 @@ describe('SimFileManagerFunction', function () { sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_4, (err, data) => { if (err) { // Expect slot id 4 return err here. + console.log(`Telephony_Sim_getISOCountryCodeForSim_Async_0200, err: ${err.message}`); console.log('Telephony_Sim_getISOCountryCodeForSim_Async_0200 finish'); done(); return; @@ -225,9 +231,9 @@ describe('SimFileManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getISOCountryCodeForSim_Promise_0100', 0, async function (done) { - var countryCode = 'cn'; + let countryCode = 'cn'; try { - var data = await sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_0); + let data = await sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_0); console.log(`Telephony_Sim_getISOCountryCodeForSim_Promise_0100, data = ${data}`); // The country code for mainland China is cn. expect(data === countryCode).assertTrue(); @@ -252,6 +258,7 @@ describe('SimFileManagerFunction', function () { var data = await sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_4); } catch (err) { // Expect slotid 4 return err here. + console.log(`Telephony_Sim_getISOCountryCodeForSim_Promise_0200, err: ${err.message}`); console.log('Telephony_Sim_getISOCountryCodeForSim_Promise_0200 finish'); done(); return; @@ -268,7 +275,7 @@ describe('SimFileManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getSimOperatorNumeric_Async_0100', 0, async function (done) { - var operatorNumTopThree = '460'; + let operatorNumTopThree = '460'; sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0, (err, data) => { if (err) { console.log(`Telephony_Sim_getSimOperatorNumeric_Async_0100 fail, err: ${err.message}`); @@ -297,6 +304,7 @@ describe('SimFileManagerFunction', function () { sim.getSimOperatorNumeric(simSlotId.SLOT_ID_4, (err, data) => { if (err) { // Expect slotid 4 return err here. + console.log(`Telephony_Sim_getSimOperatorNumeric_Async_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimOperatorNumeric_Async_0200 finish'); done(); return; @@ -314,9 +322,9 @@ describe('SimFileManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getSimOperatorNumeric_Promise_0100', 0, async function (done) { - var operatorNumTopThree = '460'; + let operatorNumTopThree = '460'; try { - var data = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0); + let data = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0); console.log(`Telephony_Sim_getSimOperatorNumeric_Promise_0100, data = ${data}`); expect(data !== '' && data !== undefined).assertTrue(); // The length of operator numeric in mainland China is 5. @@ -344,6 +352,7 @@ describe('SimFileManagerFunction', function () { var data = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_4); } catch (err) { // Expect slotid 4 return err here. + console.log(`Telephony_Sim_getSimOperatorNumeric_Promise_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimOperatorNumeric_Promise_0200 finish'); done(); return; @@ -359,9 +368,9 @@ describe('SimFileManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getSimSpn_Async_0100', 0, async function (done) { - var mobileSpn = '00434D4343FFFFFFFFFFFFFFFFFFFFFFFF'; - var unicomSpn = '00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'; - var telecomSpn = '01804E2D56FD75354FE1FFFFFFFFFFFFFF'; + let mobileSpn = '00434D4343FFFFFFFFFFFFFFFFFFFFFFFF'; + let unicomSpn = '00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'; + let telecomSpn = '01804E2D56FD75354FE1FFFFFFFFFFFFFF'; sim.getSimSpn(simSlotId.SLOT_ID_0, (err, data) => { if (err) { console.log(`Telephony_Sim_getSimSpn_Async_0100 fail, err: ${err.message}`); @@ -404,6 +413,7 @@ describe('SimFileManagerFunction', function () { sim.getSimSpn(simSlotId.SLOT_ID_4, (err, data) => { if (err) { // Expect slotid 4 return err here. + console.log(`Telephony_Sim_getSimSpn_Async_0200 fail: ${err.message}`); console.log('Telephony_Sim_getSimSpn_Async_0200 finish'); done(); return; @@ -420,15 +430,15 @@ describe('SimFileManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getSimSpn_Promise_0100', 0, async function (done) { - var mobileSpn = '00434D4343FFFFFFFFFFFFFFFFFFFFFFFF'; - var unicomSpn = '00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'; - var telecomSpn = '01804E2D56FD75354FE1FFFFFFFFFFFFFF'; + let mobileSpn = '00434D4343FFFFFFFFFFFFFFFFFFFFFFFF'; + let unicomSpn = '00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'; + let telecomSpn = '01804E2D56FD75354FE1FFFFFFFFFFFFFF'; try { - var data = await sim.getSimSpn(simSlotId.SLOT_ID_0); + let data = await sim.getSimSpn(simSlotId.SLOT_ID_0); console.log(`Telephony_Sim_getSimSpn_Promise_0100, data = ${data}`); expect(data !== '' && data !== undefined).assertTrue(); try { - var value = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0); + let value = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0); console.log(`Telephony_Sim_getSimSpn_Promise_0100, value : ${value}`); if ((value === operatorCode.MOBILE_CODE_1) || (value === operatorCode.MOBILE_CODE_2) || (value === operatorCode.MOBILE_CODE_3) || (value === operatorCode.MOBILE_CODE_4)) { @@ -466,6 +476,7 @@ describe('SimFileManagerFunction', function () { var data = await sim.getSimSpn(simSlotId.SLOT_ID_4); } catch (err) { // Expect slotid 4 return err here. + console.log(`Telephony_Sim_getSimSpn_Promise_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimSpn_Promise_0200 finish'); done(); return; @@ -481,7 +492,7 @@ describe('SimFileManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getSimGid1_Async_0100', 0, async function (done) { - var minLength = 1; + let minLength = 1; sim.getSimGid1(simSlotId.SLOT_ID_0, (err, data) => { if (err) { console.log(`Telephony_Sim_getSimGid1_Async_0100 fail, err: ${err.message}`); @@ -506,6 +517,7 @@ describe('SimFileManagerFunction', function () { sim.getSimGid1(simSlotId.SLOT_ID_4, (err, data) => { if (err) { // Expect slotid 4 return err here. + console.log(`Telephony_Sim_getSimGid1_Async_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimGid1_Async_0200 finish'); done(); return; @@ -522,9 +534,9 @@ describe('SimFileManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getSimGid1_Promise_0100', 0, async function (done) { - var minLength = 1; + let minLength = 1; try { - var data = await sim.getSimGid1(simSlotId.SLOT_ID_0); + let data = await sim.getSimGid1(simSlotId.SLOT_ID_0); console.log(`Telephony_Sim_getSimGid1_Promise_0100, data = ${data}`); expect(data !== '' && data !== undefined).assertTrue(); expect((data.length >= minLength)).assertTrue(); @@ -548,6 +560,7 @@ describe('SimFileManagerFunction', function () { var data = await sim.getSimGid1(simSlotId.SLOT_ID_4); } catch (err) { // Expect slotid 4 return err here. + console.log(`Telephony_Sim_getSimGid1_Promise_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimGid1_Promise_0200 finish'); done(); return; diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/BUILD.gn b/telephony/telephonyjstest/sim/sim_manager_function_test/BUILD.gn index 328cfbab0..8e8b35391 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/BUILD.gn +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/BUILD.gn @@ -28,4 +28,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManagerFunction.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManagerFunction.test.js index 9783379f3..616d88d55 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManagerFunction.test.js +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManagerFunction.test.js @@ -19,6 +19,13 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' describe('SimManagerFunction', function () { + var defaultValue = 0; + beforeAll(async function () { + // Gets the default calling card ID. + let result = await sim.getDefaultVoiceSlotId(); + defaultValue = result; + }) + /** * @tc.number Telephony_Sim_getSimAccountInfo_Async_0100 * @tc.name Enter normal parameters to test whether the getSimAccountInfo @@ -26,8 +33,8 @@ describe('SimManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getSimAccountInfo_Async_0100', 0, async function (done) { - var defaultName = 'simDefaultDisplayName'; - var defaultNumber = 'simDefaultDisplayNumber'; + let defaultName = 'simDefaultDisplayName'; + let defaultNumber = 'simDefaultDisplayNumber'; sim.getSimAccountInfo(simSlotId.SLOT_ID_0, (err, data) => { if (err) { console.log(`Telephony_Sim_getSimAccountInfo_Async_0100 fail, err: ${err.message}`); @@ -55,6 +62,7 @@ describe('SimManagerFunction', function () { sim.getSimAccountInfo(simSlotId.SLOT_ID_4, (err, data) => { if (err) { // Enter the exception ID to enter err. + console.log(`Telephony_Sim_getSimAccountInfo_Async_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimAccountInfo_Async_0200 finish'); done(); return; @@ -72,10 +80,10 @@ describe('SimManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getSimAccountInfo_Promise_0100', 0, async function (done) { - var defaultName = 'simDefaultDisplayName'; - var defaultNumber = 'simDefaultDisplayNumber'; + let defaultName = 'simDefaultDisplayName'; + let defaultNumber = 'simDefaultDisplayNumber'; try { - var data = await sim.getSimAccountInfo(simSlotId.SLOT_ID_0); + let data = await sim.getSimAccountInfo(simSlotId.SLOT_ID_0); expect(data.slotIndex === simSlotId.SLOT_ID_0).assertTrue(); // return the default piling data as simDefaultDisplayName. expect(data.showName === defaultName).assertTrue(); @@ -100,9 +108,10 @@ describe('SimManagerFunction', function () { */ it('Telephony_Sim_getSimAccountInfo_Promise_0200', 0, async function (done) { try { - var data = await sim.getSimAccountInfo(simSlotId.SLOT_ID_4); + let data = await sim.getSimAccountInfo(simSlotId.SLOT_ID_4); } catch (err) { // Enter the exception ID to enter err. + console.log(`Telephony_Sim_getSimAccountInfo_Promise_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimAccountInfo_Promise_0200 finish'); done(); return; @@ -119,16 +128,6 @@ describe('SimManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getDefaultVoiceSlotId_Async_0100', 0, async function (done) { - var defaultValue = 0; - sim.getDefaultVoiceSlotId((err, result) => { - if (err) { - console.log(`Telephony_Sim_getDefaultVoiceSlotId_Async_0100 fail, err: ${err.message}`); - expect().assertFail(); - done(); - return; - } - defaultValue = result; - }); sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_0, (err) => { if (err) { console.log(`Telephony_Sim_getDefaultVoiceSlotId_Async_0100 setDefaultVoiceSLOT_ID_err: ${err.message}`); @@ -168,16 +167,6 @@ describe('SimManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getDefaultVoiceSlotId_Async_0200', 0, async function (done) { - var defaultValue = 0; - sim.getDefaultVoiceSlotId((err, result) => { - if (err) { - console.log(`Telephony_Sim_getDefaultVoiceSlotId_Async_0200 fail, err: ${err.message}`); - expect().assertFail(); - done(); - return; - } - defaultValue = result; - }); sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_2, (err) => { if (err) { console.log(`Telephony_Sim_getDefaultVoiceSlotId_Async_0200:setDefaultVoiceSLOT_ID_err: ${ @@ -218,13 +207,10 @@ describe('SimManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getDefaultVoiceSlotId_Promise_0100', 0, async function (done) { - var defaultValue = 0; - var result = await sim.getDefaultVoiceSlotId(); - defaultValue = result; try { await sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_2); try { - var data = await sim.getDefaultVoiceSlotId(); + let data = await sim.getDefaultVoiceSlotId(); expect(data === simSlotId.SLOT_ID_2).assertTrue(); } catch (err) { console.log(`Telephony_Sim_getDefaultVoiceSlotId_Promise_0100 fail, err: ${err.message}`); @@ -250,13 +236,10 @@ describe('SimManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_getDefaultVoiceSlotId_Promise_0200', 0, async function (done) { - var defaultValue = 0; - var result = await sim.getDefaultVoiceSlotId(); - defaultValue = result; try { await sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_0); try { - var data = await sim.getDefaultVoiceSlotId(); + let data = await sim.getDefaultVoiceSlotId(); console.log(`Telephony_Sim_getDefaultVoiceSlotId_Promise_0200, data = ${data}`); expect(data === simSlotId.SLOT_ID_0).assertTrue(); // Restore Settings @@ -295,6 +278,7 @@ describe('SimManagerFunction', function () { } expect(result !== simSlotId.SLOT_ID_4).assertTrue(); }); + console.log(`Telephony_Sim_setDefaultVoiceSlotId_Async_0100, err: ${err.message}`); console.log('Telephony_Sim_setDefaultVoiceSlotId_Async_0100 finish'); done(); return; @@ -312,11 +296,12 @@ describe('SimManagerFunction', function () { */ it('Telephony_Sim_setDefaultVoiceSlotId_Promise_0100', 0, async function (done) { try { - var data = await sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_4); + let data = await sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_4); } catch (err) { // Expect slotid 4 return err here. - var result = await sim.getDefaultVoiceSlotId(); + let result = await sim.getDefaultVoiceSlotId(); expect(result !== simSlotId.SLOT_ID_4).assertTrue(); + console.log(`Telephony_Sim_setDefaultVoiceSlotId_Promise_0100, err: ${err.message}`); console.log('Telephony_Sim_setDefaultVoiceSlotId_Promise_0100 finish'); done(); return; diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/BUILD.gn b/telephony/telephonyjstest/sim/sim_no_sim_function_test/BUILD.gn new file mode 100644 index 000000000..69ad8680c --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("SimNoSimFunctionTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "SimNoSimFunctionTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/Test.json b/telephony/telephonyjstest/sim/sim_no_sim_function_test/Test.json new file mode 100644 index 000000000..c07d06dc6 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for sim no sim function Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "240000", + "package": "com.ohos.simnosimfunction", + "shell-timeout": "240000", + "native-test-timeout":"240000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/package.json b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/package.json new file mode 100644 index 000000000..3fd1454b4 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/package.json @@ -0,0 +1,15 @@ +{ + "name": "formate", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "lint":"eslint --fix ./src/main/js/**/**.js" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "eslint": "^7.32.0" + } +} diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/config.json b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/config.json new file mode 100644 index 000000000..d490b016d --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.ohos.simnosimfunction", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.simnosimfunction", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.ohos.simnosimfunction.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/app.js b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/app.js new file mode 100644 index 000000000..d61b8caa6 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate () { + console.info('TestApplication onCreate'); + }, + onDestroy () { + console.info('TestApplication onDestroy'); + } +}; diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 000000000..55561b837 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 000000000..cce1af067 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 000000000..6fda79275 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 000000000..371603e8d --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + SIM卡TEST + +
diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..5e9c3a742 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import file from '@system.file'; +import app from '@system.app'; +import device from '@system.device'; +import router from '@system.router'; +import {Core, ExpectExtend} from 'deccjsunit/index'; + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: '' + }, + onInit () { + this.title = this.$t('strings.world'); + }, + onShow () { + console.info('onShow finish!'); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + core.init(); + + const configService = core.getDefaultService('config'); + configService.timeout = 8000 + configService.setConfig(this); + + require('../../../test/List.test'); + core.execute(); + }, + onReady () { + }, +}; \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/utils/Constant.test.js b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/utils/Constant.test.js new file mode 100644 index 000000000..25acac325 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/default/utils/Constant.test.js @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const simSlotId = { + SLOT_ID_0: 0, + SLOT_ID_1: 1, + SLOT_ID_2: 2, + SLOT_ID_4: 4 +}; \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 000000000..2f9470d82 --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;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{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y { + if (err) { + console.log(`Telephony_Sim_getSimState_Async_0500 fail, err: ${err.message}`); + expect().assertFail(); + done(); + return; + } + console.log(`Telephony_Sim_getSimState_Async_0500, data : ${data}`); + // If there is no SIM card, the return value is SIM_STATE_NOT_PRESENT. + expect(data === sim.SIM_STATE_NOT_PRESENT).assertTrue(); + console.log('Telephony_Sim_getSimState_Async_0500 finish'); + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getSimState_Promise_0500 + * @tc.name Test if there is no SIM card in the case of normal finish-parameter call interface getSimState. + * @tc.desc Function test + */ + it('Telephony_Sim_getSimState_Promise_0500', 0, async function (done) { + try { + let data = await sim.getSimState(simSlotId.SLOT_ID_0); + console.log(`Telephony_Sim_getSimState_Promise_0500, data : ${data}`); + // If there is no SIM card, the return value is SIM_STATE_NOT_PRESENT. + expect(data === sim.SIM_STATE_NOT_PRESENT).assertTrue(); + } catch (err) { + console.log(`Telephony_Sim_getSimState_Promise_0500 fail, err: ${err.message}`); + expect().assertFail(); + done(); + return; + } + console.log('Telephony_Sim_getSimState_Promise_0500 finish'); + done(); + }); +}); \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..e058bb61e --- /dev/null +++ b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "sim" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/sim/sim_no_sim_function_test/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&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xV?CB{_Qhu z;}_q1bvO^g{8<3!gYbo4Di{8qzV+(9 zdlmksohQmRTs@qB;(Wo?dER_ux6XQb@q$tQPW?CMu6GVQd;R=iR;-S{Kr%Zks7>b1 zNs{|-+jhObYE}NR&`TGGr^h^4bjh%c>R#@=8nM&Md>_a+zVulsl;){flFekV1t9ob z+SqfV_Pv3$2f)bQ8%Ul2>fdYR^1zs0BQF~olsOj5AodC&Q_7SMFzsz2 z9newxE&jodk~tNHwl%LBMMDbrk=(^b literal 0 HcmV?d00001 diff --git a/telephony/telephonyjstest/sim/sim_state_manager_function_test/BUILD.gn b/telephony/telephonyjstest/sim/sim_state_manager_function_test/BUILD.gn index 33c8150d8..3a055fcec 100644 --- a/telephony/telephonyjstest/sim/sim_state_manager_function_test/BUILD.gn +++ b/telephony/telephonyjstest/sim/sim_state_manager_function_test/BUILD.gn @@ -28,4 +28,4 @@ ohos_js_assets("hjs_demo_js_assets") { ohos_resources("hjs_demo_resources") { sources = [ "./entry/src/main/js/resources" ] hap_profile = "./entry/src/main/config.json" -} +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sim/sim_state_manager_function_test/entry/src/main/js/test/SimStateManagerFunction.test.js b/telephony/telephonyjstest/sim/sim_state_manager_function_test/entry/src/main/js/test/SimStateManagerFunction.test.js index 179472366..45c009d48 100644 --- a/telephony/telephonyjstest/sim/sim_state_manager_function_test/entry/src/main/js/test/SimStateManagerFunction.test.js +++ b/telephony/telephonyjstest/sim/sim_state_manager_function_test/entry/src/main/js/test/SimStateManagerFunction.test.js @@ -48,6 +48,7 @@ describe('SimStateManagerFunction', function () { sim.getSimState(simSlotId.SLOT_ID_4, (err, data) => { if (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_getSimState_Async_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimState_Async_0200 finish'); done(); return; @@ -65,7 +66,7 @@ describe('SimStateManagerFunction', function () { */ it('Telephony_Sim_getSimState_Promise_0100', 0, async function (done) { try { - var data = await sim.getSimState(simSlotId.SLOT_ID_0); + let data = await sim.getSimState(simSlotId.SLOT_ID_0); console.log(`Telephony_Sim_getSimState_Promise_0100, data = ${data}`); expect(data === sim.SIM_STATE_READY).assertTrue(); } catch (err) { @@ -88,6 +89,7 @@ describe('SimStateManagerFunction', function () { var data = await sim.getSimState(simSlotId.SLOT_ID_4); } catch (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_getSimState_Promise_0200, err: ${err.message}`); console.log('Telephony_Sim_getSimState_Promise_0200 finish'); done(); return; @@ -103,7 +105,7 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_unlockPin_Async_0100', 0, async function (done) { - var PIN = '1234'; + let PIN = '1234'; sim.unlockPin(simSlotId.SLOT_ID_0, PIN, (err, data) => { if (err) { console.log(`Telephony_Sim_unlockPin_Async_0100 fail, err: ${err.message}`); @@ -123,10 +125,11 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_unlockPin_Async_0400', 0, async function (done) { - var PIN = '1234'; + let PIN = '1234'; sim.unlockPin(simSlotId.SLOT_ID_4, PIN, (err, data) => { if (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_unlockPin_Async_0400, err: ${err.message}`); console.log('Telephony_Sim_unlockPin_Async_0400 finish'); done(); return; @@ -143,9 +146,9 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_unlockPin_Promise_0100', 0, async function (done) { - var PIN = '1234'; + let PIN = '1234'; try { - var data = await sim.unlockPin(simSlotId.SLOT_ID_0, PIN); + let data = await sim.unlockPin(simSlotId.SLOT_ID_0, PIN); expect(data.result === OTHER_ABNORMAL).assertTrue(); } catch (err) { console.log(`Telephony_Sim_unlockPin_Promise_0100 fail, err: ${err.message}`); @@ -163,11 +166,12 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_unlockPin_Promise_0400', 0, async function (done) { - var PIN = '1234'; + let PIN = '1234'; try { await sim.unlockPin(simSlotId.SLOT_ID_4, PIN); } catch (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_unlockPin_Promise_0400, err: ${err.message}`); console.log('Telephony_Sim_unlockPin_Promise_0400 finish'); done(); return; @@ -183,8 +187,8 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_unlockPuk_Async_0100', 0, async function (done) { - var newPin = '1234'; - var PUK = '12345678'; + let newPin = '1234'; + let PUK = '12345678'; sim.unlockPuk(simSlotId.SLOT_ID_0, newPin, PUK, (err, data) => { if (err) { console.log(`Telephony_Sim_unlockPuk_Async_0100 fail, err: ${err.message}`); @@ -205,11 +209,12 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_unlockPuk_Async_0400', 0, async function (done) { - var newPin = '1234'; - var PUK = '12345678'; + let newPin = '1234'; + let PUK = '12345678'; sim.unlockPuk(simSlotId.SLOT_ID_4, newPin, PUK, (err, data) => { if (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_unlockPuk_Async_0400, err: ${err.message}`); console.log('Telephony_Sim_unlockPuk_Async_0400 finish'); done(); return; @@ -226,10 +231,10 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_unlockPuk_Promise_0100', 0, async function (done) { - var newPin = '1234'; - var PUK = '12345678'; + let newPin = '1234'; + let PUK = '12345678'; try { - var data = await sim.unlockPuk(simSlotId.SLOT_ID_0, newPin, PUK); + let data = await sim.unlockPuk(simSlotId.SLOT_ID_0, newPin, PUK); expect(data.result === OTHER_ABNORMAL).assertTrue(); } catch (err) { console.log(`Telephony_Sim_unlockPuk_Promise_0100 fail, err: ${err.message}`); @@ -248,12 +253,13 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_unlockPuk_Promise_0400', 0, async function (done) { - var newPin = '1234'; - var PUK = '12345678'; + let newPin = '1234'; + let PUK = '12345678'; try { await sim.unlockPuk(simSlotId.SLOT_ID_4, newPin, PUK); } catch (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_unlockPuk_Promise_0400, err: ${err.message}`); console.log('Telephony_Sim_unlockPuk_Promise_0400 finish'); done(); return; @@ -268,8 +274,8 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_alterPin_Async_0100', 0, async function (done) { - var oldPin = '9999'; - var newPin = '1234'; + let oldPin = '9999'; + let newPin = '1234'; sim.alterPin(simSlotId.SLOT_ID_0, oldPin, newPin, (err, data) => { if (err) { console.log(`Telephony_Sim_alterPin_Async_0100 fail, err: ${err.message}`); @@ -289,11 +295,12 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_alterPin_Async_0400', 0, async function (done) { - var oldPin = '9999'; - var newPin = '1234'; + let oldPin = '9999'; + let newPin = '1234'; sim.alterPin(simSlotId.SLOT_ID_4, oldPin, newPin, (err, data) => { if (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_alterPin_Async_0400, err: ${err.message}`); console.log('Telephony_Sim_alterPin_Async_0400 finish'); done(); return; @@ -310,10 +317,10 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_alterPin_Promise_0100', 0, async function (done) { - var oldPin = '9999'; - var newPin = '1234'; + let oldPin = '9999'; + let newPin = '1234'; try { - var data = await sim.alterPin(simSlotId.SLOT_ID_0, oldPin, newPin); + let data = await sim.alterPin(simSlotId.SLOT_ID_0, oldPin, newPin); expect(data.result === OTHER_ABNORMAL).assertTrue(); } catch (err) { console.log(`Telephony_Sim_alterPin_Promise_0100 fail, err: ${err.message}`); @@ -331,12 +338,14 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_alterPin_Promise_0400', 0, async function (done) { - var oldPin = '9999'; - var newPin = '1234'; + let oldPin = '9999'; + let newPin = '1234'; try { - var data = await sim.alterPin(simSlotId.SLOT_ID_4, oldPin, newPin); + let data = await sim.alterPin(simSlotId.SLOT_ID_4, oldPin, newPin); expect(data.result === OTHER_ABNORMAL).assertTrue(); } catch (err) { + // Enter the exception ID to enter error. + console.log(`Telephony_Sim_alterPin_Promise_0400, err: ${err.message}`); console.log('Telephony_Sim_alterPin_Promise_0400 finish'); done(); return; @@ -353,7 +362,7 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_setLockState_Async_0100', 0, async function (done) { - var PIN = '0123456789'; + let PIN = '0123456789'; sim.setLockState(simSlotId.SLOT_ID_0, PIN, lockSwitch.OPEN, (err, data) => { if (err) { console.log(`Telephony_Sim_setLockState_Async_0100 fail, err: ${err.message}`); @@ -374,7 +383,7 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_setLockState_Async_0200', 0, async function (done) { - var PIN = '0123456789'; + let PIN = '0123456789'; sim.setLockState(simSlotId.SLOT_ID_0, PIN, lockSwitch.CLOSE, (err, data) => { if (err) { console.log(`Telephony_Sim_setLockState_Async_0200 fail, err: ${err.message}`); @@ -394,10 +403,11 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_setLockState_Async_0500', 0, async function (done) { - var PIN = '0123456789'; + let PIN = '0123456789'; sim.setLockState(simSlotId.SLOT_ID_4, PIN, lockSwitch.OPEN, (err, data) => { if (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_setLockState_Async_0500, err: ${err.message}`); console.log('Telephony_Sim_setLockState_Async_0500 finish'); done(); return; @@ -415,9 +425,9 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_setLockState_Promise_0100', 0, async function (done) { - var PIN = '0123456789'; + let PIN = '0123456789'; try { - var data = await sim.setLockState(simSlotId.SLOT_ID_0, PIN, lockSwitch.OPEN); + let data = await sim.setLockState(simSlotId.SLOT_ID_0, PIN, lockSwitch.OPEN); expect(data.result === OTHER_ABNORMAL).assertTrue(); } catch (err) { console.log(`Telephony_Sim_setLockState_Promise_0100 fail, err: ${err.message}`); @@ -436,9 +446,9 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_setLockState_Promise_0200', 0, async function (done) { - var PIN = '0123456789'; + let PIN = '0123456789'; try { - var data = await sim.setLockState(simSlotId.SLOT_ID_0, PIN, lockSwitch.CLOSE); + let data = await sim.setLockState(simSlotId.SLOT_ID_0, PIN, lockSwitch.CLOSE); expect(data.result === OTHER_ABNORMAL).assertTrue(); } catch (err) { console.log(`Telephony_Sim_setLockState_Promise_0200 fail, err: ${err.message}`); @@ -456,11 +466,12 @@ describe('SimStateManagerFunction', function () { * @tc.desc Function test */ it('Telephony_Sim_setLockState_Promise_0500', 0, async function (done) { - var PIN = '0123456789'; + let PIN = '0123456789'; try { await sim.setLockState(simSlotId.SLOT_ID_4, PIN, lockSwitch.OPEN); } catch (err) { // Enter the exception ID to enter error. + console.log(`Telephony_Sim_setLockState_Promise_0500, err: ${err.message}`); console.log('Telephony_Sim_setLockState_Promise_0500 finish'); done(); return; diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_add/entry/src/main/js/test/SmsMmsAdd.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_add/entry/src/main/js/test/SmsMmsAdd.test.js index e7582a874..74f42e71a 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_add/entry/src/main/js/test/SmsMmsAdd.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_add/entry/src/main/js/test/SmsMmsAdd.test.js @@ -28,13 +28,70 @@ describe('SmsMmsAddTest', function () { const TRUE_SLOT_ID = 0; const FALSE_SLOT_ID = 9; + /** Indicates the SMS message body. */ + //visibleMessageBody: 'hello'; + /** Indicates the address of the sender, which is to be displayed on the UI. */ + //visibleRawAddress: '+86861360101****'; + /** Indicates the SMS type. */ + //messageClass: sms.FORWARD_MESSAGE; + /** Indicates the protocol identifier. */ + //protocolId: 0; + /** Indicates the short message service center (SMSC) address. */ + //scAddress: '+861380075****'; + /** Indicates the SMSC timestamp. */ + //scTimestamp: number; + /** Indicates whether the received SMS is a "replace short message". */ + //isReplaceMessage: false; + /** Indicates whether the received SMS contains "TP-Reply-Path". */ + //hasReplyPath: false; + /** Indicates Protocol Data Units (PDUs) from an SMS message. */ + //pdu: Array; + /** + * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the + * Short Message Service Center (SMSC). + */ + //status: 0; + /** Indicates whether the current message is SMS-STATUS-REPORT. */ + //isSmsStatusReportMessage: false; const CORRECT_SMS_PDU = '01000F9168683106019196F400080A00680065006C006C006F'; + const CORRECT_SMS_PDU_SMSC = '+861380075****'; + const CORRECT_SMS_PDU_RAWADDRESS = '+86861360101****'; + const CORRECT_SMS_PDU_MESSAGEBODY = 'hello'; + + /** Indicates the SMS message body. */ + //visibleMessageBody: '33'; + /** Indicates the address of the sender, which is to be displayed on the UI. */ + //visibleRawAddress: '+861914644****'; + /** Indicates the SMS type. */ + //messageClass: sms.FORWARD_MESSAGE; + /** Indicates the protocol identifier. */ + //protocolId: 0; + /** Indicates the short message service center (SMSC) address. */ + //scAddress: '+861380075****'; + /** Indicates the SMSC timestamp. */ + //scTimestamp: number; + /** Indicates whether the received SMS is a "replace short message". */ + //isReplaceMessage: false; + /** Indicates whether the received SMS contains "TP-Reply-Path". */ + //hasReplyPath: false; + /** Indicates Protocol Data Units (PDUs) from an SMS message. */ + //pdu: Array; + /** + * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the + * Short Message Service Center (SMSC). + */ + //status: 0; + /** Indicates whether the current message is SMS-STATUS-REPORT. */ + //isSmsStatusReportMessage: true; const RECEIVE_SMS_PDU = '240D91689141468496F600001270721142432302B319'; - // The PDU corresponding to the length is CORRECT_SMS_PDU,RECEIVE_SMS_PDU - var pduLength = [50, 44]; + const RECEIVE_SMS_PDU_SMSC = '+861380075****'; + const RECEIVE_SMS_PDU_RAWADDRESS = '+861914644****'; + const RECEIVE_SMS_PDU_MESSAGEBODY = '33'; + //The PDU corresponding to the length is CORRECT_SMS_PDU,RECEIVE_SMS_PDU + var pduLength = [50, 44]; + //Default length of the encoded SMS center service address const INTERCEPT_POINT_PLUS = 20; - beforeAll(async function () { //Delete all SMS messages from the SIM card sms.getAllSimMessages(TRUE_SLOT_ID, (geterr, getresult) => { @@ -77,7 +134,43 @@ describe('SmsMmsAddTest', function () { return newPdu.substring(pduBegin, pduEnd); } - /** + //Matching PDU Data --CORRECT_SMS_PDU + function pduDataMatch(parameter) { + if(parameter === undefined || parameter === null) { + return false; + } + return (parameter.shortMessage.visibleMessageBody === CORRECT_SMS_PDU_MESSAGEBODY && + parameter.shortMessage.visibleRawAddress.length === CORRECT_SMS_PDU_RAWADDRESS.length && + parameter.shortMessage.messageClass === sms.FORWARD_MESSAGE && + parameter.shortMessage.protocolId === 0 && + parameter.shortMessage.scAddress.length === CORRECT_SMS_PDU_SMSC.length && + parameter.shortMessage.scTimestamp !== undefined && + parameter.shortMessage.isReplaceMessage === false && + parameter.shortMessage.hasReplyPath === false && + parameter.shortMessage.pdu.length > 0 && + parameter.shortMessage.status === 0 && + parameter.shortMessage.isSmsStatusReportMessage === false ); + } + + //Matching PDU Data --RECEIVE_SMS_PDU + function receivePduDataMatch(parameter) { + if(parameter === undefined || parameter === null) { + return false; + } + return (parameter.shortMessage.visibleMessageBody === RECEIVE_SMS_PDU_MESSAGEBODY && + parameter.shortMessage.visibleRawAddress.length === RECEIVE_SMS_PDU_RAWADDRESS.length && + parameter.shortMessage.messageClass === sms.FORWARD_MESSAGE && + parameter.shortMessage.protocolId === 0 && + parameter.shortMessage.scAddress.length === RECEIVE_SMS_PDU_SMSC.length && + parameter.shortMessage.scTimestamp !== undefined && + parameter.shortMessage.isReplaceMessage === false && + parameter.shortMessage.hasReplyPath === false && + parameter.shortMessage.pdu.length > 0 && + parameter.shortMessage.status === 0 && + parameter.shortMessage.isSmsStatusReportMessage === true ); + } + + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0100 * @tc.name When SLOTID is the correct value,Save a text message to the SIM card * @tc.desc Function test @@ -105,7 +198,8 @@ describe('SmsMmsAddTest', function () { return; } let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); - let isAdd = (addOfPdu === CORRECT_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT); + let isAdd = (addOfPdu === CORRECT_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT && + pduDataMatch(getresult[0])); expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_0100 getAllSimMessages cur finish'); done(); @@ -113,7 +207,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0200 * @tc.name When SLOTID is the wrong value,Failed to save SMS to SIM * @tc.desc Function test @@ -137,7 +231,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0300 * @tc.name Set the length of SMS service address "SMSC" exceeding the limit,Failed to save SMS to SIM * @tc.desc Function test @@ -160,8 +254,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_0300 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -170,15 +264,17 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0400 - * @tc.name Set the SMS center service address "SMSC" to Chinese,Save a text message to the SIM card + * @tc.name Set the SMS center service address "SMSC" to Chinese,Save a text message to the SIM card, + * The saved SMS center service address will be overwritten by the default value * @tc.desc Function test */ it('Telephony_SmsMms_addSimMessage_Async_0400', 0, async function (done) { + let newSmsc = '短信中心服务地址' let data = { slotId: TRUE_SLOT_ID, - smsc: '短信中心服务地址', + smsc: newSmsc, pdu: CORRECT_SMS_PDU, status: sms.SIM_MESSAGE_STATUS_SENT }; @@ -198,7 +294,8 @@ describe('SmsMmsAddTest', function () { return; } let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); - let isAdd = (addOfPdu === CORRECT_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT); + let isAdd = (addOfPdu === CORRECT_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT && + pduDataMatch(getresult[0])); expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_0400 getAllSimMessages cur finish'); done(); @@ -206,9 +303,9 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0500 - * @tc.name Set the SMS center service address "SMSC" to English,Save a text message to the SIM card + * @tc.name Set the SMS center service address "SMSC" to English,Failed to save SMS to SIM * @tc.desc Function test */ it('Telephony_SmsMms_addSimMessage_Async_0500', 0, async function (done) { @@ -230,8 +327,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_0500 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -240,15 +337,17 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0600 - * @tc.name Set the SMS center service address "SMSC" to Special characters,Save a text message to the SIM card + * @tc.name Set the SMS center service address "SMSC" to Special characters,Save a text message to the SIM card, + * The saved SMS center service address will be overwritten by the default value * @tc.desc Function test */ it('Telephony_SmsMms_addSimMessage_Async_0600', 0, async function (done) { + let newSmsc = '$%&**^?'; let data = { slotId: TRUE_SLOT_ID, - smsc: '$%&**^?', + smsc: newSmsc, pdu: CORRECT_SMS_PDU, status: sms.SIM_MESSAGE_STATUS_SENT }; @@ -268,7 +367,8 @@ describe('SmsMmsAddTest', function () { return; } let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); - let isAdd = (addOfPdu === CORRECT_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT); + let isAdd = (addOfPdu === CORRECT_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT && + pduDataMatch(getresult[0])); expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_0600 getAllSimMessages cur finish'); done(); @@ -276,9 +376,9 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0700 - * @tc.name Set the SMS center service address "SMSC" to Mixed character,Save a text message to the SIM card + * @tc.name Set the SMS center service address "SMSC" to Mixed character,Failed to save SMS to SIM * @tc.desc Function test */ it('Telephony_SmsMms_addSimMessage_Async_0700', 0, async function (done) { @@ -300,8 +400,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_0700 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -310,7 +410,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0800 * @tc.name Set the PDU to empty,Failed to save SMS to SIM card * @tc.desc Function test @@ -334,8 +434,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_0800 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -344,7 +444,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_0900 * @tc.name Set PDU to Chinese,Failed to save SMS to SIM card * @tc.desc Function test @@ -366,10 +466,10 @@ describe('SmsMmsAddTest', function () { done(); return; } - expect(getresult[0].shortMessage.pdu.length === 0).assertTrue(); + expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_0900 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -378,7 +478,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1000 * @tc.name Set PDU to English,Failed to save SMS to SIM card * @tc.desc Function test @@ -402,8 +502,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1000 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -412,7 +512,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1100 * @tc.name Set PDU to figure,Failed to save SMS to SIM card * @tc.desc Function test @@ -436,8 +536,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1100 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -447,7 +547,7 @@ describe('SmsMmsAddTest', function () { }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1200 * @tc.name Set PDU to Special characters,Failed to save SMS to SIM card * @tc.desc Function test @@ -471,8 +571,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1200 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -481,7 +581,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1300 * @tc.name Set PDU to Mixed character,Failed to save SMS to SIM card * @tc.desc Function test @@ -505,8 +605,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1300 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -515,7 +615,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1400 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_READ, * Save a text message to the SIM card @@ -544,7 +644,8 @@ describe('SmsMmsAddTest', function () { return; } let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[1]); - let isAdd = (addOfPdu === RECEIVE_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_READ); + let isAdd = (addOfPdu === RECEIVE_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_READ && + receivePduDataMatch(getresult[0])); expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1400 getAllSimMessages cur finish'); done(); @@ -552,7 +653,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1500 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNREAD, * Save a text message to the SIM card @@ -582,7 +683,8 @@ describe('SmsMmsAddTest', function () { } let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[1]); let isAdd = (addOfPdu === RECEIVE_SMS_PDU && - getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNREAD); + getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNREAD && + receivePduDataMatch(getresult[0])); expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1500 getAllSimMessages cur finish'); done(); @@ -590,7 +692,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1600 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNSENT, * Save a text message to the SIM card @@ -620,7 +722,8 @@ describe('SmsMmsAddTest', function () { } let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); let isAdd = (addOfPdu === CORRECT_SMS_PDU && - getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNSENT); + getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNSENT && + pduDataMatch(getresult[0])); expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1600 getAllSimMessages cur finish'); done(); @@ -628,7 +731,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1700 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNSENT,Set the PDU read type * Description Failed to add SMS messages to the SIM card @@ -653,8 +756,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1700 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -663,7 +766,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Async_1800 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNREAD,Set the PDU sending type * Description Failed to add SMS messages to the SIM card @@ -688,8 +791,8 @@ describe('SmsMmsAddTest', function () { } expect(getresult.length === 0).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Async_1800 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -698,7 +801,7 @@ describe('SmsMmsAddTest', function () { }); }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0100 * @tc.name When SLOTID is the correct value,Save a text message to the SIM card * @tc.desc Function test @@ -722,8 +825,10 @@ describe('SmsMmsAddTest', function () { try { let promise = await sms.getAllSimMessages(TRUE_SLOT_ID); let addOfPdu = interceptionPdu(promise[0].shortMessage.pdu, pduLength[0]); - expect(addOfPdu === CORRECT_SMS_PDU && - promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT).assertTrue(); + let isAdd = (addOfPdu === CORRECT_SMS_PDU && + promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT && + pduDataMatch(promise[0])); + expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Promise_0100 getAllSimMessages cur finish'); done(); } catch (err) { @@ -733,7 +838,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0200 * @tc.name When SLOTID is the wrong value,Failed to save SMS to SIM * @tc.desc Function test @@ -756,7 +861,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0300 * @tc.name Set the length of SMS service address "SMSC" exceeding the limit, * Failed to save the SMS message to the SIM card @@ -791,15 +896,17 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0400 * @tc.name Set the SMS center service address "SMSC" to Chinese,Save a text message to the SIM card + The saved SMS center service address will be overwritten by the default value * @tc.desc Function test */ it('Telephony_SmsMms_addSimMessage_Promise_0400', 0, async function (done) { + let newSmsc = '短信中心服务地址'; let data = { slotId: TRUE_SLOT_ID, - smsc: '短信中心服务地址', + smsc: newSmsc, pdu: CORRECT_SMS_PDU, status: sms.SIM_MESSAGE_STATUS_SENT }; @@ -815,8 +922,10 @@ describe('SmsMmsAddTest', function () { try { let promise = await sms.getAllSimMessages(TRUE_SLOT_ID); let addOfPdu = interceptionPdu(promise[0].shortMessage.pdu, pduLength[0]); - expect(addOfPdu === CORRECT_SMS_PDU && - promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT).assertTrue(); + let isAdd = (addOfPdu === CORRECT_SMS_PDU && + promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT && + pduDataMatch(promise[0])); + expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Promise_0400 getAllSimMessages cur finish'); done(); } catch (err) { @@ -826,7 +935,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0500 * @tc.name Set the SMS center service address "SMSC" to English,Failed to save the SMS message to the SIM card * @tc.desc Function test @@ -859,15 +968,17 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0600 * @tc.name Set the SMS center service address "SMSC" to Special characters,Save a text message to the SIM card + The saved SMS center service address will be overwritten by the default value * @tc.desc Function test */ it('Telephony_SmsMms_addSimMessage_Promise_0600', 0, async function (done) { + let newSmsc = '%&^*#!'; let data = { slotId: TRUE_SLOT_ID, - smsc: '%&^*#!', + smsc: newSmsc, pdu: CORRECT_SMS_PDU, status: sms.SIM_MESSAGE_STATUS_SENT }; @@ -883,8 +994,10 @@ describe('SmsMmsAddTest', function () { try { let promise = await sms.getAllSimMessages(TRUE_SLOT_ID); let addOfPdu = interceptionPdu(promise[0].shortMessage.pdu, pduLength[0]); - expect(addOfPdu === CORRECT_SMS_PDU && - promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT).assertTrue(); + let isAdd = (addOfPdu === CORRECT_SMS_PDU && + promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT && + pduDataMatch(promise[0])); + expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Promise_0600 getAllSimMessages cur finish'); done(); } catch (err) { @@ -894,7 +1007,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0700 * @tc.name Set the SMS center service address "SMSC" to Mixed character, * Failed to save the SMS message to the SIM card @@ -928,7 +1041,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0800 * @tc.name Set the PDU to empty,Failed to save SMS to SIM card * @tc.desc Function test @@ -961,7 +1074,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_0900 * @tc.name Set PDU to Chinese,Failed to save SMS to SIM card * @tc.desc Function test @@ -994,7 +1107,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1000 * @tc.name Set PDU to English,Failed to save SMS to SIM card * @tc.desc Function test @@ -1027,7 +1140,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1100 * @tc.name Set PDU to figure,Failed to save SMS to SIM card * @tc.desc Function test @@ -1060,7 +1173,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1200 * @tc.name Set PDU to Special characters,Failed to save SMS to SIM card * @tc.desc Function test @@ -1093,7 +1206,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1300 * @tc.name Set PDU to Mixed character,Failed to save SMS to SIM card * @tc.desc Function test @@ -1126,7 +1239,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1400 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_READ, * Save a text message to the SIM card @@ -1151,8 +1264,10 @@ describe('SmsMmsAddTest', function () { try { let promise = await sms.getAllSimMessages(TRUE_SLOT_ID); let addOfPdu = interceptionPdu(promise[0].shortMessage.pdu, pduLength[1]); - expect(addOfPdu === RECEIVE_SMS_PDU && - promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_READ).assertTrue(); + let isAdd = (addOfPdu === RECEIVE_SMS_PDU && + promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_READ && + receivePduDataMatch(promise[0])); + expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Promise_1400 getAllSimMessages cur finish'); done(); } catch (err) { @@ -1162,7 +1277,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1500 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNREAD, * Save a text message to the SIM card @@ -1187,8 +1302,10 @@ describe('SmsMmsAddTest', function () { try { let promise = await sms.getAllSimMessages(TRUE_SLOT_ID); let addOfPdu = interceptionPdu(promise[0].shortMessage.pdu, pduLength[1]); - expect(addOfPdu === RECEIVE_SMS_PDU && - promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNREAD).assertTrue(); + let isAdd = (addOfPdu === RECEIVE_SMS_PDU && + promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNREAD && + receivePduDataMatch(promise[0])); + expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Promise_1500 getAllSimMessages cur finish'); done(); } catch (err) { @@ -1198,7 +1315,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1600 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNSENT, * Save a text message to the SIM card @@ -1223,8 +1340,10 @@ describe('SmsMmsAddTest', function () { try { let promise = await sms.getAllSimMessages(TRUE_SLOT_ID); let addOfPdu = interceptionPdu(promise[0].shortMessage.pdu, pduLength[0]); - expect(addOfPdu === CORRECT_SMS_PDU && - promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNSENT).assertTrue(); + let isAdd = (addOfPdu === CORRECT_SMS_PDU && + promise[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNSENT && + pduDataMatch(promise[0])); + expect(isAdd).assertTrue(); console.log('Telephony_SmsMms_addSimMessage_Promise_1600 getAllSimMessages cur finish'); done(); } catch (err) { @@ -1234,7 +1353,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1700 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNSENT,Set the PDU read type * Description Failed to add SMS messages to the SIM card @@ -1268,7 +1387,7 @@ describe('SmsMmsAddTest', function () { } }); - /** + /* * @tc.number Telephony_SmsMms_addSimMessage_Promise_1800 * @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNREAD,Set the PDU sending type * Description Failed to add SMS messages to the SIM card diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_config/entry/src/main/js/test/SmsMmsConfig.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_config/entry/src/main/js/test/SmsMmsConfig.test.js index 5cc35961b..791d98679 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_config/entry/src/main/js/test/SmsMmsConfig.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_config/entry/src/main/js/test/SmsMmsConfig.test.js @@ -34,17 +34,17 @@ describe('SmsMmsConfigTest', function () { const RANTYPE_CDMA = 2; const RANTYPE_ERROR = 3; - var DEFAULT_SMS_SLOTID = 0; + var defaultSmsSlotid = 0; beforeAll(async function () { sms.getDefaultSmsSlotId((geterr, getresult) => { if (geterr) { return; } - DEFAULT_SMS_SLOTID = getresult; + defaultSmsSlotid = getresult; }); }); beforeEach(async function () { - sms.setDefaultSmsSlotId(DEFAULT_SMS_SLOTID, (err) => {}); + sms.setDefaultSmsSlotId(defaultSmsSlotid, (err) => {}); }); /** diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_create_message/entry/src/main/js/test/SmsMmsCreateMessage.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_create_message/entry/src/main/js/test/SmsMmsCreateMessage.test.js index bd244ffd4..3faf43941 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_create_message/entry/src/main/js/test/SmsMmsCreateMessage.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_create_message/entry/src/main/js/test/SmsMmsCreateMessage.test.js @@ -26,25 +26,133 @@ import { describe('SmsMmsCreateTest', function () { var rawArrayNull = []; + const ADDR_LENGTH = 14; + /** Indicates the SMS message body. */ + // visibleMessageBody: 'Aa'; + /** Indicates the address of the sender, which is to be displayed on the UI. */ + // visibleRawAddress: '+861892659****'; + /** Indicates the SMS type. */ + // messageClass: sms.FORWARD_MESSAGE; + /** Indicates the protocol identifier. */ + // protocolId: 0; + /** Indicates the short message service center (SMSC) address. */ + // scAddress: '+861380020****'; + /** Indicates the SMSC timestamp. */ + // scTimestamp: 1617848441; + /** Indicates whether the received SMS is a "replace short message". */ + // isReplaceMessage: false; + /** Indicates whether the received SMS contains "TP-Reply-Path". */ + // hasReplyPath: false; + /** Indicates Protocol Data Units (PDUs) from an SMS message. */ + // pdu: Array; + /** + * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the + * Short Message Service Center (SMSC). + */ + // status: 0; + /** Indicates whether the current message is SMS-STATUS-REPORT. */ + // isSmsStatusReportMessage: true; var rawArray = [ - 0x08,0x91,0x68,0x31,0x08,0x70,0x55,0x05,0xF0,0x01,0x00, - 0x07,0x91,0x68,0x01,0x80,0xF6,0x00,0x08,0x04,0x00,0x41,0x00,0x61 - ]; + 0x08,0x91,0x68,0x31,0x08,0x20,0x00,0x75,0xF4,0x24,0x0D,0x91, + 0x68,0x81,0x29,0x56,0x29,0x83,0xF6,0x00,0x00,0x12,0x40,0x80, + 0x01,0x02,0x14,0x23,0x02,0xC1,0x30 + ] // rawArray PDU data - const SC_TIMESTAMP = 12011; - var MESSAGEBODY = 'Aa'; - var RAWADDRESS = '+8610086'; - var SC_ADDRESS = '+8613800755500'; + const MESSAGEBODY = 'Aa'; + const SC_TIMESTAMP = 1617848441; + /** Indicates the SMS message body. */ + // visibleMessageBody: '33'; + /** Indicates the address of the sender, which is to be displayed on the UI. */ + // visibleRawAddress: '+861914644****'; + /** Indicates the SMS type. */ + // messageClass: sms.FORWARD_MESSAGE; + /** Indicates the protocol identifier. */ + // protocolId: 0; + /** Indicates the short message service center (SMSC) address. */ + // scAddress: ''; + /** Indicates the SMSC timestamp. */ + // scTimestamp: 1627356274; + /** Indicates whether the received SMS is a "replace short message". */ + // isReplaceMessage: false; + /** Indicates whether the received SMS contains "TP-Reply-Path". */ + // hasReplyPath: false; + /** Indicates Protocol Data Units (PDUs) from an SMS message. */ + // pdu: Array; + /** + * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the + * Short Message Service Center (SMSC). + */ + // status: 0; + /** Indicates whether the current message is SMS-STATUS-REPORT. */ + // isSmsStatusReportMessage: true; var pduArray = [ - 0x00,0x01,0x00,0x07,0x91,0x68,0x01,0x80,0xF6,0x00, - 0x08,0x0A,0x00,0x68,0x00,0x65,0x00,0x6C,0x00,0x6C,0x00,0x6F - ]; + 0x00,0x24,0x0D,0x91,0x68,0x91,0x41,0x46,0x84,0x96,0xF6, + 0x00,0x00,0x12,0x70,0x72,0x11,0x42,0x43,0x23,0x02,0xB3,0x19 + ] // pduArray PDU data - var PDU_MESSAGEBODY = 'hello'; - var PDU_RAWADDRESS = '+8610086'; - const PDU_SC_TIMESTAMP = 11950; + const PDU_MESSAGEBODY = '33'; + const PDU_SC_TIMESTAMP = 1627356274; + + /** Indicates the SMS message body. */ + // visibleMessageBody: '1'; + /** Indicates the address of the sender, which is to be displayed on the UI. */ + // visibleRawAddress: ''; + /** Indicates the SMS type. */ + // messageClass: sms.INSTANT_MESSAGE; + /** Indicates the protocol identifier. */ + // protocolId: 0; + /** Indicates the short message service center (SMSC) address. */ + // scAddress: ''; + /** Indicates the SMSC timestamp. */ + // scTimestamp: number; + /** Indicates whether the received SMS is a "replace short message". */ + // isReplaceMessage: false; + /** Indicates whether the received SMS contains "TP-Reply-Path". */ + // hasReplyPath: false; + /** Indicates Protocol Data Units (PDUs) from an SMS message. */ + // pdu: Array; + /** + * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the + * Short Message Service Center (SMSC). + */ + // status: 0; + /** Indicates whether the current message is SMS-STATUS-REPORT. */ + // isSmsStatusReportMessage: false; + var InstantPdu = [0x00,0x01,0x00,0x07,0x91,0x68,0x01,0x80,0xF6,0x00,0x19,0x02,0x00,0x31] + // pduArray PDU data + const INSTANT_PDU_MESSAGEBODY = '1'; + + /** Indicates the SMS message body. */ + // visibleMessageBody: '1'; + /** Indicates the address of the sender, which is to be displayed on the UI. */ + // visibleRawAddress: ''; + /** Indicates the SMS type. */ + // messageClass: sms.OPTIONAL_MESSAGE; + /** Indicates the protocol identifier. */ + // protocolId: 0; + /** Indicates the short message service center (SMSC) address. */ + // scAddress: ''; + /** Indicates the SMSC timestamp. */ + // scTimestamp: number; + /** Indicates whether the received SMS is a "replace short message". */ + // isReplaceMessage: false; + /** Indicates whether the received SMS contains "TP-Reply-Path". */ + // hasReplyPath: false; + /** Indicates Protocol Data Units (PDUs) from an SMS message. */ + // pdu: Array; + /** + * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the + * Short Message Service Center (SMSC). + */ + // status: 0; + /** Indicates whether the current message is SMS-STATUS-REPORT. */ + // isSmsStatusReportMessage: false; + var OptionalPdu = [0x00,0x01,0x00,0x07,0x91,0x68,0x01,0x80,0xF6,0x00,0x1A,0x02,0x00,0x31] + // pduArray PDU data + const OPTIONAL_PDU_MESSAGEBODY = '1'; + /* * @tc.number Telephony_SmsMms_createMessage_Async_0100 @@ -62,10 +170,10 @@ describe('SmsMmsCreateTest', function () { return; } expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue(); - expect(shortMessage.visibleRawAddress === RAWADDRESS).assertTrue(); + expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue(); expect(shortMessage.protocolId === 0).assertTrue(); - expect(shortMessage.scAddress === SC_ADDRESS).assertTrue(); + expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue(); expect(shortMessage.isReplaceMessage).assertFalse(); expect(shortMessage.hasReplyPath).assertFalse(); @@ -113,7 +221,7 @@ describe('SmsMmsCreateTest', function () { return; } expect(shortMessage.visibleMessageBody === PDU_MESSAGEBODY).assertTrue(); - expect(shortMessage.visibleRawAddress === PDU_RAWADDRESS).assertTrue(); + expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue(); expect(shortMessage.protocolId === 0).assertTrue(); expect(shortMessage.scAddress.length === 0).assertTrue(); @@ -128,6 +236,68 @@ describe('SmsMmsCreateTest', function () { }); }); + /* + * @tc.number Telephony_SmsMms_createMessage_Async_0900 + * @tc.name Call interface CreateMessage, + * pass in the PDU(InstantPdu) in line with the coding specification, the specification is 3GPP, + * shortMessage Don't empty, message Class is INSTANT_MESSAGE + * @tc.desc Function test + */ + it('Telephony_SmsMms_createMessage_Async_0900', 0, async function (done) { + sms.createMessage(InstantPdu, '3gpp', (err, shortMessage) => { + if (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_createMessage_Async_0100 fail'); + done(); + return; + } + expect(shortMessage.visibleMessageBody === INSTANT_PDU_MESSAGEBODY).assertTrue(); + expect(shortMessage.visibleRawAddress.length === 0).assertTrue(); + expect(shortMessage.messageClass === sms.INSTANT_MESSAGE).assertTrue(); + expect(shortMessage.protocolId === 0).assertTrue(); + expect(shortMessage.scAddress.length === 0).assertTrue(); + expect(shortMessage.scTimestamp !== undefined).assertTrue(); + expect(shortMessage.isReplaceMessage).assertFalse(); + expect(shortMessage.hasReplyPath).assertFalse(); + expect(shortMessage.pdu.length > 0).assertTrue(); + expect(shortMessage.status === 0).assertTrue(); + expect(shortMessage.isSmsStatusReportMessage).assertFalse(); + console.log('Telephony_SmsMms_createMessage_Async_0900 finish'); + done(); + }); + }); + + /* + * @tc.number Telephony_SmsMms_createMessage_Async_1000 + * @tc.name Call interface CreateMessage, + * pass in the PDU(OptionalPdu) in line with the coding specification, the specification is 3GPP, + * shortMessage Don't empty, message Class is OPTIONAL_MESSAGE + * @tc.desc Function test + */ + it('Telephony_SmsMms_createMessage_Async_1000', 0, async function (done) { + sms.createMessage(OptionalPdu, '3gpp', (err, shortMessage) => { + if (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_createMessage_Async_0100 fail'); + done(); + return; + } + expect(shortMessage.visibleMessageBody === OPTIONAL_PDU_MESSAGEBODY).assertTrue(); + expect(shortMessage.visibleRawAddress.length === 0).assertTrue(); + expect(shortMessage.messageClass === sms.OPTIONAL_MESSAGE).assertTrue(); + expect(shortMessage.protocolId === 0).assertTrue(); + expect(shortMessage.scAddress.length === 0).assertTrue(); + expect(shortMessage.scTimestamp !== undefined).assertTrue(); + expect(shortMessage.isReplaceMessage).assertFalse(); + expect(shortMessage.hasReplyPath).assertFalse(); + expect(shortMessage.pdu.length > 0).assertTrue(); + expect(shortMessage.status === 0).assertTrue(); + expect(shortMessage.isSmsStatusReportMessage).assertFalse(); + console.log('Telephony_SmsMms_createMessage_Async_1000 finish'); + done(); + }); + }); + /* * @tc.number Telephony_SmsMms_createMessage_Promise_0100 * @tc.name Call interface CreateMessage, @@ -139,10 +309,10 @@ describe('SmsMmsCreateTest', function () { try { var promise = await sms.createMessage(rawArray, '3gpp'); expect(promise.visibleMessageBody === MESSAGEBODY).assertTrue(); - expect(promise.visibleRawAddress === RAWADDRESS).assertTrue(); + expect(promise.visibleRawAddress.length === ADDR_LENGTH).assertTrue(); expect(promise.messageClass === sms.FORWARD_MESSAGE).assertTrue(); expect(promise.protocolId === 0).assertTrue(); - expect(promise.scAddress === SC_ADDRESS).assertTrue(); + expect(promise.scAddress.length === ADDR_LENGTH).assertTrue(); expect(promise.scTimestamp === SC_TIMESTAMP).assertTrue(); expect(promise.isReplaceMessage).assertFalse(); expect(promise.hasReplyPath).assertFalse(); @@ -188,11 +358,11 @@ describe('SmsMmsCreateTest', function () { try { var promise = await sms.createMessage(pduArray, '3gpp'); expect(promise.visibleMessageBody === PDU_MESSAGEBODY).assertTrue(); - expect(promise.visibleRawAddress === PDU_RAWADDRESS).assertTrue(); + expect(promise.visibleRawAddress.length === ADDR_LENGTH).assertTrue(); expect(promise.messageClass === sms.FORWARD_MESSAGE).assertTrue(); expect(promise.protocolId === 0).assertTrue(); expect(promise.scAddress.length === 0).assertTrue(); - expect(promise.scTimestamp === PDU_SC_TIMESTAMP).assertTrue(); + expect(promise.scTimestamp === PDU_SC_TIMESTAMP ).assertTrue(); expect(promise.isReplaceMessage).assertFalse(); expect(promise.hasReplyPath).assertFalse(); expect(promise.pdu.length > 0).assertTrue(); @@ -206,4 +376,64 @@ describe('SmsMmsCreateTest', function () { done(); } }); + + /* + * @tc.number Telephony_SmsMms_createMessage_Promise_0900 + * @tc.name Call interface CreateMessage, + * pass in the PDU(pduArray) in line with the coding specification, the specification is 3GPP, + * promise returns the result Don't empty, message Class is INSTANT_MESSAGE + * @tc.desc Function test + */ + it('Telephony_SmsMms_createMessage_Promise_0900', 0, async function (done) { + try { + var promise = await sms.createMessage(InstantPdu, '3gpp'); + expect(promise.visibleMessageBody === INSTANT_PDU_MESSAGEBODY).assertTrue(); + expect(promise.visibleRawAddress.length === 0).assertTrue(); + expect(promise.messageClass === sms.INSTANT_MESSAGE).assertTrue(); + expect(promise.protocolId === 0).assertTrue(); + expect(promise.scAddress.length === 0).assertTrue(); + expect(promise.scTimestamp !== undefined ).assertTrue(); + expect(promise.isReplaceMessage).assertFalse(); + expect(promise.hasReplyPath).assertFalse(); + expect(promise.pdu.length > 0).assertTrue(); + expect(promise.status === 0).assertTrue(); + expect(promise.isSmsStatusReportMessage).assertFalse(); + console.log('Telephony_SmsMms_createMessage_Promise_0900 finish'); + done(); + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_createMessage_Promise_0900 fail'); + done(); + } + }); + + /* + * @tc.number Telephony_SmsMms_createMessage_Promise_1000 + * @tc.name Call interface CreateMessage, + * pass in the PDU(pduArray) in line with the coding specification, the specification is 3GPP, + * promise returns the result Don't empty, message Class is OPTIONAL_MESSAGE + * @tc.desc Function test + */ + it('Telephony_SmsMms_createMessage_Promise_1000', 0, async function (done) { + try { + var promise = await sms.createMessage(OptionalPdu, '3gpp'); + expect(promise.visibleMessageBody === OPTIONAL_PDU_MESSAGEBODY).assertTrue(); + expect(promise.visibleRawAddress.length === 0).assertTrue(); + expect(promise.messageClass === sms.OPTIONAL_MESSAGE).assertTrue(); + expect(promise.protocolId === 0).assertTrue(); + expect(promise.scAddress.length === 0).assertTrue(); + expect(promise.scTimestamp !== undefined ).assertTrue(); + expect(promise.isReplaceMessage).assertFalse(); + expect(promise.hasReplyPath).assertFalse(); + expect(promise.pdu.length > 0).assertTrue(); + expect(promise.status === 0).assertTrue(); + expect(promise.isSmsStatusReportMessage).assertFalse(); + console.log('Telephony_SmsMms_createMessage_Promise_1000 finish'); + done(); + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_createMessage_Promise_1000 fail'); + done(); + } + }); }); \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_del_sim/entry/src/main/js/test/SmsMmsDelSim.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_del_sim/entry/src/main/js/test/SmsMmsDelSim.test.js index 647318786..8a9b10d1d 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_del_sim/entry/src/main/js/test/SmsMmsDelSim.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_del_sim/entry/src/main/js/test/SmsMmsDelSim.test.js @@ -26,6 +26,7 @@ import { describe('SmsMmsDelTest', function () { const TRUE_SLOT_ID = 0; const FALSE_SLOT_ID = 9; + //PDU code data that meets specifications for testing const CORRECT_SMS_PDU = '01000F9168683106019196F400080A00680065006C006C006F'; beforeAll(async function () { @@ -66,7 +67,7 @@ describe('SmsMmsDelTest', function () { slotId: TRUE_SLOT_ID, smsc: '', pdu: CORRECT_SMS_PDU, - status: sms.MESSAGE_HAS_BEEN_SENT + status: sms.SIM_MESSAGE_STATUS_SENT }; sms.addSimMessage(data, (adderr) => { if (adderr) { @@ -159,6 +160,7 @@ describe('SmsMmsDelTest', function () { * @tc.desc Function test */ it('Telephony_SmsMms_delSimMessage_Async_0400', 0, async function (done) { + //This value is the maximum for this type let addIndex = 0xffffffff; sms.delSimMessage(TRUE_SLOT_ID, addIndex, (delerr) => { if (delerr) { @@ -183,7 +185,7 @@ describe('SmsMmsDelTest', function () { slotId: TRUE_SLOT_ID, smsc: '', pdu: CORRECT_SMS_PDU, - status: sms.MESSAGE_HAS_BEEN_SENT + status: sms.SIM_MESSAGE_STATUS_SENT }; try { await sms.addSimMessage(data); @@ -276,6 +278,7 @@ describe('SmsMmsDelTest', function () { * @tc.desc Function test */ it('Telephony_SmsMms_delSimMessage_Promise_0400', 0, async function (done) { + //This value is the maximum for this type let addIndex = 0xffffffff; try { await sms.delSimMessage(TRUE_SLOT_ID, addIndex); diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_function/entry/src/main/js/test/SmsMmsFunction.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_function/entry/src/main/js/test/SmsMmsFunction.test.js index 8905f4783..10299fff9 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_function/entry/src/main/js/test/SmsMmsFunction.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_function/entry/src/main/js/test/SmsMmsFunction.test.js @@ -80,6 +80,7 @@ describe('SmsMmsTest', function () { content: 'hello', sendCallback: (err, value) => { if (err) { + expect().assertFail(); console.log('Telephony_SmsMms_sendMessage_0200 fail'); done(); return; @@ -106,6 +107,7 @@ describe('SmsMmsTest', function () { content: '11111', sendCallback: (err, value) => { if (err) { + expect().assertFail(); console.log('Telephony_SmsMms_sendMessage_0300 fail'); done(); return; @@ -132,6 +134,7 @@ describe('SmsMmsTest', function () { content: '', sendCallback: (err, value) => { if (err) { + expect().assertFail(); console.log('Telephony_SmsMms_sendMessage_0400 fail'); done(); return; @@ -152,9 +155,9 @@ describe('SmsMmsTest', function () { * @tc.desc Function test */ it('Telephony_SmsMms_sendMessage_0500', 0, async function (done) { - const count = MAX_TEST; + const COUNT = MAX_TEST; let str = ''; - for (let index = 0;index < count;index++) { + for (let index = 0;index < COUNT;index++) { str += 't'; } sms.sendMessage({ @@ -194,9 +197,9 @@ describe('SmsMmsTest', function () { * @tc.desc Function test */ it('Telephony_SmsMms_sendMessage_0600', 0, async function (done) { - const count = MAX_TEST + 1; + const COUNT = MAX_TEST + 1; let str = ''; - for (let index = 0;index < count;index++) { + for (let index = 0;index < COUNT;index++) { str += 't'; } sms.sendMessage({ @@ -370,7 +373,6 @@ describe('SmsMmsTest', function () { }, deliveryCallback: (err, value) => { if (err) { - console.log('deliveryCallback err'); expect().assertFail(); console.log('Telephony_SmsMms_sendMessage_1000 deliveryCallback fail'); done(); @@ -410,7 +412,6 @@ describe('SmsMmsTest', function () { }, deliveryCallback: (err, value) => { if (err) { - console.log('deliveryCallback err'); expect().assertFail(); console.log('Telephony_SmsMms_sendMessage_1100 deliveryCallback fail'); done(); diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_get_all/entry/src/main/js/test/SmsMmsGetAll.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_get_all/entry/src/main/js/test/SmsMmsGetAll.test.js index 84c00aa76..7bc662fb4 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_get_all/entry/src/main/js/test/SmsMmsGetAll.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_get_all/entry/src/main/js/test/SmsMmsGetAll.test.js @@ -26,6 +26,7 @@ import { describe('SmsMmsGetAllTest', function () { const TRUE_SLOT_ID = 0; const FALSE_SLOT_ID = 9; + //PDU code data that meets specifications for testing const CORRECT_SMS_PDU = '01000F9168683106019196F400080A00680065006C006C006F'; const PDU_LENGTH = 50; const INTERCEPT_POINT_PLUS = 20; @@ -99,6 +100,7 @@ describe('SmsMmsGetAllTest', function () { done(); return; } + expect(getresult.length > 0).assertTrue(); let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, PDU_LENGTH); let isAdd = (addOfPdu === CORRECT_SMS_PDU && getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT); @@ -171,6 +173,7 @@ describe('SmsMmsGetAllTest', function () { } try { let promiseGet = await sms.getAllSimMessages(TRUE_SLOT_ID); + expect(promiseGet.length > 0).assertTrue(); let addOfPdu = interceptionPdu(promiseGet[0].shortMessage.pdu, PDU_LENGTH); let isAdd = (addOfPdu === CORRECT_SMS_PDU && promiseGet[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT); diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/BUILD.gn b/telephony/telephonyjstest/sms_mms/sms_mms_radio/BUILD.gn new file mode 100644 index 000000000..e119ed53e --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("SmsMmsConfig") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "SmsMmsConfig" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/Test.json b/telephony/telephonyjstest/sms_mms/sms_mms_radio/Test.json new file mode 100644 index 000000000..6b6f4c2cb --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for sms_mms demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "240000", + "package": "com.ohos.smsmms", + "shell-timeout": "240000", + "native-test-timeout":"240000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/config.json b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/config.json new file mode 100644 index 000000000..049a30f90 --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.ohos.smsmms", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.smsmms", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.ohos.smsmms.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/app.js b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/app.js new file mode 100644 index 000000000..e423f4bce --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 000000000..e63c70d97 --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 000000000..de6ee5748 --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 000000000..6fda79275 --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 000000000..f64b040a5 --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..f16c40ec1 --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import { + Core, + ExpectExtend +} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish!') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.timeout = 60000 + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() {}, +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 000000000..2f9470d82 --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{Baxrkd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h2f!aV=cHAhi_E_mfUth(sM4^hJq7B zQsGWqdZUm9S%F`$nQ*_#NcuD`&)Ek%_s{&^78{9Hm ztri&rYLOxgFdG>O@+XHy z9#;|&vBCPXH5Mon^I`jSuR$&~ZWtyB67ujzFSj!51>#C}C17~TffQ{c-!QFQkTQ%! zIR^b1`zHx|*1GU?tbBx23weFLz5H?y_Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y { + setTimeout(() => { + reslove(); + }, timeout); + }) + } + + async function turnOnRadio() { + let isOn = await radio.isRadioOn(); + if (!isOn) { + await radio.turnOnRadio(); + console.log('Telephony_NetworkSearch_DeviceInformation turnOnRadio success'); + await sleep(TIME_RADIO_TURNON); + } + } + + beforeAll(async function () { + await turnOnRadio(); + }); + + afterAll(async function () { + await turnOnRadio(); + }); + + /* + * @tc.number Telephony_SmsMms_sendMessage_1700 + * @tc.name When Radio switch is turned off, sending SMS fails + * @tc.desc Function test + */ + it('Telephony_SmsMms_sendMessage_1700', 0, async function (done) { + await radio.turnOffRadio(); + sms.sendMessage({ + slotId: TRUE_SLOT_ID, + destinationHost: SMS_SEND_DST_NUMBER, + content: 'hello', + sendCallback: (err, value) => { + if (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_sendMessage_1700 sendCallback fail'); + done(); + return; + } + console.log(`Telephony_SmsMms_sendMessage_1700 sendCallback success sendResult = ${value.result}`); + expect(value.result === sms.SEND_SMS_FAILURE_RADIO_OFF).assertTrue(); + console.log('Telephony_SmsMms_sendMessage_1700 sendCallback finish'); + done(); + }, + deliveryCallback: (err, value) => {} + }); + }); +}); \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..a9c511780 --- /dev/null +++ b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "sms_mms" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/sms_mms/sms_mms_radio/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MB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3o*TS?TZJ`NS^NF2%HMkyS{?uJ$`!P4_L^ z1`NFDUbNyg_qREifgktnp1_v{Jbb`7m}2PTyUdOmtJj~m z9bB=ecw4_^rw1IW=of+>nrW5=d3k`3qHCxsIN_F{T1A545};;+fsyC&qChi+YV zr~M63H8ZLCPYmsjY>ls9cL%I)F|JIW-#+48$+lD4k*(P*kDM%zx_fvu4u5ZYUnI}5 zdrycFq>xFU)&X3p@pP2u%$o}}YcRn(MhJ&B2o?KS@cIVz>Ye%o^xV?CB{_Qhu z;}_q1bvO^g{8<3!gYbo4Di{8qzV+(9 zdlmksohQmRTs@qB;(Wo?dER_ux6XQb@q$tQPW?CMu6GVQd;R=iR;-S{Kr%Zks7>b1 zNs{|-+jhObYE}NR&`TGGr^h^4bjh%c>R#@=8nM&Md>_a+zVulsl;){flFekV1t9ob z+SqfV_Pv3$2f)bQ8%Ul2>fdYR^1zs0BQF~olsOj5AodC&Q_7SMFzsz2 z9newxE&jodk~tNHwl%LBMMDbrk=(^b literal 0 HcmV?d00001 diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_smsc/entry/src/main/js/test/SmsMmsSmsc.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_smsc/entry/src/main/js/test/SmsMmsSmsc.test.js index 31d92a7d9..de1862eaf 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_smsc/entry/src/main/js/test/SmsMmsSmsc.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_smsc/entry/src/main/js/test/SmsMmsSmsc.test.js @@ -27,20 +27,20 @@ describe('SmsMmsSmscTest', function () { const TRUE_SLOT_ID = 0; const FALSE_SLOT_ID = 9; - const OTHER_SMSC_NUMBER = '+8613800755500'; - const USABLE_SMSC_NUMBER = '+8613800512500'; + const OTHER_SMSC_NUMBER = '+8613800755***'; + const USABLE_SMSC_NUMBER = '+8613800512***'; - var DATA_SCADDR = ''; + var dataScAddr = ''; beforeAll(async function () { sms.getSmscAddr(TRUE_SLOT_ID, (geterr, getresult) => { if (geterr) { return; } - DATA_SCADDR = getresult + dataScAddr = getresult; }); }); - beforeEach(async function () { - sms.setSmscAddr(TRUE_SLOT_ID, DATA_SCADDR, (err) => {}); + afterEach(async function () { + sms.setSmscAddr(TRUE_SLOT_ID, dataScAddr, (err) => {}); }); /** @@ -132,8 +132,8 @@ describe('SmsMmsSmscTest', function () { } expect(getresult === beforeAddr).assertTrue(); console.log('Telephony_SmsMms_setSmscAddr_Async_0300 finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -213,8 +213,8 @@ describe('SmsMmsSmscTest', function () { expect(getresult === beforeAddr).assertTrue(); console.log(`setSmscAddr result = ${getresult}`); console.log('Telephony_SmsMms_setSmscAddr_Async_0500 finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -252,8 +252,8 @@ describe('SmsMmsSmscTest', function () { expect(getresult === beforeAddr).assertTrue(); console.log(`setSmscAddr result = ${getresult}`); console.log('Telephony_SmsMms_setSmscAddr_Async_0600 finish'); + done(); }); - done(); return; } console.log('Telephony_SmsMms_setSmscAddr_Async_0600 setSmscAddr fail '); @@ -291,8 +291,8 @@ describe('SmsMmsSmscTest', function () { expect(getresult === beforeAddr).assertTrue(); console.log(`setSmscAddr result = ${getresult}`); console.log('Telephony_SmsMms_setSmscAddr_Async_0700 finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -330,8 +330,8 @@ describe('SmsMmsSmscTest', function () { expect(getresult === beforeAddr).assertTrue(); console.log(`setSmscAddr result = ${getresult}`); console.log('Telephony_SmsMms_setSmscAddr_Async_0800 finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -369,8 +369,8 @@ describe('SmsMmsSmscTest', function () { expect(getresult === beforeAddr).assertTrue(); console.log(`setSmscAddr result = ${getresult}`); console.log('Telephony_SmsMms_setSmscAddr_Async_0900 finish'); + done(); }); - done(); return; } expect().assertFail(); diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_updata_asy/entry/src/main/js/test/SmsMmsUpdataAsy.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_updata_asy/entry/src/main/js/test/SmsMmsUpdataAsy.test.js index fed68a4ae..20f2e5165 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_updata_asy/entry/src/main/js/test/SmsMmsUpdataAsy.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_updata_asy/entry/src/main/js/test/SmsMmsUpdataAsy.test.js @@ -26,13 +26,15 @@ import { describe('SmsMmsUpdataTest', function () { const TRUE_SLOT_ID = 0; const FALSE_SLOT_ID = 9; + //PDU code data that meets specifications for testing const CORRECT_SMS_PDU = '01000F9168683106019196F400080A00680065006C006C006F'; const RECEIVE_SMS_PDU = '240D91689141468496F600001270721142432302B319'; const RECEIVE_OTHER_SMS_PDU = '240D91689141468496F600001270721174322302B91C'; + const OTHER_SMS_PDU = '010005910180F6000806003100320033'; + // The PDU corresponding to the length is CORRECT_SMS_PDU,RECEIVE_SMS_PDU,RECEIVE_OTHER_SMS_PDU,OTHER_SMS_PDU + var pduLength = [50, 44, 44, 32]; - // The PDU corresponding to the length is CORRECT_SMS_PDU,RECEIVE_SMS_PDU,RECEIVE_OTHER_SMS_PDU - var pduLength = [50, 44, 44]; - + //Default length of the encoded SMS center service address const INTERCEPT_POINT_PLUS = 20; beforeAll(async function () { @@ -276,8 +278,8 @@ describe('SmsMmsUpdataTest', function () { } expect(getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_READ).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_0400 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -399,8 +401,8 @@ describe('SmsMmsUpdataTest', function () { } expect(getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNREAD).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_0600 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -461,8 +463,8 @@ describe('SmsMmsUpdataTest', function () { } expect(getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNREAD).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_0700 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -585,8 +587,8 @@ describe('SmsMmsUpdataTest', function () { } expect(getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_0900 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -647,8 +649,8 @@ describe('SmsMmsUpdataTest', function () { } expect(getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_SENT).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1000 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -771,8 +773,8 @@ describe('SmsMmsUpdataTest', function () { } expect(getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNSENT).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1200 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -833,8 +835,8 @@ describe('SmsMmsUpdataTest', function () { } expect(getresult[0].simMessageStatus === sms.SIM_MESSAGE_STATUS_UNSENT).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1300 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -896,8 +898,8 @@ describe('SmsMmsUpdataTest', function () { let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1400 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -959,8 +961,8 @@ describe('SmsMmsUpdataTest', function () { let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1500 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -1022,8 +1024,8 @@ describe('SmsMmsUpdataTest', function () { let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1600 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -1085,8 +1087,8 @@ describe('SmsMmsUpdataTest', function () { let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1700 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -1148,8 +1150,8 @@ describe('SmsMmsUpdataTest', function () { let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1800 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -1211,8 +1213,8 @@ describe('SmsMmsUpdataTest', function () { let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_1900 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -1275,8 +1277,8 @@ describe('SmsMmsUpdataTest', function () { let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_2000 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -1339,8 +1341,8 @@ describe('SmsMmsUpdataTest', function () { let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[2]); expect(addOfPdu === RECEIVE_OTHER_SMS_PDU).assertTrue(); console.log('Telephony_SmsMms_updateSimMessage_Async_2100 getAllSimMessages cur finish'); + done(); }); - done(); return; } expect().assertFail(); @@ -1350,4 +1352,134 @@ describe('SmsMmsUpdataTest', function () { }); }); }); + + /** + * @tc.number Telephony_SmsMms_updateSimMessage_Async_2200 + * @tc.name The SMS status does not change,The STATUS of the SMS message is send, + * The pdu of the sent type is changed to another PDU that meets the conditions. The update succeeds + * @tc.desc Function test + */ + it('Telephony_SmsMms_updateSimMessage_Async_2200', 0, async function (done) { + let data = { + slotId: TRUE_SLOT_ID, + smsc: '', + pdu: OTHER_SMS_PDU, + status: sms.SIM_MESSAGE_STATUS_SENT + }; + let addIndex = 0; + let upDataPdu = CORRECT_SMS_PDU; + let upData = { + slotId: TRUE_SLOT_ID, + msgIndex: addIndex, + newStatus: sms.SIM_MESSAGE_STATUS_SENT, + pdu: upDataPdu, + smsc: '' + }; + sms.addSimMessage(data, (adderr) => { + if (adderr) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2200 add fail'); + done(); + return; + } + console.log('Telephony_SmsMms_updateSimMessage_Async_2200 finish add result '); + sms.getAllSimMessages(TRUE_SLOT_ID, (err, result) => { + if (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2200 get fail'); + done(); + return; + } + addIndex = result[0].indexOnSim; + console.log('Telephony_SmsMms_updateSimMessage_Async_2200 getAllSimMessages finish'); + sms.updateSimMessage(upData, (updataerr) => { + if (updataerr) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2200 update fail'); + done(); + return; + } + console.log('Telephony_SmsMms_updateSimMessage_Async_2200 update finish result '); + sms.getAllSimMessages(TRUE_SLOT_ID, (geterr, getresult) => { + if (geterr) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2200 fail'); + done(); + return; + } + let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[0]); + expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2200 getAllSimMessages cur finish'); + done(); + }); + }); + }); + }); + }); + + /** + * @tc.number Telephony_SmsMms_updateSimMessage_Async_2300 + * @tc.name The SMS status does not change,The status of the SMS message is read, + * The PDU of the read type is changed to another PDU that meets the conditions. + * The update is successful + * @tc.desc Function test + */ + it('Telephony_SmsMms_updateSimMessage_Async_2300', 0, async function (done) { + let data = { + slotId: TRUE_SLOT_ID, + smsc: '', + pdu: RECEIVE_SMS_PDU, + status: sms.SIM_MESSAGE_STATUS_READ + }; + let addIndex = 0; + let upDataPdu = RECEIVE_OTHER_SMS_PDU; + let upData = { + slotId: TRUE_SLOT_ID, + msgIndex: addIndex, + newStatus: sms.SIM_MESSAGE_STATUS_READ, + pdu: upDataPdu, + smsc: '' + }; + sms.addSimMessage(data, (adderr) => { + if (adderr) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2300 add fail'); + done(); + return; + } + console.log('Telephony_SmsMms_updateSimMessage_Async_2300 finish add result '); + sms.getAllSimMessages(TRUE_SLOT_ID, (err, result) => { + if (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2300 get fail'); + done(); + return; + } + addIndex = result[0].indexOnSim; + console.log('Telephony_SmsMms_updateSimMessage_Async_2300 getAllSimMessages finish'); + sms.updateSimMessage(upData, (updataerr) => { + if (updataerr) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2300 update fail'); + done(); + return; + } + console.log('Telephony_SmsMms_updateSimMessage_Async_2300 update finish result '); + sms.getAllSimMessages(TRUE_SLOT_ID, (geterr, getresult) => { + if (geterr) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2300 fail'); + done(); + return; + } + let addOfPdu = interceptionPdu(getresult[0].shortMessage.pdu, pduLength[2]); + expect(addOfPdu === RECEIVE_OTHER_SMS_PDU).assertTrue(); + console.log('Telephony_SmsMms_updateSimMessage_Async_2300 getAllSimMessages cur finish'); + done(); + }); + }); + }); + }); + }); + }); \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_updata_pro/entry/src/main/js/test/SmsMmsUpdataPro.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_updata_pro/entry/src/main/js/test/SmsMmsUpdataPro.test.js index 2655a97bb..f40edbed6 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_updata_pro/entry/src/main/js/test/SmsMmsUpdataPro.test.js +++ b/telephony/telephonyjstest/sms_mms/sms_mms_updata_pro/entry/src/main/js/test/SmsMmsUpdataPro.test.js @@ -26,13 +26,14 @@ import { describe('SmsMmsUpdataTest', function () { const TRUE_SLOT_ID = 0; const FALSE_SLOT_ID = 9; + //PDU code data that meets specifications for testing const CORRECT_SMS_PDU = '01000F9168683106019196F400080A00680065006C006C006F'; const RECEIVE_SMS_PDU = '240D91689141468496F600001270721142432302B319'; const RECEIVE_OTHER_SMS_PDU = '240D91689141468496F600001270721174322302B91C'; - - // The PDU corresponding to the length is CORRECT_SMS_PDU,RECEIVE_SMS_PDU,RECEIVE_OTHER_SMS_PDU - var pduLength = [50, 44, 44]; - + const OTHER_SMS_PDU = '010005910180F6000806003100320033'; + //The PDU corresponding to the length is CORRECT_SMS_PDU,RECEIVE_SMS_PDU,RECEIVE_OTHER_SMS_PDU,OTHER_SMS_PDU + var pduLength = [50, 44, 44, 32]; + //Default length of the encoded SMS center service address const INTERCEPT_POINT_PLUS = 20; beforeAll(async function () { @@ -1362,4 +1363,134 @@ describe('SmsMmsUpdataTest', function () { done(); } }); + + /** + * @tc.number Telephony_SmsMms_updateSimMessage_Async_2200 + * @tc.name The SMS status does not change,The STATUS of the SMS message is send, + * The pdu of the sent type is changed to another PDU that meets the conditions.The update succeeds + * @tc.desc Function test + */ + it('Telephony_SmsMms_updateSimMessage_Promise_2200', 0, async function (done) { + let beforeSmsRecord = []; + let data = { + slotId: TRUE_SLOT_ID, + smsc: '', + pdu: OTHER_SMS_PDU, + status: sms.SIM_MESSAGE_STATUS_SENT + }; + let addIndex = 0; + try { + await sms.addSimMessage(data); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2200 addSimMessage finish'); + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2200 add fail'); + done(); + return; + } + try { + beforeSmsRecord = await sms.getAllSimMessages(TRUE_SLOT_ID); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2200 getAllSimMessages before finish'); + addIndex = beforeSmsRecord[0].indexOnSim; + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2200 get fail'); + done(); + return; + } + let upDataPdu = CORRECT_SMS_PDU; + let upData = { + slotId: TRUE_SLOT_ID, + msgIndex: addIndex, + newStatus: sms.SIM_MESSAGE_STATUS_SENT, + pdu: upDataPdu, + smsc: '' + }; + try { + await sms.updateSimMessage(upData); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2200 promiseUpdata finish'); + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2200 add fail'); + done(); + return; + } + try { + let promise = await sms.getAllSimMessages(TRUE_SLOT_ID); + let addOfPdu = interceptionPdu(promise[0].shortMessage.pdu, pduLength[0]); + expect(addOfPdu === CORRECT_SMS_PDU).assertTrue(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2200 getAllSimMessages cur finish'); + done(); + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2200 fail'); + done(); + } + }); + + /** + * @tc.number Telephony_SmsMms_updateSimMessage_Async_2300 + * @tc.name The SMS status does not change,The status of the SMS message is read, + * The PDU of the read type is changed to another PDU that meets the conditions. + * The update is successful + * @tc.desc Function test + */ + it('Telephony_SmsMms_updateSimMessage_Promise_2300', 0, async function (done) { + let beforeSmsRecord = []; + let data = { + slotId: TRUE_SLOT_ID, + smsc: '', + pdu: RECEIVE_SMS_PDU, + status: sms.SIM_MESSAGE_STATUS_READ + }; + let addIndex = 0; + try { + await sms.addSimMessage(data); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2300 addSimMessage finish'); + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2300 add fail'); + done(); + return; + } + try { + beforeSmsRecord = await sms.getAllSimMessages(TRUE_SLOT_ID); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2300 getAllSimMessages before finish'); + addIndex = beforeSmsRecord[0].indexOnSim; + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2300 get fail'); + done(); + return; + } + let upDataPdu = RECEIVE_OTHER_SMS_PDU; + let upData = { + slotId: TRUE_SLOT_ID, + msgIndex: addIndex, + newStatus: sms.SIM_MESSAGE_STATUS_READ, + pdu: upDataPdu, + smsc: '' + }; + try { + await sms.updateSimMessage(upData); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2300 promiseUpdata finish'); + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2300 add fail'); + done(); + return; + } + try { + let promise = await sms.getAllSimMessages(TRUE_SLOT_ID); + let addOfPdu = interceptionPdu(promise[0].shortMessage.pdu, pduLength[2]); + expect(addOfPdu === RECEIVE_OTHER_SMS_PDU).assertTrue(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2300 getAllSimMessages cur finish'); + done(); + } catch (err) { + expect().assertFail(); + console.log('Telephony_SmsMms_updateSimMessage_Promise_2300 fail'); + done(); + } + }); + }); \ No newline at end of file -- GitLab