diff --git a/telephony/BUILD.gn b/telephony/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..5e26b4ee7aaabdfa7fb778d939d82d29c1f5e5d4
--- /dev/null
+++ b/telephony/BUILD.gn
@@ -0,0 +1,17 @@
+# 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.
+
+group("telephony") {
+ testonly = true
+ deps = [ "telephonyjstest:telephonyjstest" ]
+}
diff --git a/telephony/telephonyjstest/BUILD.gn b/telephony/telephonyjstest/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..97520ef460d2295aaf9703107c00a1745168ae41
--- /dev/null
+++ b/telephony/telephonyjstest/BUILD.gn
@@ -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.
+
+group("telephonyjstest") {
+ testonly = true
+ deps = [
+ "call_manager:call_manager",
+ "cellular_data:cellular_data",
+ "network_search:network_search",
+ "sim:sim",
+ "sms_mms:sms_mms",
+ ]
+}
diff --git a/telephony/telephonyjstest/call_manager/BUILD.gn b/telephony/telephonyjstest/call_manager/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..afa53e6cee41b46e5081cd34f2bbac05e4451715
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/BUILD.gn
@@ -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.
+
+import("//test/xts/tools/build/suite.gni")
+
+group("call_manager") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "call_manager_ims2_call:ActsCallManagerIms2CallTest" ]
+ }
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/BUILD.gn b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..235315030f64c759e42575ff2e3e7af9a5cd100e
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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("ActsCallManagerIms2CallTest") {
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsCallManagerIms2CallTest"
+}
+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/call_manager/call_manager_ims2_call/Test.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..d56e2bcbc2740078b51825118db4f2db106dc99a
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/Test.json
@@ -0,0 +1,19 @@
+{
+ "description": "Configuration for ActsCallManagerIms2CallTest Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "1200000",
+ "package": "com.ohos.actscallmanagerims2calltest",
+ "shell-timeout": "1200000",
+ "native-test-timeout":"1200000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "$module.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/config.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..7cb5a2b6ffa4681fdffbd05f7569e9bf4c630b04
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/config.json
@@ -0,0 +1,61 @@
+{
+ "app": {
+ "bundleName": "com.ohos.actscallmanagerims2calltest",
+ "vendor": "ohos",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.ohos.actscallmanagerims2calltest",
+ "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.actscallmanagerims2calltest.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/call_manager/call_manager_ims2_call/entry/src/main/js/default/app.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..f6cc8926d94f6e4c3803ae8a7be2f5f08c0f78b5
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b9bce0e76ce9e71aa4690cc9fc57117d8f48bb7
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,48 @@
+/*
+ * 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() {
+ },
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..2f9470d82c49675a64972657d8d367cd95e51c63
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..49b30290edbe89814c2e1d73eeca668c4fa6c18a
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js
@@ -0,0 +1,2157 @@
+/**
+ * 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 call from '@ohos.telephony.call';
+import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
+import {
+ AUTO_ACCEPT_NUMBER,
+ AUTO_ACCEPT_NUMBER2,
+ PHONE_NUMBER_LENGTH_11,
+ CALL_STATUS_DIALING,
+ CALL_ID_NOT_EXIST,
+ CALL_STATE_UNKNOWN,
+ CALL_STATE_IDLE,
+ DEFAULT_SLOT_ID,
+ CALL_MODE_IMS,
+ SLOT_ID_INVALID,
+ PHONE_LIST2,
+ RTT_MSG,
+ CALL_MODE_SEND_RECEIVE,
+ POS_700,
+ POS_10,
+ POS_LENGTH_300,
+ POS_LENGTH_600,
+ DEVICE_EARPIECE,
+ BOUNDARY_NUMBER_INT,
+ SENT_STRING_C,
+ MINUS_VALUE,
+ PHONE_NUMBER_LONG,
+ NULL_PHONE_NUMBER,
+ DIAL_CARRIER_TYPE,
+ DIAL_SCENCE_CALL_PRIVILEGED,
+ MEDIA_TYPE_VOICE,
+ ROTATION_MINUS_1,
+ IMAGE_LOCAL_ERROR_PATH,
+ POS_Z_ERROR,
+ RESTRICTION_TYPE_ROAMING_INCOMING,
+ RESTRICTION_MODE_ACTIVATION,
+ RIGHT_PASSWORD,
+ RESTRICTION_TYPE_ALL_INCOMING,
+ TRANSFER_TYPE_NOT_REACHABLE,
+ TRANSFER_TYPE_UNCONDITIONAL,
+ PHONE_NUMBER_AREA_LAND,
+ CALL_TRANSFER_DISABLE,
+ TRANSFER_TYPE_NO_REPLY,
+ COMMAND_CALL_ERROR4,
+ COMMAND_CALL_ERROR,
+ CARMER_ID_NOT_EXIT,
+ ZOOM_RATIO_MINUS_1_0
+} from './lib/Const.js';
+import {toString} from './lib/ApiToPromise.js';
+import {
+ scenceInCalling,
+ hangupCall2,
+ hangupCall,
+ callDetailsChangeOn,
+ callId as gloabCallId,
+ reachState,
+ callDetailsChangeOff
+} from './lib/ScenceInCalling.js';
+const GETMAIN_CALLID_ERRO = -1;
+let callId = null;
+describe('CallManageImsCall', function () {
+ beforeAll(async function (done) {
+ callDetailsChangeOn();
+ try {
+ await call.enableImsSwitch(DEFAULT_SLOT_ID);
+ console.log('Telephony_CallManager enableImsSwitch success');
+ await call.setCallPreferenceMode(DEFAULT_SLOT_ID, CALL_MODE_IMS);
+ console.log('Telephony_CallManager setCallPreferenceMode success');
+ } catch (error) {
+ console.log(`Telephony_CallManager setCallPreferenceMode or enableImsSwitch error,error:${
+ toString(error)}`);
+ }
+ done();
+ });
+
+ afterEach(async function () {
+ try {
+ let callState = await call.getCallState();
+ console.log(`Telephony_CallManager callState ${callState} ${gloabCallId}`);
+ if (callState === CALL_STATE_UNKNOWN || callState === CALL_STATE_IDLE) {
+ return;
+ }
+ if (gloabCallId) {
+ let data = await hangupCall('Telephony_CallManager', gloabCallId);
+ console.log(`Telephony_CallManager hangupCall success ${toString(data)}`);
+ }
+ } catch (error) {
+ console.log('Telephony_CallManager hangupCall or getCallState error');
+ }
+ });
+
+ afterAll(function () {
+ callDetailsChangeOff();
+ console.log('Telephony_CallManager all 54 case is over for callmanager CallManageImsCall');
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_combineConference_Async_0100
+ * @tc.name Run the function combineConference by args callId CALL_ID_NOT_EXIST by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_combineConference_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_combineConference_Async_0100';
+ call.combineConference(CALL_ID_NOT_EXIST, (error, data) => {
+ if (error) {
+ console.log(`${caseName} combineConference ${CALL_ID_NOT_EXIST} error,case success,error:${
+ toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} combineConference success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_combineConference_Promise_0100
+ * @tc.name Run the function combineConference by args callId CALL_ID_NOT_EXIST by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_combineConference_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_combineConference_Promise_0100';
+ call.combineConference(CALL_ID_NOT_EXIST).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} combineConference success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} combineConference ${CALL_ID_NOT_EXIST} error,case success,error:${
+ toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_separateConference_Async_0100
+ * @tc.name Run the function separateConference by args callId CALL_ID_NOT_EXIST by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_separateConference_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_separateConference_Async_0100';
+ call.separateConference(CALL_ID_NOT_EXIST, (error, data) => {
+ if (error) {
+ console.log(`${caseName} separateConference ${CALL_ID_NOT_EXIST} error,case success,error:${
+ toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} separateConference success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_separateConference_Promise_0100
+ * @tc.name Run the function separateConference by args callId CALL_ID_NOT_EXIST by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_separateConference_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_separateConference_Promise_0100';
+ call.separateConference(CALL_ID_NOT_EXIST).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} separateConference success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} separateConference ${CALL_ID_NOT_EXIST} error,case success,error:${
+ toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_joinConference_Async_0100
+ * @tc.name Run the function joinConference by args mainCallId CALL_ID_NOT_EXIST,
+ * callNumberList PHONE_LIST2 by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_joinConference_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_joinConference_Async_0100';
+ call.joinConference(CALL_ID_NOT_EXIST, PHONE_LIST2, (error, data) => {
+ if (error) {
+ console.log(`${caseName} joinConference ${CALL_ID_NOT_EXIST} error,case success,error:${
+ toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} joinConference success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_joinConference_Promise_0100
+ * @tc.name Run the function joinConference by args mainCallId CALL_ID_NOT_EXIST,
+ * callNumberList PHONE_LIST2 by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_joinConference_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_joinConference_Promise_0100';
+ call.joinConference(CALL_ID_NOT_EXIST, PHONE_LIST2).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} joinConference success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} joinConference ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400
+ * @tc.name Run the function enableLteEnhanceMode by args slotId SLOT_ID_INVALID,
+ * by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400';
+ call.enableLteEnhanceMode(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} enableLteEnhanceMode error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} enableLteEnhanceMode success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400
+ * @tc.name Run the function enableLteEnhanceMode by args slotId SLOT_ID_INVALID by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400';
+ call.enableLteEnhanceMode(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} enableLteEnhanceMode success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} enableLteEnhanceMode error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400
+ * @tc.name Run the function disableLteEnhanceMode by args slotId SLOT_ID_INVALID,
+ * by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400';
+ call.disableLteEnhanceMode(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} disableLteEnhanceMode error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} disableLteEnhanceMode success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400
+ * @tc.name Run the function disableLteEnhanceMode by args slotId SLOT_ID_INVALID by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400';
+ call.disableLteEnhanceMode(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} disableLteEnhanceMode success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} disableLteEnhanceMode error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400
+ * @tc.name Run the function isLteEnhanceModeEnabled by args slotId SLOT_ID_INVALID by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400';
+ call.isLteEnhanceModeEnabled(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} isLteEnhanceModeEnabled error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} isLteEnhanceModeEnabled success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400
+ * @tc.name Run the function isLteEnhanceModeEnabled by args slotId SLOT_ID_INVALID by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400';
+ call.isLteEnhanceModeEnabled(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} isLteEnhanceModeEnabled success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} isLteEnhanceModeEnabled error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_startRTT_Async_0200
+ * @tc.name Run function startRTT by args callId CALL_ID_NOT_EXIST,msg RTT_MSG by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_startRTT_Async_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_startRTT_Async_0200';
+ call.startRTT(CALL_ID_NOT_EXIST, RTT_MSG, (error, data) => {
+ if (error) {
+ console.log(`${caseName} startRTT ${callId} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} startRTT success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_startRTT_Promise_0200
+ * @tc.name Run function startRTT by args callId CALL_ID_NOT_EXIST,msg RTT_MSG by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_startRTT_Promise_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_startRTT_Promise_0200';
+ call.startRTT(CALL_ID_NOT_EXIST, RTT_MSG).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} startRTT success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} startRTT ${callId} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_stopRTT_Async_0200
+ * @tc.name Run function stopRTT by args callId CALL_ID_NOT_EXIST by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_stopRTT_Async_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_stopRTT_Async_0200';
+ call.stopRTT(CALL_ID_NOT_EXIST, (error, data) => {
+ if (error) {
+ console.log(`${caseName} stopRTT ${callId} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} stopRTT success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_stopRTT_Promise_0200
+ * @tc.name Run function stopRTT by args callId CALL_ID_NOT_EXIST by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_stopRTT_Promise_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_stopRTT_Promise_0200';
+ call.stopRTT(CALL_ID_NOT_EXIST).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} stopRTT success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} stopRTT ${callId} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_updateImsCallMode_Async_0700
+ * @tc.name Run function updateImsCallMode by args callId CALL_ID_NOT_EXIST,
+ * mode CALL_MODE_SEND_RECEIVE by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_updateImsCallMode_Async_0700', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_IMS_updateImsCallMode_Async_0700';
+ call.updateImsCallMode(CALL_ID_NOT_EXIST, CALL_MODE_SEND_RECEIVE, (error, data) => {
+ if (error) {
+ console.log(`${caseName} updateImsCallMode2 error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} updateImsCallMode2 success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_updateImsCallMode_Promise_0700
+ * @tc.name Run function updateImsCallMode by args callId CALL_ID_NOT_EXIST,
+ * mode CALL_MODE_SEND_RECEIVE by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_updateImsCallMode_Promise_0700', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_IMS_updateImsCallMode_Promise_0700';
+ call.updateImsCallMode(CALL_ID_NOT_EXIST, CALL_MODE_SEND_RECEIVE).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} updateImsCallMode success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} updateImsCallMode error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_holdCall_Async_0100
+ * @tc.name Run the function holdCall by args callId CALL_ID_NOT_EXIST by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_holdCall_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_holdCall_Async_0100';
+ call.holdCall(CALL_ID_NOT_EXIST, (error, data) => {
+ if (error) {
+ console.log(`${caseName} holdCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} holdCall success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_holdCall_Promise_0100
+ * @tc.name Run the function holdCall by args callId CALL_ID_NOT_EXIST by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_holdCall_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_holdCall_Promise_0100';
+ call.holdCall(CALL_ID_NOT_EXIST).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} holdCall success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} holdCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_unHoldCall_Async_0100
+ * @tc.name Run the function unHoldCall by args callId CALL_ID_NOT_EXIST by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_unHoldCall_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_unHoldCall_Async_0100';
+ call.unHoldCall(CALL_ID_NOT_EXIST, (error, data) => {
+ if (error) {
+ console.log(`${caseName} unHoldCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} unHoldCall success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_unHoldCall_Promise_0100
+ * @tc.name Run the function unHoldCall by args callId CALL_ID_NOT_EXIST by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_unHoldCall_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_unHoldCall_Promise_0100';
+ call.unHoldCall(CALL_ID_NOT_EXIST).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} unHoldCall success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} unHoldCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_switchCall_Async_0100
+ * @tc.name Run the function switchCall by args callId CALL_ID_NOT_EXIST by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_switchCall_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_switchCall_Async_0100';
+ call.switchCall(CALL_ID_NOT_EXIST, (error, data) => {
+ if (error) {
+ console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_switchCall_Promise_0100
+ * @tc.name Run the function switchCall by args callId CALL_ID_NOT_EXIST by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_switchCall_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_switchCall_Promise_0100';
+ call.switchCall(CALL_ID_NOT_EXIST).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} switchCall ${CALL_ID_NOT_EXIST} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_USSD_dial_Async_0600
+ * @tc.name Run the function dial by args phoneNumber COMMAND_CALL_ERROR options
+ * {accountId:DEFAULT_SLOT_ID,videoState:MEDIA_TYPE_VOICE,dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
+ * dialType:DIAL_CARRIER_TYPE} by callback,the function return true
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_USSD_dial_Async_0600', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_USSD_dial_Async_0600';
+ call.dial(COMMAND_CALL_ERROR, {accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
+ dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE}, (error, data) => {
+ if (error) {
+ expect().assertFail();
+ console.log(`${caseName} dial error,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect(data).assertTrue();
+ console.log(`${caseName} dial success,case ${data === true ? 'success' :
+ 'failed'},data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_USSD_dial_Promise_0600
+ * @tc.name Run the function dial by args phoneNumber COMMAND_CALL_ERROR4 options
+ * {accountId:DEFAULT_SLOT_ID,videoState:MEDIA_TYPE_VOICE,dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
+ * dialType:DIAL_CARRIER_TYPE} by promise,the function return true
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_USSD_dial_Promise_0600', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_USSD_dial_Promise_0600';
+ call.dial(COMMAND_CALL_ERROR4, {accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
+ dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE}).then(data => {
+ expect(data).assertTrue();
+ console.log(`${caseName} dial success,case ${data === true ? 'success' : 'failed'},data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ expect().assertFail();
+ console.log(`${caseName} dial error,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_enableImsSwitch_Async_0400
+ * @tc.name Run the function enableImsSwitch by args callId SLOT_ID_INVALID by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_enableImsSwitch_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_enableImsSwitch_Async_0400';
+ call.enableImsSwitch(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} enableImsSwitch error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} enableImsSwitch success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_enableImsSwitch_Promise_0400
+ * @tc.name Run the function enableImsSwitch by args callId SLOT_ID_INVALID by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_enableImsSwitch_Promise_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_enableImsSwitch_Promise_0400';
+ call.enableImsSwitch(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} enableImsSwitch success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} enableImsSwitch error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_disableImsSwitch_Async_0600
+ * @tc.name Run the function disableImsSwitch by args callId SLOT_ID_INVALID by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_disableImsSwitch_Async_0600', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_disableImsSwitch_Async_0600';
+ call.disableImsSwitch(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} disableImsSwitch error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} disableImsSwitch success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_disableImsSwitch_Promise_0600
+ * @tc.name Run the function disableImsSwitch by args callId SLOT_ID_INVALID by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_disableImsSwitch_Promise_0600', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_disableImsSwitch_Promise_0600';
+ call.disableImsSwitch(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} disableImsSwitch success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} disableImsSwitch error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_isImsSwitchEnabled_Async_0500
+ * @tc.name Run the function isImsSwitchEnabled by args callId SLOT_ID_INVALID by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_isImsSwitchEnabled_Async_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_isImsSwitchEnabled_Async_0500';
+ call.isImsSwitchEnabled(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} isImsSwitchEnabled error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} isImsSwitchEnabled success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_isImsSwitchEnabled_Promise_0500
+ * @tc.name Run the function isImsSwitchEnabled by args callId SLOT_ID_INVALID by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_isImsSwitchEnabled_Promise_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_isImsSwitchEnabled_Promise_0500';
+ call.isImsSwitchEnabled(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} isImsSwitchEnabled success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} isImsSwitchEnabled error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_setCallTransfer_Async_1300
+ * @tc.name Run function setCallTransfer by args slotId SLOT_ID_INVALID,settingType CALL_TRANSFER_DISABLE,
+ * type TRANSFER_TYPE_NO_REPLY,transferNum PHONE_NUMBER_LENGTH_11 by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_setCallTransfer_Async_1300', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_IMS_setCallTransfer_Async_1300';
+ call.setCallTransfer(SLOT_ID_INVALID, {
+ settingType:CALL_TRANSFER_DISABLE,
+ type:TRANSFER_TYPE_NO_REPLY,
+ transferNum:PHONE_NUMBER_LENGTH_11
+ }, (error, data) => {
+ if (error) {
+ console.log(`${caseName} case success, error:${toString(error)}`);
+ done();
+ return;
+ }
+ console.log(`${caseName} case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_setCallTransfer_Promise_1300
+ * @tc.name Run function setCallTransfer by args slotId SLOT_ID_INVALID,settingType CALL_TRANSFER_DISABLE,
+ * type TRANSFER_TYPE_UNCONDITIONAL,transferNum PHONE_NUMBER_AREA_LAND by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_setCallTransfer_Promise_1300', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_IMS_setCallTransfer_Promise_1300';
+ try {
+ let data = await call.setCallTransfer(SLOT_ID_INVALID, {
+ settingType:CALL_TRANSFER_DISABLE,
+ type:TRANSFER_TYPE_UNCONDITIONAL,
+ transferNum:PHONE_NUMBER_AREA_LAND
+ });
+ console.log(`${caseName} case failed,data:${toString(data)}`);
+ expect().assertFail();
+ } catch (err) {
+ console.log(`${caseName} case success, err:${toString(err)}`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_getCallTransferInfo_Async_1500
+ * @tc.name Run function getCallTransferInfo by args slotId SLOT_ID_INVALID,
+ * type TRANSFER_TYPE_UNCONDITIONAL by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_getCallTransferInfo_Async_1500', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_IMS_getCallTransferInfo_Async_1500';
+ call.getCallTransferInfo(SLOT_ID_INVALID, TRANSFER_TYPE_UNCONDITIONAL, (error, data) => {
+ if (error) {
+ console.log(`${caseName} getCallTransferInfo error, case success. error:${toString(error)}`);
+ done();
+ return;
+ }
+ console.log(`${caseName} getCallTransferInfo success,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_getCallTransferInfo_Promise_1500
+ * @tc.name Run function getCallTransferInfo by args slotId SLOT_ID_INVALID,
+ * type TRANSFER_TYPE_NOT_REACHABLE by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_getCallTransferInfo_Promise_1500', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_IMS_getCallTransferInfo_Promise_1500';
+ try {
+ var data = await call.getCallTransferInfo(SLOT_ID_INVALID, TRANSFER_TYPE_NOT_REACHABLE);
+ console.log(`${caseName} case failed,data:${toString(data)}`);
+ expect().assertFail();
+ } catch (err) {
+ console.log(`${caseName} case success. error:${toString(err)}`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_setCallWaiting_Async_0700
+ * @tc.name Run the function setCallWaiting by args slotId SLOT_ID_INVALID activate true by callback to open,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_setCallWaiting_Async_0700', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_setCallWaiting_Async_0700';
+ call.setCallWaiting(SLOT_ID_INVALID, true, (error, data) => {
+ if (error) {
+ console.log(`${caseName} setCallWaiting error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} setCallWaiting success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_setCallWaiting_Promise_0700
+ * @tc.name Run the function setCallWaiting by args slotId SLOT_ID_INVALID activate true by promise to open,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_setCallWaiting_Promise_0700', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_setCallWaiting_Promise_0700';
+ call.setCallWaiting(SLOT_ID_INVALID, true).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} setCallWaiting success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} setCallWaiting error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_setCallRestriction_Async_1200
+ * @tc.name Run function setCallRestriction by callback
+ * by arg slotId SLOT_ID_INVALID type RESTRICTION_TYPE_ALL_INCOMING password RIGHT_PASSWORD
+ * mode RESTRICTION_MODE_ACTIVATION,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_setCallRestriction_Async_1200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_setCallRestriction_Async_1200';
+ call.setCallRestriction(SLOT_ID_INVALID, {
+ type:RESTRICTION_TYPE_ALL_INCOMING,
+ password:RIGHT_PASSWORD,
+ mode:RESTRICTION_MODE_ACTIVATION
+ }, (error, data) => {
+ if (error) {
+ console.log(`${caseName} success,case ${error ? 'success' : 'failed'},error:${toString(error)}`);
+ expect(!!error).assertTrue();
+ done();
+ return;
+ }
+ console.log(`${caseName} error,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_setCallRestriction_Promise_1200
+ * @tc.name Run function setCallRestriction by promise
+ * by arg slotId SLOT_ID_INVALID type RESTRICTION_TYPE_ALL_INCOMING password RIGHT_PASSWORD
+ * mode RESTRICTION_MODE_ACTIVATION,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_setCallRestriction_Promise_1200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_setCallRestriction_Promise_1200';
+ call.setCallRestriction(SLOT_ID_INVALID, {
+ type:RESTRICTION_TYPE_ALL_INCOMING,
+ password:RIGHT_PASSWORD,
+ mode:RESTRICTION_MODE_ACTIVATION
+ })
+ .then(data => {
+ console.log(`${caseName} error,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ })
+ .catch((error) => {
+ console.log(`${caseName} success,case ${error ? 'success' : 'failed'},error:${toString(error)}`);
+ expect(!!error).assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_getCallRestrictionStatus_Async_1100
+ * @tc.name Run function getCallRestrictionStatus by callback by arg slotId
+ * that is SLOT_ID_INVALID CallRestrictionType RESTRICTION_TYPE_ROAMING_INCOMING ,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_getCallRestrictionStatus_Async_1100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_getCallRestrictionStatus_Async_1100';
+ call.getCallRestrictionStatus(SLOT_ID_INVALID, RESTRICTION_TYPE_ROAMING_INCOMING, (error, data) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ console.log(`${caseName} success,case faild,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_getCallRestrictionStatus_Promise_1100
+ * @tc.name Run function getCallRestrictionStatus by promise by arg slotId (that is at SLOT_ID_INVALID)
+ * CallRestrictionType RESTRICTION_TYPE_ROAMING_INCOMING ,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_getCallRestrictionStatus_Promise_1100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_getCallRestrictionStatus_Promise_1100';
+ call.getCallRestrictionStatus(SLOT_ID_INVALID, RESTRICTION_TYPE_ROAMING_INCOMING)
+ .then(data => {
+ console.log(`${caseName} success,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ })
+ .catch(error => {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_getCallWaitingStatus_Async_0500
+ * @tc.name Run the function getCallWaitingStatus by args slotId SLOT_ID_INVALID by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_getCallWaitingStatus_Async_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_getCallWaitingStatus_Async_0500';
+ call.getCallWaitingStatus(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} getCallWaitingStatus error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} getCallWaitingStatus success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_getCallWaitingStatus_Promise_0500
+ * @tc.name Run the function getCallWaitingStatus by args slotId SLOT_ID_INVALID by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_getCallWaitingStatus_Promise_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_getCallWaitingStatus_Promise_0500';
+ call.getCallWaitingStatus(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} getCallWaitingStatus success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} getCallWaitingStatus error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_controlCamera_Async_0200
+ * @tc.name Dial a call and after answering the call,run function controlCamera by
+ * args cameraId CARMER_ID_NOT_EXIT by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_controlCamera_Async_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_controlCamera_Async_0200';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER2,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ let cameraId = CARMER_ID_NOT_EXIT;
+ call.controlCamera(cameraId, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} case failed`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_controlCamera_Promise_0200
+ * @tc.name Dial a call and after answering the call,run function controlCamera by args cameraId
+ * CARMER_ID_NOT_EXIT by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_controlCamera_Promise_0200', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_controlCamera_Promise_0200';
+ let cameraId = CARMER_ID_NOT_EXIT;
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER2,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ await call.controlCamera(cameraId);
+ console.log(`${caseName} case failed`);
+ expect().assertFail();
+ } catch (err) {
+ console.log(`${caseName} case success. error:${toString(err)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setPreviewWindow_Async_0300
+ * @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
+ * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setPreviewWindow_Async_0300', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setPreviewWindow_Async_0300';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
+ call.setPreviewWindow(info, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} case faild`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setPreviewWindow_Promise_0300
+ * @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
+ * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setPreviewWindow_Promise_0300', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setPreviewWindow_Promise_0300';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
+ await call.setPreviewWindow(info);
+ console.log(`${caseName} case faild`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setDisplayWindow_Async_0300
+ * @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
+ * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setDisplayWindow_Async_0300', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setDisplayWindow_Async_0300';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
+ await call.setDisplayWindow(info);
+ console.log(`${caseName} case faild`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setDisplayWindow_Promise_0300
+ * @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
+ * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setDisplayWindow_Promise_0300', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setDisplayWindow_Promise_0300';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
+ await call.setDisplayWindow(info);
+ console.log(`${caseName} case faild`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setCameraZoom_Async_0400
+ * @tc.name Dial a call and after answering the call,run function setCameraZoom by args
+ * zoomRatio ZOOM_RATIO_MINUS_1_0 by callback,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setCameraZoom_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setCameraZoom_Async_0400';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER2,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ call.setCameraZoom(ZOOM_RATIO_MINUS_1_0, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} case failed`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setCameraZoom_Promise_0400
+ * @tc.name Dial a call and after answering the call,run function setCameraZoom by args
+ * zoomRatio ZOOM_RATIO_MINUS_1_0 by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setCameraZoom_Promise_0400', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setCameraZoom_Promise_0400';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ await call.setCameraZoom(ZOOM_RATIO_MINUS_1_0);
+ console.log(`${caseName} case failed`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setPausePicture_Async_0500
+ * @tc.name Dial a call and after answering the call,run function setPausePicture by args
+ * path IMAGE_LOCAL_ERROR_PATH by callback,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setPausePicture_Async_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setPausePicture_Async_0500';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ call.setPausePicture(IMAGE_LOCAL_ERROR_PATH, (error) => {
+ if (error) {
+ console.log(`${caseName} case success,error:${toString(error)}`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} success,case failed`);
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setPausePicture_Promise_0500
+ * @tc.name Dial a call and after answering the call,run function setPausePicture
+ * by args path IMAGE_LOCAL_ERROR_PATH by promise,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setPausePicture_Promise_0500', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setPausePicture_Promise_0500';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ await call.setPausePicture(IMAGE_LOCAL_ERROR_PATH);
+ console.log(`${caseName} success,case failed`);
+ } catch (error) {
+ console.log(`${caseName} case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setDeviceDirection_Async_0500
+ * @tc.name Dial a call and after answering the call,run function setDeviceDirection
+ * by args rotation ROTATION_MINUS_1 by callback,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setDeviceDirection_Async_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setDeviceDirection_Async_0500';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ call.setDeviceDirection(ROTATION_MINUS_1, (error) => {
+ if (error) {
+ console.log(`${caseName} success, case success`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} error,case failed,error:${toString(error)}`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setDeviceDirection_Promise_0500
+ * @tc.name Dial a call and after answering the call,run function setDeviceDirection
+ * by args rotation ROTATION_MINUS_1 by promise,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setDeviceDirection_Promise_0500', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setDeviceDirection_Promise_0500';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER2,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ await call.setDeviceDirection(ROTATION_MINUS_1);
+ console.log(`${caseName} success,case error`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_dial_Async_0600
+ * @tc.name Dial a call by function dial by args phoneNumber NULL_PHONE_NUMBER options
+ * {accountId: DEFAULT_SLOT_ID, videoState: MEDIA_TYPE_VOICE, dialScene: DIAL_SCENCE_CALL_PRIVILEGED,
+ * dialType:DIAL_CARRIER_TYPE} by callback,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_dial_Async_0600', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_dial_Async_0600';
+ let flag = true;
+ reachState(caseName, CALL_STATUS_DIALING, '', false).then(data => {
+ callId = data.callId;
+ console.log(`${caseName} reachState success,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ }).catch(error => {
+ console.log(`${caseName} reachState error,case ${flag ? 'success' : 'failed'},error:${toString(error)}`);
+ expect(flag).assertTrue();
+ done();
+ });
+ let obj = {accountId: DEFAULT_SLOT_ID, videoState: MEDIA_TYPE_VOICE,
+ dialScene: DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_CARRIER_TYPE};
+ call.dial(NULL_PHONE_NUMBER, obj, (error, data) => {
+ if (error) {
+ console.log(`${caseName} dial error,error:${toString(error)}`);
+ flag = true;
+ return;
+ }
+ flag = false;
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_dial_Promise_0100
+ * @tc.name Dial a call by function dial by args phoneNumber PHONE_NUMBER_LONG by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_dial_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_dial_Promise_0100';
+ let flag = true;
+ reachState(caseName, CALL_STATUS_DIALING, '', false).then(data => {
+ callId = data.callId;
+ console.log(`${caseName} reachState success,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ }).catch(error => {
+ console.log(`${caseName} reachState error,case ${flag ? 'success' : 'failed'},error:${toString(error)}`);
+ expect(flag).assertTrue();
+ done();
+ });
+ call.dial(PHONE_NUMBER_LONG).then(data => {
+ flag = false;
+ }).catch(error => {
+ console.log(`${caseName} dial error,error:${toString(error)}`);
+ flag = true;
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_answer_Async_0100
+ * @tc.name Run function answer by args callId BOUNDARY_NUMBER_INT by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_answer_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_answer_Async_0100';
+ call.answer(BOUNDARY_NUMBER_INT, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} success,case failed`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_answer_Promise_0100
+ * @tc.name Run function answer by args callId CALL_ID_NOT_EXIST by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_answer_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_answer_Promise_0100';
+ call.answer(CALL_ID_NOT_EXIST).then(() => {
+ expect().assertFail();
+ console.log(`${caseName} success,case failed`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_reject_Async_0100
+ * @tc.name Run function reject by args callId BOUNDARY_NUMBER_INT by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_reject_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_reject_Async_0100';
+ call.reject(BOUNDARY_NUMBER_INT, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} success,case failed`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_reject_Promise_0100
+ * @tc.name Run function reject by args callId CALL_ID_NOT_EXIST by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_reject_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_reject_Promise_0100';
+ call.reject(CALL_ID_NOT_EXIST).then(() => {
+ expect().assertFail();
+ console.log(`${caseName} success,case failed`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_hangup_Async_0100
+ * @tc.name Run function hangup by args callId BOUNDARY_NUMBER_INT by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_hangup_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_hangup_Async_0100';
+ call.hangup(BOUNDARY_NUMBER_INT, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} success,case failed`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_hangup_Promise_0100
+ * @tc.name Run function hangup by args callId CALL_ID_NOT_EXIST by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_hangup_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_hangup_Promise_0100';
+ call.hangup(CALL_ID_NOT_EXIST).then(() => {
+ expect().assertFail();
+ console.log(`${caseName} success,case failed`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_startDTMF_Async_1300
+ * @tc.name Run function startDTMF by args callId MINUS_VALUE character C by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_startDTMF_Async_1300', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_startDTMF_Async_1300';
+ call.startDTMF(MINUS_VALUE, SENT_STRING_C, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} success,case failed`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_startDTMF_Promise_1300
+ * @tc.name Dial a call by function dial by args phoneNumber PHONE_NUMBER_LENGTH_11 when before being accepted,
+ * run function startDTMF by args callId BOUNDARY_NUMBER_INT character C by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_startDTMF_Promise_1300', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_startDTMF_Promise_1300';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:PHONE_NUMBER_LENGTH_11,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ call.startDTMF(BOUNDARY_NUMBER_INT, SENT_STRING_C).then(data => {
+ console.log(`${caseName} success,case error,data:${toString(data)}`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ }).catch(error => {
+ console.log(`${caseName} case success`);
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_stopDTMF_Async_0100
+ * @tc.name Run function stopDTMF by args callId CALL_ID_NOT_EXIST by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_stopDTMF_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_stopDTMF_Async_0100';
+ call.stopDTMF(CALL_ID_NOT_EXIST, (error, data) => {
+ if (error) {
+ console.log(`${caseName} case success`);
+ done();
+ return;
+ }
+ console.log(`${caseName} success,case error,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_stopDTMF_Promise_0100
+ * @tc.name Run function stopDTMF by args callId BOUNDARY_NUMBER_INT by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_stopDTMF_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_stopDTMF_Promise_0100';
+ call.stopDTMF(BOUNDARY_NUMBER_INT).then(data => {
+ console.log(`${caseName} success,case error,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ }).catch(error => {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_muteRinger_Async_0100
+ * @tc.name Unwanted state,run function muteRinger by callback,the function return void
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_muteRinger_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_muteRinger_Async_0100';
+ call.muteRinger((error, data) => {
+ if (error) {
+ console.log(`${caseName} error,case failed,error:${toString(error)}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`${caseName} success,case success`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_muteRinger_Promise_0100
+ * @tc.name Unwanted state,run function muteRinger by promise,the function return void
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_muteRinger_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_muteRinger_Promise_0100';
+ call.muteRinger()
+ .then(data => {
+ console.log(`${caseName} success,case success`);
+ done();
+ })
+ .catch((error) => {
+ console.log(`${caseName} error,case failed,error:${toString(error)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setAudioDevice_Async_0500
+ * @tc.name Unwanted state,run function setAudioDevice by callback and by arg DEVICE_EARPIECE,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setAudioDevice_Async_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setAudioDevice_Async_0500';
+ call.setAudioDevice(DEVICE_EARPIECE, (error, data) => {
+ if (error) {
+ console.log(`${caseName} success,case ${error ? 'success' : 'failed'},error:${toString(error)}`);
+ expect(!!error).assertTrue();
+ done();
+ return;
+ }
+ console.log(`${caseName} error,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setAudioDevice_Promise_0500
+ * @tc.name Unwanted state,run function setAudioDevice by promise and by arg DEVICE_EARPIECE,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setAudioDevice_Promise_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setAudioDevice_Promise_0500';
+ call.setAudioDevice(DEVICE_EARPIECE)
+ .then(data => {
+ console.log(`${caseName} error,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ })
+ .catch(error => {
+ console.log(`${caseName} success,case ${error ? 'success' : 'failed'},error:${toString(error)}`);
+ expect(!!error).assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setMuted_Async_0300
+ * @tc.name Unwanted state,run function setMuted by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setMuted_Async_0300', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setMuted_Async_0300';
+ call.setMuted((error, data) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ expect(!!error).assertTrue();
+ done();
+ return;
+ }
+ console.log(`${caseName} success,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setMuted_Promise_0300
+ * @tc.name Unwanted state,run function setMuted by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setMuted_Promise_0300', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setMuted_Promise_0300';
+ call.setMuted()
+ .then(data => {
+ console.log(`${caseName} success,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ })
+ .catch(error => {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ expect(!!error).assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_cancelMuted_Async_0300
+ * @tc.name Unwanted state,run function cancelMuted by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_cancelMuted_Async_0300', 0, function (done) {
+ let caseName = 'Telephony_CallManager_cancelMuted_Async_0300';
+ call.cancelMuted((error, data) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ console.log(`${caseName} success,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_cancelMuted_Promise_0300
+ * @tc.name Unwanted state,run function cancelMuted by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_cancelMuted_Promise_0300', 0, function (done) {
+ let caseName = 'Telephony_CallManager_cancelMuted_Promise_0300';
+ call.cancelMuted()
+ .then(data => {
+ console.log(`${caseName} success,case failed,data:${toString(data)}`);
+ expect().assertFail();
+ done();
+ })
+ .catch(error => {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isNewCallAllowed_Async_0200
+ * @tc.name Unwanted state ,run the function isNewCallAllowed by callback ,the function return true
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_isNewCallAllowed_Async_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_isNewCallAllowed_Async_0200';
+ call.isNewCallAllowed(function (error, data) {
+ if (error) {
+ console.log(`${caseName} error,case failed,error:${toString(error)}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`${caseName} success,case ${data === true ? 'success' : 'failed'},data:${toString(data)}`);
+ expect(data === true).assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isNewCallAllowed_Promise_0200
+ * @tc.name Unwanted state ,run the function isNewCallAllowed by promise ,the function return true
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_isNewCallAllowed_Promise_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_isNewCallAllowed_Promise_0200';
+ call.isNewCallAllowed()
+ .then(data => {
+ console.log(`${caseName} success,case ${data === true ? 'success' : 'failed'},data:${toString(data)}`);
+ expect(data === true).assertTrue();
+ done();
+ })
+ .catch(error => {
+ console.log(`${caseName} error,case failed,error:${toString(error)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isRinging_Async_0100
+ * @tc.name Unwanted state ,run the function isRinging by callback ,the function return false
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_isRinging_Async_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_isRinging_Async_0100';
+ call.isRinging(function (error, data) {
+ if (error) {
+ console.log(`${caseName} error,case failed,error:${toString(error)}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`${caseName} success,case ${data === false ? 'success' : 'failed'},data:${toString(data)}`);
+ expect(data === false).assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isRinging_Promise_0100
+ * @tc.name Unwanted state ,run the function isRinging by promise ,the function return false
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_isRinging_Promise_0100', 0, function (done) {
+ let caseName = 'Telephony_CallManager_isRinging_Promise_0100';
+ call.isRinging()
+ .then(data => {
+ console.log(`${caseName} success,case ${data === false ? 'success' : 'failed'},data:${toString(data)}`);
+ expect(data === false).assertTrue();
+ done();
+ })
+ .catch(error => {
+ console.log(`${caseName} error,case failed,error:${toString(error)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getCallState_Async_0100
+ * @tc.name To get the idle call status, call getCallState() to get the current call status.
+ * call.CALL_STATE_IDLE is returned
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getCallState_Async_0100', 0, async function (done) {
+ call.getCallState((err, data) => {
+ if (err) {
+ console.log(`Telephony_CallManager_getCallState_Async_0100 : err = ${err.message}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data === call.CALL_STATE_IDLE).assertTrue();
+ console.log(`Telephony_CallManager_getCallState_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getCallState_Promise_0100
+ * @tc.name To get the idle call status, call getCallState() to get the current call status.
+ * call.CALL_STATE_IDLE is returned
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getCallState_Promise_0100', 0, async function (done) {
+ try {
+ 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();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_hasCall_Async_0400
+ * @tc.name When idle, hasCall() is called to confirm that there is no current call,returning false
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_hasCall_Async_0400', 0, async function (done) {
+ 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_0400 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_hasCall_Promise_0400
+ * @tc.name When idle, hasCall() is called to confirm that there is no current call, returning false
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_hasCall_Promise_0400', 0, async function (done) {
+ try {
+ 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();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getSubCallIdList_Async_0100
+ * @tc.name If callId is 999, call getSubCallIdList() to get the call list of subcalls and return the empty list
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getSubCallIdList_Async_0100', 0, async function (done) {
+ call.getSubCallIdList(CALL_ID_NOT_EXIST, (err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log('Telephony_CallManager_getSubCallIdList_Async_0100 fail');
+ done();
+ return;
+ }
+ expect(data.length === 0).assertTrue();
+ console.log(`Telephony_CallManager_getSubCallIdList_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getSubCallIdList_Promise_0100
+ * @tc.name If callId is 999, call getSubCallIdList() to get the sub-call list
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getSubCallIdList_Promise_0100', 0, async function (done) {
+ try {
+ var data = await call.getSubCallIdList(CALL_ID_NOT_EXIST);
+ 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();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getCallIdListForConference_Async_0100
+ * @tc.name CallId for 999, the callback call getCallIdListForConference () to obtain a list all the phone call
+ * in the conference call, returns an empty list
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getCallIdListForConference_Async_0100', 0, async function (done) {
+ call.getCallIdListForConference(CALL_ID_NOT_EXIST, (err, data) => {
+ if (err) {
+ console.log('Telephony_CallManager_getCallIdListForConference_Async_0100 fail');
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data.length === 0).assertTrue();
+ console.log(`Telephony_CallManager_getCallIdListForConference_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getCallIdListForConference_Promise_0100
+ * @tc.name GetCallIdListForConference callId for 999, call () to obtain a list all the phone call in the
+ * conference call, returns an empty list
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getCallIdListForConference_Promise_0100', 0, async function (done) {
+ try {
+ var data = await call.getCallIdListForConference(CALL_ID_NOT_EXIST);
+ 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();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getMainCallId_Async_0100
+ * @tc.name If the mainCallId is 999, call getMainCallId() to get the call and return -1
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getMainCallId_Async_0100', 0, async function (done) {
+ call.getMainCallId(CALL_ID_NOT_EXIST, (err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log('Telephony_CallManager_getMainCallId_Async_0100 fail');
+ done();
+ return;
+ }
+ expect(data === GETMAIN_CALLID_ERRO).assertTrue();
+ console.log(`Telephony_CallManager_getMainCallId_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getMainCallId_Promise_0100
+ * @tc.name If mainCallId is 999, call getMainCallId() to get the call and return -1
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getMainCallId_Promise_0100', 0, async function (done) {
+ try {
+ var data = await call.getMainCallId(CALL_ID_NOT_EXIST);
+ 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 finish data = ${data}`);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0100
+ * @tc.name PhoneNumber is 100000000000. Call formatPhoneNumber() to format the number.
+ * The return value is 10 000 000 0000
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_formatPhoneNumber_Async_0100', 0, async function (done) {
+ call.formatPhoneNumber('100000000000', (err, data) => {
+ if (err) {
+ console.log(`Telephony_CallManager_formatPhoneNumber_Async_0100 err = ${err.message}`);
+ console.log('Telephony_CallManager_formatPhoneNumber_Async_0100 fail');
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data === '10 000 000 0000').assertTrue();
+ console.log(`Telephony_CallManager_formatPhoneNumber_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0100
+ * @tc.name PhoneNumber is 2000000. Call formatPhoneNumber() to format the number.
+ * The return value is 200 0000
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_formatPhoneNumber_Promise_0100', 0, async function (done) {
+ try {
+ 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();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0100
+ * @tc.name PhoneNumber is 010-0000-0000, options: CN, call formatPhoneNumberToE164() to format the number,
+ * and return +861000000000
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_formatPhoneNumberToE164_Async_0100', 0, async function (done) {
+ call.formatPhoneNumberToE164('010-0000-0000', 'CN', (err, data) => {
+ if (err) {
+ console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0100 fail');
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data === '+861000000000').assertTrue();
+ console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0100
+ * @tc.name PhoneNumber is 52300000000, options: CN, call formatPhoneNumberToE164() to format the number,
+ * return +8652300000000
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100', 0, async function (done) {
+ try {
+ 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();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1300
+ * @tc.name PhoneNumber: 110, 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_1300', 0, async function (done) {
+ call.isEmergencyPhoneNumber('110', {slotId: SLOT_ID_INVALID}, (err) => {
+ if (err) {
+ console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 finish err = ${err}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 fail ');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300
+ * @tc.name PhoneNumber: 120, 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_1300', 0, async function (done) {
+ try {
+ var data = await call.isEmergencyPhoneNumber('120', {slotId: SLOT_ID_INVALID});
+ expect().assertFail();
+ console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 fail ');
+ done();
+ } catch (err) {
+ console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 finish err = ${err}`);
+ done();
+ }
+ });
+
+});
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f4aa98ba23b41a34c9a959aeee40f5992019d6c0
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/**
+ * 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.
+ */
+ require('./CallManageAll.test.js');
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromise.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromise.js
new file mode 100644
index 0000000000000000000000000000000000000000..6b600564fdbb1d4d60842af99ba7e91d0af346ca
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromise.js
@@ -0,0 +1,40 @@
+/**
+ * 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 function toString (data) {
+ if (typeof data === 'object') {
+ return JSON.stringify(data);
+ } else {
+ return data;
+ }
+}
+
+export function promisify (fn) {
+ return function () {
+ let args = Array.prototype.slice.call(arguments);
+ return new Promise(function (resolve, reject) {
+ console.log(`Telephony_CallManager promisify args:${toString(arguments)},fn:${fn}`);
+ args.push(function (error, data) {
+ console.log(`Telephony_CallManager promisify error:${toString(error)},data:${toString(data)}`);
+ if (error) {
+ reject(error);
+ } else {
+ resolve(data);
+ }
+ });
+ fn.apply(null, args);
+ });
+ };
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromisePerfomance.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromisePerfomance.js
new file mode 100644
index 0000000000000000000000000000000000000000..5a56f755682cf2a3044420b18f85f3071d3475f5
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromisePerfomance.js
@@ -0,0 +1,139 @@
+
+/**
+ * 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_PERF_COUNT, PERF_GOAL_TIME} from './Const.js';
+import {toString} from './ApiToPromise.js';
+// packaging the function to the perfomace test function
+export async function apiToPromisePerfomace (options, args) {
+ // recursion plan
+ let {func, caseName, target, perfTime, compareFunc} = options;
+ let flag = true;
+ let count = TEST_PERF_COUNT;
+ perfTime = perfTime ? perfTime : PERF_GOAL_TIME;
+
+ console.log(`${caseName} apiToPromisePerfomace func ${func}, caseName ${caseName},args:${toString(args)}`);
+ function excuteCallbackPromise () {
+ return new Promise((resolve, reject) => {
+ function excuteCallback () {
+ target[func](...args);
+ }
+ args[args.length - 1] = function (error, data) {
+ if (count === 0) {
+ if (flag) {
+ resolve(flag);
+ } else {
+ reject(new Error(`flag:${flag}`));
+ }
+ } else {
+ flag = flag && !!compareFunc(error, data);
+ count--;
+ excuteCallback();
+ }
+ };
+ excuteCallback();
+ });
+ }
+
+ let startTime = new Date().getTime();
+ if (typeof args[args.length - 1] === 'function') {
+ try {
+ flag = await excuteCallbackPromise();
+ } catch (error) {
+ flag = false;
+ }
+ } else {
+ for (;count > 0;count--) {
+ let error = null;
+ let data = null;
+ try {
+ data = await target[func](...args);
+ flag = flag && !!compareFunc(error, data);
+ } catch (err) {
+ error = err;
+ flag = flag && !!compareFunc(error, data);
+ }
+ }
+ }
+ let endTime = new Date().getTime();
+ const cost = endTime - startTime;
+ console.log(`${caseName} ${func} result flag:${toString(flag)} count:${TEST_PERF_COUNT}` +
+ ` cost:${cost}ms avarage:${parseInt(cost * 1000 / TEST_PERF_COUNT)}`);
+ if (flag && cost < perfTime) {
+ return flag;
+ } else {
+ throw new Error(`flag:${flag}`);
+ }
+}
+
+export async function apiToPerfomace (options, args) {
+ // recursion plan
+ let {func, caseName, target, perfTime, compareFunc, runedFunc} = options;
+ let flag = true;
+ let count = TEST_PERF_COUNT;
+ perfTime = perfTime ? perfTime : PERF_GOAL_TIME;
+
+ console.log(`${caseName} apiToPerfomace func ${func}, caseName ${caseName},args:${toString(args)}`);
+ function excuteCallbackPromise () {
+ return new Promise((resolve, reject) => {
+ function excuteCallback () {
+ target[func](...args);
+ }
+ args[args.length - 1] = function (error, data) {
+ if (count === 0) {
+ if (flag) {
+ resolve(flag);
+ } else {
+ reject(new Error(`flag:${flag}`));
+ }
+ } else {
+ flag = flag && !!compareFunc(error, data);
+ count--;
+ excuteCallback();
+ }
+ };
+ excuteCallback();
+ });
+ }
+
+ let startTime = new Date().getTime();
+ if (typeof args[args.length - 1] === 'function') {
+ try {
+ flag = await excuteCallbackPromise();
+ } catch (error) {
+ flag = false;
+ }
+ } else {
+ for (;count > 0;count--) {
+ let error = null;
+ let data = null;
+ try {
+ data = await target[func](...args);
+ flag = flag && !!compareFunc(error, data);
+ } catch (err) {
+ error = err;
+ flag = flag && !!compareFunc(error, data);
+ }
+ }
+ }
+ let endTime = new Date().getTime();
+ const cost = endTime - startTime;
+ console.log(`${caseName} ${func} result flag:${toString(flag)} count:${TEST_PERF_COUNT}` +
+ ` cost:${cost}ms avarage:${parseInt(cost * 1000 / TEST_PERF_COUNT)}`);
+ runedFunc(flag && cost < perfTime);
+}
+export function validate (error, data, func) {
+ return func(error, data);
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromiseReliability.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromiseReliability.js
new file mode 100644
index 0000000000000000000000000000000000000000..3285b2ba62d5e2ef3a617289687265bdf232e714
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromiseReliability.js
@@ -0,0 +1,131 @@
+/**
+ * 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 {toString} from './ApiToPromise.js';
+import {TEST_RELY_NUMBER} from './Const.js';
+// packaging the function to the reliability test function
+export async function apiToPromiseReliability (options, args) {
+ // recursion plan
+ let {func, caseName, target, compareFunc} = options;
+ let flag = true;
+ let count = TEST_RELY_NUMBER;
+
+ console.log(`${caseName} apiToPromiseReliability func ${func}, caseName ${caseName},args:${toString(args)}`);
+ function excuteCallbackPromise () {
+ return new Promise((resolve, reject) => {
+ function excuteCallback () {
+ target[func](...args);
+ }
+ args[args.length - 1] = function (error, data) {
+ if (count === 0) {
+ if (flag) {
+ resolve(flag);
+ } else {
+ reject(new Error(`flag:${flag}`));
+ }
+ } else {
+ flag = flag && !!compareFunc(error, data);
+ count--;
+ excuteCallback();
+ }
+ };
+ excuteCallback();
+ });
+ }
+
+ if (typeof args[args.length - 1] === 'function') {
+ try {
+ flag = await excuteCallbackPromise();
+ } catch (error) {
+ flag = false;
+ }
+ } else {
+ for (;count > 0;count--) {
+ let error = null;
+ let data = null;
+ try {
+ data = await target[func](...args);
+ flag = flag && !!compareFunc(error, data);
+ } catch (err) {
+ error = err;
+ flag = flag && !!compareFunc(error, data);
+ }
+ }
+ }
+ console.log(`${caseName} result ${func} flag:${toString(flag)} count:${TEST_RELY_NUMBER}`);
+ if (flag) {
+ return flag;
+ } else {
+ throw new Error(`flag:${flag}`);
+ }
+}
+
+export async function apiToReliability (options, args) {
+ // recursion plan
+ let {func, caseName, target, compareFunc, runedFunc} = options;
+ let flag = true;
+ let count = TEST_RELY_NUMBER;
+
+ console.log(`${caseName} apiToPromiseReliability func ${func}, caseName ${caseName},args:${toString(args)}`);
+ function excuteCallbackPromise () {
+ return new Promise((resolve, reject) => {
+ function excuteCallback () {
+ target[func](...args);
+ }
+ args[args.length - 1] = function (error, data) {
+ console.log(`${caseName} error ${toString(error)} data ${toString(data)}`);
+ if (count === 0) {
+ if (flag) {
+ resolve(flag);
+ } else {
+ reject(new Error(`flag:${flag}`));
+ }
+ } else {
+ flag = flag && !!compareFunc(error, data);
+ count--;
+ console.log(`${caseName} error:${toString(error)},data:${toString(data)},` +
+ `flag:${flag},count:${count}`);
+ excuteCallback();
+ }
+ };
+ excuteCallback();
+ });
+ }
+
+ if (typeof args[args.length - 1] === 'function') {
+ try {
+ flag = await excuteCallbackPromise();
+ } catch (error) {
+ flag = false;
+ }
+ } else {
+ for (;count > 0;count--) {
+ let error = null;
+ let data = null;
+ try {
+ data = await target[func](...args);
+ flag = flag && !!compareFunc(error, data);
+ } catch (err) {
+ error = err;
+ flag = flag && !!compareFunc(error, data);
+ }
+ console.log(`${caseName} error:${toString(error)},data:${toString(data)},flag:${flag},count:${count}`);
+ }
+ }
+ console.log(`${caseName} result ${func} flag:${toString(flag)} count:${TEST_RELY_NUMBER}`);
+ runedFunc(flag);
+}
+
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/Const.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/Const.js
new file mode 100644
index 0000000000000000000000000000000000000000..b0e95d9c43a89a32f8d2739b6420270afc562b1a
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/Const.js
@@ -0,0 +1,229 @@
+/**
+ * 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 AUTO_ACCEPT_NUMBER = '17615117737';
+export const AUTO_ACCEPT_NUMBER = '10010';
+export const AUTO_ACCEPT_NUMBER2 = '10010';
+export const NOT_ACCEPT_NUMBER = '17160409240';
+export const PHONE_NUMBER_AREA_LAND = '089800000000';
+export const PHONE_NUMBER_LENGTH_8 = '86459751';
+
+export const PHONE_NUMBER_LENGTH_11 = '10000000001';
+export const PHONE_NUMBER_VOICE_MAIL = '12599';
+export const PHONE_NUMBER_LONG = '1234567890123456789012345678901234567890123' +
+ '4567890123456789012345678901234567890123456789012345678901';
+export const EMERGENCY_NUMBER = '112';
+export const RIGHT_PASSWORD = '000001';
+export const ERROR_PASSWORD = '1234567890123456789012345678901234567890123' +
+'4567890123456789012345678901234567890123456789012345678901';
+export const CALL_EMERGENCY = 2;
+export const PHONE_LIST = ['10000000001'];
+export const PHONE_LIST2 = ['10000000001', '10000000002'];
+export const NULL_PHONE_NUMBER = '';
+export const SPECIA_CHAR_NUMBER = '"=#$%^&*()+';
+export const PHONE_NUMBER_CHAR = 'abcdefghijk';
+export const BOUNDARY_NUMBER_INT = 2147483649;
+export const MINUS_BOUNDARY_NUMBER_INT = -2147483649;
+export const MINUS_VALUE = -100;
+export const TEST_RELY_NUMBER = 20; // test count for Reliability
+export const TEST_PERF_COUNT = 20; // test count for Perfomace
+export const PERF_GOAL_TIME = TEST_PERF_COUNT * 0.5;
+
+export const CALL_STATUS_ACTIVE = 0;
+export const CALL_STATUS_HOLDING = 1;
+export const CALL_STATUS_DIALING = 2;
+export const CALL_STATUS_ALERTING = 3;
+export const CALL_STATUS_INCOMING = 4;
+export const CALL_STATUS_WAITING = 5;
+export const CALL_STATUS_DISCONNECTED = 6;
+export const CALL_STATUS_DISCONNECTING = 7;
+export const CALL_STATUS_IDLE = 8;
+
+export const TEL_CONFERENCE_IDLE = 0;
+export const TEL_CONFERENCE_ACTIVE = 1;
+export const TEL_CONFERENCE_DISCONNECTING = 2;
+export const TEL_CONFERENCE_DISCONNECTED = 3;
+
+export const DEVICE_EARPIECE = 0;
+export const DEVICE_SPEAKER = 1;
+export const DEVICE_WIRED_HEADSET = 2;
+export const DEVICE_BLUETOOTH_SCO = 3;
+export const DEVICE_INVALID = -1;
+export const DEVICE_INVALID4 = 4;
+
+export const RESTRICTION_MODE_DEACTIVATION = 0;
+export const RESTRICTION_MODE_ACTIVATION = 1;
+export const RESTRICTION_MODE_INVALID = -1;
+export const RESTRICTION_MODE_INVALID2 = 2;
+
+export const RESTRICTION_DISABLE = 0;
+export const RESTRICTION_ENABLE = 1;
+
+export const RESTRICTION_TYPE_ALL_INCOMING = 0;
+export const RESTRICTION_TYPE_ALL_OUTGOING = 1;
+export const RESTRICTION_TYPE_INTERNATIONAL = 2;
+export const RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME = 3;
+export const RESTRICTION_TYPE_ROAMING_INCOMING = 4;
+export const RESTRICTION_TYPE_INCOMING_SERVICES = 7;
+export const RESTRICTION_TYPE_OUTGOING_SERVICES = 6;
+export const RESTRICTION_TYPE_ALL_CALLS = 5;
+export const RESTRICTION_TYPE_INVALID = -1;
+export const RESTRICTION_TYPE_INVALID2 = 8;
+
+export const DEFAULT_SLOT_ID = 0;
+export const SLOT_ID1 = 1;
+export const SLOT_ID_INVALID = -1;
+export const SLOT_ID_INVALID_2 = 2;
+export const CALL_ID_NOT_EXIST = 999;
+export const VIDEO_STATE_AUDIO = 0;
+export const CALL_TYPE_CS = 0;
+export const CALL_TYPE_IMS = 1;
+
+export const EVENT_START_DTMF_SUCCESS = 3;
+export const EVENT_STOP_DTMF_SUCCESS = 5;
+
+export const CALL_STATE_UNKNOWN = -1;
+export const CALL_STATE_IDLE = 0;
+export const CALL_STATE_RINGING = 1;
+export const CALL_STATE_OFFHOOK = 2;
+
+export const TIMEOUT_LENTH = 1000;
+
+// call error code
+export const CALL_MANAGER_NUMBER_NULL_NOTICE = '83951616';
+
+export const TRANSFER_DISABLE = 0; // tran is close
+export const TRANSFER_ENABLE = 1; // tran is open
+
+export const CALL_TRANSFER_ENABLE = 0;
+export const CALL_TRANSFER_DISABLE = 1;
+export const CALL_TRANSFER_REGISTRATION = 3; // open tran function
+export const CALL_TRANSFER_ERASURE = 4; // close tran function
+export const CALL_TRANSFER_INVALID = -1;
+export const CALL_TRANSFER_INVALID2 = 5;
+export const CALL_TRANSFER_INVALID3 = 2;
+
+export const TRANSFER_TYPE_BUSY = 1; // tran busy
+export const TRANSFER_TYPE_NO_REPLY = 2;// no response tran
+export const TRANSFER_TYPE_NOT_REACHABLE = 3; // untouchable(no signal/shut down) tran
+export const TRANSFER_TYPE_UNCONDITIONAL = 0; // unconditional tran
+export const TRANSFER_TYPE_INVALID = -1;
+export const TRANSFER_TYPE_INVALID4 = 4;
+
+export const REACH_TIMES = 10;
+export const AFTER_HANUP_TIMES = 5;
+
+export const CARMER_ID_NOT_EXIT = 'xtsautotest123456';
+export const CARMER_ID_SPACE = '';
+export const IMAGE_PNG_PATH = '/system/data/callManager.png';
+export const IMAGE_JPG_PATH = '/system/data/callManager.jpg';
+export const IMAGE_BMP_PATH = '/system/data/callManager.bmp';
+export const IMAGE_WEBP_PATH = '/system/data/callManager.webp';
+export const IMAGE_LOCAL_ERROR_PATH = '/system/data/callManager/notexistpath.png';
+export const IMAGE_SPACE_PATH = '';
+export const SENT_STRING_0 = '0';
+export const SENT_STRING_1 = '1';
+export const SENT_STRING_2 = '2';
+export const SENT_STRING_3 = '3';
+export const SENT_STRING_4 = '4';
+export const SENT_STRING_5 = '5';
+export const SENT_STRING_6 = '6';
+export const SENT_STRING_7 = '7';
+export const SENT_STRING_8 = '8';
+export const SENT_STRING_9 = '9';
+export const SENT_STRING_ERROR_10 = '10';
+export const SENT_STRING_A = 'A';
+export const SENT_STRING_Z = 'Z';
+export const SENT_STRING_C = 'C';
+export const SENT_STRING_D = 'D';
+export const SENT_STRING_E = 'E';
+export const SENT_STRING_LOW_A = 'a';
+export const SENT_STRING_LOW_C = 'c';
+export const SENT_STRING_LOW_B = 'b';
+export const SENT_STRING_LOW_D = 'd';
+export const SENT_STRING_STAR = '*';
+export const SENT_STRING_ADD = '+';
+export const SENT_STRING_MINUS = '-';
+export const SENT_STRING_JIN = '#';
+export const CALL_MODE_CS = 0;
+export const CALL_MODE_IMS = 3;
+export const MEDIA_TYPE_VOICE = 0;
+export const MEDIA_TYPE_VIDEO = 1;
+export const MEDIA_TYPE_ERROR = -1;
+export const MEDIA_TYPE_ERROR2 = 2;
+export const DIAL_SCENCE_CALL_NORMAL = 0;
+export const DIAL_SCENCE_CALL_PRIVILEGED = 1;
+export const DIAL_SCENCE_CALL_CALL_EMERGENCY = 2;
+export const DIAL_SCENCE_ERROR = -1;
+export const DIAL_SCENCE_ERROR2 = 3;
+export const DIAL_CARRIER_TYPE = 0;
+export const DIAL_VOICE_MAIL_TYPE = 1;
+export const DIAL_OTT_TYPE = 2;
+export const DIAL_TYPE_ERROR = -1;
+export const DIAL_TYPE_ERROR3 = 3;
+
+export const POS_700 = 700;
+export const POS_10 = 10;
+export const POS_Z_0 = 0;
+export const POS_Z_1 = 1;
+export const POS_Z_ERROR = -1;
+export const POS_Z_ERROR2 = 2;
+export const POS_LENGTH_300 = 300;
+export const POS_LENGTH_600 = 600;
+
+export const ZOOM_RATIO_5_0 = 5.0;
+export const ZOOM_RATIO_15_0 = 15.0;
+export const ZOOM_RATIO_0_0 = 0.0;
+export const ZOOM_RATIO_10_1 = 10.1;
+export const ZOOM_RATIO_MINUS_1_0 = -1.0;
+
+export const ROTATION_0 = 0;
+export const ROTATION_90 = 90;
+export const ROTATION_60 = 60;
+export const ROTATION_180 = 180;
+export const ROTATION_270 = 270;
+export const ROTATION_360 = 360;
+export const ROTATION_MINUS_1 = -1;
+
+export const COMMAND_CALL_WAITTING_OPEN = '*43#';
+export const COMMAND_CALL_WAITTING_CLOSE = '#43#';
+export const COMMAND_CALL_WAITTING_QUERY = '*#43#';
+export const COMMAND_CALL_TRANS_OPEN = '*21*10000000001#';
+export const COMMAND_CALL_TRANS_OPEN2 = '**21*10000000001*10#';
+export const COMMAND_CALL_TRANS_RESET = '##21#';
+export const COMMAND_CALL_ERROR = '**21*10000000001******10#';
+export const COMMAND_CALL_ERROR2 = '*ABCDEF123456789#';
+export const COMMAND_CALL_ERROR3 = '#ABCDEF123456789#';
+export const COMMAND_CALL_ERROR4 = '*#ABCDE123456789#';
+export const COMMAND_CALL_ERROR5 = '**ABCDE123456789#';
+export const COMMAND_CALL_ERROR6 = '##ABCDEF123456789#';
+
+export const CALL_WAITING_DISABLE = 0;
+export const CALL_WAITING_ENABLE = 1;
+
+export const EVENT_SEND_USSD_SUCCESS = 17;
+export const EVENT_SEND_USSD_FAILED = 18;
+export const EVENT_SEND_MEDIA_MODE_UPDATE = 19;
+
+export const RTT_MSG = 'Ab666';
+
+export const CALL_MODE_AUDIO_ONLY = 0;
+export const CALL_MODE_SEND_RECEIVE = 3;
+export const CALL_MODE_SEND_ONLY = 1;
+export const CALL_MODE_RECEIVE_ONLY = 2;
+export const CALL_MODE_VIDEO_PAUSED = 4;
+export const CALL_MODE_INVALID_MINUS_1 = -1;
+export const CALL_MODE_INVALID_5 = 5;
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceInCalling.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceInCalling.js
new file mode 100644
index 0000000000000000000000000000000000000000..f9e88b234b91942172cd50e4b7f4cbeb6e589095
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceInCalling.js
@@ -0,0 +1,684 @@
+/**
+ * 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 {
+ CALL_MANAGER_NUMBER_NULL_NOTICE,
+ NULL_PHONE_NUMBER,
+ CALL_STATUS_HOLDING,
+ CALL_STATUS_DIALING,
+ CALL_STATUS_DISCONNECTED,
+ CALL_STATUS_DISCONNECTING,
+ TIMEOUT_LENTH,
+ DEFAULT_SLOT_ID,
+ CALL_STATUS_ACTIVE,
+ REACH_TIMES,
+ AFTER_HANUP_TIMES
+} from './Const.js';
+import {toString} from './ApiToPromise.js';
+import call from '@ohos.telephony.call';
+import observer from '@ohos.telephony.observer';
+
+let hunupTimeOut = null;
+
+export function clearHandupTime (caseName) {
+ console.log(`${caseName} clearHandupTime success`);
+ clearTimeout(hunupTimeOut);
+}
+
+let stateStorage = [];
+export let callId = null;
+export function callDetailsChangeOn () {
+ console.log('Telephony_CallManager callDetailsChangeOn');
+ call.on('callDetailsChange', (err, callStateInfo) => {
+ console.log(`Telephony_CallManager callDetailsChange error ${toString(err)}` +
+ `,callStateInfo ${toString(callStateInfo)}`);
+ if (callStateInfo) {
+ stateStorage.push({...callStateInfo});
+ callId = callStateInfo.callId;
+ }
+ });
+}
+export function callDetailsChangeOff () {
+ console.log('Telephony_CallManager callDetailsChangeOff');
+ call.off('callDetailsChange');
+}
+
+let reachStateTimeout = null;
+export function reachState (caseName, checkState, tag, isHunup, target) {
+ clearInterval(reachStateTimeout);
+ stateStorage = [];
+ let oldTime = new Date();
+ let timeoutflag = false;
+ let timeOutLenth = 2 * REACH_TIMES * TIMEOUT_LENTH;
+ return new Promise((resolve, reject) => {
+ reachStateTimeout = setInterval(() => {
+ let now = new Date();
+ console.log(`${caseName} ${tag} reachState now:${toString(now)},stateStorage:${toString({stateStorage})}`);
+ let find = stateStorage.find(ele => {
+ if (target && target.callId === null && ele.callState === CALL_STATUS_DIALING) {
+ target.callId = ele.callId;
+ }
+ if (target) { // be satisfied with multing call
+ return ele.callState === checkState && ele.callId === target.callId;
+ } else {
+ return ele.callState === checkState;
+ }
+ });
+ if (find) {
+ clearInterval(reachStateTimeout);
+ const message = `${caseName} ${tag} reachState,get the right state checkState:${checkState}`;
+ console.log(message);
+ resolve(find);
+ return;
+ }
+ find = stateStorage.find(ele => {
+ if (target) { // be satisfied with multing call
+ return ele.callState === CALL_STATUS_DISCONNECTED && ele.callId === target.callId;
+ } else {
+ return ele.callState === CALL_STATUS_DISCONNECTED;
+ }
+ });
+ if (find) {
+ clearInterval(reachStateTimeout);
+ reachStateTimeout = setTimeout(() => {
+ const message = `${caseName} ${tag} reachState,get the state CALL_STATUS_DISCONNECTED from` +
+ ` ${timeoutflag ? 'local' : 'opposite'}, callId ${find.callId}`;
+ console.log(message);
+ if (target) { // be satisfied with multing call
+ target.callId = null;
+ }
+ reject(new Error(message));
+ }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
+ return;
+ }
+ if (new Date() - oldTime > timeOutLenth) {
+ if (isHunup) {
+ const message = `${caseName} ${tag} timeout,hunup is runed`;
+ console.log(message);
+ clearInterval(reachStateTimeout);
+ reject(new Error(message));
+ return;
+ }
+ if (timeoutflag === false) {
+ timeoutflag = true;
+ let callId = target ? target.callId : callId;// be satisfied with multing call
+ if (!callId) {
+ clearInterval(reachStateTimeout);
+ const message = `${caseName} ${tag} timeout reachState,callId is not exit`;
+ reject(new Error(message));
+ return;
+ }
+ const message = `${caseName} ${tag} timeout reachState,start hunupCall`;
+ console.log(message);
+ hangupCall(caseName, callId).then(data => {
+ const message = `${caseName} ${tag} timeout hangupCall success,data:${toString(data)}`;
+ console.log(message);
+ clearInterval(reachStateTimeout);
+ reject(new Error(message));
+ }).catch(error => {
+ clearInterval(reachStateTimeout);
+ const message = `${caseName} ${tag} timeout hangupCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ }
+ }
+ }, 1 * TIMEOUT_LENTH);
+ });
+}
+
+export function clearReachState () {
+ clearInterval(reachStateTimeout);
+}
+
+// dial call in a nomal scence,when specific state arrive,we get the information of this state
+export function scenceInCalling (options) {
+ console.log(`scenceInCalling options ${toString(options)}`);
+ if (!options.target) { // be satisfied with multing call
+ callId = null;
+ }
+ return new Promise((resolve, reject) => {
+ let {caseName, phoneNumber, checkState, dialOptions, target} = options;
+ try {
+ reachState(caseName, checkState, 'scenceInCalling', false, target)// be satisfied with multing call
+ .then(data => {
+ const message = `${caseName} reach the right state success,data:${toString(data)}`;
+ console.log(message);
+ resolve(data);
+ })
+ .catch(error => {
+ const message = `${caseName} reach the right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ const callback = (error, data) => {
+ if (error) {
+ const message = `${caseName} scenceInCalling dial error,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ return;
+ }
+ if (data !== true) {
+ const message = `${caseName} scenceInCalling dial data error,data:${toString(data)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ return;
+ }
+ console.log(`${caseName} dial true,run continue`);
+ };
+ let arg = [phoneNumber];
+ if (dialOptions) {
+ arg.push(dialOptions);
+ }
+ arg.push(callback);
+ call.dial(...arg);
+ } catch (error) {
+ const message = `${caseName} dial try catch error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+/* normal function
+ dial a call with number '',we shoudld get the error */
+export function scenceInCallingNull (options) {
+ console.log(`scenceInCallingNull options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName, dialOptions} = options;
+ const callback = (err, data) => {
+ if (err && err.message === CALL_MANAGER_NUMBER_NULL_NOTICE) {
+ console.log(`${caseName} dial call null number,data:${toString(err)}`);
+ resolve(data);
+ return;
+ }
+ const message = `${caseName} should be CALL_MANAGER_NUMBER_NULL_NOTICE,` +
+ `dial error:${toString(err)},data:${toString(data)}`;
+ console.log(message);
+ reject(new Error(message));
+ };
+ let arg = [NULL_PHONE_NUMBER];
+ if (dialOptions) {
+ arg.push(dialOptions);
+ }
+ arg.push(callback);
+ try {
+ call.dial(...arg);
+ } catch (error) {
+ const message = `${caseName} error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+// holding call scence,use it should base on scenceInCalling,get the infomation at CALL_STATUS_HOLDING state
+export function scenceInHolding (options) {
+ console.log(`scenceInHolding options ${toString(options)}`);
+ return new Promise(async (resolve, reject) => {
+ let {caseName, callId} = options;
+ if (callId) {
+ reachState(caseName, CALL_STATUS_HOLDING, 'scenceInHolding', false)
+ .then(data => {
+ const message = `${caseName} scenceInHolding get the right state success,data:${toString(data)}`;
+ console.log(message);
+ resolve(data);
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInHolding get the right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ call.holdCall(callId, (error, data) => {
+ if (error) {
+ const message = `${caseName} scenceInHolding holdCall error,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ }
+
+ });
+ } else {
+ const message = `${caseName} scenceInHolding error,need callId`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+export function scenceInUnHolding (options) {
+ console.log(`scenceInUnHolding options ${toString(options)}`);
+ return new Promise(async (resolve, reject) => {
+ let {caseName, callId} = options;
+ if (callId) {
+ reachState(caseName, CALL_STATUS_ACTIVE, 'scenceInUnHolding', false)
+ .then(data => {
+ const message = `${caseName} scenceInUnHolding get the right state success,data:${toString(data)}`;
+ console.log(message);
+ resolve(data);
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInUnHolding get the right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ call.unHoldCall(callId, (error, data) => {
+ if (error) {
+ const message = `${caseName} scenceInUnHolding error,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ }
+
+ });
+ } else {
+ const message = `${caseName} scenceInUnHolding error,need callId`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+// hunup call scence,use it should base on scenceInCalling,specific state arrive,get the infomation at this state
+export function scenceInHangup (options) {
+ console.log(`scenceInHangup options ${toString(options)}`);
+ return new Promise(async (resolve, reject) => {
+ let {caseName, callId, checkState} = options;
+ if (callId) {
+ reachState(caseName, checkState, 'scenceInHangup', true).then(data => {
+ const message = `${caseName} scenceInHangup get the right state success ,data:${toString(data)}`;
+ console.log(message);
+ resolve(data);
+ }).catch(error => {
+ const message = `${caseName} scenceInHangup get the right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ call.hangup(callId)
+ .then((data) => {
+ const message = `${caseName} scenceInHangup data,data:${toString(data)}`;
+ console.log(message);
+ })
+ .catch(error => {
+ const message = `${caseName} func hangup,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ });
+
+ } else {
+ const message = `${caseName} scenceInHangup error,need callId`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+// hunup the call ,used in test case
+export function hangupCall2 (caseName, done, callId, delaytime) {
+ let timeout = null;
+ if (callId) {
+ const message = `${caseName} hunup,hangupCall2 callId ${callId}`;
+ console.log(message);
+ reachState(caseName, CALL_STATUS_DISCONNECTED, 'hangupCall2', true)
+ .then(data => {
+ const message = `${caseName} hangupCall2 get right state success,data:${toString(data)}`;
+ console.log(message);
+ clearTimeout(timeout);
+ timeout = setTimeout(function () {
+ done();
+ }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
+ })
+ .catch(error => {
+ const message = `${caseName} hangupCall2 get right state error,error:${toString(error)}`;
+ console.log(message);
+ });
+ call.hangup(callId)
+ .then((data) => {
+ console.log(`${caseName} func hangup success,${toString(data)}`);
+ })
+ .catch(error => {
+ const message = `${caseName} func hangup,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ done();
+ });
+
+ } else {
+ const message = `${caseName} hangupCall2 error,need callId`;
+ console.log(message);
+ done();
+ }
+}
+
+// hunup the call ,used in packaging function
+export function hangupCall (caseName, callId) {
+ return new Promise((resolve, reject) => {
+ let timeout = null;
+ if (callId) {
+ let message = `${caseName} hunup,hangupCall callId:${callId}`;
+ console.log(message);
+ reachState(caseName, CALL_STATUS_DISCONNECTED, 'hangupCall', true)
+ .then(data => {
+ const message = `${caseName} hangupCall get right state success,data:${toString(data)}`;
+ console.log(message);
+ clearTimeout(timeout);
+ timeout = setTimeout(function () {
+ resolve(data);
+ }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
+ })
+ .catch(error => {
+ const message = `${caseName} hangupCall get right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ call.hangup(callId)
+ .then((data) => {
+ console.log(`${caseName} func hangup success,${toString(data)}`);
+ })
+ .catch(error => {
+ const message = `${caseName} func hangup,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ });
+ } else {
+ const message = `${caseName} func hangup error,need callId`;
+ console.log(message);
+ reject(new Error(message));
+ }
+
+ });
+}
+
+/* dial call in a nomal scence used in third-party applications,when specific state arrive,
+ we get the information of this state */
+export function scenceInCallingForRegister (options) {
+ console.log(`scenceInCallingForRegister options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName} = options;
+ let callId = null;
+ let callChangeData = null;
+ let func = null;
+ let count = 0;
+ if (options.isOnce) {
+ func = observer.once;
+ } else {
+ func = observer.on;
+ }
+ if (typeof func !== 'function') {
+ let message = `${caseName} observer.once or observer.on is not exit,options:${toString(options)}`;
+ console.log(message);
+ reject(new Error(message));
+ return;
+ }
+ func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
+ console.log(`${caseName} callStateChange,data:${toString(data)}`);
+ callChangeData = data;
+ count++;
+ });
+
+ scenceInCalling({...options})
+ .then(data => {
+ callId = data.callId;
+ let tempCallChangeData = {count, ...callChangeData};
+ console.log(`${caseName} scenceInCalling data,data:${toString(data)},` +
+ `tempCallChangeData:${toString(tempCallChangeData)}`);
+ observer.off('callStateChange');
+ hangupCall(caseName, callId)
+ .then(data => {
+ console.log(`${caseName} scenceInCalling hangupCall data,data:${toString(data)}`);
+ resolve(tempCallChangeData);
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling hangupCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ });
+}
+
+// holding call scence used in third-party applications,we get the information of state at CALL_STATUS_HOLDING state
+export function scenceInCallingHoldingForRegister (options) {
+ console.log(`scenceInCallingHoldingForRegister options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName} = options;
+ let callId = null;
+ let callChangeData = null;
+ let func = null;
+ let count = 0;
+ if (options.isOnce) {
+ func = observer.once;
+ } else {
+ func = observer.on;
+ }
+ if (typeof func !== 'function') {
+ reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
+ return;
+ }
+ func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
+ console.log(`${caseName} callStateChange,data:${toString(data)}`);
+ count++;
+ callChangeData = data;
+ });
+ scenceInCalling(options)
+ .then(data => {
+ scenceInHolding({callId:data.callId, ...options})
+ .then(data => {
+ callId = data.callId;
+ let tempCallChangeData = {count, ...callChangeData};
+ console.log(`${caseName} scenceInHolding data,data:${toString(data)}` +
+ `,tempCallChangeData:${toString(tempCallChangeData)}`);
+ observer.off('callStateChange');
+ hangupCall(caseName, callId)
+ .then(data => {
+ console.log(`${caseName} hangupCall data,data:${toString(data)}`);
+ resolve(tempCallChangeData);
+ })
+ .catch(error => {
+ const message = `${caseName} hangupCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInHolding ,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ });
+}
+
+// holding call scence used in third-party applications,we get the information of state when unHoldCall the call
+export function scenceInCallingNnHoldingForRegister (options) {
+ console.log(`scenceInCallingNnHoldingForRegister options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName} = options;
+ let callId = null;
+ let callChangeData = null;
+ let func = null;
+ let count = 0;
+ if (options.isOnce) {
+ func = observer.once;
+ } else {
+ func = observer.on;
+ }
+ if (typeof func !== 'function') {
+ reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
+ return;
+ }
+ func('callStateChange', {slotId:DEFAULT_SLOT_ID}, (data) => {
+ console.log(`${caseName} callStateChange,data:${toString(data)}`);
+ count++;
+ callChangeData = data;
+ });
+ scenceInCalling(options)
+ .then(data => {
+ scenceInHolding({callId:data.callId, ...options})
+ .then(data => {
+ callId = data.callId;
+ scenceInUnHolding({callId:data.callId, ...options})
+ .then(data => {
+ let tempCallChangeData = {count, ...callChangeData};
+ console.log(`${caseName} unHoldCall data,data:${toString(data)},
+ tempCallChangeData:${toString(tempCallChangeData)}`);
+ observer.off('callStateChange');
+ hangupCall(caseName, callId)
+ .then(data => {
+ console.log(`${caseName} hangupCall data,data:${toString(data)}`);
+ resolve(tempCallChangeData);
+ })
+ .catch(error => {
+ const message = `${caseName} hangupCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} unHoldCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInHolding error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ });
+}
+
+// hunup call scence used in third-party applications,we get the information of state when hunup the call
+export function scenceInCallingHangupForRegister (options) {
+ console.log(`scenceInCallingHangupForRegister options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName} = options;
+ let callId = null;
+ let callChangeData = null;
+ let func = null;
+ let count = 0;
+ if (options.isOnce) {
+ func = observer.once;
+ } else {
+ func = observer.on;
+ }
+ if (typeof func !== 'function') {
+ reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
+ return;
+ }
+ func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
+ console.log(`${caseName} callStateChange,data:${toString(data)}`);
+ count++;
+ callChangeData = data;
+ });
+ scenceInCalling(options)
+ .then(data => {
+ options.checkState = CALL_STATUS_DISCONNECTED;
+ scenceInHangup({callId:data.callId, ...options})
+ .then(data => {
+ callId = data.callId;
+ let tempCallChangeData = {count, ...callChangeData};
+ console.log(`${caseName} scenceInHangup data,data:${toString(data)},` +
+ `tempCallChangeData:${toString(tempCallChangeData)}`);
+ observer.off('callStateChange');
+ resolve(tempCallChangeData);
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInHangup error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ });
+}
+
+export function isHanupEd (state) {
+ return (state === CALL_STATUS_DISCONNECTING) || (state === CALL_STATUS_DISCONNECTED);
+}
+
+export function reachCallEventState (eventId) {
+ return new Promise(function (resolve, reject) {
+ let time = null;
+ call.on('callEventChange', (err, value) => {
+ console.log(`Telephony_CallManager callEventChange error ${toString(err)},callStateInfo ${
+ toString(value)}`);
+ if (err) {
+ let message = `Telephony_CallManager reachCallEventState err message = ${toString(err)}`;
+ console.log(message);
+ clearTimeout(time);
+ reject(new Error(message));
+ return;
+ }
+ if (eventId === value.eventId) {
+ let message = `Telephony_CallManager reachCallEventState get the right eventId ${toString(value)}`;
+ console.log(message);
+ clearTimeout(time);
+ resolve(value);
+ } else {
+ let message = `Telephony_CallManager reachCallEventState get the error eventId ${toString(value)}`;
+ console.log(message);
+ clearTimeout(time);
+ reject(new Error(message));
+ }
+ });
+ time = setTimeout(function () {
+ let message = 'Telephony_CallManager reachCallEventState time out';
+ console.log(message);
+ reject(new Error(message));
+ }, 20 * TIMEOUT_LENTH);
+ });
+}
+
+export class TeleCall {
+ constructor () {
+ this.callId = null;
+ }
+ callScenceInCalling (options) {
+ this.callId = null;
+ options.target = this;
+ return scenceInCalling(options);
+ }
+ callReachState (caseName, checkState, tag, isHunup) {
+ return reachState(caseName, checkState, tag, isHunup, this);
+ }
+ callHangupCall (caseName) {
+ return hangupCall(caseName, this.callId, this);
+ }
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceLimitCalling.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceLimitCalling.js
new file mode 100644
index 0000000000000000000000000000000000000000..eade0379d5f3b350b391ea9352c4b15490245a63
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceLimitCalling.js
@@ -0,0 +1,57 @@
+/**
+ * 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 {RIGHT_PASSWORD, DEFAULT_SLOT_ID, RESTRICTION_MODE_DEACTIVATION} from './Const.js';
+import {toString} from './ApiToPromise.js';
+import call from '@ohos.telephony.call';
+
+// limit call scence
+export function scenceLimitCalling (caseName, type, mode, slotId) {
+ return new Promise((resolve, reject) => {
+ console.log(`${caseName} scenceLimitCalling type:${type},mode:${mode}`);
+ call.setCallRestriction(slotId ? slotId : DEFAULT_SLOT_ID, {
+ type,
+ mode,
+ password:RIGHT_PASSWORD,
+ })
+ .then(data => {
+ console.log(`${caseName} setCallRestriction success, data:${toString(data)}`);
+ resolve(data);
+ })
+ .catch((error) => {
+ console.log(`${caseName} setCallRestriction error,error:${toString(error)}`);
+ reject(error);
+ });
+ });
+}
+
+export function scenceLimitCancel (caseName, type, slotId) {
+ return new Promise((resolve, reject) => {
+ console.log(`${caseName} scenceLimitCancel type:${type}`);
+ call.setCallRestriction(slotId ? slotId : DEFAULT_SLOT_ID, {
+ type,
+ mode:RESTRICTION_MODE_DEACTIVATION,
+ password:RIGHT_PASSWORD,
+ })
+ .then(data => {
+ console.log(`${caseName} scenceLimitCancel success, data:${toString(data)}`);
+ resolve(data);
+ })
+ .catch((error) => {
+ console.log(`${caseName} scenceLimitCancel error,error:${toString(error)}`);
+ reject(error);
+ });
+ });
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceTransfer.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceTransfer.js
new file mode 100644
index 0000000000000000000000000000000000000000..41cfdbaf57b4df9f3ca1a315b8ca489f813b1e81
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceTransfer.js
@@ -0,0 +1,48 @@
+/**
+ * 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 call from '@ohos.telephony.call';
+import {toString} from './ApiToPromise.js';
+export function scenceTransferCalling (caseName, settingType, type, phoneNumber) {
+ return new Promise((resolve, reject) => {
+ call.setCallTransfer(0, {
+ settingType,
+ type,
+ phoneNumber,
+ })
+ .then(data => {
+ console.log(`${caseName} scenceTransferCalling success,data:${toString(data)}`);
+ resolve(data);
+ })
+ .catch((error) => {
+ console.log(`${caseName} scenceTransferCalling error,error:${toString(error)}`);
+ reject(error);
+ });
+ });
+}
+
+export function scenceTransferCancel (caseName) {
+ return new Promise((resolve, reject) => {
+ call.dial('##002#')
+ .then(data => {
+ console.log(`${caseName} scenceTransferCancel success,data:${toString(data)}`);
+ resolve(data);
+ })
+ .catch((error) => {
+ console.log(`${caseName} scenceTransferCancel error,error${toString(error)}`);
+ reject(error);
+ });
+ });
+}
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..359c05368eaa43e301bc83ff7080b351f969e715
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "CallManager"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/signature/openharmony_sx.p7b b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..e22022ce6c30b7011463824ebaf05ea9d91753f2
Binary files /dev/null and b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/signature/openharmony_sx.p7b differ
diff --git a/telephony/telephonyjstest/cellular_data/BUILD.gn b/telephony/telephonyjstest/cellular_data/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..21dcacb5a2b262902d975c227d0ca73f2456fbd4
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/BUILD.gn
@@ -0,0 +1,20 @@
+# 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")
+
+group("cellular_data") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "cellular_data_abnormal:ActsCellularDataAbnormalTest" ]
+ }
+}
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/BUILD.gn b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..d71d00f31b9a128cc1c84393805c1c6fcbb7ac69
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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("ActsCellularDataAbnormalTest") {
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsCellularDataAbnormalTest"
+}
+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/cellular_data/cellular_data_abnormal/Test.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..411be27c3ccb90aee74e7d2c64fd03bd55efb09a
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/Test.json
@@ -0,0 +1,19 @@
+{
+ "description": "Configuration for callmanager Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "18000",
+ "package": "com.ohos.cellulardata",
+ "shell-timeout": "18000",
+ "native-test-timeout":"18000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "$module.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/config.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..6707fd3baef194afe1394d4c78e0f625aa19af33
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/config.json
@@ -0,0 +1,61 @@
+{
+ "app": {
+ "bundleName": "com.ohos.cellulardata",
+ "vendor": "ohos",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.ohos.cellulardata",
+ "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.cellulardata.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/cellular_data/cellular_data_abnormal/entry/src/main/js/default/app.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..f6cc8926d94f6e4c3803ae8a7be2f5f08c0f78b5
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..f159d2674eabc1a618ae43b29a1e84ca0d6b9035
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,47 @@
+/*
+ * 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/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..359c05368eaa43e301bc83ff7080b351f969e715
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "CallManager"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..1e15f75b7eeaf47a61ef01e376d05c4efbbfcad9
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js
@@ -0,0 +1,387 @@
+/*
+ * 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 cellular from "@ohos.telephony.data";
+import { describe, it, expect } from "deccjsunit/index";
+
+describe("ActsCellularDataAbnormalTest", function () {
+ const ERR_SLOT_ID = 3;
+
+ /*
+ * @tc.number Telephony_CellularData_isCellularDataEnabled_Async_0100
+ * @tc.name Call the enableCellularData interface and then call the isCellularDataEnabled interface.
+ * The result is true
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_isCellularDataEnabled_Async_0100", 0, async function (done) {
+ cellular.isCellularDataEnabled((err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_isCellularDataEnabled_Async_0100 fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_isCellularDataEnabled_Async_0100 finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getCellularDataState_Async_0100
+ * @tc.name Call the enableCellularData interface, call the getCellularDataState interface,
+ * and get the result 1 or 2
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getCellularDataState_Async_0100", 0, async function (done) {
+ cellular.getCellularDataState((err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getCellularDataState_Async_0100 fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_getCellularDataState_Async_0100 finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_enableCellularData_Async_0100
+ * @tc.name Open the data switch and query the switch status and data status
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_enableCellularData_Async_0100", 0, async function (done) {
+ cellular.enableCellularData((err) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_enableCellularData_Async_0100 enableCellularData fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_enableCellularData_Async_0100 enableCellularData finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_disableCellularData_Async_0100
+ * @tc.name Turn off the data switch and query the switch status and data status
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_disableCellularData_Async_0100", 0, async function (done) {
+ cellular.disableCellularData((err) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_disableCellularData_Async_0100 disableCellularData fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_disableCellularData_Async_0100 disableCellularData finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_enableCellularDataRoaming_Async_0300
+ * @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3),
+ * to check the correction results
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_enableCellularDataRoaming_Async_0300", 0, async function (done) {
+ cellular.enableCellularDataRoaming(ERR_SLOT_ID, (err) => {
+ if (err) {
+ console.log("Telephony_CellularData_enableCellularDataRoaming_Async_0300 enableCellularData finish");
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log("Telephony_CellularData_enableCellularDataRoaming_Async_0300 enableCellularData fail");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_disableCellularDataRoaming_Async_0300
+ * @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3), to check the
+ * correction results
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_disableCellularDataRoaming_Async_0300", 0, async function (done) {
+ cellular.disableCellularDataRoaming(ERR_SLOT_ID, (err) => {
+ if (err) {
+ console.log(
+ "Telephony_CellularData_disableCellularDataRoaming_Async_0300 disableCellularDataRoaming finish"
+ );
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log("Telephony_CellularData_disableCellularDataRoaming_Async_0300 disableCellularDataRoaming fail");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getCellularDataFlowType_Async_0100
+ * @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
+ * verify that the callback value is within the enumeration value range
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getCellularDataFlowType_Async_0100", 0, async function (done) {
+ cellular.getCellularDataFlowType((err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getCellularDataFlowType_Async_0100 fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_getCellularDataFlowType_Async_0100 finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200
+ * @tc.name Call isCellularDataRoamingEnabled, set the slotId to error values (3), to check the correction
+ * results
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200", 0, async function (done) {
+ cellular.isCellularDataRoamingEnabled(ERR_SLOT_ID, (err) => {
+ if (err) {
+ console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200 finish");
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200 fail");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500
+ * @tc.name Call setDefaultCellularDataSlotId() interface, set the default card slot to the number of exceptions
+ * (-1), and verify whether the setting failed (Async)
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500", 0, async function (done) {
+ cellular.setDefaultCellularDataSlotId(ERR_SLOT_ID, (err) => {
+ if (err) {
+ console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 finish");
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 fail");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500
+ * @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500", 0, async function (done) {
+ cellular.getDefaultCellularDataSlotId((err) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_isCellularDataEnabled_Promise_0100
+ * @tc.name Call the enableCellularData interface and then call the isCellularDataEnabled interface.
+ * The result is true
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_isCellularDataEnabled_Promise_0100", 0, async function (done) {
+ try {
+ await cellular.isCellularDataEnabled();
+ console.log("Telephony_CellularData_isCellularDataEnabled_Promise_0100 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_isCellularDataEnabled_Promise_0100 fail");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getCellularDataState_Promise_0100
+ * @tc.name Call the enableCellularData interface, call the getCellularDataState interface,
+ * and get the result 1 or 2
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getCellularDataState_Promise_0100", 0, async function (done) {
+ try {
+ await cellular.getCellularDataState();
+ console.log("Telephony_CellularData_getCellularDataState_Promise_0100 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getCellularDataState_Promise_0100 fail");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_enableCellularData_Promise_0100
+ * @tc.name Open the data switch and query the switch status and data status
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_enableCellularData_Promise_0100", 0, async function (done) {
+ try {
+ await cellular.enableCellularData();
+ console.log("Telephony_CellularData_enableCellularData_Promise_0100 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_enableCellularData_Promise_0100 fail");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_disableCellularData_Promise_0100
+ * @tc.name Turn off the data switch and query the switch status and data status
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_disableCellularData_Promise_0100", 0, async function (done) {
+ try {
+ await cellular.disableCellularData();
+ console.log("Telephony_CellularData_disableCellularData_Promise_0100 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_disableCellularData_Promise_0100 fail");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_enableCellularDataRoaming_Promise_0300
+ * @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3),
+ * to check the correction results
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_enableCellularDataRoaming_Promise_0300", 0, async function (done) {
+ try {
+ await cellular.enableCellularDataRoaming(ERR_SLOT_ID);
+ expect().assertFail();
+ console.log("Telephony_CellularData_enableCellularDataRoaming_Promise_0300 fail");
+ done();
+ } catch (err) {
+ console.log("Telephony_CellularData_enableCellularDataRoaming_Promise_0300 finish");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_disableCellularDataRoaming_Promise_0300
+ * @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3), to check the
+ * correction results
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_disableCellularDataRoaming_Promise_0300", 0, async function (done) {
+ try {
+ await cellular.disableCellularDataRoaming(ERR_SLOT_ID);
+ expect().assertFail();
+ console.log("Telephony_CellularData_disableCellularDataRoaming_Promise_0300 fail");
+ done();
+ } catch (err) {
+ console.log("Telephony_CellularData_disableCellularDataRoaming_Promise_0300 finish");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getCellularDataFlowType_Promise_0100
+ * @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
+ * verify that the callback value is within the enumeration value range
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getCellularDataFlowType_Promise_0100", 0, async function (done) {
+ try {
+ await cellular.getCellularDataFlowType();
+ console.log("Telephony_CellularData_getCellularDataFlowType_Promise_0100 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getCellularDataFlowType_Promise_0100 fail");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200
+ * @tc.name Call isCellularDataRoamingEnabled, set the slotId to error values (3), to check the correction
+ * results
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200", 0, async function (done) {
+ try {
+ await cellular.isCellularDataRoamingEnabled(ERR_SLOT_ID);
+ expect().assertFail();
+ console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200 fail");
+ done();
+ } catch (err) {
+ console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200 finish");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500
+ * @tc.name Call setDefaultCellularDataSlotId() interface, set the default card slot to the number of exceptions
+ * (-1), and verify whether the setting failed (Async)
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500", 0, async function (done) {
+ try {
+ await cellular.setDefaultCellularDataSlotId(ERR_SLOT_ID);
+ expect().assertFail();
+ console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500 fail");
+ done();
+ } catch (err) {
+ console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500 finish");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500
+ * @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500", 0, async function (done) {
+ try {
+ await cellular.getDefaultCellularDataSlotId();
+ console.log("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 fail");
+ done();
+ }
+ })
+})
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..90fc092365568c08ee58d96ad6c57accfd2e306c
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/List.test.js
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+
+require('./CellularDataAbnorma.test.js')
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..359c05368eaa43e301bc83ff7080b351f969e715
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "CallManager"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/signature/openharmony_sx.p7b b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..bf9f0ca52a451cc28c927ed38746f950e0053a23
Binary files /dev/null and b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/signature/openharmony_sx.p7b differ
diff --git a/telephony/telephonyjstest/network_search/BUILD.gn b/telephony/telephonyjstest/network_search/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..8ecde778c76ed2cc9a85483cb7549aec0aa73930
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/BUILD.gn
@@ -0,0 +1,20 @@
+# 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")
+
+group("network_search") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "network_search_errors:ActsNetworkSearchTest" ]
+ }
+}
diff --git a/telephony/telephonyjstest/network_search/network_search_errors/BUILD.gn b/telephony/telephonyjstest/network_search/network_search_errors/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..f414b73eee8789aa0b4b8a10d30286edd7862276
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/BUILD.gn
@@ -0,0 +1,30 @@
+# 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("ActsNetworkSearchTest") {
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsNetworkSearchTest"
+}
+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/network_search/network_search_errors/Test.json b/telephony/telephonyjstest/network_search/network_search_errors/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..bc14c4c8c201fcff09882e92e3176a6f01d0852e
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/Test.json
@@ -0,0 +1,19 @@
+{
+ "description": "Configuration for NetworkSearch Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "1800",
+ "package": "com.ohos.networksearch",
+ "shell-timeout": "1800",
+ "native-test-timeout":"1800"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "$module.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/config.json b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..b34fe0fd32b39c4481c7bcaf7444a73426938b98
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/config.json
@@ -0,0 +1,61 @@
+{
+ "app": {
+ "bundleName": "com.ohos.networksearch",
+ "vendor": "ohos",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.ohos.networksearch",
+ "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.networksearch.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/network_search/network_search_errors/entry/src/main/js/default/app.js b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/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/network_search/network_search_errors/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/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/network_search/network_search_errors/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/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/network_search/network_search_errors/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/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/network_search/network_search_errors/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..f159d2674eabc1a618ae43b29a1e84ca0d6b9035
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,47 @@
+/*
+ * 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/network_search/network_search_errors/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..2f9470d82c49675a64972657d8d367cd95e51c63
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/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/network_search/network_search_errors/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..c3956077d34211b372a53efb86a27d9970dc79f5
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/List.test.js
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+
+require('./NetworkSearchErrors.test');
\ No newline at end of file
diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f4cd604ad81e713d36901d98fdc6afd47c849046
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js
@@ -0,0 +1,799 @@
+/*
+ * 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 radio from '@ohos.telephony.radio';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
+
+describe('ActsNetworkSearchTest', function () {
+
+ const SLOT_0 = 0;
+ const SLOT_2 = -1;
+ const PREFERRED_MODE_ERR2 = -1;
+
+ function sleep(timeout) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ console.log(`Telephony_NetworkSearch_CellInformation sleep ${timeout}ms`);
+ resolve();
+ }, timeout);
+ })
+ }
+
+ async function turnOnRadio() {
+ let isOn = await radio.isRadioOn();
+ if (!isOn) {
+ await radio.turnOnRadio();
+ console.log('Telephony_NetworkSearch_CellInformation turnOnRadio success');
+ await sleep(5000);
+ }
+ }
+
+ beforeAll(async function () {
+ await radio.setPreferredNetwork(SLOT_0, radio.PREFERRED_NETWORK_MODE_AUTO);
+ await turnOnRadio();
+ })
+
+ afterAll(async function () {
+ await radio.setPreferredNetwork(SLOT_0, radio.PREFERRED_NETWORK_MODE_AUTO);
+ await turnOnRadio();
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getNetworkState_Async_0700
+ * @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getNetworkState_Async_0700', 0, async function (done) {
+ radio.getNetworkState(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getNetworkState_Async_0700 finish err: ${err}`);
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getNetworkState_Async_0700 fail not go to err ${data}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getRadioTech_Async_0400
+ * @tc.name SlotId parameter input is -1, test getRadioTech() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getRadioTech_Async_0400', 0, async function (done) {
+ radio.getRadioTech(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getRadioTech_Async_0400 finish err: ${err}`);
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getRadioTech_Async_0400 fail not go to err ${data}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0400
+ * @tc.name SlotId parameter input is -1, test getSignalInformation() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getSignalInformation_Async_0400', 0, async function (done) {
+ radio.getSignalInformation(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0400 fail err: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0400 finish data: ${JSON.stringify(data)}`);
+ expect(data.length === 0).assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400
+ * @tc.name SlotId parameter input is -1, test getISOCountryCodeForNetwork() query function and datalengtch = 0
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400', 0, async function (done) {
+ radio.getISOCountryCodeForNetwork(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 fail err: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(
+ `Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 finish data: ${JSON.stringify(data)}`);
+ expect(data.length === 0).assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400
+ * @tc.name SlotId parameter input is -1, test getISOCountryCodeForNetwork() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400', 0, async function (done) {
+ try {
+ let data = await radio.getISOCountryCodeForNetwork(SLOT_2);
+ console.log(
+ `Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 finish data:${JSON.stringify(data)}`);
+ expect(data.length === 0).assertTrue();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500
+ * @tc.name SlotId parameter input is -1, test getNetworkSelectionMode() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500', 0, async function (done) {
+ radio.getNetworkSelectionMode(SLOT_2, (err, res) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500 err: ${err}`);
+ done();
+ } else {
+ console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500 fail not go to err');
+ expect().assertFail();
+ done();
+ }
+
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500
+ * @tc.name SlotId parameter input is -1, test getNetworkSelectionMode() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500', 0, async function (done) {
+ try {
+ await radio.getNetworkSelectionMode(SLOT_2);
+ console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500 fail not go to err');
+ expect().assertFail();
+ } catch (err) {
+ console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500 finish');
+ done();
+ return;
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700
+ * @tc.name SlotId parameter input is -1, test setNetworkSelectionMode() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700', 0, async function (done) {
+
+ let networkSMode = {
+ slotId: 55, //set the error slot id is 55
+ selectMode: radio.NETWORK_SELECTION_AUTOMATIC,
+ networkInformation: {
+ operatorName: '',
+ operatorNumeric: '',
+ state: radio.NETWORK_AVAILABLE,
+ radioTech: radio.RADIO_TECHNOLOGY_GSM.toString(),
+ },
+ resumeSelection: false,
+ };
+ console.log(
+ `Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700 networkSMode:${JSON.stringify(networkSMode)}`)
+ radio.setNetworkSelectionMode(networkSMode, (err) => {
+ if (err) {
+ console.log('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700 set finish');
+ done();
+ return;
+ }
+ console.log('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700 set not go to err');
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700
+ * @tc.name SlotId parameter input is -1, test setNetworkSelectionMode() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700', 0, async function (done) {
+ let networkSMode = {
+ slotId: 55, //set the error slot id is 55
+ selectMode: radio.NETWORK_SELECTION_AUTOMATIC,
+ networkInformation: {
+ operatorName: '',
+ operatorNumeric: '',
+ state: radio.NETWORK_AVAILABLE,
+ radioTech: radio.RADIO_TECHNOLOGY_GSM.toString(),
+ },
+ resumeSelection: false,
+ };
+ console.log(
+ `Telephony_NetworkSearch_setNetworkSelectionMode_Async_0700 networkSMode:${JSON.stringify(networkSMode)}`)
+ try {
+ await radio.setNetworkSelectionMode(networkSMode);
+ console.log('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0200 set fail');
+ expect().assertFail();
+ done();
+ } catch (err) {
+ console.log('Telephony_NetworkSearch_setNetworkSelectionMode_Promise_0200 set finish');
+ done();
+ };
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400
+ * @tc.name SlotId parameter input is -1, test getNetworkSearchInformation() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400', 0, async function (done) {
+ radio.getNetworkSearchInformation(SLOT_2, (err, data) => {
+ if (err) {
+ console.log('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400 finish');
+ done();
+ } else {
+ console.log('Telephony_NetworkSearch_getNetworkSearchInformation_Async_0400 fail not go to err');
+ expect().assertFail();
+ }
+ });
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0400
+ * @tc.name SlotId parameter input is -1, test getNetworkSearchInformation() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0400', 0, async function (done) {
+ try {
+ await radio.getNetworkSearchInformation(SLOT_2);
+ console.log('Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0400 fail not go to err');
+ expect().assertFail();
+ done();
+ return;
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_getNetworkSearchInformation_Promise_0400 finish err: ${err}`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getNetworkState_Promise_0700
+ * @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getNetworkState_Promise_0700', 0, async function (done) {
+ try {
+ await radio.getNetworkState(SLOT_2);
+ console.log('Telephony_NetworkSearch_getNetworkState_Promise_0700 fail not go to err');
+ expect().assertFail();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_getNetworkState_Promise_0700 finish err: ${err}`);
+ done();
+ return;
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0400
+ * @tc.name SlotId parameter input is -1, test getRadioTech() query function go to the error
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getRadioTech_Promise_0400', 0, async function (done) {
+ try {
+ await radio.getRadioTech(SLOT_2);
+ console.log('Telephony_NetworkSearch_getRadioTech_Promise_0400 fail not go to err');
+ expect().assertFail();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0400 finish err: ${err}`);
+ done();
+ return;
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getSignalInformation_Promise_0400
+ * @tc.name SlotId parameter input is -1, test getSignalInformation() query function return the datalength is 0
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getSignalInformation_Promise_0400', 0, async function (done) {
+ try {
+ let data = await radio.getSignalInformation(SLOT_2);
+ console.log(
+ `Telephony_NetworkSearch_getSignalInformation_Promise_0400 finish data: ${JSON.stringify(data)}`);
+ expect(data.length === 0).assertTrue();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_getSignalInformation_Promise_0400 fail err: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getOperatorName_Async_0400
+ * @tc.name Verify the abnormal input of "slotId", test getOperatorName() to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getOperatorName_Async_0400', 0, async function (done) {
+ radio.getOperatorName(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getOperatorName_Async_0400 fail err: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getOperatorName_Async_0400 finish data: ${data}`);
+ expect(data === '').assertTrue();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getOperatorName_Promise_0400
+ * @tc.name Verify the abnormal input of "slotId", test getOperatorName() to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getOperatorName_Promise_0400', 0, async function (done) {
+ try {
+ let data = await radio.getOperatorName(SLOT_2);
+ console.log(`Telephony_NetworkSearch_getOperatorName_Promise_0400 finish data: ${data}`);
+ expect(data === '').assertTrue();
+ done();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_getOperatorName_Promise_0400 fail err: ${err}`);
+ expect().assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getPreferredNetwork_Async_0700
+ * @tc.name Verify the abnormal input of "slotId", test getPreferredNetwork() to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getPreferredNetwork_Async_0700', 0, async function (done) {
+ radio.getPreferredNetwork(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getPreferredNetwork_Async_0700 get PASS err: ${err}`);
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getPreferredNetwork_Async_0700 fail not into err data: ${data}`);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getPreferredNetwork_Promise_0700
+ * @tc.name Verify the abnormal input of "slotId", test getPreferredNetwork() to view the return result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getPreferredNetwork_Promise_0700', 0, async function (done) {
+ try {
+ let data = await radio.getPreferredNetwork(SLOT_2);
+ console.log(`Telephony_NetworkSearch_getPreferredNetwork_Promise_0700 fail data: ${data}`);
+ expect().assertFail();
+ done();
+ return;
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_getPreferredNetwork_Promise_0700 finish err: ${err}`);
+ done();
+ }
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_setPreferredNetwork_Async_0100
+ * @tc.name Verify the abnormal input of "preferredNetworkMode",
+ * test setPreferredNetwork() to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_setPreferredNetwork_Async_0100', 0, async function (done) {
+ radio.setPreferredNetwork(SLOT_0, PREFERRED_MODE_ERR2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 set err: ${err}`);
+ radio.getPreferredNetwork(SLOT_0, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 get fail err: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 finish data: ${data}`);
+ expect(data === radio.PREFERRED_NETWORK_MODE_AUTO).assertTrue();
+ done();
+ })
+ } else {
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 fail err: ${data}`);
+ expect().assertFail();
+ done();
+ }
+ })
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_setPreferredNetwork_Async_0600
+ * @tc.name Verify the "slotId" abnormal input, test setPreferredNetwork() to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_setPreferredNetwork_Async_0600', 0, async function (done) {
+ radio.setPreferredNetwork(SLOT_2, radio.PREFERRED_NETWORK_MODE_GSM, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0600 finish err: ${err}`);
+ radio.getPreferredNetwork(SLOT_0, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0600 get fail err: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(
+ `Telephony_NetworkSearch_setPreferredNetwork_Async_0600 finish data: ${JSON.stringify(data)}`);
+ expect(data === radio.PREFERRED_NETWORK_MODE_AUTO).assertTrue();
+ done();
+ })
+ } else {
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0600 fail: not go to err ${data}`);
+ expect().assertFail();
+ done();
+ }
+
+ })
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_setPreferredNetwork_Promise_0100
+ * @tc.name Verify the abnormal input of "preferredNetworkMode",
+ * test setPreferredNetwork() to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_setPreferredNetwork_Promise_0100', 0, async function (done) {
+ try {
+ await radio.setPreferredNetwork(SLOT_0, PREFERRED_MODE_ERR2);
+ console.log('Telephony_NetworkSearch_setPreferredNetwork_Promise_0100 set fail: not go to err');
+ expect().assertFail();
+ done();
+ } catch (err) {
+ try {
+ let data = await radio.getPreferredNetwork(SLOT_0);
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0100 finish data: ${data}`);
+ expect(data === radio.PREFERRED_NETWORK_MODE_AUTO).assertTrue();
+ done();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0100 fail err: ${err}`);
+ expect().assertFail();
+ done();
+ }
+ }
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_setPreferredNetwork_Promise_0600
+ * @tc.name Verify the abnormal input of "slotId", test setPreferredNetwork() return result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_setPreferredNetwork_Promise_0600', 0, async function (done) {
+ try {
+ await radio.setPreferredNetwork(SLOT_2, radio.PREFERRED_NETWORK_MODE_GSM);
+ console.log('Telephony_NetworkSearch_setPreferredNetwork_Promise_0600 set fail: not go to err');
+ expect().assertFail();
+ done();
+ } catch (err) {
+ try {
+ let data = await radio.getPreferredNetwork(SLOT_0);
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0600 finish data: ${data}`);
+ expect(data === radio.PREFERRED_NETWORK_MODE_AUTO).assertTrue();
+ done();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0600 fail err: ${err}`);
+ expect().assertFail();
+ done();
+ }
+ }
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getCellInformation_Async_0500
+ * @tc.name Test getCellInformation() with anomalous soltId(-1) to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getCellInformation_Async_0500', 0, async function (done) {
+ radio.getCellInformation(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getCellInformation_Async_0500 fail: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getCellInformation_Async_0500 end data: ${JSON.stringify(data)}`);
+ expect(data !== '' && data != undefined && data != null).assertTrue();
+ expect(data.length).assertEqual(0);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getCellInformation_Promise_0500
+ * @tc.name Test getCellInformation() with anomalous soltId(-1) to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getCellInformation_Promise_0500', 0, async function (done) {
+ radio.getCellInformation(SLOT_2).then(data => {
+ console.log(`Telephony_NetworkSearch_getCellInformation_Promise_0500 end data: ${JSON.stringify(data)}`);
+ expect(data !== '' && data != undefined && data != null).assertTrue();
+ expect(data.length).assertEqual(0);
+ done();
+ }).catch(err => {
+ console.log(`Telephony_NetworkSearch_getCellInformation_Promise_0500 fail: ${err}`);
+ expect().assertFail();
+ done();
+ })
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_sendUpdateCellLocationRequest_Async_0100
+ * @tc.name Test sendUpdateCellLocationRequest() to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_sendUpdateCellLocationRequest_Async_0100', 0, async function (done) {
+ radio.sendUpdateCellLocationRequest((err) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_sendUpdateCellLocationRequest_Async_0100 fail: ${err}`);
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_sendUpdateCellLocationRequest_Async_0100 success`)
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_sendUpdateCellLocationRequest_Promise_0100
+ * @tc.name Test sendUpdateCellLocationRequest() to view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_sendUpdateCellLocationRequest_Promise_0100', 0, async function (done) {
+ radio.sendUpdateCellLocationRequest().then(data => {
+ console.log(`Telephony_NetworkSearch_sendUpdateCellLocationRequest_Promise_0100 end data: ${data}`);
+ done();
+ }).catch(err => {
+ console.log(`Telephony_NetworkSearch_sendUpdateCellLocationRequest_Promise_0100 fail: ${err}`);
+ done();
+ })
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getIMEI_Async_0500
+ * @tc.name Test getIMEI(-1) to check the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getIMEI_Async_0500', 0, async function (done) {
+ radio.getIMEI(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getIMEI_Async_0500 fail: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getIMEI_Async_0500 end data: ${data}`);
+ expect(data === '').assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getIMEI_Promise_0500
+ * @tc.name Test getIMEI(-1) to check the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getIMEI_Promise_0500', 0, async function (done) {
+ radio.getIMEI(SLOT_2).then(data => {
+ console.log(`Telephony_NetworkSearch_getIMEI_Promise_0500 end data: ${data}`);
+ expect(data === '').assertTrue();
+ done();
+ }).catch(err => {
+ console.log(`Telephony_NetworkSearch_getIMEI_Promise_0500 fail: ${err}`);
+ expect().assertFail();
+ done();
+ })
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getUniqueDeviceId_Async_0500
+ * @tc.name Test getUniqueDeviceId(-1) to check the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getUniqueDeviceId_Async_0500', 0, async function (done) {
+ radio.getUniqueDeviceId(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getUniqueDeviceId_Async_0500 fail: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getUniqueDeviceId_Async_0500 end data: ${data}`);
+ expect(data === '').assertTrue();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getUniqueDeviceId_Promise_0500
+ * @tc.name Test getUniqueDeviceId(-1) to check the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getUniqueDeviceId_Promise_0500', 0, async function (done) {
+ radio.getUniqueDeviceId(SLOT_2).then(data => {
+ console.log(`Telephony_NetworkSearch_getUniqueDeviceId_Promise_0500 end data: ${data}`);
+ expect(data === '').assertTrue();
+ done();
+ }).catch(err => {
+ console.log(`Telephony_NetworkSearch_getUniqueDeviceId_Promise_0500 fail: ${err}`);
+ expect().assertFail();
+ done();
+ })
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getNrOptionMode_Async_0500
+ * @tc.name Test getNrOptionMode(-1) to check the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getNrOptionMode_Async_0500', 0, async function (done) {
+ radio.getNrOptionMode(SLOT_2, (err, data) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_getNrOptionMode_Async_0500 get fail err: ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`Telephony_NetworkSearch_getNrOptionMode_Async_0500 end data: ${JSON.stringify(data)}`);
+ expect(data === radio.NR_OPTION_UNKNOWN).assertTrue();
+ done();
+ });
+ })
+
+ /**
+ * @tc.number Telephony_NetworkSearch_getNrOptionMode_Promise_0500
+ * @tc.name Test getNrOptionMode(-1) to check the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_getNrOptionMode_Promise_0500', 0, async function (done) {
+ radio.getNrOptionMode(SLOT_2).then(data => {
+ console.log(`Telephony_NetworkSearch_getNrOptionMode_Promise_0500 end data: ${data}`);
+ expect(data === radio.NR_OPTION_UNKNOWN).assertTrue();
+ done();
+ }).catch(err => {
+ console.log(`Telephony_NetworkSearch_getNrOptionMode_Promise_0500 fail: ${err}`);
+ expect().assertFail();
+ done();
+ })
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_turnOnRadio_Async_0200
+ * @tc.name Test The function turnOnRadio
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_turnOnRadio_Async_0200', 0, async function (done) {
+ radio.turnOnRadio((err) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_turnOnRadio_Async_0200 turnOn fail: ${err}`);
+ done();
+ return;
+ }
+ console.log('Telephony_NetworkSearch_turnOnRadio_Async_0200 turnOn finish');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_turnOnRadio_Promise_0200
+ * @tc.name Test The function turnOnRadio
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_turnOnRadio_Promise_0200', 0, async function (done) {
+ try {
+ await radio.turnOnRadio();
+ console.log('Telephony_NetworkSearch_turnOnRadio_Promise_0200 success');
+ done();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_turnOnRadio_Promise_0200 fail ${err}`);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_turnOffRadio_Async_0200
+ * @tc.name Test The function turnOffRadio
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_turnOffRadio_Async_0200', 0, async function (done) {
+ radio.turnOffRadio((err) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_turnOffRadio_Async_0200 turnOff fail: ${err}`);
+ done();
+ return;
+ }
+ console.log('Telephony_NetworkSearch_turnOffRadio_Async_0200 turnOff finish');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_turnOffRadio_Promise_0200
+ * @tc.name Test The function turnOffRadio
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_turnOffRadio_Promise_0200', 0, async function (done) {
+ try {
+ await radio.turnOffRadio();
+ console.log('Telephony_NetworkSearch_turnOffRadio_Promise_0200 success');
+ done();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_turnOffRadio_Promise_0200 fail ${err}`);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_isRadioOn_Async_0200
+ * @tc.name Test The function isRadioOn
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_isRadioOn_Async_0200', 0, async function (done) {
+ radio.isRadioOn((err) => {
+ if (err) {
+ console.log(`Telephony_NetworkSearch_isRadioOn_Async_0200 fail: ${err}`);
+ done();
+ return;
+ }
+ console.log('Telephony_NetworkSearch_isRadioOn_Async_0200 finish');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_NetworkSearch_isRadioOn_Promise_0200
+ * @tc.name Test The function isRadioOn
+ * @tc.desc Function test
+ */
+ it('Telephony_NetworkSearch_isRadioOn_Promise_0200', 0, async function (done) {
+ try {
+ await radio.isRadioOn();
+ console.log('Telephony_NetworkSearch_isRadioOn_Promise_0200 success');
+ done();
+ } catch (err) {
+ console.log(`Telephony_NetworkSearch_isRadioOn_Promise_0200 fail ${err}`);
+ done();
+ }
+ });
+
+});
diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..aa6e0c68f39790c9a96bc4f170be5673dfef29ba
--- /dev/null
+++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "NetworkSearchTest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/network_search/network_search_errors/signature/openharmony_sx.p7b b/telephony/telephonyjstest/network_search/network_search_errors/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/telephony/telephonyjstest/network_search/network_search_errors/signature/openharmony_sx.p7b differ
diff --git a/telephony/telephonyjstest/sim/BUILD.gn b/telephony/telephonyjstest/sim/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..0e4d8d5a7b894bf46644cf5dd4f4b50627a152d6
--- /dev/null
+++ b/telephony/telephonyjstest/sim/BUILD.gn
@@ -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.
+
+import("//build/ohos_var.gni")
+
+group("sim") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "sim_manager_function_test:ActsSimManagerFunctionTest" ]
+ }
+}
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/BUILD.gn b/telephony/telephonyjstest/sim/sim_manager_function_test/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..7dedfbfeab096fd7111c83d52500a93d10205ac2
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_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("ActsSimManagerFunctionTest") {
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsSimManagerFunctionTest"
+}
+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/sim/sim_manager_function_test/Test.json b/telephony/telephonyjstest/sim/sim_manager_function_test/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..13e4b71590e925206c23a8c036946357d31a83d2
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_function_test/Test.json
@@ -0,0 +1,19 @@
+{
+ "description": "Function test of sim manager interface",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "540000",
+ "package": "com.ohos.simmanagertest",
+ "shell-timeout": "540000",
+ "native-test-timeout":"540000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "$module.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/config.json b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..5f6a69ff6207abfc5ddeccfbff399c31e1e4dd85
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/config.json
@@ -0,0 +1,61 @@
+{
+ "app": {
+ "bundleName": "com.ohos.simmanagertest",
+ "vendor": "ohos",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.ohos.simmanagertest",
+ "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.simmanagertest.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_manager_function_test/entry/src/main/js/default/app.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..d61b8caa653cfb8b0cdceb353771c56284c50051
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_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_manager_function_test/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_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_manager_function_test/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_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_manager_function_test/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_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_manager_function_test/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..371603e8dea03f96bec7d7d0692c22592a838671
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ SIM卡TEST
+
+
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..5e9c3a742931c17eb35cde56a0e59c338d8a5958
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_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_manager_function_test/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..4a597eff5e394f532d992554bc080451926e8275
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "Sim Test"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Sim Test - sim manager interface test"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..2f505b3914456589ad315a6c6780a08756a41dba
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/List.test.js
@@ -0,0 +1,16 @@
+/**
+ * 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.
+ */
+
+require('./SimManager.test');
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..46993607e98f09547811d40532c8bc1a5c15da12
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js
@@ -0,0 +1,1684 @@
+/**
+ * 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 sim from '@ohos.telephony.sim';
+import * as env from './lib/Const';
+import { describe, it, expect } from 'deccjsunit/index';
+
+describe('SimManagerTest', function () {
+
+ /**
+ * @tc.number Telephony_Sim_getISOCountryCodeForSim_Async_0200
+ * @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function
+ * can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getISOCountryCodeForSim_Async_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getISOCountryCodeForSim_Async_0200';
+ sim.getISOCountryCodeForSim(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getISOCountryCodeForSim_Promise_0200
+ * @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function
+ * can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getISOCountryCodeForSim_Promise_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getISOCountryCodeForSim_Promise_0200';
+ try {
+ var data = await sim.getISOCountryCodeForSim(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimOperatorNumeric_Async_0200
+ * @tc.name Enter exception parameters to test whether the getSimOperatorNumeric interface function
+ * can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimOperatorNumeric_Async_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimOperatorNumeric_Async_0200';
+ sim.getSimOperatorNumeric(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimOperatorNumeric_Promise_0200
+ * @tc.name Enter exception parameters to test whether the getSimOperatorNumeric interface function
+ * can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimOperatorNumeric_Promise_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimOperatorNumeric_Promise_0200';
+ try {
+ var data = await sim.getSimOperatorNumeric(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimSpn_Async_0200
+ * @tc.name Enter exception parameters to test whether the getSimSpn interface function can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimSpn_Async_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimSpn_Async_0200';
+ sim.getSimSpn(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} fail: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimSpn_Promise_0200
+ * @tc.name Enter exception parameters to test whether the getSimSpn interface function can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimSpn_Promise_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimSpn_Promise_0200';
+ try {
+ var data = await sim.getSimSpn(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimState_Async_0200
+ * @tc.name Enter exception parameters to test whether the getSimState interface function can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimState_Async_0200', 0, async function (done) {
+ sim.getSimState(env.SLOTID2, (err, data) => {
+ const CASE_NAME = 'Telephony_Sim_getSimState_Async_0200';
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimState_Promise_0200
+ * @tc.name Enter exception parameters to test whether the getSimState interface function can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimState_Promise_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimState_Promise_0200';
+ try {
+ var data = await sim.getSimState(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimGid1_Async_0200
+ * @tc.name Enter exception parameters to test whether the getSimGid1 interface function can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimGid1_Async_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimGid1_Async_0200';
+ sim.getSimGid1(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimGid1_Promise_0200
+ * @tc.name Enter exception parameters to test whether the getSimGid1 interface function can execute normally.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimGid1_Promise_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimGid1_Promise_0200';
+ try {
+ var data = await sim.getSimGid1(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, data = ${data}`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimAccountInfo_Async_0200
+ * @tc.name Test getSimAccountInfo async callback interface slotid exception,
+ * enter parameter 2, and check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimAccountInfo_Async_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimAccountInfo_Async_0200';
+ sim.getSimAccountInfo(env.SLOTID2, (err) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect error: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} test fail.`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimAccountInfo_Promise_0200
+ * @tc.name Test getSimAccountInfo promise interface slotid exception,
+ * enter parameter 2, and check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimAccountInfo_Promise_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimAccountInfo_Promise_0200';
+ try {
+ await sim.getSimAccountInfo(env.SLOTID2);
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect error: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_setDefaultVoiceSlotId_Async_0100
+ * @tc.name Test the setDefaultVoiceLotid interface when the input SIM ID parameter is 2.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_setDefaultVoiceSlotId_Async_0100', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_setDefaultVoiceSlotId_Async_0100';
+ sim.setDefaultVoiceSlotId(env.SLOTID2, (err) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_setDefaultVoiceSlotId_Promise_0100
+ * @tc.name Test the setDefaultVoiceLotid interface when the input SIM ID parameter is 2.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_setDefaultVoiceSlotId_Promise_0100', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_setDefaultVoiceSlotId_Promise_0100';
+ try {
+ await sim.setDefaultVoiceSlotId(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getDefaultVoiceSlotId_Async_0200
+ * @tc.name The test first sets the default card number and then calls
+ * the getDefaultVoiceLotid interface to get the SIM ID.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getDefaultVoiceSlotId_Async_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotId_Async_0200';
+ sim.getDefaultVoiceSlotId((err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getDefaultVoiceSlotId_Promise_0200
+ * @tc.name The test first sets the default card number and then calls
+ * the getDefaultVoiceLotid interface to get the default SIM ID.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getDefaultVoiceSlotId_Promise_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotId_Promise_0200';
+ try {
+ let data = await sim.getDefaultVoiceSlotId();
+ console.log(`${CASE_NAME}, data = ${data}`);
+ expect().assertFail();
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockPin_Async_0400
+ * @tc.name The status of the card is ready state, the unlockPin interface is tested, and slotId is abnormal.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockPin_Async_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockPin_Async_0400';
+ sim.unlockPin(env.SLOTID2, env.CORRECT_PIN, err => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockPin_Promise_0400
+ * @tc.name The status of the card is ready state, the unlockPin interface is tested, and slotId is abnormal.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockPin_Promise_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockPin_Promise_0400';
+ try {
+ await sim.unlockPin(env.SLOTID2, env.CORRECT_PIN);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockPuk_Async_0400
+ * @tc.name The card status is ready state, and the unlockPuk interface is tested.
+ * The slotId parameter is abnormal.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockPuk_Async_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockPuk_Async_0400';
+ sim.unlockPuk(env.SLOTID2, env.CORRECT_PIN, env.CORRECT_PUK, err => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockPuk_Promise_0400
+ * @tc.name The card status is ready state, and the unlockPuk interface is tested.
+ * The slotId parameter is abnormal.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockPuk_Promise_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockPuk_Promise_0400';
+ try {
+ await sim.unlockPuk(env.SLOTID2, env.CORRECT_PIN, env.CORRECT_PUK);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_alterPin_Async_0400
+ * @tc.name The status of the card is ready state, and the alterPin interface. SlotId is abnormal.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_alterPin_Async_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_alterPin_Async_0400';
+ sim.alterPin(env.SLOTID2, env.CORRECT_PIN, env.ALTER_PIN, err => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_alterPin_Promise_0400
+ * @tc.name The status of the card is ready state, and the alterPin interface is tested. SlotId is abnormal.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_alterPin_Promise_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_alterPin_Promise_0400';
+ try {
+ await sim.alterPin(env.SLOTID2, env.CORRECT_PIN, env.ALTER_PIN);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_SetLockState_Async_1000
+ * @tc.name The card is in the ready state, test the SetLockState async callback interface
+ * slotId exception into the parameter 2, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_SetLockState_Async_1000', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_SetLockState_Async_1000';
+ const lockInfo = { lockType: sim.PIN_LOCK, state: sim.LOCK_OFF, password: env.CORRECT_PIN };
+ sim.setLockState(env.SLOTID2, lockInfo, error => {
+ if (error) {
+ console.log(`${CASE_NAME} setLockState expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} test fail`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_SetLockState_Promise_1000
+ * @tc.name The card is in the ready state, test the SetLockState promise interface
+ * slotId exception into the parameter 2, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_SetLockState_Promise_1000', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_SetLockState_Promise_1000';
+ const lockInfo = { lockType: sim.PIN_LOCK, state: sim.LOCK_OFF, password: env.CORRECT_PIN };
+ try {
+ await sim.setLockState(env.SLOTID2, lockInfo);
+ console.log(`${CASE_NAME} test fail`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} setLockState expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_GetSimIccId_Async_0600
+ * @tc.name CDMA file, getSimIccId async callback interface slotId
+ * exception enters parameter -1 test
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_GetSimIccId_Async_0600', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_GetSimIccId_Async_0600';
+ sim.getSimIccId(env.SLOTID2, error => {
+ if (error) {
+ console.log(`${CASE_NAME} getSimIccId expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish.`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} test fail.`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_GetSimIccId_Promise_0600
+ * @tc.name CDMA file, getSimIccId promise interface slotId
+ * exception enters parameter -1 test
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_GetSimIccId_Promise_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_GetSimIccId_Promise_0600';
+ try {
+ await sim.getSimIccId(env.SLOTID2);
+ expect().assertFail();
+ console.log(`${CASE_NAME} test fail.`);
+ } catch (error) {
+ console.log(`${CASE_NAME} getSimIccId expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish.`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getIMSI_Async_0200
+ * @tc.name To test the getIMSI interface, enter slotid as 4 and expect the result to enter err.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getIMSI_Async_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getIMSI_Async_0200';
+ sim.getIMSI(env.SLOTID2, err => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getIMSI_Promise_0200
+ * @tc.name To test the getIMSI interface, enter slotid as 4 and expect the result to enter err.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getIMSI_Promise_0200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getIMSI_Async_0200';
+ try {
+ await sim.getIMSI(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_isSimActive_Async_0700
+ * @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
+ * check the callback value, and expect the callback result flase
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_isSimActive_Async_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700';
+ sim.isSimActive(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} fail, err: ${err.message}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data).assertFalse();
+ console.log(`${CASE_NAME} finish`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_isSimActive_Promise_0700
+ * @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
+ * check the callback value, and expect the callback result flase
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_isSimActive_Promise_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_isSimActive_Promise_0700';
+ try {
+ let data = await sim.isSimActive(env.SLOTID2);
+ expect(data).assertFalse();
+ } catch (err) {
+ console.log(`${CASE_NAME} isSimActive fail, err: ${err.message}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} finish`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_activateSim_Async_0600
+ * @tc.name Test the slotId exception input parameter 2 of activateSim interface,
+ * check the callback value, and expect to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_activateSim_Async_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_activateSim_Async_0600';
+ sim.activateSim(env.SLOTID2, (err) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_activateSim_Promise_0600
+ * @tc.name Test the slotId exception input parameter 2 of activateSim interface,
+ * check the callback value, and expect to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_activateSim_Promise_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_activateSim_Promise_0600';
+ try {
+ await sim.activateSim(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail`);
+ expect().assertFail();
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_deactivateSim_Async_0600
+ * @tc.name Test the deactivateSim interface slotId exception input parameter 2
+ * and check the callback value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_deactivateSim_Async_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_deactivateSim_Async_0600';
+ sim.deactivateSim(env.SLOTID2, (err) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_deactivateSim_Promise_0600
+ * @tc.name Test the deactivateSim interface slotId exception input parameter
+ * 2 and check the callback value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_deactivateSim_Promise_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_deactivateSim_Promise_0600';
+ try {
+ await sim.deactivateSim(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail`);
+ expect().assertFail();
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_hasSimCard_Async_0600
+ * @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
+ * check the callback value, and expect the callback result flase
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_hasSimCard_Async_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600';
+ sim.hasSimCard(env.SLOTID2, (err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, err: ${err.message}`);
+ done();
+ return;
+ }
+ expect(data).assertFalse();
+ console.log(`${CASE_NAME} finish`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_hasSimCard_Promise_0600
+ * @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
+ * check the callback value, and expect the callback result flase
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_hasSimCard_Promise_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_hasSimCard_Promise_0600';
+ try {
+ let data = await sim.hasSimCard(env.SLOTID2);
+ expect(data).assertFalse();
+ } catch (err) {
+ expect().assertFail();
+ console.log(`${CASE_NAME} fail, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} finish`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_setShowName_Async_0700
+ * @tc.name Test setShowName slotId exception input parameter 2 to check the
+ * callback value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_setShowName_Async_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_setShowName_Async_0700';
+ sim.setShowName(env.SLOTID2, env.CARD_NAME, (err) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_setShowName_Promise_0700
+ * @tc.name Test setShowName promise interface slotId exception into parameter 2, check the return value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_setShowName_Promise_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_setShowName_Promise_0700';
+ try {
+ await sim.setShowName(env.SLOTID2, env.CARD_NAME);
+ } catch (err) {
+ console.log(`${CASE_NAME} finish, error : ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail`);
+ expect().assertFail();
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getShowName_Async_0700
+ * @tc.name Test the slotId exception input parameter 2 of getShowName and
+ * check the return value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getShowName_Async_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getShowName_Async_0700';
+ sim.getShowName(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} , data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getShowName_Promise_0700
+ * @tc.name Test the slotId exception input parameter 2 of getShowName and check the
+ * return value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+
+ it('Telephony_Sim_getShowName_Promise_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getShowName_Promise_0700';
+ try {
+ let data = await sim.getShowName(env.SLOTID2);
+ console.log(`${CASE_NAME} fail, data : ${data}`);
+ expect().assertFail();
+ done();
+ } catch (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_Sim_setShowNumber_Async_0700
+ * @tc.name Test setShowNumber slotId exception input parameter 2, check the callback value,
+ * and expect to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_setShowNumber_Async_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_setShowNumber_Async_0700';
+ sim.setShowNumber(env.SLOTID2, env.CARD_NUMBER, (err) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_setShowNumber_Promise_0700
+ * @tc.name Test setShowNumber slotId exception input parameter 2 and check
+ * the return value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_setShowNumber_Promise_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_setShowNumber_Promise_0700';
+ try {
+ await sim.setShowNumber(env.SLOTID2, env.CARD_NUMBER);
+ console.log(`${CASE_NAME} fail`);
+ expect().assertFail();
+ done();
+ } catch (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getShowNumber_Async_0600
+ * @tc.name Test the slotId exception of the getShowNumber async callback interface into parameter 2,
+ * check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getShowNumber_Async_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getShowNumber_Async_0600';
+ sim.getShowNumber(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} fail, data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getShowNumber_Promise_0600
+ * @tc.name Test the slotId exception of the getShowNumber interface into parameter 2, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getShowNumber_Promise_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getShowNumber_Promise_0600';
+ try {
+ let data = await sim.getShowNumber(env.SLOTID2);
+ console.log(`${CASE_NAME} fail, data : ${data}`);
+ expect().assertFail();
+ done();
+ } catch (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getOperatorConfigs_Async_0700
+ * @tc.name Test the getOperatorConfigs slotId exception input parameter 2 and check the
+ * callback value, expecting to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getOperatorConfigs_Async_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getOperatorConfigs_Async_0700';
+ sim.getOperatorConfigs(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} , data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getOperatorConfigs_Promise_0700
+ * @tc.name Test the getOperatorConfigs slotId exception input parameter 2 and check
+ * the callback value, expecting to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getOperatorConfigs_Promise_0700', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getOperatorConfigs_Promise_0700';
+ try {
+ let data = await sim.getOperatorConfigs(env.SLOTID2);
+ console.log(`${CASE_NAME} fail, data : ${data}`);
+ expect().assertFail();
+ done();
+ } catch (err) {
+ console.log(`${CASE_NAME} finish, err: ${err.message}`);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getActiveSimAccountInfoList_Async_0500
+ * @tc.name When there is no card, test the getActiveSimAccountInfoList interface and check the return value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getActiveSimAccountInfoList_Async_0500', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_getActiveSimAccountInfoList_Async_0500';
+ sim.getActiveSimAccountInfoList(error => {
+ if (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ } else {
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ }
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getActiveSimAccountInfoList_Promise_0500
+ * @tc.name When there is no card, test the getActiveSimAccountInfoList interface and check the return value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getActiveSimAccountInfoList_Promise_0500', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getActiveSimAccountInfoList_Async_0500';
+ try {
+ await sim.getActiveSimAccountInfoList();
+ expect().assertFail();
+ console.log(`${CASE_NAME} test fail.`);
+ } catch (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockPin2_Async_1000
+ * @tc.name Test slotid exception input parameter 2 of unlockPin2 and check the callback
+ * value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockPin2_Async_1000', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockPin2_Async_1000';
+ sim.unlockPin2(env.SLOTID2, env.INCORRECT_PIN2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} , data: ${JSON.stringify(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockPin2_Promise_1000
+ * @tc.name Test slotid exception input parameter 2 of unlockPin2 and check the callback
+ * value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockPin2_Promise_1000', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockPin2_Promise_1000';
+ try {
+ await sim.unlockPin2(env.SLOTID2, env.INCORRECT_PIN2);
+ expect().assertFail();
+ } catch (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockPuk2_Async_1100
+ * @tc.name Test the slotId exception input parameter 2 of the unlockPuk2
+ * interface and check the callback value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockPuk2_Async_1100', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockPuk2_Async_1100';
+ sim.unlockPuk2(env.SLOTID2, env.INCORRECT_PIN2, env.INCORRECT_PUK2_LEN8, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect err: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME}, data: ${JSON.stringify(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockPuk2_Promise_1100
+ * @tc.name Test the slotId exception input parameter 2 of the unlockPuk2 interface
+ * and check the callback value, expecting to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockPuk2_Promise_1100', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockPuk2_Async_1100';
+ try {
+ const data = await sim.unlockPuk2(env.SLOTID2, env.INCORRECT_PIN2, env.INCORRECT_PUK2_LEN8);
+ console.log(`${CASE_NAME}, data: ${JSON.stringify(data)}`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} expect err: ${error.message}`);
+ console.log(`${CASE_NAME} finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_alterPin2_Async_1100
+ * @tc.name Test alterPin2 interface exception slotId input parameter 2, check the callback
+ * value, expecting to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_alterPin2_Async_1100', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_alterPin2_Async_1100';
+ sim.alterPin2(env.SLOTID2, env.INCORRECT_PIN2, env.INCORRECT_PIN2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} expect error: ${err.message}`);
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} data: ${JSON.stringify(data)}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_alterPin2_Promise_1100
+ * @tc.name Test alterPin2 interface exception slotId input parameter 2, check the callback
+ * value, expecting to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_alterPin2_Promise_1100', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_alterPin2_Promise_1100';
+ try {
+ const data = await sim.alterPin2(env.SLOTID2, env.INCORRECT_PIN2, env.INCORRECT_PIN2);
+ console.log(`${CASE_NAME} data: ${JSON.stringify(data)}`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_queryIccDiallingNumbers_Async_0800
+ * @tc.name Test sim.queryIccDiallingNumbers(soltId: 2, type: 1, callback:
+ * AsyncCallback>), expect return a empty array.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_queryIccDiallingNumbers_Async_0800', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_queryIccDiallingNumbers_Async_0800';
+ sim.queryIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, (error, data) => {
+ if (error) {
+ console.log(`${CASE_NAME} query error: ${error.message}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data.length === 0).assertTrue();
+ console.log(`${CASE_NAME} finish`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number elephony_Sim_queryIccDiallingNumbers_Promise_0800
+ * @tc.name Test sim.queryIccDiallingNumbers(soltId: 2, type: 1):Promise>
+ * promise interface, expect result is a empty array.
+ * @tc.desc Function test
+ */
+ it('telephony_Sim_queryIccDiallingNumbers_Promise_0800', 0, async function (done) {
+ const CASE_NAME = 'telephony_Sim_queryIccDiallingNumbers_Promise_0800';
+ try {
+ const contacts = await sim.queryIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT);
+ expect(contacts.length === 0).assertTrue();
+ console.log(`${CASE_NAME} test finish.`);
+ } catch (error) {
+ console.log(`${CASE_NAME} query error:${error.message}`);
+ expect().assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_addIccDiallingNumbers_Async_0900
+ * @tc.name Test sim.addIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers:
+ * {recordNumber: 1, alphaTag: 'test', number: '12345678', pin2: '123@#ABCD'},
+ * callback: AsyncCallback) async callback interface, expect enter error.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_addIccDiallingNumbers_Async_0900', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_addIccDiallingNumbers_Async_0900';
+ const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
+ const GENERAL_CONTACT_INFO = Object.assign({}, { 'pin2': env.INCORRECT_PIN2 }, CONTACT_INFO);
+ sim.addIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, GENERAL_CONTACT_INFO, error => {
+ if (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} finish.`);
+ } else {
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ }
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_addIccDiallingNumbers_Promise_0900
+ * @tc.name Test sim.addIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers:
+ * {recordNumber: 1, alphaTag: 'test', number: '12345678', pin2: '123@#ABCD'}): Promise
+ * promise interface, expect enter error.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_addIccDiallingNumbers_Promise_0900', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_addIccDiallingNumbers_Promise_0900';
+ const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
+ const GENERAL_CONTACT_INFO = Object.assign({}, { 'pin2': env.INCORRECT_PIN2 }, CONTACT_INFO);
+ try {
+ await sim.addIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, GENERAL_CONTACT_INFO);
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish.`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_delIccDiallingNumbers_Async_0900
+ * @tc.name Test sim.delIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers: DiallingNumbersInfo,
+ * callback: AsyncCallback) async callback interface, expect enter error.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_delIccDiallingNumbers_Async_0900', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_delIccDiallingNumbers_Async_0900';
+ const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
+ sim.delIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, CONTACT_INFO, error => {
+ if (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} finish.`);
+ } else {
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ }
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_delIccDiallingNumbers_Promise_0900
+ * @tc.name Test sim.delIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers: DiallingNumbersInfo):
+ * Promise promise interface to delete record, expect enter error.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_delIccDiallingNumbers_Promise_0900', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_delIccDiallingNumbers_Promise_0900';
+ const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
+ try {
+ await sim.delIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, CONTACT_INFO);
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_updateIccDiallingNumbers_Async_1200
+ * @tc.name Test sim.updateIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers:
+ * {recordNumber: 1, alphaTag: 'test_Update', number: '87654321', pin2:'123@#ABCD'}, callback:
+ * AsyncCallback) async callback interface, expect enter error.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_updateIccDiallingNumbers_Async_1200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_updateIccDiallingNumbers_Async_1200';
+ let updateInfo = { recordNumber: 1, alphaTag: 'test_Update', number: '87654321', pin2: '123@#ABCD' };
+ sim.updateIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, updateInfo, error => {
+ if (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish.`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_updateIccDiallingNumbers_Promise_1200
+ * @tc.name Test sim.updateIccDiallingNumbers(soltId: 2, type: 1, diallingNumbers:
+ * {recordNumber: 1, alphaTag: 'test_Update', number: '87654321', pin2:'123@#ABCD'})
+ * promise interface, expect enter error.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_updateIccDiallingNumbers_Promise_1200', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_updateIccDiallingNumbers_Promise_1200';
+ let updateInfo = { recordNumber: 1, alphaTag: 'test_Update', number: '87654321', pin2: '123@#ABCD' };
+ try {
+ console.log(`${CASE_NAME} update`);
+ await sim.updateIccDiallingNumbers(env.SLOTID2, sim.GENERAL_CONTACT, updateInfo);
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish.`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimTelephoneNumber_Async_0600
+ * @tc.name Test getSimTelephoneNumber slotId exception input parameter 2,
+ * check the callback value, and expect to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimTelephoneNumber_Async_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimTelephoneNumber_Async_0600';
+ sim.getSimTelephoneNumber(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} , data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getSimTelephoneNumber_Promise_0600
+ * @tc.name Test getSimTelephoneNumber slotId exception input parameter 2, check the callback
+ * value, and expect to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getSimTelephoneNumber_Promise_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getSimTelephoneNumber_Promise_0600';
+ let data;
+ try {
+ data = await sim.getSimTelephoneNumber(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME}, data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getVoiceMailIdentifier_Async_0600
+ * @tc.name Test getVoiceMailIdentifier slotId exception input parameter 2, check the
+ * callback value, and expect to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getVoiceMailIdentifier_Async_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getVoiceMailIdentifier_Async_0600';
+ sim.getVoiceMailIdentifier(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} , data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getVoiceMailIdentifier_Promise_0600
+ * @tc.name Test getVoiceMailIdentifier slotId exception input parameter 2, check the callback
+ * value, and expect to enter err
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getVoiceMailIdentifier_Promise_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getVoiceMailIdentifier_Promise_0600';
+ let data;
+ try {
+ data = await sim.getVoiceMailIdentifier(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME}, data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getVoiceMailNumber_Async_0600
+ * @tc.name Test getVoiceMailNumber slotId exception input parameter 2, check the callback
+ * value, and expect to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getVoiceMailNumber_Async_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getVoiceMailNumber_Async_0600';
+ sim.getVoiceMailNumber(env.SLOTID2, (err, data) => {
+ if (err) {
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} , data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getVoiceMailNumber_Promise_0600
+ * @tc.name Test getVoiceMailNumber slotId exception input parameter 2, check the callback
+ * value, and expect to enter ERR
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getVoiceMailNumber_Promise_0600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_getVoiceMailNumber_Promise_0600';
+ let data;
+ try {
+ data = await sim.getVoiceMailNumber(env.SLOTID2);
+ } catch (err) {
+ console.log(`${CASE_NAME} finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME}, data : ${data}`);
+ expect().assertFail();
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_setVoiceMailInfo_Async_0400
+ * @tc.name Test the setVoiceMailInfo async callback interface, slotId is 2, expect enter error.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_setVoiceMailInfo_Async_0400', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_setVoiceMailInfo_Async_0400';
+ sim.setVoiceMailInfo(env.SLOTID2, env.MAIL_NAME_LEN12, env.MAIL_NUMBER_LEN20, error => {
+ if (error) {
+ console.log(`${CASE_NAME} setVoiceMailInfo expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ } else {
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ }
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_setVoiceMailInfo_Promise_0400
+ * @tc.name Test the setVoiceMailInfo promise interface, slotId is 2, expect enter error.
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_setVoiceMailInfo_Promise_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_setVoiceMailInfo_Promise_0400';
+ try {
+ await sim.setVoiceMailInfo(env.SLOTID2, env.MAIL_NAME_LEN12, env.MAIL_NUMBER_LEN20);
+ console.log(`${CASE_NAME} test fail.`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} setVoiceMailInfo expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_getMaxSimCount_0100
+ * @tc.name Test the getMaxSimCount interface and view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_getMaxSimCount_0100', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_getMaxSimCount_0100';
+ let simCount = sim.getMaxSimCount();
+ expect(simCount > env.SIM_MIN_COUNT).assertTrue();
+ console.log(`${CASE_NAME} test finish.`);
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_GetLockState_Async_0300
+ * @tc.name Test the GetLockState async callback interface, enter parameter 2
+ * for slotId exception, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_GetLockState_Async_0300', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_GetLockState_Async_0300';
+ sim.getLockState(env.SLOTID2, sim.PIN_LOCK, error => {
+ if (error) {
+ console.log(`${CASE_NAME} getLockState expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} test fail`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_GetLockState_Promise_0300
+ * @tc.name Test the GetLockState promise interface, enter parameter 2
+ * for slotId exception, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_GetLockState_Promise_0300', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_GetLockState_Promise_0300';
+ try {
+ await sim.getLockState(env.SLOTID2, sim.PIN_LOCK);
+ console.log(`${CASE_NAME} test fail`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} getLockState expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_GetCardType_Async_0400
+ * @tc.name Verify that the slotId of the GetCardType async callback interface is abnormal
+ * and enter parameter 2, and check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_GetCardType_Async_0400', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_GetCardType_Async_0400';
+ sim.getCardType(env.SLOTID2, (error, cardType) => {
+ if (error) {
+ console.log(`${CASE_NAME} GetCardType error: ${error.message}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(cardType === sim.UNKNOWN_CARD).assertTrue();
+ console.log(`${CASE_NAME} test finish.`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_GetCardType_Promise_0400
+ * @tc.name Verify that the slotId of the GetCardType promise interface is abnormal
+ * and enter parameter 2, and check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_GetCardType_Promise_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_GetCardType_Promise_0400';
+ try {
+ const cardType = await sim.getCardType(env.SLOTID2);
+ expect(cardType === sim.UNKNOWN_CARD).assertTrue();
+ console.log(`${CASE_NAME} test finish.`);
+ } catch (error) {
+ console.log(`${CASE_NAME} GetCardType error: ${error.message}`);
+ expect().assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_SendEnvelopeCmd_Async_0300
+ * @tc.name Test SendEnvelopeCmd async callback interface, enter parameter 2
+ * for slotId exception, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_SendEnvelopeCmd_Async_0300', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_SendEnvelopeCmd_Async_0300';
+ sim.sendEnvelopeCmd(env.SLOTID2, env.STK_CMD, (error) => {
+ if (error) {
+ console.log(`${CASE_NAME} SendEnvelopeCmd expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} test fail`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_SendEnvelopeCmd_Promise_0300
+ * @tc.name Test SendEnvelopeCmd promise interface, enter parameter 2
+ * for slotId exception, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_SendEnvelopeCmd_Promise_0300', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_SendEnvelopeCmd_Promise_0300';
+ try {
+ await sim.sendEnvelopeCmd(env.SLOTID2, env.STK_CMD);
+ console.log(`${CASE_NAME} test fail`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} SendEnvelopeCmd expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_SendTerminalResponseCmd_Async_0300
+ * @tc.name Test SendTerminalResponseCmd async callback interface, enter parameter 2
+ * for slotId exception, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_SendTerminalResponseCmd_Async_0300', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_SendTerminalResponseCmd_Async_0300';
+ sim.sendTerminalResponseCmd(env.SLOTID2, env.STK_CMD, (error) => {
+ if (error) {
+ console.log(`${CASE_NAME} SendTerminalResponseCmd expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ done();
+ return;
+ }
+ console.log(`${CASE_NAME} test fail`);
+ expect().assertFail();
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_SendTerminalResponseCmd_Promise_0300
+ * @tc.name Test SendTerminalResponseCmd promise interface, enter parameter 2
+ * for slotId exception, check the callback value
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_SendTerminalResponseCmd_Promise_0300', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_SendTerminalResponseCmd_Promise_0300';
+ try {
+ await sim.sendTerminalResponseCmd(env.SLOTID2, env.STK_CMD);
+ console.log(`${CASE_NAME} test fail`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${CASE_NAME} SendTerminalResponseCmd expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish`);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_hasOperatorPrivileges_Async_0400
+ * @tc.name Test hasOperatorPrivileges interface slotId exception enter parameter 2,
+ * check the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_hasOperatorPrivileges_Async_0400', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Async_0400';
+ sim.hasOperatorPrivileges(env.SLOTID2, (error, result) => {
+ if (error) {
+ console.log(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(result).assertFalse();
+ console.log(`${CASE_NAME} test finish.`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_hasOperatorPrivileges_Promise_0400
+ * @tc.name Test hasOperatorPrivileges interface slotId exception enter parameter 2,
+ * check the returned result
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_hasOperatorPrivileges_Promise_0400', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Promise_0400';
+ try {
+ const result = await sim.hasOperatorPrivileges(env.SLOTID2);
+ expect(result).assertFalse();
+ console.log(`${CASE_NAME} test finish.`);
+ } catch (error) {
+ console.log(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`);
+ expect().assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockSimLock_Async_2600
+ * @tc.name Test the unlocksimLock interface slotId exception into parameter 2, view the callback result
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockSimLock_Async_2600', 0, function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockSimLock_Async_2600';
+ const lockInfo = { lockType: sim.PN_PIN_LOCK, password: env.SIM_PN_PIN_PASSWORD };
+ sim.unlockSimLock(env.SLOTID2, lockInfo, async (error) => {
+ if (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish.`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${CASE_NAME} test fail.`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_Sim_unlockSimLock_Promise_2600
+ * @tc.name Test the unlocksimLock interface slotId exception into parameter 2, view the return result
+ * @tc.desc Function test
+ */
+ it('Telephony_Sim_unlockSimLock_Promise_2600', 0, async function (done) {
+ const CASE_NAME = 'Telephony_Sim_unlockSimLock_Promise_2600';
+ const lockInfo = { lockType: sim.PN_PIN_LOCK, password: env.SIM_PN_PIN_PASSWORD };
+ try {
+ await sim.unlockSimLock(env.SLOTID2, lockInfo);
+ expect().assertFail();
+ console.log(`${CASE_NAME} test fail.`);
+ } catch (error) {
+ console.log(`${CASE_NAME} expect error: ${error.message}`);
+ console.log(`${CASE_NAME} test finish.`);
+ }
+ done();
+ });
+});
\ No newline at end of file
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/lib/Const.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/lib/Const.js
new file mode 100644
index 0000000000000000000000000000000000000000..3f2dd04d8f93c84c9e70c445be1c3e172f77c757
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/lib/Const.js
@@ -0,0 +1,30 @@
+/**
+ * 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 SLOTID2 = 2;
+export const CORRECT_PIN = '1234';
+export const CORRECT_PUK = '12345678';
+export const CORRECT_PIN2 = '12345678';
+export const INCORRECT_PIN2 = '4321';
+export const INCORRECT_PUK2_LEN8 = '12345678';
+export const ALTER_PIN = '1234';
+export const LOCK_STATE = { SUCCESS: 0, FAILURE: -1, EXCEPTION: -2 };
+export const CARD_NAME = '1234';
+export const CARD_NUMBER = '1234';
+export const MAIL_NAME_LEN12 = '123#@%_ABCDE';
+export const MAIL_NUMBER_LEN20 = '01234567890123456789';
+export const SIM_MIN_COUNT = 0;
+export const STK_CMD = 'D30781020181900101';
+export const SIM_PN_PIN_PASSWORD = '1111';
\ No newline at end of file
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..4a597eff5e394f532d992554bc080451926e8275
--- /dev/null
+++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "Sim Test"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Sim Test - sim manager interface test"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/signature/openharmony_sx.p7b b/telephony/telephonyjstest/sim/sim_manager_function_test/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/telephony/telephonyjstest/sim/sim_manager_function_test/signature/openharmony_sx.p7b differ
diff --git a/telephony/telephonyjstest/sms_mms/BUILD.gn b/telephony/telephonyjstest/sms_mms/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..456564752c1c76259389440aa59590676d9b19ab
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/BUILD.gn
@@ -0,0 +1,20 @@
+# 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")
+
+group("sms_mms") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "sms_mms_error:SmsMmsErrorTest" ]
+ }
+}
diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_error/BUILD.gn b/telephony/telephonyjstest/sms_mms/sms_mms_error/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..03ec5c041b6579515f1e07b8224dbcb923326c10
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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("SmsMmsErrorTest") {
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActSmsMmsErrorTest"
+}
+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_error/Test.json b/telephony/telephonyjstest/sms_mms/sms_mms_error/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..6b6f4c2cbda37c23d329b62e872d7273d75ca6ac
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/config.json b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..049a30f90d882a4b1dcfe510234883aa13ccb1b9
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/js/default/app.js b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..f16c40ec1e4f1bd06067470db310384d6d51314b
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..2f9470d82c49675a64972657d8d367cd95e51c63
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..5217735899f1d17ef21e175da57268f6decd2e30
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
+require('./SmsMmsError.test.js')
+
+
+
diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/SmsMmsError.test.js b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/SmsMmsError.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6d8b76e56b39c6673bda494b5a12cf21e1ab676b
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/js/test/SmsMmsError.test.js
@@ -0,0 +1,739 @@
+/*
+ * 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 sms from '@ohos.telephony.sms';
+import {
+ describe,
+ beforeAll,
+ beforeEach,
+ afterEach,
+ afterAll,
+ it,
+ expect
+} from 'deccjsunit/index';
+
+describe('SmsMmsErrorTest', function () {
+ const FALSE_SLOT_ID = 9;
+ const CORRECT_SMS_PDU = '01000F9168683106019196F400080A00680065006C006C006F';
+ const eorroMessagePath = '/data/telephony/deSrc/EorroMessagePath.mms';
+ const IDENTIFIER_MIN = 0;
+ const IDENTIFIER_MAX = 0xFFFF;
+ const RANTYPE_GSM = 1;
+ var rawArrayNull = [];
+ const SMS_SEND_DST_NUMBER = '';
+ const MAX_CHINESE_MESSAGE_LENTH = 63;
+ const MAX_MESSAGE_LENTH = 2401;
+
+ /*
+ * @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
+ */
+ it('Telephony_SmsMms_addSimMessage_Async_0200', 0, async function (done) {
+ let data = {
+ slotId: FALSE_SLOT_ID,
+ smsc: '',
+ pdu: CORRECT_SMS_PDU,
+ status: sms.SIM_MESSAGE_STATUS_SENT
+ };
+ sms.addSimMessage(data, (err, result) => {
+ if (err) {
+ console.log('Telephony_SmsMms_addSimMessage_Async_0200 finish');
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_SmsMms_addSimMessage_Async_0200 fail');
+ done();
+ });
+ });
+
+ /*
+ * @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
+ */
+ it('Telephony_SmsMms_addSimMessage_Promise_0200', 0, async function (done) {
+ let data = {
+ slotId: FALSE_SLOT_ID,
+ smsc: '',
+ pdu: CORRECT_SMS_PDU,
+ status: sms.SIM_MESSAGE_STATUS_SENT
+ };
+ try {
+ await sms.addSimMessage(data);
+ expect().assertFail();
+ console.log('Telephony_SmsMms_addSimMessage_Promise_0200 fail');
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_addSimMessage_Promise_0200 finish');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_delSimMessage_Async_0200
+ * @tc.name When SLOTID is the wrong value,Deletes a text message from the SIM card fail
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_delSimMessage_Async_0200', 0, async function (done) {
+ sms.delSimMessage(FALSE_SLOT_ID, 0, (err) => {
+ if (err) {
+ console.log('Telephony_SmsMms_delSimMessage_Async_0200 delSimMessage finish');
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_SmsMms_delSimMessage_Async_0200 fail');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_delSimMessage_Promise_0200
+ * @tc.name When SLOTID is the wrong value,Deletes a text message from the SIM card fail
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_delSimMessage_Promise_0200', 0, async function (done) {
+ try {
+ await sms.delSimMessage(FALSE_SLOT_ID, 0);
+ expect().assertFail();
+ console.log('Telephony_SmsMms_delSimMessage_Promise_0200 fail');
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_delSimMessage_Promise_0200 finish');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_updateSimMessage_Async_0100
+ * @tc.name When SLOTID is the wrong value,Failed to update SIM card SMS record
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_updateSimMessage_Async_0100', 0, async function (done) {
+ let upData = {
+ slotId: FALSE_SLOT_ID,
+ msgIndex: 0,
+ newStatus: sms.SIM_MESSAGE_STATUS_SENT,
+ pdu: CORRECT_SMS_PDU,
+ smsc: ''
+ };
+ sms.updateSimMessage(upData, (err) => {
+ if (err) {
+ console.log('Telephony_SmsMms_updateSimMessage_Async_0100 update finish');
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_SmsMms_updateSimMessage_Async_0100 update fail');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_updateSimMessage_Promise_0100
+ * @tc.name When SLOTID is the wrong value,Failed to update SIM card SMS record
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_updateSimMessage_Promise_0100', 0, async function (done) {
+ let upData = {
+ slotId: FALSE_SLOT_ID,
+ msgIndex: 0,
+ newStatus: sms.SIM_MESSAGE_STATUS_SENT,
+ pdu: CORRECT_SMS_PDU,
+ smsc: ''
+ };
+ try {
+ await sms.updateSimMessage(upData);
+ expect().assertFail();
+ console.log('Telephony_SmsMms_updateSimMessage_Promise_0100 fail');
+ done();
+ return;
+ } catch (err) {
+ console.log('Telephony_SmsMms_updateSimMessage_Promise_0100 getAllSimMessages cur finish');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_getAllSIMMessages_Async_0200
+ * @tc.name When "SLOTID" is an error value,Failed to query all SMS records for SIM card
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getAllSIMMessages_Async_0200', 0, async function (done) {
+ sms.getAllSimMessages(FALSE_SLOT_ID, (err, result) => {
+ if (err) {
+ expect().assertFail();
+ console.log('Telephony_SmsMms_getAllSIMMessages_Async_0200 fail');
+ done();
+ return;
+ }
+ expect(result === undefined || result.length === 0).assertTrue();
+ console.log('Telephony_SmsMms_getAllSIMMessages_Async_0200 finish');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_getAllSIMMessages_Promise_0200
+ * @tc.name When "SLOTID" is an error value,Failed to query all SMS records for SIM card
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getAllSIMMessages_Promise_0200', 0, async function (done) {
+ try {
+ let promise = await sms.getAllSimMessages(FALSE_SLOT_ID);
+ expect(promise === null || promise === undefined || promise.length === 0).assertTrue();
+ console.log('Telephony_SmsMms_getAllSIMMessages_Promise_0200 getAllSimMessages cur finish');
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log('Telephony_SmsMms_getAllSIMMessages_Promise_0200 fail');
+ done();
+ }
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_createMessage_Async_0200
+ * @tc.name Call interface CreateMessage,
+ * The incoming PDU is empty, the specification is 3GPP,
+ * shortMessage isn't empty
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_createMessage_Async_0200', 0, async function (done) {
+ sms.createMessage(rawArrayNull, '3gpp', (err, shortMessage) => {
+ if (err) {
+ console.log('Telephony_SmsMms_createMessage_Async_0200 finish');
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_SmsMms_createMessage_Async_0200 fail');
+ done();
+ });
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_sendMessage_0200
+ * @tc.name Call the interface sendMessage, set the card slot parameter "slotId" to FALSE_SLOT_ID,
+ * SMS failed to send
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_sendMessage_0200', 0, async function (done) {
+ sms.sendMessage({
+ slotId: FALSE_SLOT_ID,
+ destinationHost: SMS_SEND_DST_NUMBER,
+ content: 'hello',
+ sendCallback: (err, value) => {
+ if (err) {
+ expect().assertFail();
+ console.log('Telephony_SmsMms_sendMessage_0200 fail');
+ done();
+ return;
+ }
+ console.log(`sendCallback success sendResult = ${value.result}`);
+ expect(value.result === sms.SEND_SMS_FAILURE_UNKNOWN).assertTrue();
+ console.log('Telephony_SmsMms_sendMessage_0200 finish');
+ done();
+ },
+ deliveryCallback: () => {}
+ });
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_createMessage_Promise_0200
+ * @tc.name Call interface CreateMessage,
+ * The incoming PDU is empty, the specification is 3GPP,
+ * promise returns the result Don't empty
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_createMessage_Promise_0200', 0, async function (done) {
+ try {
+ await sms.createMessage(rawArrayNull, '3gpp');
+ expect().assertFail();
+ console.log('Telephony_SmsMms_createMessage_Promise_0200 fail');
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_createMessage_Promise_0200 finish');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_setSmscAddr_Async_0200
+ * @tc.name When "SLOTID" is an error value,Failed to set short message service address
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_setSmscAddr_Async_0200', 0, async function (done) {
+ sms.setSmscAddr(FALSE_SLOT_ID, '', (err) => {
+ if (err) {
+ console.log('Telephony_SmsMms_setSmscAddr_Async_0200 finish');
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_SmsMms_setSmscAddr_Async_0200 fail');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_setSmscAddr_Promise_0200
+ * @tc.name When "SLOTID" is an error value,Failed to set short message service address
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_setSmscAddr_Promise_0200', 0, async function (done) {
+ try {
+ await sms.setSmscAddr(FALSE_SLOT_ID, '');
+ expect().assertFail();
+ console.log('Telephony_SmsMms_createMessage_Promise_0200 fail');
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_createMessage_Promise_0200 finish ');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_getSmscAddr_Async_0200
+ * @tc.name When "SLOTID" is an error value,Failed to get SMS service address
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getSmscAddr_Async_0200', 0, async function (done) {
+ sms.getSmscAddr(FALSE_SLOT_ID, (err, getresult) => {
+ if (err) {
+ expect().assertFail();
+ console.log('Telephony_SmsMms_getSmscAddr_Async_0200 fail');
+ done();
+ return;
+ }
+ expect(getresult === undefined || getresult === '');
+ console.log('Telephony_SmsMms_getSmscAddr_Async_0200 finish');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_getSmscAddr_Promise_0200
+ * @tc.name When "SLOTID" is an error value,Failed to get SMS service address
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getSmscAddr_Promise_0200', 0, async function (done) {
+ try {
+ let promise = await sms.getSmscAddr(FALSE_SLOT_ID);
+ expect(promise === undefined || promise === '');
+ console.log('Telephony_SmsMms_getSmscAddr_Promise_0200 finish');
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_getSmscAddr_Promise_0200 fail');
+ expect().assertFail();
+ done();
+ }
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_getSmsSegmentsInfo_Async_2000
+ * @tc.name The passed argument is an error slotId, view the results
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getSmsSegmentsInfo_Async_2000', 0, async function (done) {
+ let message = '';
+ for (let index = 0;index < MAX_CHINESE_MESSAGE_LENTH + 1;index++) {
+ message += '中';
+ }
+ sms.getSmsSegmentsInfo(FALSE_SLOT_ID, message, true, (error, result) => {
+ if (error) {
+ console.log("Telephony_SmsMms_getSmsSegmentsInfo_Async_2000 getSmsSegmentsInfoon error " + error.message);
+ console.log('Telephony_SmsMms_getSmsSegmentsInfo_Async_2000 finish');
+ } else {
+ expect().assertFail();
+ console.log('Telephony_SmsMms_getSmsSegmentsInfo_Async_2000 fail');
+ }
+ done();
+ });
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_getSmsSegmentsInfo_Promise_2000
+ * @tc.name The passed argument is an error slotId, view the results
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getSmsSegmentsInfo_Promise_2000', 0, async function (done) {
+ let message = '';
+ for (let index = 0;index < MAX_MESSAGE_LENTH;index++) {
+ message += 'a';
+ }
+ try {
+ let result = await sms.getSmsSegmentsInfo(FALSE_SLOT_ID, message, true);
+ console.log('Telephony_SmsMms_getSmsSegmentsInfo_Promise_2000 fail');
+ expect().assertFail();
+ } catch (err) {
+ console.log('Telephony_SmsMms_getSmsSegmentsInfo_Promise_2000 finish');
+ }
+ done();
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_isImsSmsSupported_Async_0100
+ * @tc.name Check whether the Ims SMS function is supported
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_isImsSmsSupported_Async_0100', 0, async function (done) {
+ sms.isImsSmsSupported((error, result) => {
+ if (error) {
+ console.log('Telephony_SmsMms_isImsSmsSupported_Async_0100 fail');
+ } else {
+ expect(result === false || result === true).assertTrue();
+ console.log('Telephony_SmsMms_isImsSmsSupported_Async_0100 finish');
+ }
+ done();
+ });
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_isImsSmsSupported_Promise_0100
+ * @tc.name Check whether the Ims SMS function is supported
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_isImsSmsSupported_Promise_0100', 0, async function (done) {
+ try {
+ let result = await sms.isImsSmsSupported();
+ expect(result === false || result === true).assertTrue();
+ console.log('Telephony_SmsMms_isImsSmsSupported_Promise_0100 finish');
+ } catch (err) {
+ console.log('Telephony_SmsMms_isImsSmsSupported_Promise_0100 fail');
+ }
+ done();
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_hasSmsCapability_0100
+ * @tc.name Check whether the Ims SMS function is supported
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_hasSmsCapability_0100', 0, async function (done) {
+ let result = sms.hasSmsCapability();
+ console.log('Telephony_SmsMms_hasSmsCapability_0100 result : ' + result);
+ expect(result === false || result === true).assertTrue();
+ done();
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_getImsShortMessageFormat_Async_0100
+ * @tc.name call the interface to obtain SMS system
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getImsShortMessageFormat_Async_0100', 0, async function (done) {
+ sms.getImsShortMessageFormat((error, result) => {
+ if (error) {
+ console.log('Telephony_SmsMms_getImsShortMessageFormat_Async_0100 fail');
+ expect().assertFail();
+ } else {
+ expect(result === undefined || result === '3gpp' || result === '3gpp2').assertTrue();
+ console.log('Telephony_SmsMms_getImsShortMessageFormat_Async_0100 finish');
+ }
+ done();
+ });
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_getImsShortMessageFormat_Promise_0100
+ * @tc.name call the interface to obtain SMS system
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getImsShortMessageFormat_Promise_0100', 0, async function (done) {
+ try {
+ let result = await sms.getImsShortMessageFormat();
+ expect(result === undefined || result === '3gpp' || result === '3gpp2').assertTrue();
+ console.log('Telephony_SmsMms_getImsShortMessageFormat_Promise_0100 finish');
+ } catch (err) {
+ expect().assertFail();
+ console.log('Telephony_SmsMms_getImsShortMessageFormat_Promise_0100 fail');
+ }
+ done();
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_splitMessage_Async_1600
+ * @tc.name Call the interface, set message to empty, and see the result
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_splitMessage_Async_1600', 0, async function (done) {
+ let message = '';
+ sms.splitMessage(message, (error, result) => {
+ if (error) {
+ console.log("Telephony_SmsMms_splitMessage_Async_1600 splitMessage on error because " + error.message);
+ console.log('Telephony_SmsMms_splitMessage_Async_1600 fail');
+ } else {
+ console.log("Telephony_SmsMms_splitMessage_Async_1600 splitMessage on value = " + JSON.stringify(result));
+ expect(result === undefined || result.length === 0).assertTrue();
+ console.log('Telephony_SmsMms_splitMessage_Async_1600 finish');
+ }
+ done();
+ });
+ });
+
+ /*
+ * @tc.number Telephony_SmsMms_splitMessage_Promise_1600
+ * @tc.name Call the interface, set message to empty, and see the result
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_splitMessage_Promise_1600', 0, async function (done) {
+ let message = '';
+ try {
+ let result = await sms.splitMessage(message);
+ console.log('Telephony_SmsMms_splitMessage_Promise_1600 finish');
+ expect(result === undefined || result.length === 0).assertTrue();
+ } catch (err) {
+ console.log('Telephony_SmsMms_splitMessage_Promise_1600 fail');
+ }
+ done();
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_decodeMms_Async_1000
+ * @tc.name Passing in the exception path, Parse failure
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_decodeMms_Async_1000', 0, async function (done) {
+ sms.decodeMms(eorroMessagePath, (err, data) => {
+ if (err) {
+ console.log('Telephony_SmsMms_decodeMms_Async_1000 finish');
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_SmsMms_decodeMms_Async_1000 fail');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_decodeMms_Promise_1000
+ * @tc.name Passing in the exception path, Parse failure
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_decodeMms_Promise_1000', 0, async function (done) {
+ try {
+ await sms.decodeMms(eorroMessagePath);
+ console.log('Telephony_SmsMms_decodeMms_Promise_1000 fail');
+ expect().assertFail();
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_decodeMms_Promise_1000 finish');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_encodeMms_Async_0900
+ * @tc.name ReadOrigInd type MMS, encoding after decoding, the content after decoding and coding before the same
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_encodeMms_Async_0900', 0, async function (done) {
+ let mmsType = {
+ version: sms.MMS_VERSION_1_1,
+ messageId: "0001",
+ to: [{address: "+861388888****/TYPE=PLMN", charset: sms.UTF_8}],
+ "from": {address: "+861381234****/TYPE=PLMN", charset: sms.UTF_8},
+ readStatus: 129,
+ date: 1639378126,
+ };
+ sms.encodeMms({messageType: sms.TYPE_MMS_READ_ORIG_IND, mmsType}, (err, encodeData) =>{
+ if (err) {
+ console.log('Telephony_SmsMms_encodeMms_Async_0900 encodeMms fail');
+ done();
+ return;
+ }
+ console.log('Telephony_SmsMms_encodeMms_Async_0900 encodeMms finish');
+ sms.decodeMms(encodeData, (err, data) => {
+ if (err) {
+ console.log('Telephony_SmsMms_encodeMms_Async_0900 fail');
+ done();
+ return;
+ }
+ expect(data.messageType === sms.TYPE_MMS_READ_ORIG_IND).assertTrue();
+ expect(data.mmsType.version === sms.MMS_VERSION_1_1).assertTrue();
+ expect(data.mmsType.messageId === '0001').assertTrue();
+ expect(data.mmsType.to.length > 0).assertTrue();
+ expect(data.mmsType.to[0].address.length > 0).assertTrue();
+ expect(data.mmsType.to[0].charset === sms.UTF_8).assertTrue();
+ expect(data.mmsType.from.address.length > 0).assertTrue();
+ expect(data.mmsType.from.charset === sms.UTF_8).assertTrue();
+ expect(data.mmsType.date > 0).assertTrue();
+ expect(data.mmsType.readStatus === 129).assertTrue();
+ console.log('Telephony_SmsMms_encodeMms_Async_0900 finish');
+ done();
+ });
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_encodeMms_Promise_0900
+ * @tc.name ReadOrigInd type MMS, encoding after decoding, the content after decoding and coding before the same
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_encodeMms_Promise_0900', 0, async function (done) {
+ let mmsType = {
+ version: sms.MMS_VERSION_1_1,
+ messageId: "0001",
+ to: [{address: "+861388888****/TYPE=PLMN", charset: sms.UTF_8}],
+ "from": {address: "+861381234****/TYPE=PLMN", charset: sms.UTF_8},
+ date: 1639378126,
+ readStatus: 129,
+ };
+ try {
+ let encodePromise = await sms.encodeMms({messageType: sms.TYPE_MMS_READ_ORIG_IND, mmsType});
+ expect(encodePromise.length > 0).assertTrue();
+ console.log('Telephony_SmsMms_encodeMms_Promise_0900 encodeMms finish');
+ let promise = await sms.decodeMms(encodePromise);
+ expect(promise.messageType === sms.TYPE_MMS_READ_ORIG_IND).assertTrue();
+ expect(promise.mmsType.version === sms.MMS_VERSION_1_1).assertTrue();
+ expect(promise.mmsType.messageId === '0001').assertTrue();
+ expect(promise.mmsType.to.length > 0).assertTrue();
+ expect(promise.mmsType.to[0].address.length > 0).assertTrue();
+ expect(promise.mmsType.to[0].charset === sms.UTF_8).assertTrue();
+ expect(promise.mmsType.from.address.length > 0).assertTrue();
+ expect(promise.mmsType.from.charset === sms.UTF_8).assertTrue();
+ expect(promise.mmsType.date > 0).assertTrue();
+ expect(promise.mmsType.readStatus === 129).assertTrue();
+ console.log('Telephony_SmsMms_decodeMms_Promise_0900 finish');
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_decodeMms_Promise_0900 fail');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_setCBConfig_Async_0600
+ * @tc.name When "SLOTID" is an error value,Failed to set up cell broadcast
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_setCBConfig_Async_0600', 0, async function (done) {
+ let data = {
+ slotId: FALSE_SLOT_ID,
+ enable: true,
+ startMessageId: IDENTIFIER_MIN,
+ endMessageId: IDENTIFIER_MAX,
+ ranType: RANTYPE_GSM
+ };
+ sms.setCBConfig(data, (err) => {
+ if (err) {
+ console.log(`Telephony_SmsMms_setCBConfig_Async_0600 finish err : ${err.message}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_SmsMms_setCBConfig_Async_0600 fail');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_setCBConfig_Promise_0600
+ * @tc.name When "SLOTID" is an error value,Failed to set up cell broadcast
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_setCBConfig_Promise_0600', 0, async function (done) {
+ let data = {
+ slotId: FALSE_SLOT_ID,
+ enable: true,
+ startMessageId: IDENTIFIER_MIN,
+ endMessageId: IDENTIFIER_MAX,
+ ranType: RANTYPE_GSM
+ };
+ try {
+ await sms.setCBConfig(data);
+ expect().assertFail();
+ console.log('Telephony_SmsMms_setCBConfig_Promise_0600 fail');
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_setCBConfig_Promise_0600 finish');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_setDefaultSmsSlotId_Async_0200
+ * @tc.name The default card slot ID is set to an error value,Failed to set send SMS card slot ID
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_setDefaultSmsSlotId_Async_0200', 0, async function (done) {
+ sms.setDefaultSmsSlotId(FALSE_SLOT_ID, (err) => {
+ if (err) {
+ console.log('Telephony_SmsMms_setDefaultSmsSlotId_Async_0200 finish');
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_SmsMms_setDefaultSmsSlotId_Async_0200 fail');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_setDefaultSmsSlotId_Promise_0200
+ * @tc.name The default card slot ID is set to an error value,Failed to set send SMS card slot ID
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_setDefaultSmsSlotId_Promise_0200', 0, async function (done) {
+ try {
+ await sms.setDefaultSmsSlotId(FALSE_SLOT_ID);
+ expect().assertFail();
+ console.log('Telephony_SmsMms_setDefaultSmsSlotId_Promise_0200 fail');
+ done();
+ return;
+ } catch (err) {
+ console.log('Telephony_SmsMms_setDefaultSmsSlotId_Promise_0200 finish');
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_getDefaultSmsSlotId_Async_0100
+ * @tc.name Set the default card slot ID for sending SMS
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getDefaultSmsSlotId_Async_0100', 0, async function (done) {
+ sms.getDefaultSmsSlotId((geterr, getresult) => {
+ if (geterr) {
+ console.log('Telephony_SmsMms_getDefaultSmsSlotId_Async_0100 fail');
+ done();
+ return;
+ }
+ expect(getresult !== FALSE_SLOT_ID).assertTrue();
+ console.log('Telephony_SmsMms_getDefaultSmsSlotId_Async_0100 finish');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_SmsMms_getDefaultSmsSlotId_Promise_0100
+ * @tc.name Set the default card slot ID for sending SMS
+ * @tc.desc Function test
+ */
+ it('Telephony_SmsMms_getDefaultSmsSlotId_Promise_0100', 0, async function (done) {
+ try {
+ let promise = await sms.getDefaultSmsSlotId();
+ expect(promise !== FALSE_SLOT_ID).assertTrue();
+ console.log('Telephony_SmsMms_getDefaultSmsSlotId_Promise_0100 finish');
+ done();
+ } catch (err) {
+ console.log('Telephony_SmsMms_getDefaultSmsSlotId_Promise_0100 fail');
+ done();
+ }
+ });
+
+});
\ No newline at end of file
diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..a9c51178090d89031c53928862cb1cf26cbdf895
--- /dev/null
+++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/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_error/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/telephony/telephonyjstest/sms_mms/sms_mms_error/entry/src/main/resources/base/media/icon.png differ
diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_error/signature/openharmony_sx.p7b b/telephony/telephonyjstest/sms_mms/sms_mms_error/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/telephony/telephonyjstest/sms_mms/sms_mms_error/signature/openharmony_sx.p7b differ
diff --git a/test_packages.gni b/test_packages.gni
index ad39723c1316a4aff000bdaa00f9b8086ccc90fc..9cb2dac47936614f7b5c7502af27767555422ba9 100755
--- a/test_packages.gni
+++ b/test_packages.gni
@@ -36,6 +36,7 @@ _all_test_packages = [
"${ACTS_ROOT}/multimodalinput:multimodalinput",
"${ACTS_ROOT}/resourceschedule:resourceschedule",
"${ACTS_ROOT}/dsoftbus:dsoftbus",
+ "${ACTS_ROOT}/telephony:telephony",
]
_all_test_packages_ivi = [