提交 f6ef3c7e 编写于 作者: 高曦

电话系统api整改

Signed-off-by: N高曦 <gaoxi785@huawei.com>
上级 18af9ba4
......@@ -23,7 +23,8 @@ group("telephonyjstest") {
"netmanager_http:ActsNetManagerHttpEtsTest",
"netmanager_socket:ActsNetManagerSocketEtsTest",
"network_search:network_search",
"new_add:ActsNewAddEtsTest",
"observer:ActsObserverEtsTest",
"radiostatistic:ActsRadiostatisticEtsTest",
"sim:sim",
"sms_mms:sms_mms",
]
......
......@@ -45,7 +45,7 @@
"launchType": "standard"
}
],
"reqPermissions": [
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
......
......@@ -56,83 +56,7 @@ describe("ActsCellularDataAbnormalTest", function () {
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) {
console.log("Telephony_CellularData_enableCellularData_Async_0100 enableCellularData finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_enableCellularData_Async_0100 enableCellularData fail");
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) {
console.log("Telephony_CellularData_disableCellularData_Async_0100 disableCellularData finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_disableCellularData_Async_0100 disableCellularData fail");
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
......@@ -170,26 +94,7 @@ describe("ActsCellularDataAbnormalTest", function () {
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)
......@@ -244,76 +149,6 @@ describe("ActsCellularDataAbnormalTest", function () {
}
})
/*
* @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();
expect().assertFail();
console.log("Telephony_CellularData_enableCellularData_Promise_0100 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_enableCellularData_Promise_0100 finish");
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();
expect().assertFail();
console.log("Telephony_CellularData_disableCellularData_Promise_0100 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_disableCellularData_Promise_0100 finish");
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
......@@ -350,24 +185,6 @@ describe("ActsCellularDataAbnormalTest", function () {
}
})
/*
* @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)
......
......@@ -52,7 +52,7 @@
"launchType": "standard"
}
],
"reqPermissions": [
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
......
......@@ -116,13 +116,11 @@ export default function httpRequestJsunit() {
}
});
/**
* @tc.number Telephony_http_HttpRequest_destroy_0100
* @tc.name httprequest::destroy
* @tc.desc Test Test httprequest property.
*/
it("Telephony_http_HttpRequest_destroy_0100", 0, async function (done) {
var casename = "Telephony_http_HttpRequest_0200"
console.log("-----------------------HttpRequest_destroy Test is starting-----------------------");
......@@ -163,7 +161,6 @@ export default function httpRequestJsunit() {
* @tc.name httprequest::on_headerReceive
* @tc.desc Test Test httprequest property.
*/
it("Telephony_http_HttpRequest_on_headerReceive_0100", 0, async function (done) {
var casename = "Telephony_http_HttpRequest_0300"
console.log("-----------------------HttpRequest_on_headerReceive Test is starting-----------------------");
......
......@@ -55,8 +55,6 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_http_HttpRequestOptions_method_0200
* @tc.name HttpRequestOptions::method
......@@ -94,7 +92,6 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_extraData_0100
* @tc.name HttpRequestOptions::extraData
......@@ -137,8 +134,6 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_extraData_0200
* @tc.name HttpRequestOptions::extraData
......@@ -184,13 +179,11 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_header_0100
* @tc.name HttpRequestOptions::header
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_header_0100", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0300';
console.log("-----------------------HttpRequestOptions_header Test is starting-----------------------");
......@@ -232,7 +225,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::header
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_header_0200", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0300';
console.log("-----------------------HttpRequestOptions_header_01 Test is starting-----------------------");
......@@ -281,7 +273,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::header
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_header_0300", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0300';
console.log("-----------------------HttpRequestOptions_header_02 Test is starting-----------------------");
......@@ -323,7 +314,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::header
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_header_0400", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0300';
console.log("-----------------------HttpRequestOptions_header_03 Test is starting-----------------------");
......@@ -364,10 +354,6 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_readTimeout_0100
* @tc.name HttpRequestOptions::readTimeout
......@@ -408,7 +394,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::readTimeout
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_readTimeout_0200", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0400';
console.log("-----------------------HttpRequestOptions_readTimeout_01 Test is starting-----------------------");
......@@ -441,13 +426,11 @@ export default function HttpRequestOptionsJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpRequestOptions_connectTimeout_0100
* @tc.name HttpRequestOptions::connectTimeout
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_connectTimeout_0100", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0500';
console.log("-----------------------HttpRequestOptions_connectTimeout Test is starting-----------------------");
......@@ -483,7 +466,6 @@ export default function HttpRequestOptionsJsunit() {
* @tc.name HttpRequestOptions::connectTimeout
* @tc.desc Test Test HttpRequestOptions property.
*/
it("Telephony_Http_HttpRequestOptions_connectTimeout_0200", 0, async function (done) {
var casename = 'Telephony_Http_HttpRequestOptions_0500';
console.log("-----------------------HttpRequestOptions_connectTimeout_01 Test is starting-----------------------");
......
......@@ -331,16 +331,12 @@ export default function httpResponseJsunit() {
}
});
/**
* @tc.number Telephony_Http_HttpResponse_cookies_0100
* @tc.name HttpResponse::cookies
* @tc.desc Test Test HttpResponse property.
*/
it("Telephony_Http_HttpResponse_cookies_0100", 0, async function (done) {
var casename = 'Telephony_Http_HttpResponse_0400';
console.log("-----------------------HttpResponse cookies Test is starting-----------------------");
......@@ -378,7 +374,6 @@ export default function httpResponseJsunit() {
* @tc.desc Test Test HttpResponse property.
*/
it("Telephony_Http_HttpResponse_cookies_0200", 0, async function (done) {
var casename = 'Telephony_Http_HttpResponse_0400';
console.log("-----------------------HttpResponse cookies_01 Test is starting-----------------------");
......@@ -402,15 +397,12 @@ export default function httpResponseJsunit() {
});
/**
* @tc.number Telephony_Http_HttpResponse_cookies_0300
* @tc.name HttpResponse::cookies
* @tc.desc Test Test HttpResponse property.
*/
it("Telephony_Http_HttpResponse_cookies_0300", 0, async function (done) {
var casename = 'Telephony_Http_HttpResponse_0400';
console.log("-----------------------HttpResponse cookies_02 Test is starting-----------------------");
......
......@@ -417,11 +417,6 @@ export default function requestMethodJsunit() {
}
});
})
};
......
......@@ -544,7 +544,6 @@ export default function responseCodeJsunit() {
});
/**
* @tc.number Telephony_Http_ResponseCode_CONFLICT_0100
* @tc.name ResponseCode::CONFLICT
......@@ -564,8 +563,6 @@ export default function responseCodeJsunit() {
});
/**
* @tc.number Telephony_Http_ResponseCode_GONE_0100
* @tc.name ResponseCode::GONE
......
......@@ -52,7 +52,7 @@
"launchType": "standard"
}
],
"reqPermissions": [
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
......
......@@ -407,80 +407,6 @@ export default function connectionJsunit() {
done();
});
/*
* @tc.number : Telephony_Connection_Connection_enableAirplaneMode_0100
* @tc.name : enableAirplaneMode
* @tc.desc : Enables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_enableAirplaneMode_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0100 Test start*************");
connection.enableAirplaneMode((error, data) => {
if (error) {
expect(true).assertTrue();
done();
return;
}
expect().assertFail();
done();
});
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0100 Test end*************");
done();
});
/*
* @tc.number : Telephony_Connection_Connection_enableAirplaneMode_0200
* @tc.name : enableAirplaneMode
* @tc.desc : Enables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_enableAirplaneMode_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0200 Test start*************");
connection.enableAirplaneMode().then(data => {
expect(true).assertTrue();
}).catch(err => {
expect().assertFail();
});
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0200 Test end*************");
done();
});
/*
* @tc.number : Telephony_Connection_Connection_disableAirplaneMode_0100
* @tc.name : disableAirplaneMode
* @tc.desc : Disables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_disableAirplaneMode_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_disableAirplaneMode_0100 Test start*************");
connection.disableAirplaneMode((error, data) => {
if (error) {
expect(true).assertTrue();
done();
return;
}
expect().assertFail();
done();
});
console.log("************* Telephony_Connection_Connection_disableAirplaneMode_0100 Test end*************");
done();
});
/*
* @tc.number : Telephony_Connection_Connection_disableAirplaneMode_0200
* @tc.name : disableAirplaneMode
* @tc.desc : Disables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_disableAirplaneMode_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetConnected_0200 Test start*************");
connection.disableAirplaneMode().then(data => {
expect(true).assertTrue();
}).catch(err => {
expect().assertFail();
});
console.log("************* Telephony_Connection_Connection_disableAirplaneMode_0200 Test end*************");
done();
});
/*
* @tc.number : Telephony_Connection_Connection_reportNetConnected_0100
* @tc.name : reportNetConnected
......
......@@ -16,13 +16,13 @@
//other import
import connectionJsunit from './ConnectionJsunit.test.ets';
import socketJsunit from './SocketJsunit.test.ets';
//import webSocketJsunit from './WebSocketJsunit.test.ets';
import webSocketJsunit from './WebSocketJsunit.test.ets';
import connectionSecondJsUnit from './ConnectionSecondJsUnit.test.ets';
export default function testsuite() {
//other
socketJsunit();
//webSocketJsunit();
webSocketJsunit();
connectionJsunit();
connectionSecondJsUnit();
}
\ No newline at end of file
......@@ -45,7 +45,7 @@
"launchType": "standard"
}
],
"reqPermissions": [
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
......
// @ts-nocheck
/**
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import sim from '@ohos.telephony.sim';
import * as env from './lib/Const.js';
import utils from './Utils.ets'
export default function simJsunit() {
describe('appInfoTest', function () {
console.log("************* sim Test start*************");
/**
* @tc.number Telephony_Sim_getOperatorConfigs_Async_0100
* @tc.name The slotId parameter is 0 and the OperatorConfig structure is not expected to be empty
* @tc.desc Function test
*/
it('Telephony_Sim_getOperatorConfigs_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
console.log('Telephony_Sim_getOperatorConfigs_Async_0100 start');
let containerIsEmpty = 0;
sim.getOperatorConfigs(env.DEFAULT_SLOTID, (err, data) => {
console.log('Telephony_Sim_getOperatorConfigs_Async_0100 result');
if (err) {
console.log(`Telephony_Sim_getOperatorConfigs_Async_0100 fail, err : ${err.message}`);
done();
return;
}
expect(Object.keys(data).length !== containerIsEmpty).assertTrue();
expect(data.field !== containerIsEmpty).assertTrue();
expect(data.value !== containerIsEmpty).assertTrue();
console.log('Telephony_Sim_getOperatorConfigs_Async_0100 finish');
done();
});
});
/**
* @tc.number Telephony_Sim_getSimAccountInfo_Async_0100
* @tc.name Get the return value by calling the GetSimAccountInfo interface SIM ID input parameter 0.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimAccountInfo_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
const CASE_NAME = 'Telephony_Sim_getSimAccountInfo_Async_0100';
let iccIdValue;
sim.getSimAccountInfo(env.DEFAULT_SLOTID, (err, info) => {
if (err) {
console.log(`${CASE_NAME} fail ,err : ${err.message}`);
done();
return;
}
console.log(`${CASE_NAME} getSimAccountInfo: ${JSON.stringify(info)}`);
expect(info.slotIndex === env.DEFAULT_SLOTID
&& info.isEsim === false
&& info.isActive === true
&& info.iccId === iccIdValue
&& info.showName === env.SIM_SLOT_NAME
&& info.showNumber === env.SIM_SLOT_NUMBER
&& info.simId === "simId"
).assertTrue();
console.log(`${CASE_NAME} finish`);
done();
});
});
/**
* @tc.number Telephony_Sim_unlockPin_Async_0100
* @tc.name Test the unlockPin interface when the card status is ready state.
* @tc.desc Function test
*/
it('Telephony_Sim_unlockPin_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
let PIN = '1234';
sim.unlockPin(env.DEFAULT_SLOTID, PIN, (err, data) => {
if (err) {
console.log(`Telephony_Sim_unlockPin_Async_0100 fail, err: ${err.message}`);
done();
return;
}
expect(data.result === env.OTHER_ABNORMAL).assertTrue();
console.log('Telephony_Sim_unlockPin_Async_0100 finish');
done();
});
});
/**
* @tc.number Telephony_Sim_addIccDiallingNumbers_Async_0100
* @tc.name Test sim.addIccDiallingNumbers(soltId: -1, type: 1, diallingNumbers:
* {recordNumber: 1, alphaTag: 'test', number: '12345678', pin2: '123@#ABCD'},
* callback: AsyncCallback<void>) async callback interface, expect enter error.
* @tc.desc Function test
*/
const CONTACT_INFO = { 'recordNumber': 1, 'alphaTag': 'test', 'number': '12345678' };
const GENERAL_CONTACT_INFO = Object.assign({}, { 'pin2': env.INCORRECT_PIN2 }, CONTACT_INFO);
it('Telephony_Sim_addIccDiallingNumbers_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
const CASE_NAME = 'Telephony_Sim_addIccDiallingNumbers_Async_0100';
var number = env.SLOTID_MINUS1;
sim.addIccDiallingNumbers(number,
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_SetLockState_Async_0100
* @tc.name Test the SetLockState async callback interface to open the PIN lock and check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_SetLockState_Async_0100', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_SetLockState_Async_0100';
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
const lockInfo = { lockType: sim.PIN_LOCK, state: sim.LOCK_ON, password: env.CORRECT_PIN };
await setPinLockState(sim.LOCK_OFF);
sim.setLockState(env.DEFAULT_SLOTID, lockInfo, (error, lockStatusResponse) => {
if (error) {
console.log(`${CASE_NAME} setLockState error: ${error.message}`);
expect().assertFail();
done();
return;
}
if (lockStatusResponse.result !== env.LOCK_RESULT.SUCCESS) {
console.log(`${CASE_NAME} setLockState failure, lock status response: ${lockStatusResponse.result}`);
expect().assertFail();
done();
return;
}
});
});
console.log("************* sim Test end*************");
})
}
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNewAddEtsTest") {
ohos_js_hap_suite("ActsObserverEtsTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_demo_ets_assets",
......@@ -21,7 +21,7 @@ ohos_js_hap_suite("ActsNewAddEtsTest") {
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsNewAddEtsTest"
hap_name = "ActsObserverEtsTest"
}
ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
......
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1500000",
"package": "com.ohos.observer",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsObserverEtsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.newadd",
"bundleName": "com.ohos.observer",
"vendor": "open",
"version": {
"code": 1000000,
......@@ -14,7 +14,7 @@
},
"deviceConfig": {},
"module": {
"package": "com.ohos.newadd",
"package": "com.ohos.observer",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
......
/**
* 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.
*/
//other import
import observer from './ObserverJsunit.test.ets'
export default function testsuite() {
observer();
}
\ No newline at end of file
......@@ -191,58 +191,7 @@ export default function observerJsunit() {
done()
})
/*
* @tc.number : Telephony_observer_observer_on_cellInfoChange_0100
* @tc.name : on_cellInfoChange
* @tc.desc : call the on method of cellInfoChange
*/
it('Telephony_observer_observer_on_cellInfoChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_cellInfoChange_0100 Test start *************")
observer.on('cellInfoChange', (cellInformation) => {
expect().assertFail()
done()
return
})
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_cellInfoChange_0100 Test end *************")
done()
})
/*
* @tc.number : Telephony_observer_observer_on_cellInfoChange_0200
* @tc.name : on_cellInfoChange
* @tc.desc : call the on method of cellInfoChange
*/
it('Telephony_observer_observer_on_cellInfoChange_0200', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_cellInfoChange_0200 Test start *************")
observer.on('cellInfoChange', {
slotId: SLOT_0
}, (cellInformation) => {
expect().assertFail()
done()
return
})
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_cellInfoChange_0200 Test end *************")
done()
})
/*
* @tc.number : Telephony_observer_observer_off_cellInfoChange_0100
* @tc.name : off_cellInfoChange
* @tc.desc : call the off method of cellInfoChange
*/
it('Telephony_observer_observer_off_cellInfoChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_off_cellInfoChange_0100 Test start *************")
observer.off('cellInfoChange', (cellInformation) => {
expect().assertFail()
done()
return
})
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_off_cellInfoChange_0100 Test end *************")
done()
})
/*
* @tc.number : Telephony_observer_observer_on_cellularDataConnectionStateChange_0100
......
# 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("ActsRadiostatisticEtsTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_demo_ets_assets",
":ace_demo_ets_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsRadiostatisticEtsTest"
}
ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("ace_demo_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -3,13 +3,13 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "2000000",
"package": "com.ohos.newadd",
"package": "com.ohos.radiostatistic",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsNewAddEtsTest.hap"
"ActsRadiostatisticEtsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
{
"app": {
"bundleName": "com.ohos.radiostatistic",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.radiostatistic",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
},
{
"name":"ohos.permission.SET_TELEPHONY_STATE",
"reason":"need use ohos.permission.SET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.GET_TELEPHONY_STATE",
"reason":"need use ohos.permission.GET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.PLACE_CALL",
"reason":"need use ohos.permission.PLACE_CALL"
},
{
"name":"ohos.permission.READ_CONTACTS",
"reason":"need use ohos.permission.READ_CONTACTS"
},
{
"name":"ohos.permission.WRITE_CONTACTS",
"reason":"need use ohos.permission.WRITE_CONTACTS"
},
{
"name":"ohos.permission.SEND_MESSAGES",
"reason":"need use ohos.permission.SEND_MESSAGES"
},
{
"name":"ohos.permission.RECEIVE_SMS",
"reason":"need use ohos.permission.RECEIVE_SMS"
},
{
"name":"ohos.permission.READ_CALL_LOG",
"reason":"need use ohos.permission.READ_CALL_LOG"
},
{
"name":"ohos.permission.GET_NETWORK_INFO",
"reason":"need use ohos.permission.GET_NETWORK_INFO"
},
{
"name":"ohos.permission.INTERNET",
"reason":"need use ohos.permission.INTERNET"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/Button",
"pages/Blank",
"pages/DataPanel",
"pages/Divider",
"pages/Text",
"pages/RowSplit",
"pages/Scroll",
"pages/Stack",
"pages/Image",
"pages/Progress",
"pages/Qrcode",
"pages/Rating",
"pages/Span",
"pages/Slider",
"pages/Badge",
"pages/Column",
"pages/ColumnSplit",
"pages/Counter",
"pages/Flex",
"pages/GridContainer"
],
"name": ".MainAbility",
"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('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ 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.
*/
@Entry
@Component
struct badge {
@State counts: number = 33
@State message: string = 'new'
@State active: boolean = false
private content: string = "badge Page";
onPageShow() {
console.info('badge page show called');
}
onBuildDone() {
console.info('badge page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Badge({
count: this.counts,
position: BadgePosition.Right,
maxCount: 99,
style: { color: 0xFFFFFF, fontSize: 16, badgeSize: 20, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge')
Text("BadgePosition.RightTop").fontSize(16)
Badge({
count: this.counts,
position: BadgePosition.RightTop,
maxCount: 99,
style: { color: 0xFFFFFF, fontSize: '16', badgeSize: '20', badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge1')
Text("BadgePosition.Left").fontSize(16)
Badge({
count: this.counts,
position: BadgePosition.Left,
maxCount: 99,
style: { color: Color.Pink, fontSize: 16, badgeSize: 20, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge2')
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct blank_testcase {
@State Color: Color = Color.Pink
@State active: boolean = false
private content: string = "Blank Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Blank(100)
.color(this.Color)
.key('blank')
Text('on/off').fontSize(18).height(60)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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 router from '@system.router'
@Entry
@Component
struct button_testcase {
@State stateEffect: boolean = true
@State ButtonType: ButtonType = ButtonType.Circle
private content: string = "Button Page";
onPageShow() {
console.info('Button page show called');
}
onBuildDone() {
console.info('Button page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button('1.value', { type: ButtonType.Circle, stateEffect: this.stateEffect })
.fontSize(12)
.fontWeight(FontWeight.Bold)
.fontColor(0xCCCCCC)
.height(40)
.width(40)
.key('button')
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
.padding(10)
Button() {
Text("2.Capsule")
}
.type(ButtonType.Capsule)
.stateEffect(false)
.backgroundColor('#0D9FFB')
.padding(10)
.key('button1')
Button() {
Text("3.Normal")
}.type(ButtonType.Normal)
.backgroundColor('#0D9FFB')
.key('button2')
}.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct column {
@State active: boolean = false
private content: string = "Column Page"
onPageShow() {
console.info('Column page show called');
}
onBuildDone() {
console.info('Column page build done called');
}
build() {
Column({ space: 5 }) {
Text('alignItems(Center)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.Center).width('90%').border({ width: 1 }).key('column')
Text('alignItems(Start)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column({ space: '5' }) {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.Start).width('90%').border({ width: 1 }).key('column1')
Text('alignItems(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.End).width('90%').border({ width: 1 }).key('column2')
}.width('100%').padding({ top: 5 })
}
}
/*
* 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.
*/
@Entry
@Component
struct columnSplit {
private content: string = "ColumnSplit Page"
onPageShow() {
console.info('ColumnSplit page show called');
}
onBuildDone() {
console.info('ColumnSplit page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column() {
Text('ColumnSplit').fontSize(9).fontColor(0xCCCCCC).width('90%')
ColumnSplit() {
Text('1').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('2').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('3').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.key('columnSplit')
.resizeable(true)
.width('90%').height('60%')
}.width("100%")
Column() {
Text('ColumnSplit1').fontSize(9).fontColor(0xCCCCCC).width('90%')
ColumnSplit() {
Text('1').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('2').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('3').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.key('columnSplit1')
.resizeable(false)
.width('90%').height('60%')
}.width("100%")
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
......@@ -17,11 +17,9 @@
import convertOptionsJsunit from './ConvertOptionsJsunit.test.ets'
import radioJsunit from './RadioJsunit.test.ets'
import radioSecondJsunit from './RadioSecondJsunit.test.ets'
import observerJsunit from './ObserverJsunit.test.ets'
import smsUiJsunit from './SmsMmsJsunit.test.ets';
import callJsunit from './CallJsunit.test.ets';
import dataJsunit from './DataJsunit.test.ets';
import simJsunit from './SimJsunit.test.ets';
import statisticsUiJsunit from './StatisticsJsunit.test.ets';
export default function testsuite() {
......@@ -30,9 +28,7 @@ export default function testsuite() {
callJsunit();
smsUiJsunit();
convertOptionsJsunit();
observerJsunit();
radioJsunit();
radioSecondJsunit();
simJsunit();
statisticsUiJsunit();
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册