提交 c81af719 编写于 作者: G gaoxi

telephony update

Signed-off-by: Ngaoxi <gaoxi785@huawei.com>
上级 df6bf199
...@@ -16,14 +16,15 @@ group("telephonyjstest") { ...@@ -16,14 +16,15 @@ group("telephonyjstest") {
deps = [ deps = [
"call_manager:call_manager", "call_manager:call_manager",
"cellular_data:cellular_data", "cellular_data:cellular_data",
"contact_function:ActsContactFunctionEtsTest", #"contact_function:ActsContactFunctionEtsTest",
"contact_function_merge:ActsContactFunctionMergeEtsTest", #"contact_function_merge:ActsContactFunctionMergeEtsTest",
"contact_performance:ActsContactPerformanceEtsTest", #"contact_performance:ActsContactPerformanceEtsTest",
"contact_stability:ActsContactStabilityEtsTest", #"contact_stability:ActsContactStabilityEtsTest",
"netmanager_http:ActsNetManagerHttpEtsTest", "netmanager_http:ActsNetManagerHttpEtsTest",
"netmanager_socket:ActsNetManagerSocketEtsTest", "netmanager_socket:ActsNetManagerSocketEtsTest",
"network_search:network_search", "network_search:network_search",
"new_add:ActsNewAddEtsTest", "observer:ActsObserverEtsTest",
"radiostatistic:ActsRadiostatisticEtsTest",
"sim:sim", "sim:sim",
"sms_mms:sms_mms", "sms_mms:sms_mms",
] ]
......
...@@ -56,83 +56,7 @@ describe("ActsCellularDataAbnormalTest", function () { ...@@ -56,83 +56,7 @@ describe("ActsCellularDataAbnormalTest", function () {
done(); 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.number Telephony_CellularData_getCellularDataFlowType_Async_0100
* @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and * @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
...@@ -170,26 +94,7 @@ describe("ActsCellularDataAbnormalTest", function () { ...@@ -170,26 +94,7 @@ describe("ActsCellularDataAbnormalTest", function () {
done(); 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.number Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500
* @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async) * @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
...@@ -244,76 +149,6 @@ describe("ActsCellularDataAbnormalTest", function () { ...@@ -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.number Telephony_CellularData_getCellularDataFlowType_Promise_0100
* @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and * @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
...@@ -350,24 +185,6 @@ describe("ActsCellularDataAbnormalTest", function () { ...@@ -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.number Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500
* @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async) * @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
......
/**
* 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.
*/
//contact import
import CalllogTest from './contact/Calllog_test.js'
import ContactCardTest from './contact/ContactCard_test.js'
import ContactsTest from './contact/Contacts_test.js'
import GroupsTest from './contact/Groups_test.js'
import ObjectInterfaceTest from './contact/ObjectInterface_test.js'
import RecoveryTest from './contact/recovery_test.js'
import VoicemailTest from './contact/Voicemail_test.js'
import ContactClassTest from './contact/ContactClass_test.js'
import ContacterTest from './contact/ContacterJsunit.ets'
export default function testsuite() {
//contact
ContactClassTest();
ContacterTest();
CalllogTest();
ContactCardTest();
ContactsTest();
GroupsTest();
ObjectInterfaceTest();
RecoveryTest();
VoicemailTest();
}
\ 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.
*/
import contact from '@ohos.contact';
import utils from '../Utils.ets'
import {describe, expect, it} from 'deccjsunit/index'
export default function ContactClassTest() {
describe('ContactClassTest', function () {
console.log('*************ContactClassTest is start*************');
/* *
* @tc.number : telephony_contact_phoneNumber_test_0100
* @tc.name : CUSTOM_LABEL NUM_HOME NUM_MOBILE NUM_WORK NUM_FAX_WORK
* @tc.desc : check class PhoneNumber
*/
it("telephony_contact_phoneNumber_test_0100", 0, async function (done) {
console.log("************* telephony_contact_phoneNumber_test_0100 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
expect(0).assertEqual(contact.PhoneNumber.CUSTOM_LABEL);
expect(1).assertEqual(contact.PhoneNumber.NUM_HOME);
expect(2).assertEqual(contact.PhoneNumber.NUM_MOBILE);
expect(3).assertEqual(contact.PhoneNumber.NUM_WORK);
expect(4).assertEqual(contact.PhoneNumber.NUM_FAX_WORK);
done();
} catch (error) {
console.log("telephony_contact_phoneNumber_test_0100 error " + error.message);
}
console.log("************* telephony_contact_phoneNumber_test_0100 Test end*************");
});
/* *
* @tc.number : telephony_contact_phoneNumber_test_0200
* @tc.name : NUM_FAX_HOME NUM_PAGER NUM_OTHER NUM_CALLBACK NUM_CAR
* @tc.desc : check class PhoneNumber
*/
it("telephony_contact_phoneNumber_test_0200", 0, async function (done) {
console.log("************* telephony_contact_phoneNumber_test_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(5).assertEqual(contact.PhoneNumber.NUM_FAX_HOME);
expect(6).assertEqual(contact.PhoneNumber.NUM_PAGER);
expect(7).assertEqual(contact.PhoneNumber.NUM_OTHER);
expect(8).assertEqual(contact.PhoneNumber.NUM_CALLBACK);
expect(9).assertEqual(contact.PhoneNumber.NUM_CAR);
done();
console.log("************* telephony_contact_phoneNumber_test_0200 Test end*************");
});
/* *
* @tc.number : telephony_contact_phoneNumber_test_0300
* @tc.name : NUM_COMPANY_MAIN NUM_ISDN NUM_MAIN NUM_OTHER_FAX NUM_RADIO
* @tc.desc : check class PhoneNumber
*/
it("telephony_contact_phoneNumber_test_0300", 0, async function (done) {
console.log("************* telephony_contact_phoneNumber_test_0300 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(10).assertEqual(contact.PhoneNumber.NUM_COMPANY_MAIN);
expect(11).assertEqual(contact.PhoneNumber.NUM_ISDN);
expect(12).assertEqual(contact.PhoneNumber.NUM_MAIN);
expect(13).assertEqual(contact.PhoneNumber.NUM_OTHER_FAX);
expect(14).assertEqual(contact.PhoneNumber.NUM_RADIO);
done();
console.log("************* telephony_contact_phoneNumber_test_0300 Test end*************");
});
/* *
* @tc.number : telephony_contact_phoneNumber_test_0400
* @tc.name : NUM_TELEX NUM_TTY_TDD NUM_WORK_MOBILE NUM_WORK_PAGER NUM_ASSISTANT NUM_MMS INVALID_LABEL_ID labelName
* @tc.desc : check class PhoneNumber
*/
it("telephony_contact_phoneNumber_test_0400", 0, async function (done) {
console.log("************* telephony_contact_phoneNumber_test_0400 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(15).assertEqual(contact.PhoneNumber.NUM_TELEX);
expect(16).assertEqual(contact.PhoneNumber.NUM_TTY_TDD);
expect(17).assertEqual(contact.PhoneNumber.NUM_WORK_MOBILE);
expect(18).assertEqual(contact.PhoneNumber.NUM_WORK_PAGER);
expect(19).assertEqual(contact.PhoneNumber.NUM_ASSISTANT);
expect(20).assertEqual(contact.PhoneNumber.NUM_MMS);
expect(-1).assertEqual(contact.PhoneNumber.INVALID_LABEL_ID);
expect(typeof contact.PhoneNumber.labelName).assertEqual("string");
done();
console.log("************* telephony_contact_phoneNumber_test_0400 Test end*************");
});
/* *
* @tc.number : telephony_contact_postalAddress_test_0100
* @tc.name : CUSTOM_LABEL ADDR_HOME ADDR_WORK ADDR_OTHER INVALID_LABEL_ID
* @tc.desc : check class PostalAddress
*/
it("telephony_contact_postalAddress_test_0100", 0, async function (done) {
console.log("************* telephony_contact_postalAddress_test_0100 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(0).assertEqual(contact.PostalAddress.CUSTOM_LABEL);
expect(1).assertEqual(contact.PostalAddress.ADDR_HOME);
expect(2).assertEqual(contact.PostalAddress.ADDR_WORK);
expect(3).assertEqual(contact.PostalAddress.ADDR_OTHER);
expect(-1).assertEqual(contact.PostalAddress.INVALID_LABEL_ID);
done();
console.log("************* telephony_contact_postalAddress_test_0100 Test end*************");
});
/* *
* @tc.number : telephony_contact_postalAddress_test_0200
* @tc.name : labelName neighborhood pobox postalAddress postcode street
* @tc.desc : check class PostalAddress
*/
it("telephony_contact_postalAddress_test_0200", 0, async function (done) {
console.log("************* telephony_contact_postalAddress_test_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
var postalAddress = new contact.PostalAddress({
'labelName': 'testLabel',
'neighborhood': 'beijing',
'pobox': 'testBox',
'postalAddress': 'testAddress',
'postcode': 'testCode',
'street': 'testStreet'
})
expect(postalAddress.labelName).assertEqual('testLabel');
expect(postalAddress.neighborhood).assertEqual('beijing');
expect(postalAddress.pobox).assertEqual('testBox');
expect(postalAddress.postalAddress).assertEqual('testAddress');
expect(postalAddress.postcode).assertEqual('testCode');
expect(postalAddress.street).assertEqual('testStreet');
} catch (err) {
console.log("telephony_contact_postalAddress_test_0200 test error " + err.message);
}
done();
console.log("************* telephony_contact_postalAddress_test_0200 Test end*************");
});
/* *
* @tc.number : telephony_contact_relation_test_0100
* @tc.name : CUSTOM_LABEL ADDR_HOME ADDR_WORK ADDR_OTHER INVALID_LABEL_ID
* @tc.desc : check class Relation
*/
it("telephony_contact_relation_test_0100", 0, async function (done) {
console.log("************* telephony_contact_relation_test_0100 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(0).assertEqual(contact.Relation.CUSTOM_LABEL);
expect(1).assertEqual(contact.Relation.RELATION_ASSISTANT);
expect(2).assertEqual(contact.Relation.RELATION_BROTHER);
expect(3).assertEqual(contact.Relation.RELATION_CHILD);
expect(4).assertEqual(contact.Relation.RELATION_DOMESTIC_PARTNER);
done();
console.log("************* telephony_contact_relation_test_0100 Test end*************");
});
/* *
* @tc.number : telephony_contact_relation_test_0200
* @tc.name : RELATION_FATHER RELATION_FRIEND RELATION_MANAGER RELATION_MOTHER RELATION_PARENT
* @tc.desc : check class Relation
*/
it("telephony_contact_relation_test_0200", 0, async function (done) {
console.log("************* telephony_contact_relation_test_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(5).assertEqual(contact.Relation.RELATION_FATHER);
expect(6).assertEqual(contact.Relation.RELATION_FRIEND);
expect(7).assertEqual(contact.Relation.RELATION_MANAGER);
expect(8).assertEqual(contact.Relation.RELATION_MOTHER);
expect(9).assertEqual(contact.Relation.RELATION_PARENT);
done();
console.log("************* telephony_contact_relation_test_0200 Test end*************");
});
/* *
* @tc.number : telephony_contact_Relation_test_0300
* @tc.name : RELATION_PARTNER RELATION_REFERRED_BY RELATION_RELATIVE
RELATION_SISTER RELATION_SPOUSE INVALID_LABEL_ID
* @tc.desc : check class Relation
*/
it("telephony_contact_relation_test_0300", 0, async function (done) {
console.log("************* telephony_contact_relation_test_0300 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(10).assertEqual(contact.Relation.RELATION_PARTNER);
expect(11).assertEqual(contact.Relation.RELATION_REFERRED_BY);
expect(12).assertEqual(contact.Relation.RELATION_RELATIVE);
expect(13).assertEqual(contact.Relation.RELATION_SISTER);
expect(14).assertEqual(contact.Relation.RELATION_SPOUSE);
expect(-1).assertEqual(contact.Relation.INVALID_LABEL_ID);
done();
console.log("************* telephony_contact_relation_test_0300 Test end*************");
});
/* *
* @tc.number : telephony_contact_relation_test_0400
* @tc.name : labelName relationName
* @tc.desc : check class Relation
*/
it("telephony_contact_relation_test_0400", 0, async function (done) {
console.log("************* telephony_contact_relation_test_0400 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
var relation = new contact.Relation({
'labelName': 'testLabel',
'relationName': 'testRelation'
})
expect(relation.labelName).assertEqual('testLabel');
expect(relation.relationName).assertEqual('testRelation');
} catch (err) {
console.log("telephony_contact_relation_test_0400 test error " + err.message);
}
done();
console.log("************* telephony_contact_relation_test_0400 Test end*************");
});
/* *
* @tc.number : telephony_contact_sipAddress_test_0100
* @tc.name : CUSTOM_LABEL SIP_HOME SIP_WORK SIP_OTHER INVALID_LABEL_ID
* @tc.desc : check class SipAddress
*/
it("telephony_contact_sipAddress_test_0100", 0, async function (done) {
console.log("************* telephony_contact_sipAddress_test_0100 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(0).assertEqual(contact.SipAddress.CUSTOM_LABEL);
expect(1).assertEqual(contact.SipAddress.SIP_HOME);
expect(2).assertEqual(contact.SipAddress.SIP_WORK);
expect(3).assertEqual(contact.SipAddress.SIP_OTHER);
expect(-1).assertEqual(contact.SipAddress.INVALID_LABEL_ID);
done();
console.log("************* telephony_contact_sipAddress_test_0100 Test end*************");
});
/* *
* @tc.number : telephony_contact_sipAddress_test_0200
* @tc.name : labelName sipAddress
* @tc.desc : check class SipAddress
*/
it("telephony_contact_sipAddress_test_0200", 0, async function (done) {
console.log("************* telephony_contact_sipAddress_test_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
var sip = new contact.SipAddress({
'labelName': 'testLabel',
'sipAddress': 'testSip'
})
expect(sip.labelName).assertEqual('testLabel');
expect(sip.sipAddress).assertEqual('testSip');
} catch (err) {
console.log("telephony_contact_sipAddress_test_0200 test error " + err.message);
}
done();
console.log("************* telephony_contact_sipAddress_test_0200 Test end*************");
});
console.log('*************ContactClassTest is end*************');
})
}
\ No newline at end of file
// @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'
import contact from '@ohos.contact';
import utils from '../Utils.ets'
export default function contacterJsunit() {
describe('ContacterTest',function () {
/**
* @tc.number Telephony_contact_Contact_0100
* @tc.name Test The Contact enum
* @tc.desc Function test
*/
it('Telephony_contact_Contact_0100', 0, async function (done) {
console.info("Telephony_contact_Contact_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Contact.INVALID_CONTACT_ID === -1).assertTrue();
expect(contact.Contact.id === 0).assertTrue();
expect(contact.Contact.key !== "test").assertTrue();
console.info("Telephony_contact_Contact_0100 end")
done();
});
/**
* @tc.number Telephony_contact_Contact_0200
* @tc.name Test The Contact enum
* @tc.desc Function test
*/
it('Telephony_contact_Contact_0200', 0, async function (done) {
console.info("Telephony_contact_Contact_0200 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Contact.INVALID_CONTACT_ID === -1).assertTrue();
expect(contact.Contact.id === 1).assertTrue();
expect(contact.Contact.key !== "key").assertTrue();
console.info("Telephony_contact_Contact_0200 end")
done();
});
/**
* @tc.number Telephony_contact_Attribute_0100
* @tc.name Test The Attribute enum
* @tc.desc Function test
*/
it('Telephony_contact_Attribute_0100', 0, async function (done) {
console.info("Telephony_contact_Attribute_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Attribute.ATTR_CONTACT_EVENT === 0).assertTrue();
expect(contact.Attribute.ATTR_EMAIL === 0).assertTrue();
expect(contact.Attribute.ATTR_GROUP_MEMBERSHIP === 0).assertTrue();
expect(contact.Attribute.ATTR_IM === 0).assertTrue();
expect(contact.Attribute.ATTR_NAME === 0).assertTrue();
expect(contact.Attribute.ATTR_NICKNAME === 0).assertTrue();
expect(contact.Attribute.ATTR_NOTE === 0).assertTrue();
expect(contact.Attribute.ATTR_ORGANIZATION === 0).assertTrue();
expect(contact.Attribute.ATTR_PHONE === 0).assertTrue();
expect(contact.Attribute.ATTR_PORTRAIT === 0).assertTrue();
expect(contact.Attribute.ATTR_POSTAL_ADDRESS === 0).assertTrue();
expect(contact.Attribute.ATTR_RELATION === 0).assertTrue();
expect(contact.Attribute.ATTR_SIP_ADDRESS === 0).assertTrue();
expect(contact.Attribute.ATTR_WEBSITE === 0).assertTrue();
console.info("Telephony_contact_Attribute_0100 end")
done();
});
/**
* @tc.number Telephony_contact_Attribute_0200
* @tc.name Test The Attribute enum
* @tc.desc Function test
*/
it('Telephony_contact_Attribute_0200', 0, async function (done) {
console.info("Telephony_contact_Attribute_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Attribute.ATTR_CONTACT_EVENT === 1).assertTrue();
expect(contact.Attribute.ATTR_EMAIL === 1).assertTrue();
expect(contact.Attribute.ATTR_GROUP_MEMBERSHIP === 1).assertTrue();
expect(contact.Attribute.ATTR_IM === 1).assertTrue();
expect(contact.Attribute.ATTR_NAME === 1).assertTrue();
expect(contact.Attribute.ATTR_NICKNAME === 1).assertTrue();
expect(contact.Attribute.ATTR_NOTE === 1).assertTrue();
expect(contact.Attribute.ATTR_ORGANIZATION === 1).assertTrue();
expect(contact.Attribute.ATTR_PHONE === 1).assertTrue();
expect(contact.Attribute.ATTR_PORTRAIT === 1).assertTrue();
expect(contact.Attribute.ATTR_POSTAL_ADDRESS === 1).assertTrue();
expect(contact.Attribute.ATTR_RELATION === 1).assertTrue();
expect(contact.Attribute.ATTR_SIP_ADDRESS === 1).assertTrue();
expect(contact.Attribute.ATTR_WEBSITE === 1).assertTrue();
console.info("Telephony_contact_Attribute_0200 end")
done();
});
/**
* @tc.number Telephony_contact_Email_0100
* @tc.name Test The Attribute Email
* @tc.desc Function test
*/
it('Telephony_contact_Email_0100', 0, async function (done) {
console.info("Telephony_contact_Email_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Email.CUSTOM_LABEL === 0).assertTrue();
expect(contact.Email.EMAIL_HOME === 1).assertTrue();
expect(contact.Email.EMAIL_WORK === 2).assertTrue();
expect(contact.Email.EMAIL_OTHER === 3).assertTrue();
expect(contact.Email.INVALID_LABEL_ID === -1).assertTrue();
expect(contact.Email.email !== "email").assertTrue();
expect(contact.Email.labelName !== "email").assertTrue();
expect(contact.Email.displayName !== "email").assertTrue();
console.info("Telephony_contact_Email_0100 end")
done();
});
/**
* @tc.number Telephony_contact_Email_0200
* @tc.name Test The Attribute Email
* @tc.desc Function test
*/
it('Telephony_contact_Email_0200', 0, async function (done) {
console.info("Telephony_contact_Email_0200 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Email.CUSTOM_LABEL === 0).assertTrue();
expect(contact.Email.EMAIL_HOME === 1).assertTrue();
expect(contact.Email.EMAIL_WORK === 2).assertTrue();
expect(contact.Email.EMAIL_OTHER === 3).assertTrue();
expect(contact.Email.INVALID_LABEL_ID === -1).assertTrue();
expect(contact.Email.email !== "email2").assertTrue();
expect(contact.Email.labelName !== "email2").assertTrue();
expect(contact.Email.displayName !== "email2").assertTrue();
console.info("Telephony_contact_Email_0200 end")
done();
});
/**
* @tc.number Telephony_contact_Event_0100
* @tc.name Test The Attribute Event
* @tc.desc Function test
*/
it('Telephony_contact_Event_0100', 0, async function (done) {
console.info("Telephony_contact_Event_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Event.CUSTOM_LABEL === 0).assertTrue();
expect(contact.Event.EVENT_ANNIVERSARY === 1).assertTrue();
expect(contact.Event.EVENT_OTHER === 2).assertTrue();
expect(contact.Event.EVENT_BIRTHDAY === 3).assertTrue();
expect(contact.Event.INVALID_LABEL_ID === -1).assertTrue();
expect(contact.Event.eventDate !== "event").assertTrue();
expect(contact.Event.labelName !== "event").assertTrue();
console.info("Telephony_contact_Event_0100 end")
done();
});
/**
* @tc.number Telephony_contact_Event_0200
* @tc.name Test The Attribute Event
* @tc.desc Function test
*/
it('Telephony_contact_Event_0200', 0, async function (done) {
console.info("Telephony_contact_Event_0200 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Event.CUSTOM_LABEL === 0).assertTrue();
expect(contact.Event.EVENT_ANNIVERSARY === 1).assertTrue();
expect(contact.Event.EVENT_OTHER === 2).assertTrue();
expect(contact.Event.EVENT_BIRTHDAY === 3).assertTrue();
expect(contact.Event.INVALID_LABEL_ID === -1).assertTrue();
expect(contact.Event.eventDate !== "event2").assertTrue();
expect(contact.Event.labelName !== "event2").assertTrue();
console.info("Telephony_contact_Event_0200 end")
done();
});
/**
* @tc.number Telephony_contact_ImAddress_0100
* @tc.name Test The Attribute ImAddress
* @tc.desc Function test
*/
it('Telephony_contact_ImAddress_0100', 0, async function (done) {
console.info("Telephony_contact_ImAddress_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.ImAddress.CUSTOM_LABEL === -1).assertTrue();
expect(contact.ImAddress.IM_AIM === 0).assertTrue();
expect(contact.ImAddress.IM_MSN === 1).assertTrue();
expect(contact.ImAddress.IM_YAHOO === 2).assertTrue();
expect(contact.ImAddress.IM_SKYPE === 3).assertTrue();
expect(contact.ImAddress.IM_QQ === 4).assertTrue();
expect(contact.ImAddress.IM_ICQ === 6).assertTrue();
expect(contact.ImAddress.IM_JABBER === 7).assertTrue();
expect(contact.ImAddress.INVALID_LABEL_ID === -2).assertTrue();
expect(contact.ImAddress.imAddress !== "imAddress").assertTrue();
expect(contact.ImAddress.labelName !== "imAddress").assertTrue();
console.info("Telephony_contact_ImAddress_0100 end")
done();
});
/**
* @tc.number Telephony_contact_ImAddress_0200
* @tc.name Test The Attribute ImAddress
* @tc.desc Function test
*/
it('Telephony_contact_ImAddress_0200', 0, async function (done) {
console.info("Telephony_contact_ImAddress_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.ImAddress.CUSTOM_LABEL === -1).assertTrue();
expect(contact.ImAddress.IM_AIM === 0).assertTrue();
expect(contact.ImAddress.IM_MSN === 1).assertTrue();
expect(contact.ImAddress.IM_YAHOO === 2).assertTrue();
expect(contact.ImAddress.IM_SKYPE === 3).assertTrue();
expect(contact.ImAddress.IM_QQ === 4).assertTrue();
expect(contact.ImAddress.IM_ICQ === 6).assertTrue();
expect(contact.ImAddress.IM_JABBER === 7).assertTrue();
expect(contact.ImAddress.INVALID_LABEL_ID === -2).assertTrue();
expect(contact.ImAddress.imAddress !== "imAddress2").assertTrue();
expect(contact.ImAddress.labelName !== "imAddress2").assertTrue();
console.info("Telephony_contact_ImAddress_0200 end")
done();
});
})
}
\ 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.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsContactFunctionMergeEtsTest") {
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 = "ActsContactFunctionMergeEtsTest"
}
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"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"package": "com.ohos.contactfunctionmerge",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsContactFunctionMergeEtsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册