提交 3849eedc 编写于 作者: O openharmony_ci 提交者: Gitee

!1251 电话子系统合入master挑到LTS XTS用例补齐

Merge pull request !1251 from yexiangbin/cherry-pick-1638341957
......@@ -27,6 +27,7 @@ describe('CallManagerMMI', function () {
it('Telephony_CallManager_MMI_Async_0100', 0, async function (done) {
call.dial('**21*12599*10#', (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Async_0100 fail');
done();
return;
......@@ -34,9 +35,9 @@ describe('CallManagerMMI', function () {
expect(data).assertTrue();
console.log('Telephony_CallManager_MMI_Async_0100 finish data = ' + data);
done();
})
call.dial('##002#', (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Async_0100 fail');
done();
return;
......@@ -46,6 +47,7 @@ describe('CallManagerMMI', function () {
done();
})
})
})
/*
* @tc.number Telephony_CallManager_MMI_Async_0200
......@@ -56,15 +58,16 @@ describe('CallManagerMMI', function () {
it('Telephony_CallManager_MMI_Async_0200', 0, async function (done) {
call.dial('**33*0000#', (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Async_0200 fail');
done();
return;
}
expect(data).assertTrue();
console.log('Telephony_CallManager_MMI_Async_0200 finish data = ' + data);
})
call.dial('#33*0000#', (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Async_0200 fail');
done();
return;
......@@ -74,6 +77,7 @@ describe('CallManagerMMI', function () {
done();
})
})
})
/*
* @tc.number Telephony_CallManager_MMI_Async_0300
......@@ -84,15 +88,16 @@ describe('CallManagerMMI', function () {
it('Telephony_CallManager_MMI_Async_0300', 0, async function (done) {
call.dial('*331*0000#', (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Async_0300 fail');
done();
return;
}
expect(data).assertTrue();
console.log('Telephony_CallManager_MMI_Async_0300 finish data = ' + data);
})
call.dial('#331#0000#', (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Async_0300 fail');
done();
return;
......@@ -102,6 +107,7 @@ describe('CallManagerMMI', function () {
done();
})
})
})
/*
* @tc.number Telephony_CallManager_MMI_Async_0400
......@@ -112,6 +118,7 @@ describe('CallManagerMMI', function () {
it('Telephony_CallManager_MMI_Async_0400', 0, async function (done) {
call.dial('#35*0000#', (err, data) => {
if (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Async_0400 fail');
done();
return;
......@@ -132,12 +139,12 @@ describe('CallManagerMMI', function () {
var data = await call.dial('##330*0000#');
expect(data).assertTrue();
console.log('Telephony_CallManager_MMI_Promise_0100 finish data = ' + data);
done();
} catch (err) {
console.log('Telephony_CallManager_MMI_Promise_0100 fail');
expect().assertFail();
done();
}
done();
})
/*
......@@ -151,12 +158,12 @@ describe('CallManagerMMI', function () {
var data = await call.dial('*#330#0000#');
expect(data).assertTrue();
console.log('Telephony_CallManager_MMI_Promise_0200 finish data = ' + data);
done();
} catch (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Promise_0200 fail');
done();
}
done();
})
/*
......@@ -169,12 +176,12 @@ describe('CallManagerMMI', function () {
var data = await call.dial('*#31#');
expect(data).assertTrue();
console.log('Telephony_CallManager_MMI_Promise_0300 finish data = ' + data);
done();
} catch (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Promise_0300 fail');
done();
}
done();
})
/*
......@@ -191,16 +198,17 @@ describe('CallManagerMMI', function () {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Promise_0400 fail');
done();
return;
}
try {
var data = await call.dial('*31#');
expect(data).assertTrue();
console.log('Telephony_CallManager_MMI_Promise_0400 finish data = ' + data);
done();
} catch (err) {
expect().assertFail();
console.log('Telephony_CallManager_MMI_Promise_0400 fail');
done();
}
done();
})
})
......@@ -16,7 +16,21 @@
# 配置发送短信的电话号码
config_const_var[0]="const SMS_SEND_DST_NUMBER = '138xxxxxxxx';"
#配置通话管理自动接听号码
config_const_var[1]="const CALLMANAGER_TEST_PHONY_NUMBER = '10086';"
# 短信测试中使用到的短信中心服务地址
config_const_var[2]="const OTHER_SMSC_NUMBER = '+86138xxxxxxxx';"
config_const_var[3]="const USABLE_SMSC_NUMBER = '+86138xxxxxxxx';"
#通话管理用例使用号码
config_const_var[4]="const INVALID_NUMBER = '138xxxxxxxx';"
config_const_var[5]="const THE_THREE_NUMBER = '112';"
config_const_var[6]="const EIGHTEEN_DIGITS = '123456789123456789';"
config_const_var[7]="const WITH_LETTER_NUMBER = 'abcde123456';"
config_const_var[8]="const EIGHT_NUMBER = '00000000';"
config_const_var[9]="const EIGHT_NUMBER_WITH_AN_AREA_CODE = '0898 0000 0000';"
config_const_var[10]="const MORE_THAN_30_NUMBERS = '12345678901234567890012345678901';"
for((i = 0; i < ${#config_const_var}; i++))
do
......
......@@ -65,7 +65,6 @@ describe('NetworkSearchTest', function () {
const ISO_COUNTRY_CODE = 'cn';
const PLMN_SIZE = 5;
/**
* @tc.number Telephony_NetworkSearch_getNetworkState_Async_0100
* @tc.name Test the getNetworkState() query function and return the default card 0 network registration status
......@@ -97,8 +96,8 @@ describe('NetworkSearchTest', function () {
data.plmnNumeric != null
).assertTrue();
expect(data.plmnNumeric.length == 5 && data.plmnNumeric.substr(0, 3) === '460').assertTrue();
expect(garrRegState).assertContain(data.regStatus);
expect(data.nsaState === 1).assertTrue();
expect(data.regStatus === radio.REG_STATE_IN_SERVICE).assertTrue();
expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue();
expect(data.isRoaming === false).assertTrue();
expect(data.isCaActive === false).assertTrue();
expect(data.isEmergency === false).assertTrue();
......@@ -129,8 +128,8 @@ describe('NetworkSearchTest', function () {
data.shortOperatorName != undefined && data.shortOperatorName != '' && data.shortOperatorName != null
).assertTrue();
expect(data.plmnNumeric.length === PLMN_SIZE && data.plmnNumeric.substr(0, 3) === '460').assertTrue();
expect(garrRegState).assertContain(data.regStatus);
expect(data.nsaState === 1).assertTrue();
expect(data.regStatus === radio.REG_STATE_IN_SERVICE).assertTrue();
expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue();
expect(data.isRoaming === false).assertTrue();
expect(data.isCaActive === false).assertTrue();
expect(data.isEmergency === false).assertTrue();
......@@ -174,8 +173,7 @@ describe('NetworkSearchTest', function () {
done();
return;
}
console.log(`Telephony_NetworkSearch_getRadioTech_Async_0100 finish psRadioTech: ${psRadioTech}
csRadioTech: ${csRadioTech}`);
console.log(`Telephony_NetworkSearch_getRadioTech_Async_0100 finish ps: ${psRadioTech} cs: ${csRadioTech}`);
expect(garrRadioTech).assertContain(psRadioTech);
expect(garrRadioTech).assertContain(csRadioTech);
done();
......@@ -249,7 +247,7 @@ describe('NetworkSearchTest', function () {
return;
}
console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0400 finish data: ${JSON.stringify(data)}`);
expect(data === undefined || data.length === 0).assertTrue();
expect(data.length === 0).assertTrue();
done();
});
});
......@@ -271,8 +269,8 @@ describe('NetworkSearchTest', function () {
data.shortOperatorName != undefined && data.shortOperatorName != '' && data.shortOperatorName != null
).assertTrue();
expect(data.plmnNumeric.length === PLMN_SIZE && data.plmnNumeric.substr(0, 3) === '460').assertTrue();
expect(garrRegState).assertContain(data.regStatus);
expect(data.nsaState === 1).assertTrue();
expect(data.regStatus === radio.REG_STATE_IN_SERVICE).assertTrue();
expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue();
expect(data.isRoaming === false).assertTrue();
expect(data.isCaActive === false).assertTrue();
expect(data.isEmergency === false).assertTrue();
......@@ -304,8 +302,8 @@ describe('NetworkSearchTest', function () {
data.shortOperatorName != undefined && data.shortOperatorName != '' && data.shortOperatorName != null
).assertTrue();
expect(data.plmnNumeric.length === PLMN_SIZE && data.plmnNumeric.substr(0, 3) === '460').assertTrue();
expect(garrRegState).assertContain(data.regStatus);
expect(data.nsaState === 1).assertTrue();
expect(data.regStatus === radio.REG_STATE_IN_SERVICE).assertTrue();
expect(data.nsaState === radio.NSA_STATE_NOT_SUPPORT).assertTrue();
expect(data.isRoaming === false).assertTrue();
expect(data.isCaActive === false).assertTrue();
expect(data.isEmergency === false).assertTrue();
......@@ -419,7 +417,7 @@ describe('NetworkSearchTest', function () {
let data = await radio.getSignalInformation(slotId);
console.log(
`Telephony_NetworkSearch_getSignalInformation_Promise_0400 finish data: ${JSON.stringify(data)}`);
expect(data === undefined || data.length === 0).assertTrue();
expect(data.length === 0).assertTrue();
} catch (err) {
console.log(`Telephony_NetworkSearch_getSignalInformation_Promise_0400 fail err: ${err}`);
expect().assertFail();
......@@ -485,7 +483,7 @@ describe('NetworkSearchTest', function () {
}
console.log(
`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 finish data: ${JSON.stringify(data)}`);
expect(data === undefined || data.length === 0).assertTrue();
expect(data.length === 0).assertTrue();
done();
});
});
......@@ -501,7 +499,7 @@ describe('NetworkSearchTest', function () {
let data = await radio.getISOCountryCodeForNetwork(slotId);
console.log(
`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 finish data:${JSON.stringify(data)}`);
expect(data === undefined || data.length === 0).assertTrue();
expect(data.length === 0).assertTrue();
} catch (err) {
console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err: ${err}`);
expect().assertFail();
......
......@@ -49,6 +49,7 @@ describe('SimFileManagerFunction', function () {
sim.getIMSI(simSlotId.SLOT_ID_4, (err, data) => {
if (err) {
// Enter the exception ID to enter err.
console.log(`Telephony_Sim_getIMSI_Async_0200, err: ${err.message}`);
console.log('Telephony_Sim_getIMSI_Async_0200 finish');
done();
return;
......@@ -66,7 +67,7 @@ describe('SimFileManagerFunction', function () {
*/
it('Telephony_Sim_getIMSI_Promise_0100', 0, async function (done) {
try {
var data = await sim.getIMSI(simSlotId.SLOT_ID_0);
let data = await sim.getIMSI(simSlotId.SLOT_ID_0);
console.log(`Telephony_Sim_getIMSI_Promise_0100 data = ${data}`);
expect(data !== '' || data !== undefined).assertTrue();
expect(data.length === IMSI_LENGTH).assertTrue();
......@@ -86,8 +87,10 @@ describe('SimFileManagerFunction', function () {
*/
it('Telephony_Sim_getIMSI_Promise_0200', 0, async function (done) {
try {
var data = await sim.getIMSI(simSlotId.SLOT_ID_4);
let data = await sim.getIMSI(simSlotId.SLOT_ID_4);
} catch (err) {
// Enter the exception ID to enter err.
console.log(`Telephony_Sim_getIMSI_Promise_0200, err: ${err.message}`);
console.log('Telephony_Sim_getIMSI_Promise_0200 finish');
done();
return;
......@@ -127,6 +130,7 @@ describe('SimFileManagerFunction', function () {
sim.getSimIccId(simSlotId.SLOT_ID_4, (err, data) => {
if (err) {
// Enter the exception ID to enter err.
console.log(`Telephony_Sim_getSimIccId_Async_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimIccId_Async_0200 finish');
done();
return;
......@@ -144,7 +148,7 @@ describe('SimFileManagerFunction', function () {
*/
it('Telephony_Sim_getSimIccId_Promise_0100', 0, async function (done) {
try {
var data = await sim.getSimIccId(simSlotId.SLOT_ID_0);
let data = await sim.getSimIccId(simSlotId.SLOT_ID_0);
console.log(`Telephony_Sim_getSimIccId_Promise_0100 data${data}`);
expect(data !== '' || data !== undefined).assertTrue();
expect(data.length === ICC_LENGTH).assertTrue();
......@@ -164,8 +168,9 @@ describe('SimFileManagerFunction', function () {
*/
it('Telephony_Sim_getSimIccId_Promise_0200', 0, async function (done) {
try {
var data = await sim.getSimIccId(simSlotId.SLOT_ID_4);
let data = await sim.getSimIccId(simSlotId.SLOT_ID_4);
} catch (err) {
console.log(`Telephony_Sim_getSimIccId_Promise_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimIccId_Promise_0200 finish');
done();
return;
......@@ -182,7 +187,7 @@ describe('SimFileManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getISOCountryCodeForSim_Async_0100', 0, async function (done) {
var countryCode = 'cn';
let countryCode = 'cn';
sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_0, (err, data) => {
if (err) {
console.log(`Telephony_Sim_getISOCountryCodeForSim_Async_0100 fail, err: ${err.message}`);
......@@ -208,6 +213,7 @@ describe('SimFileManagerFunction', function () {
sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_4, (err, data) => {
if (err) {
// Expect slot id 4 return err here.
console.log(`Telephony_Sim_getISOCountryCodeForSim_Async_0200, err: ${err.message}`);
console.log('Telephony_Sim_getISOCountryCodeForSim_Async_0200 finish');
done();
return;
......@@ -225,9 +231,9 @@ describe('SimFileManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getISOCountryCodeForSim_Promise_0100', 0, async function (done) {
var countryCode = 'cn';
let countryCode = 'cn';
try {
var data = await sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_0);
let data = await sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_0);
console.log(`Telephony_Sim_getISOCountryCodeForSim_Promise_0100, data = ${data}`);
// The country code for mainland China is cn.
expect(data === countryCode).assertTrue();
......@@ -252,6 +258,7 @@ describe('SimFileManagerFunction', function () {
var data = await sim.getISOCountryCodeForSim(simSlotId.SLOT_ID_4);
} catch (err) {
// Expect slotid 4 return err here.
console.log(`Telephony_Sim_getISOCountryCodeForSim_Promise_0200, err: ${err.message}`);
console.log('Telephony_Sim_getISOCountryCodeForSim_Promise_0200 finish');
done();
return;
......@@ -268,7 +275,7 @@ describe('SimFileManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getSimOperatorNumeric_Async_0100', 0, async function (done) {
var operatorNumTopThree = '460';
let operatorNumTopThree = '460';
sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0, (err, data) => {
if (err) {
console.log(`Telephony_Sim_getSimOperatorNumeric_Async_0100 fail, err: ${err.message}`);
......@@ -297,6 +304,7 @@ describe('SimFileManagerFunction', function () {
sim.getSimOperatorNumeric(simSlotId.SLOT_ID_4, (err, data) => {
if (err) {
// Expect slotid 4 return err here.
console.log(`Telephony_Sim_getSimOperatorNumeric_Async_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimOperatorNumeric_Async_0200 finish');
done();
return;
......@@ -314,9 +322,9 @@ describe('SimFileManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getSimOperatorNumeric_Promise_0100', 0, async function (done) {
var operatorNumTopThree = '460';
let operatorNumTopThree = '460';
try {
var data = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0);
let data = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0);
console.log(`Telephony_Sim_getSimOperatorNumeric_Promise_0100, data = ${data}`);
expect(data !== '' && data !== undefined).assertTrue();
// The length of operator numeric in mainland China is 5.
......@@ -344,6 +352,7 @@ describe('SimFileManagerFunction', function () {
var data = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_4);
} catch (err) {
// Expect slotid 4 return err here.
console.log(`Telephony_Sim_getSimOperatorNumeric_Promise_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimOperatorNumeric_Promise_0200 finish');
done();
return;
......@@ -359,9 +368,9 @@ describe('SimFileManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getSimSpn_Async_0100', 0, async function (done) {
var mobileSpn = '00434D4343FFFFFFFFFFFFFFFFFFFFFFFF';
var unicomSpn = '00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
var telecomSpn = '01804E2D56FD75354FE1FFFFFFFFFFFFFF';
let mobileSpn = '00434D4343FFFFFFFFFFFFFFFFFFFFFFFF';
let unicomSpn = '00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
let telecomSpn = '01804E2D56FD75354FE1FFFFFFFFFFFFFF';
sim.getSimSpn(simSlotId.SLOT_ID_0, (err, data) => {
if (err) {
console.log(`Telephony_Sim_getSimSpn_Async_0100 fail, err: ${err.message}`);
......@@ -404,6 +413,7 @@ describe('SimFileManagerFunction', function () {
sim.getSimSpn(simSlotId.SLOT_ID_4, (err, data) => {
if (err) {
// Expect slotid 4 return err here.
console.log(`Telephony_Sim_getSimSpn_Async_0200 fail: ${err.message}`);
console.log('Telephony_Sim_getSimSpn_Async_0200 finish');
done();
return;
......@@ -420,15 +430,15 @@ describe('SimFileManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getSimSpn_Promise_0100', 0, async function (done) {
var mobileSpn = '00434D4343FFFFFFFFFFFFFFFFFFFFFFFF';
var unicomSpn = '00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
var telecomSpn = '01804E2D56FD75354FE1FFFFFFFFFFFFFF';
let mobileSpn = '00434D4343FFFFFFFFFFFFFFFFFFFFFFFF';
let unicomSpn = '00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
let telecomSpn = '01804E2D56FD75354FE1FFFFFFFFFFFFFF';
try {
var data = await sim.getSimSpn(simSlotId.SLOT_ID_0);
let data = await sim.getSimSpn(simSlotId.SLOT_ID_0);
console.log(`Telephony_Sim_getSimSpn_Promise_0100, data = ${data}`);
expect(data !== '' && data !== undefined).assertTrue();
try {
var value = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0);
let value = await sim.getSimOperatorNumeric(simSlotId.SLOT_ID_0);
console.log(`Telephony_Sim_getSimSpn_Promise_0100, value : ${value}`);
if ((value === operatorCode.MOBILE_CODE_1) || (value === operatorCode.MOBILE_CODE_2) ||
(value === operatorCode.MOBILE_CODE_3) || (value === operatorCode.MOBILE_CODE_4)) {
......@@ -466,6 +476,7 @@ describe('SimFileManagerFunction', function () {
var data = await sim.getSimSpn(simSlotId.SLOT_ID_4);
} catch (err) {
// Expect slotid 4 return err here.
console.log(`Telephony_Sim_getSimSpn_Promise_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimSpn_Promise_0200 finish');
done();
return;
......@@ -481,7 +492,7 @@ describe('SimFileManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getSimGid1_Async_0100', 0, async function (done) {
var minLength = 1;
let minLength = 1;
sim.getSimGid1(simSlotId.SLOT_ID_0, (err, data) => {
if (err) {
console.log(`Telephony_Sim_getSimGid1_Async_0100 fail, err: ${err.message}`);
......@@ -506,6 +517,7 @@ describe('SimFileManagerFunction', function () {
sim.getSimGid1(simSlotId.SLOT_ID_4, (err, data) => {
if (err) {
// Expect slotid 4 return err here.
console.log(`Telephony_Sim_getSimGid1_Async_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimGid1_Async_0200 finish');
done();
return;
......@@ -522,9 +534,9 @@ describe('SimFileManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getSimGid1_Promise_0100', 0, async function (done) {
var minLength = 1;
let minLength = 1;
try {
var data = await sim.getSimGid1(simSlotId.SLOT_ID_0);
let data = await sim.getSimGid1(simSlotId.SLOT_ID_0);
console.log(`Telephony_Sim_getSimGid1_Promise_0100, data = ${data}`);
expect(data !== '' && data !== undefined).assertTrue();
expect((data.length >= minLength)).assertTrue();
......@@ -548,6 +560,7 @@ describe('SimFileManagerFunction', function () {
var data = await sim.getSimGid1(simSlotId.SLOT_ID_4);
} catch (err) {
// Expect slotid 4 return err here.
console.log(`Telephony_Sim_getSimGid1_Promise_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimGid1_Promise_0200 finish');
done();
return;
......
......@@ -19,6 +19,13 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe('SimManagerFunction', function () {
var defaultValue = 0;
beforeAll(async function () {
// Gets the default calling card ID.
let result = await sim.getDefaultVoiceSlotId();
defaultValue = result;
})
/**
* @tc.number Telephony_Sim_getSimAccountInfo_Async_0100
* @tc.name Enter normal parameters to test whether the getSimAccountInfo
......@@ -26,8 +33,8 @@ describe('SimManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getSimAccountInfo_Async_0100', 0, async function (done) {
var defaultName = 'simDefaultDisplayName';
var defaultNumber = 'simDefaultDisplayNumber';
let defaultName = 'simDefaultDisplayName';
let defaultNumber = 'simDefaultDisplayNumber';
sim.getSimAccountInfo(simSlotId.SLOT_ID_0, (err, data) => {
if (err) {
console.log(`Telephony_Sim_getSimAccountInfo_Async_0100 fail, err: ${err.message}`);
......@@ -55,6 +62,7 @@ describe('SimManagerFunction', function () {
sim.getSimAccountInfo(simSlotId.SLOT_ID_4, (err, data) => {
if (err) {
// Enter the exception ID to enter err.
console.log(`Telephony_Sim_getSimAccountInfo_Async_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimAccountInfo_Async_0200 finish');
done();
return;
......@@ -72,10 +80,10 @@ describe('SimManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getSimAccountInfo_Promise_0100', 0, async function (done) {
var defaultName = 'simDefaultDisplayName';
var defaultNumber = 'simDefaultDisplayNumber';
let defaultName = 'simDefaultDisplayName';
let defaultNumber = 'simDefaultDisplayNumber';
try {
var data = await sim.getSimAccountInfo(simSlotId.SLOT_ID_0);
let data = await sim.getSimAccountInfo(simSlotId.SLOT_ID_0);
expect(data.slotIndex === simSlotId.SLOT_ID_0).assertTrue();
// return the default piling data as simDefaultDisplayName.
expect(data.showName === defaultName).assertTrue();
......@@ -100,9 +108,10 @@ describe('SimManagerFunction', function () {
*/
it('Telephony_Sim_getSimAccountInfo_Promise_0200', 0, async function (done) {
try {
var data = await sim.getSimAccountInfo(simSlotId.SLOT_ID_4);
let data = await sim.getSimAccountInfo(simSlotId.SLOT_ID_4);
} catch (err) {
// Enter the exception ID to enter err.
console.log(`Telephony_Sim_getSimAccountInfo_Promise_0200, err: ${err.message}`);
console.log('Telephony_Sim_getSimAccountInfo_Promise_0200 finish');
done();
return;
......@@ -119,16 +128,6 @@ describe('SimManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotId_Async_0100', 0, async function (done) {
var defaultValue = 0;
sim.getDefaultVoiceSlotId((err, result) => {
if (err) {
console.log(`Telephony_Sim_getDefaultVoiceSlotId_Async_0100 fail, err: ${err.message}`);
expect().assertFail();
done();
return;
}
defaultValue = result;
});
sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_0, (err) => {
if (err) {
console.log(`Telephony_Sim_getDefaultVoiceSlotId_Async_0100 setDefaultVoiceSLOT_ID_err: ${err.message}`);
......@@ -168,16 +167,6 @@ describe('SimManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotId_Async_0200', 0, async function (done) {
var defaultValue = 0;
sim.getDefaultVoiceSlotId((err, result) => {
if (err) {
console.log(`Telephony_Sim_getDefaultVoiceSlotId_Async_0200 fail, err: ${err.message}`);
expect().assertFail();
done();
return;
}
defaultValue = result;
});
sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_2, (err) => {
if (err) {
console.log(`Telephony_Sim_getDefaultVoiceSlotId_Async_0200:setDefaultVoiceSLOT_ID_err: ${
......@@ -218,13 +207,10 @@ describe('SimManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotId_Promise_0100', 0, async function (done) {
var defaultValue = 0;
var result = await sim.getDefaultVoiceSlotId();
defaultValue = result;
try {
await sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_2);
try {
var data = await sim.getDefaultVoiceSlotId();
let data = await sim.getDefaultVoiceSlotId();
expect(data === simSlotId.SLOT_ID_2).assertTrue();
} catch (err) {
console.log(`Telephony_Sim_getDefaultVoiceSlotId_Promise_0100 fail, err: ${err.message}`);
......@@ -250,13 +236,10 @@ describe('SimManagerFunction', function () {
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotId_Promise_0200', 0, async function (done) {
var defaultValue = 0;
var result = await sim.getDefaultVoiceSlotId();
defaultValue = result;
try {
await sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_0);
try {
var data = await sim.getDefaultVoiceSlotId();
let data = await sim.getDefaultVoiceSlotId();
console.log(`Telephony_Sim_getDefaultVoiceSlotId_Promise_0200, data = ${data}`);
expect(data === simSlotId.SLOT_ID_0).assertTrue();
// Restore Settings
......@@ -295,6 +278,7 @@ describe('SimManagerFunction', function () {
}
expect(result !== simSlotId.SLOT_ID_4).assertTrue();
});
console.log(`Telephony_Sim_setDefaultVoiceSlotId_Async_0100, err: ${err.message}`);
console.log('Telephony_Sim_setDefaultVoiceSlotId_Async_0100 finish');
done();
return;
......@@ -312,11 +296,12 @@ describe('SimManagerFunction', function () {
*/
it('Telephony_Sim_setDefaultVoiceSlotId_Promise_0100', 0, async function (done) {
try {
var data = await sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_4);
let data = await sim.setDefaultVoiceSlotId(simSlotId.SLOT_ID_4);
} catch (err) {
// Expect slotid 4 return err here.
var result = await sim.getDefaultVoiceSlotId();
let result = await sim.getDefaultVoiceSlotId();
expect(result !== simSlotId.SLOT_ID_4).assertTrue();
console.log(`Telephony_Sim_setDefaultVoiceSlotId_Promise_0100, err: ${err.message}`);
console.log('Telephony_Sim_setDefaultVoiceSlotId_Promise_0100 finish');
done();
return;
......
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("SimNoSimFunctionTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "SimNoSimFunctionTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
\ No newline at end of file
{
"description": "Configuration for sim no sim function Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "240000",
"package": "com.ohos.simnosimfunction",
"shell-timeout": "240000",
"native-test-timeout":"240000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"name": "formate",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint":"eslint --fix ./src/main/js/**/**.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"eslint": "^7.32.0"
}
}
{
"app": {
"bundleName": "com.ohos.simnosimfunction",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.simnosimfunction",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.ohos.simnosimfunction.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册