提交 aaaa229a 编写于 作者: 高曦

电话子系统js用例上库

Signed-off-by: N高曦 <gaoxi785@huawei.com>
上级 1c308076
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
import call from '@ohos.telephony.call'; import call from '@ohos.telephony.call';
import observer from '@ohos.telephony.observer';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
import { import {
AUTO_ACCEPT_NUMBER, AUTO_ACCEPT_NUMBER,
...@@ -57,7 +58,10 @@ import { ...@@ -57,7 +58,10 @@ import {
COMMAND_CALL_ERROR4, COMMAND_CALL_ERROR4,
COMMAND_CALL_ERROR, COMMAND_CALL_ERROR,
CARMER_ID_NOT_EXIT, CARMER_ID_NOT_EXIT,
ZOOM_RATIO_MINUS_1_0 ZOOM_RATIO_MINUS_1_0,
DIAL_SCENCE_CALL_NORMAL,
DIAL_TYPE_OTT,
EVENT_OTT_FUNCTION_UNSUPPORTED
} from './lib/Const.js'; } from './lib/Const.js';
import {toString} from './lib/ApiToPromise.js'; import {toString} from './lib/ApiToPromise.js';
import { import {
...@@ -67,13 +71,51 @@ import { ...@@ -67,13 +71,51 @@ import {
callDetailsChangeOn, callDetailsChangeOn,
callId as gloabCallId, callId as gloabCallId,
reachState, reachState,
callDetailsChangeOff callDetailsChangeOff,
reachCallEventState
} from './lib/ScenceInCalling.js'; } from './lib/ScenceInCalling.js';
const GETMAIN_CALLID_ERRO = -1; const GETMAIN_CALLID_ERRO = -1;
const REJECT_MESSAGE_STR = 'Hi,hello?';
const REJECT_MESSAGE_NUM = 1234567890123456789012345678901234567890;
const ERR_SLOT_ID = -1;
const SLOTID = 0;
const THE_THREE_NUMBER = '112';
const DIAL_TYPE_ERR_CALL = 3;
const TIME_OUT = 20000;
const WAITING_TIME = 200;
let callId = null; let callId = null;
class RejectMessageOptions {
constructor (str) {
this.messageContent = str;
}
}
class EmergencyNumberOptions {
constructor (num) {
this.slotId = num;
}
}
class NumberFormatOptions {
constructor (str) {
this.countryCode = str;
}
}
const sleep = (time) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, time);
});
};
var callState = -1;
var timing = 0;
var endTime = 0;
describe('CallManageImsCall', function () { describe('CallManageImsCall', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
callDetailsChangeOn(); callDetailsChangeOn();
observer.on('callStateChange', function (error, data) {});
observer.on('callStateChange', {slotId: DEFAULT_SLOT_ID}, function (error, data) {});
try { try {
await call.enableImsSwitch(DEFAULT_SLOT_ID); await call.enableImsSwitch(DEFAULT_SLOT_ID);
console.log('Telephony_CallManager enableImsSwitch success'); console.log('Telephony_CallManager enableImsSwitch success');
...@@ -103,6 +145,7 @@ describe('CallManageImsCall', function () { ...@@ -103,6 +145,7 @@ describe('CallManageImsCall', function () {
}); });
afterAll(function () { afterAll(function () {
observer.off('callStateChange');
callDetailsChangeOff(); callDetailsChangeOff();
console.log('Telephony_CallManager all 54 case is over for callmanager CallManageImsCall'); console.log('Telephony_CallManager all 54 case is over for callmanager CallManageImsCall');
}); });
...@@ -1483,6 +1526,65 @@ describe('CallManageImsCall', function () { ...@@ -1483,6 +1526,65 @@ describe('CallManageImsCall', function () {
}); });
}); });
/**
* @tc.number Telephony_CallManager_reject_Promise_0400
* @tc.name Test the function runs 10 times, stability test
* @tc.desc Function test
*/
it('Telephony_CallManager_reject_Promise_0400', 0, async function (done) {
let caseName = 'Telephony_CallManager_reject_Promise_0400';
let callId = null;
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
try {
data = await call.reject(callId, new RejectMessageOptions(REJECT_MESSAGE_STR));
console.log(`${caseName} reject success,case failed,data:${toString(data)}`);
done();
} catch (err) {
console.log(`${caseName} reject error,case success,err:${toString(err)}`);
done();
}
} catch (error) {
console.log(`${caseName} scenceInCalling error,case failed,error:${toString(error)}`);
done();
}
});
/**
* @tc.number Telephony_CallManager_reject_Async_0400
* @tc.name Test the function runs 10 times, stability test
* @tc.desc Function test
*/
it('Telephony_CallManager_reject_Async_0400', 0, async function (done) {
let caseName = 'Telephony_CallManager_reject_Async_0400';
let callId = null;
try {
let data = await scenceInCalling({
caseName:caseName,
phoneNumber:AUTO_ACCEPT_NUMBER,
checkState:CALL_STATUS_DIALING
});
callId = data.callId;
call.reject(callId, new RejectMessageOptions(REJECT_MESSAGE_NUM), (err, data) => {
if (err) {
console.log(`${caseName} reject error,case success,err:${toString(err)}`);
done();
return;
}
console.log(`${caseName} reject success,case failed,data:${toString(data)}`);
done();
});
} catch (error) {
console.log(`${caseName} scenceInCalling error,case failed,error:${toString(error)}`);
done();
}
});
/** /**
* @tc.number Telephony_CallManager_IMS_hangup_Async_0100 * @tc.number Telephony_CallManager_IMS_hangup_Async_0100
* @tc.name Run function hangup by args callId BOUNDARY_NUMBER_INT by callback, * @tc.name Run function hangup by args callId BOUNDARY_NUMBER_INT by callback,
...@@ -2084,7 +2186,8 @@ describe('CallManageImsCall', function () { ...@@ -2084,7 +2186,8 @@ describe('CallManageImsCall', function () {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_CallManager_formatPhoneNumberToE164_Async_0100', 0, async function (done) { it('Telephony_CallManager_formatPhoneNumberToE164_Async_0100', 0, async function (done) {
call.formatPhoneNumberToE164('010-0000-0000', 'CN', (err, data) => { let numberFormatOptions = new NumberFormatOptions('CN');
call.formatPhoneNumberToE164('010-0000-0000', numberFormatOptions.countryCode, (err, data) => {
if (err) { if (err) {
console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0100 fail'); console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0100 fail');
expect().assertFail(); expect().assertFail();
...@@ -2104,8 +2207,9 @@ describe('CallManageImsCall', function () { ...@@ -2104,8 +2207,9 @@ describe('CallManageImsCall', function () {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100', 0, async function (done) { it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100', 0, async function (done) {
let numberFormatOptions = new NumberFormatOptions('CN');
try { try {
var data = await call.formatPhoneNumberToE164('52300000000', 'CN'); var data = await call.formatPhoneNumberToE164('52300000000', numberFormatOptions.countryCode);
expect(data === '+8652300000000').assertTrue(); expect(data === '+8652300000000').assertTrue();
console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 finish data = ${data}`); console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 finish data = ${data}`);
done(); done();
...@@ -2124,7 +2228,8 @@ describe('CallManageImsCall', function () { ...@@ -2124,7 +2228,8 @@ describe('CallManageImsCall', function () {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300', 0, async function (done) { it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300', 0, async function (done) {
call.isEmergencyPhoneNumber('110', {slotId: SLOT_ID_INVALID}, (err) => { let emergencyNumberOptions = new EmergencyNumberOptions(ERR_SLOT_ID);
call.isEmergencyPhoneNumber('110', emergencyNumberOptions, (err) => {
if (err) { if (err) {
console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 finish err = ${err}`); console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 finish err = ${err}`);
done(); done();
...@@ -2143,8 +2248,9 @@ describe('CallManageImsCall', function () { ...@@ -2143,8 +2248,9 @@ describe('CallManageImsCall', function () {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300', 0, async function (done) { it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300', 0, async function (done) {
let emergencyNumberOptions = new EmergencyNumberOptions(ERR_SLOT_ID);
try { try {
var data = await call.isEmergencyPhoneNumber('120', {slotId: SLOT_ID_INVALID}); var data = await call.isEmergencyPhoneNumber('120', emergencyNumberOptions);
expect().assertFail(); expect().assertFail();
console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 fail '); console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 fail ');
done(); done();
...@@ -2154,4 +2260,156 @@ describe('CallManageImsCall', function () { ...@@ -2154,4 +2260,156 @@ describe('CallManageImsCall', function () {
} }
}); });
/**
* @tc.number Telephony_CallManager_isInEmergencyCall_Async_0200
* @tc.name Dial an emergency number (THE_THREE_NUMBER) and call isInEmergencyCall() to determine whether
* an emergency call is made, returning true
* @tc.desc Function test
*/
it('Telephony_CallManager_isInEmergencyCall_Async_0200', 0, async function (done) {
const options = {accountId:SLOTID, videoState:MEDIA_TYPE_VOICE, dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
dialType:DIAL_CARRIER_TYPE};
call.dial(THE_THREE_NUMBER, options, async (err, data) => {
if (err) {
console.log(`Telephony_CallManager_isInEmergencyCall_Async_0200 dial fail : err = ${err}`);
done();
return;
}
console.log(`Telephony_CallManager_isInEmergencyCall_Async_0200 dial finish : data = ${data}`);
const startTime = new Date().getTime();
while (true) {
if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE ||
callState === call.CALL_STATUS_ALERTING) {
call.isInEmergencyCall((err, data) => {
if (err) {
console.log(
`Telephony_CallManager_isInEmergencyCall_Async_0200 isInEmrgencyCall fail : err = ${
err}`
);
done();
return;
}
console.log(
`Telephony_CallManager_isInEmergencyCall_Async_0200 isInEmrgencyCall finish : data = ${
data}`
);
done();
});
return;
}
await sleep(WAITING_TIME);
endTime = new Date().getTime();
timing = endTime - startTime;
if (timing > TIME_OUT) {
done();
break;
}
}
});
});
/**
* @tc.number Telephony_CallManager_isInEmergencyCall_Promise_0200
* @tc.name Dial an emergency number (THE_THREE_NUMBER) and call isInEmergencyCall() to determine whether
* an emergency call is made. The return value is true
* @tc.desc Function test
*/
it('Telephony_CallManager_isInEmergencyCall_Promise_0200', 0, async function (done) {
try {
const options = {accountId:SLOTID, videoState:MEDIA_TYPE_VOICE, dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
dialType:DIAL_CARRIER_TYPE};
var data = await call.dial(THE_THREE_NUMBER, options);
console.log(`Telephony_CallManager_isInEmergencyCall_Promise_0200 dial finish : data = ${data}`);
const startTime = new Date().getTime();
while (true) {
if (callState === call.CALL_STATUS_DIALING || callState === call.CALL_STATUS_ACTIVE ||
callState === call.CALL_STATUS_ALERTING) {
try {
var data = await call.isInEmergencyCall();
console.log(`Telephony_CallManager_isInEmergencyCall_Promise_0200 finish : data = ${data}`);
done();
} catch (err) {
console.log(`Telephony_CallManager_isInEmergencyCall_Promise_0200 fail : err = ${err}`);
done();
return;
}
return;
}
await sleep(WAITING_TIME);
endTime = new Date().getTime();
timing = endTime - startTime;
if (timing > TIME_OUT) {
done();
break;
}
}
} catch (err) {
console.log(`Telephony_CallManager_isInEmergencyCall_Promise_0200 dial fail : err = ${err}`);
done();
}
});
/**
* @tc.number Telephony_CallManager_IMS_dial_Promise_0900
* @tc.name Dial a call by function dial by args phoneNumber PHONE_NUMBER_LENGTH_11 options
* {accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE, dialScene:DIAL_SCENCE_CALL_PRIVILEGED,
* dialType:DIAL_TYPE_ERR_CALL} by promise,the function return error
* @tc.desc Function test
*/
it('Telephony_CallManager_IMS_dial_Promise_0900', 0, function (done) {
let caseName = 'Telephony_CallManager_IMS_dial_Promise_0900';
let flag = true;
reachState(caseName, CALL_STATUS_DIALING, '', false).then(data => {
callId = data.callId;
console.log(`${caseName} reachState success,case failed,data:${toString(data)}`);
hangupCall2(caseName, done, callId);
}).catch(error => {
console.log(`${caseName} reachState error,case ${flag ? 'success' : 'failed'},error:${toString(error)}`);
done();
});
let obj = {accountId:DEFAULT_SLOT_ID, videoState:MEDIA_TYPE_VOICE,
dialScene:DIAL_SCENCE_CALL_PRIVILEGED, dialType:DIAL_TYPE_ERR_CALL};
call.dial(PHONE_NUMBER_LENGTH_11, obj).then(data => {
flag = false;
}).catch(error => {
console.log(`${caseName} dial error,error:${toString(error)}`);
flag = true;
});
});
/**
* @tc.number Telephony_CallManager_on_0900
* @tc.name Dial a call by number AUTO_ACCEPT_NUMBER options {accountId: DEFAULT_SLOT_ID,
* videoState: MEDIA_TYPE_VOICE,dialScene: DIAL_SCENCE_CALL_NORMAL, dialType:DIAL_TYPE_OTT}
* and before being accepted,the callEventChange event get EVENT_OTT_FUNCTION_UNSUPPORTED
* @tc.desc Function test
*/
it('Telephony_CallManager_on_0900', 0, function (done) {
let caseName = 'Telephony_CallManager_on_0900';
let callId = null;
reachCallEventState(EVENT_OTT_FUNCTION_UNSUPPORTED).then(data => {
console.log(`${caseName} reachCallEventState success,case ${
data.eventId === EVENT_OTT_FUNCTION_UNSUPPORTED ?
'success' : 'failed'},data:${toString(data)}`);
done();
}).catch(error => {
if (callId) {
console.log(`${caseName} reachCallEventState error,case failed,error:${toString(error)}`);
done();
} else {
console.log(`${caseName} scenceInCalling error,case failed,error:${toString(error)}`);
done();
}
});
let options = {accountId: DEFAULT_SLOT_ID, videoState: MEDIA_TYPE_VOICE,
dialScene: DIAL_SCENCE_CALL_NORMAL, dialType:DIAL_TYPE_OTT};
call.dial(AUTO_ACCEPT_NUMBER, options, (err, data) => {
if (err) {
console.log(`${caseName} dial err:${err}`);
return;
}
console.log(`${caseName} dial success data:${data}`);
});
});
}); });
\ No newline at end of file
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
*/ */
import radio from '@ohos.telephony.radio'; import radio from '@ohos.telephony.radio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import observer from '@ohos.telephony.observer';
import { describe, beforeAll, afterAll, it, expect } from 'deccjsunit/index';
describe('ActsNetworkSearchTest', function () { describe('ActsNetworkSearchTest', function () {
...@@ -795,5 +796,51 @@ describe('ActsNetworkSearchTest', function () { ...@@ -795,5 +796,51 @@ describe('ActsNetworkSearchTest', function () {
done(); done();
} }
}); });
/**
* @tc.number Telephony_StateRegistry_on_0200
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_on_0200', 0, async function (done) {
observer.on('networkStateChange', { slotId: SLOT_0 }, (networkState) => {
console.log(`Telephony_StateRegistry_on_0200 networkStateChanged data: ${JSON.stringify(networkState)}`);
done();
});
done();
});
/**
* @tc.number Telephony_StateRegistry_off_0200
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_off_0200', 0, async function (done) {
observer.off('networkStateChange');
done();
});
/**
* @tc.number Telephony_StateRegistry_on_0300
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_on_0300', 0, async function (done) {
observer.on('signalInfoChange', { slotId: SLOT_0 }, (networkState) => {
console.log(`Telephony_StateRegistry_on_0200 networkStateChanged data: ${JSON.stringify(networkState)}`);
done();
});
done();
});
/**
* @tc.number Telephony_StateRegistry_off_0300
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_off_0300', 0, async function (done) {
observer.off('signalInfoChange');
done();
});
}); });
...@@ -19,6 +19,48 @@ import { describe, it, expect } from 'deccjsunit/index'; ...@@ -19,6 +19,48 @@ import { describe, it, expect } from 'deccjsunit/index';
describe('SimManagerTest', function () { describe('SimManagerTest', function () {
/**
* @tc.number Telephony_Sim_constantValidate_0100
* @tc.name SIM card constant validation
* @tc.desc Function test
*/
it('Telephony_Sim_constantValidate_0100', 0, async function (done) {
expect(sim.SIM_STATE_UNKNOWN === env.CONSTANTS.SIM_STATE_UNKNOWN).assertTrue();
expect(sim.SIM_STATE_NOT_PRESENT === env.CONSTANTS.SIM_STATE_NOT_PRESENT).assertTrue();
expect(sim.SIM_STATE_LOCKED === env.CONSTANTS.SIM_STATE_LOCKED).assertTrue();
expect(sim.SIM_STATE_NOT_READY === env.CONSTANTS.SIM_STATE_NOT_READY).assertTrue();
expect(sim.SIM_STATE_READY === env.CONSTANTS.SIM_STATE_READY).assertTrue();
expect(sim.SIM_STATE_LOADED === env.CONSTANTS.SIM_STATE_LOADED).assertTrue();
expect(sim.GENERAL_CONTACT === env.CONSTANTS.GENERAL_CONTACT).assertTrue();
expect(sim.FIXED_DIALING === env.CONSTANTS.FIXED_DIALING).assertTrue();
expect(sim.LOCK_OFF === env.CONSTANTS.LOCK_OFF).assertTrue();
expect(sim.LOCK_ON === env.CONSTANTS.LOCK_ON).assertTrue();
expect(sim.PIN_LOCK === env.CONSTANTS.PIN_LOCK).assertTrue();
expect(sim.FDN_LOCK === env.CONSTANTS.FDN_LOCK).assertTrue();
expect(sim.UNKNOWN_CARD === env.CONSTANTS.UNKNOWN_CARD).assertTrue();
expect(sim.SINGLE_MODE_SIM_CARD === env.CONSTANTS.SINGLE_MODE_SIM_CARD).assertTrue();
expect(sim.SINGLE_MODE_USIM_CARD === env.CONSTANTS.SINGLE_MODE_USIM_CARD).assertTrue();
expect(sim.SINGLE_MODE_RUIM_CARD === env.CONSTANTS.SINGLE_MODE_RUIM_CARD).assertTrue();
expect(sim.DUAL_MODE_CG_CARD === env.CONSTANTS.DUAL_MODE_CG_CARD).assertTrue();
expect(sim.CT_NATIONAL_ROAMING_CARD === env.CONSTANTS.CT_NATIONAL_ROAMING_CARD).assertTrue();
expect(sim.CU_DUAL_MODE_CARD === env.CONSTANTS.CU_DUAL_MODE_CARD).assertTrue();
expect(sim.DUAL_MODE_TELECOM_LTE_CARD === env.CONSTANTS.DUAL_MODE_TELECOM_LTE_CARD).assertTrue();
expect(sim.DUAL_MODE_UG_CARD === env.CONSTANTS.DUAL_MODE_UG_CARD).assertTrue();
expect(sim.SINGLE_MODE_ISIM_CARD === env.CONSTANTS.SINGLE_MODE_ISIM_CARD).assertTrue();
expect(sim.PN_PIN_LOCK === env.CONSTANTS.PN_PIN_LOCK).assertTrue();
expect(sim.PN_PUK_LOCK === env.CONSTANTS.PN_PUK_LOCK).assertTrue();
expect(sim.PU_PIN_LOCK === env.CONSTANTS.PU_PIN_LOCK).assertTrue();
expect(sim.PU_PUK_LOCK === env.CONSTANTS.PU_PUK_LOCK).assertTrue();
expect(sim.PP_PIN_LOCK === env.CONSTANTS.PP_PIN_LOCK).assertTrue();
expect(sim.PP_PUK_LOCK === env.CONSTANTS.PP_PUK_LOCK).assertTrue();
expect(sim.PC_PIN_LOCK === env.CONSTANTS.PC_PIN_LOCK).assertTrue();
expect(sim.PC_PUK_LOCK === env.CONSTANTS.PC_PUK_LOCK).assertTrue();
expect(sim.SIM_PIN_LOCK === env.CONSTANTS.SIM_PIN_LOCK).assertTrue();
expect(sim.SIM_PUK_LOCK === env.CONSTANTS.SIM_PUK_LOCK).assertTrue();
console.log(`Telephony_Sim_constantValidate_0100 finish`);
done();
});
/** /**
* @tc.number Telephony_Sim_getISOCountryCodeForSim_Async_0200 * @tc.number Telephony_Sim_getISOCountryCodeForSim_Async_0200
* @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function * @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function
......
...@@ -15,6 +15,6 @@ import("//test/xts/tools/build/suite.gni") ...@@ -15,6 +15,6 @@ import("//test/xts/tools/build/suite.gni")
group("sms_mms") { group("sms_mms") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ "sms_mms_error:SmsMmsErrorTest" ] deps = [ "sms_mms_error:ActSmsMmsErrorTest" ]
} }
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("SmsMmsErrorTest") { ohos_js_hap_suite("ActSmsMmsErrorTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./entry/src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
......
...@@ -82,6 +82,164 @@ describe('SmsMmsErrorTest', function () { ...@@ -82,6 +82,164 @@ describe('SmsMmsErrorTest', function () {
} }
}); });
/*
* @tc.number Telephony_SmsMms_addSimMessage_Async_1400
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_READ,
* Save a text message to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Async_1400', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: RECEIVE_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_READ
};
sms.addSimMessage(data, (adderr) => {
if (adderr) {
console.log('Telephony_SmsMms_addSimMessage_Async_1400 add fail');
done();
return;
}
console.log('Telephony_SmsMms_addSimMessage_Async_1400 finish ');
});
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Promise_1400
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_READ,
* Save a text message to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Promise_1400', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: RECEIVE_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_READ
};
try {
await sms.addSimMessage(data);
console.log('Telephony_SmsMms_addSimMessage_Promise_1400 finish ');
} catch (err) {
console.log('Telephony_SmsMms_addSimMessage_Promise_1400 add fail');
done();
}
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Async_1700
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNSENT,Set the PDU read type
* Description Failed to add SMS messages to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Async_1700', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: RECEIVE_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_UNSENT
};
sms.addSimMessage(data, (adderr) => {
if (adderr) {
console.log('Telephony_SmsMms_addSimMessage_Async_1700 finish ');
sms.getAllSimMessages(TRUE_SLOT_ID, (geterr, getresult) => {
if (geterr) {
console.log('Telephony_SmsMms_addSimMessage_Async_1700 get cur fail');
done();
return;
}
expect(getresult.length === 0).assertTrue();
console.log('Telephony_SmsMms_addSimMessage_Async_1700 getAllSimMessages cur finish');
done();
});
return;
}
console.log('Telephony_SmsMms_addSimMessage_Async_1700 add fail');
done();
});
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Promise_1700
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNSENT,Set the PDU read type
* Description Failed to add SMS messages to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Promise_1700', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: RECEIVE_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_UNSENT
};
try {
await sms.addSimMessage(data);
console.log('Telephony_SmsMms_addSimMessage_Promise_1700 add fail');
done();
return;
} catch (err) {
console.log('Telephony_SmsMms_addSimMessage_Promise_1700 finish ');
done();
}
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Async_1800
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNREAD,Set the PDU sending type
* Description Failed to add SMS messages to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Async_1800', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: CORRECT_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_UNREAD
};
sms.addSimMessage(data, (adderr) => {
if (adderr) {
console.log('Telephony_SmsMms_addSimMessage_Async_1800 finish ');
sms.getAllSimMessages(TRUE_SLOT_ID, (geterr, getresult) => {
if (geterr) {
console.log('Telephony_SmsMms_addSimMessage_Async_1800 get cur fail');
done();
return;
}
expect(getresult.length === 0).assertTrue();
console.log('Telephony_SmsMms_addSimMessage_Async_1800 getAllSimMessages cur finish');
done();
});
return;
}
console.log('Telephony_SmsMms_addSimMessage_Async_1800 add fail');
done();
});
});
/*
* @tc.number Telephony_SmsMms_addSimMessage_Promise_1800
* @tc.name When status is equal to the correct value of SIM_MESSAGE_STATUS_UNREAD,Set the PDU sending type
* Description Failed to add SMS messages to the SIM card
* @tc.desc Function test
*/
it('Telephony_SmsMms_addSimMessage_Promise_1800', 0, async function (done) {
let data = {
slotId: TRUE_SLOT_ID,
smsc: '',
pdu: CORRECT_SMS_PDU,
status: sms.SIM_MESSAGE_STATUS_UNREAD
};
try {
await sms.addSimMessage(data);
console.log('Telephony_SmsMms_addSimMessage_Promise_1800 add fail');
done();
} catch (err) {
console.log('Telephony_SmsMms_addSimMessage_Promise_1800 finish ');
done();
}
});
/** /**
* @tc.number Telephony_SmsMms_delSimMessage_Async_0200 * @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.name When SLOTID is the wrong value,Deletes a text message from the SIM card fail
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册