提交 e8bd47c9 编写于 作者: 1 15829070344

【输入法】XTS用例优化

Signed-off-by: N15829070344 <hehaitao5@huawei.com>
Change-Id: Ib52e9e2661059abe4a99351c7a0b48d97bf5089b
上级 02f5c7ec
......@@ -6,7 +6,7 @@
"bundle-name": "com.acts.imeability.test",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
"testcase-timeout": 10000
},
"kits": [{
"test-file-name": [
......
......@@ -29,7 +29,7 @@ export default function imeAbilityTest(abilityContext) {
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/
beforeEach(function () {
console.info('beforeEach: switchInputMethod to kikakeyboard.');
console.info('====>beforeEach: switchInputMethod to kikakeyboard.');
let serviceAbilityProperty = {
packageName: "com.example.kikakeyboard",
methodId: "ServiceExtAbility",
......@@ -39,7 +39,7 @@ export default function imeAbilityTest(abilityContext) {
}
inputMethod.switchInputMethod(serviceAbilityProperty).then((data)=>{
console.info('SUB_InputMethod_IMEAbility_0001 switchInputMethod to Kika :' + data);
console.info('====>SUB_InputMethod_IMEAbility_0001 switchInputMethod to Kika :' + data);
expect(data == true).assertTrue();
})
......@@ -49,7 +49,7 @@ export default function imeAbilityTest(abilityContext) {
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/
afterEach(function () {
console.info('afterEach: Test case-level clearance conditions is executed.');
console.info('====>afterEach: Test case-level clearance conditions is executed.');
});
/**
......@@ -60,7 +60,7 @@ export default function imeAbilityTest(abilityContext) {
* @tc.level : Level 1
*/
it('SUB_InputMethod_IMEAbility_0001', 0, async function (done) {
console.info('----------SUB_InputMethod_IMEAbility_0001 start-------------');
console.info('====>----------SUB_InputMethod_IMEAbility_0001 start-------------');
let imExtAbilityProperty = {
packageName : "com.acts.imeability.test",
methodId : "com.acts.imeability.test.ImExtAbility",
......@@ -70,11 +70,11 @@ export default function imeAbilityTest(abilityContext) {
}
inputMethod.switchInputMethod(imExtAbilityProperty).then((data)=>{
console.info('SUB_InputMethod_IMEAbility_0004 switchInputMethod to IME :' + data);
console.info('====>SUB_InputMethod_IMEAbility_0004 switchInputMethod to IME :' + data);
expect(data == true).assertTrue();
});
sleep(Date.now(), 3000);
console.info('----------SUB_InputMethod_IMEAbility_0001 end-------------');
console.info('====>----------SUB_InputMethod_IMEAbility_0001 end-------------');
done();
})
......@@ -87,7 +87,7 @@ export default function imeAbilityTest(abilityContext) {
* @tc.level : Level 1
*/
it('SUB_InputMethod_IMEAbility_0002', 0, async function (done) {
console.info('-----------SUB_InputMethod_IMEAbility_0002 start-------------');
console.info('====>-----------SUB_InputMethod_IMEAbility_0002 start-------------');
let imExtAbilityProperty = {
packageName : "com.acts.imeability.test",
......@@ -98,11 +98,11 @@ export default function imeAbilityTest(abilityContext) {
}
inputMethod.switchInputMethod(imExtAbilityProperty).then((data)=>{
console.info('SUB_InputMethod_IMEAbility_0004 switchInputMethod to IME :' + data);
console.info('====>SUB_InputMethod_IMEAbility_0004 switchInputMethod to IME :' + data);
expect(data == true).assertTrue();
});
sleep(Date.now(), 2500);
console.info('-----------SUB_InputMethod_IMEAbility_0002 end-------------');
console.info('====>-----------SUB_InputMethod_IMEAbility_0002 end-------------');
done();
})
})
......
......@@ -34,9 +34,9 @@ export default class Utils {
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
console.info("====>[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
console.info("====>[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
......@@ -47,12 +47,12 @@ export default class Utils {
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
console.info('====>start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
console.info('====>start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
......@@ -70,16 +70,16 @@ export default class Utils {
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
console.info('====>move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
let downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
console.info('====>down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
console.info('====>start to move')
if (drag) {
await this.sleep(500)
}
......@@ -90,14 +90,14 @@ export default class Utils {
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
console.info('====>move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
console.info('====>start to up')
if (drag) {
await this.sleep(100)
}
......@@ -107,7 +107,7 @@ export default class Utils {
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
console.info('====>up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
......
......@@ -17,12 +17,12 @@ import inputMethod from '@ohos.inputmethod';
export default function inputMethodJSUnit() {
describe('appInfoTest_input_2', function () {
console.info("************* settings Test start*************");
console.info("====>************* settings Test start*************");
it('inputmethoh_test_001', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethoh_test_001 result:" + JSON.stringify(inputMethodSetting));
console.info("====>inputmethoh_test_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod((arr) => {
console.info("appInfoTest_input_2 listInputMethod result---" + JSON.stringify(arr));
console.info("====>appInfoTest_input_2 listInputMethod result---" + JSON.stringify(arr));
expect(1==1).assertTrue();
});
done();
......@@ -30,40 +30,40 @@ export default function inputMethodJSUnit() {
it('inputmethoh_test_002', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting));
console.info("====>inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod().then(inputMethodProperty => {
if (inputMethodProperty.length > 0){
let obj = inputMethodProperty[0]
console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj));
console.info("====>inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj));
expect(obj.packageName != null).assertTrue();
expect(obj.methodId != null).assertTrue();
}else{
console.info("inputmethoh_test_002 listInputMethod is null");
console.info("====>inputmethoh_test_002 listInputMethod is null");
expect().assertFail()
}
}).catch(err => {
console.info("inputmethoh_test_002 listInputMethod is err: " + JSON.stringify(err));
console.info("====>inputmethoh_test_002 listInputMethod is err: " + JSON.stringify(err));
});
done();
});
it('inputmethoh_test_003', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethoh_test_003 result:" + JSON.stringify(inputMethodSetting));
console.info("====>inputmethoh_test_003 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.displayOptionalInputMethod(() => {
console.info("inputmethoh_test_003 displayOptionalInputMethod---");
console.info("====>inputmethoh_test_003 displayOptionalInputMethod---");
});
done();
});
it('inputmethoh_test_004', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting));
console.info("====>inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.displayOptionalInputMethod().then(() => {
console.info("inputmethoh_test_004 displayOptionalInputMethod is called");
console.info("====>inputmethoh_test_004 displayOptionalInputMethod is called");
expect(true).assertTrue()
}).catch(err => {
console.info("inputmethoh_test_004 displayOptionalInputMethod is err: " + JSON.stringify(err));
console.info("====>inputmethoh_test_004 displayOptionalInputMethod is err: " + JSON.stringify(err));
expect().assertFail()
});
done();
......@@ -71,24 +71,24 @@ export default function inputMethodJSUnit() {
it('inputmethoh_test_005', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController();
console.info("inputmethoh_test_005 result:" + JSON.stringify(inputMethodCtrl));
console.info("====>inputmethoh_test_005 result:" + JSON.stringify(inputMethodCtrl));
inputMethodCtrl.stopInput((res) => {
console.info("inputmethoh_test_005 stopInput result----" + res);
console.info("====>inputmethoh_test_005 stopInput result----" + res);
});
done();
});
it('inputmethoh_test_006', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController();
console.info("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl));
inputMethodCtrl.stopInput().then(data => {
console.info("inputmethoh_test_006 stopInput result----" + data);
expect(data == true).assertTrue();
}).catch(err => {
console.info("inputmethoh_test_006 stopInput is err: " + JSON.stringify(err));
console.info("====>inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl));
inputMethodCtrl.stopInput().then(() => {
expect().assertFail();
done();
}).catch((err) => {
console.info("====>inputmethoh_test_006 stopInput is err: " + JSON.stringify(err));
expect().assertEqual();
done();
});
done();
});
/*
......@@ -97,11 +97,11 @@ export default function inputMethodJSUnit() {
* @tc.desc: Verify Max_ TYPE_ NUM
*/
it('inputmethod_test_MAX_TYPE_NUM_001', 0, async function (done) {
console.info("************* inputmethod_test_MAX_TYPE_NUM_001 Test start*************");
console.info("====>************* inputmethod_test_MAX_TYPE_NUM_001 Test start*************");
let inputMethodSetting = inputMethod.MAX_TYPE_NUM;
console.info("inputmethod_test_001 result:" + inputMethodSetting);
expect(inputMethodSetting != null).assertTrue();
console.info("************* inputmethod_test_MAX_TYPE_NUM_001 Test end*************");
console.info("====>inputmethod_test_001 result:" + inputMethodSetting);
expect(inputMethodSetting !== null).assertTrue();
console.info("====>************* inputmethod_test_MAX_TYPE_NUM_001 Test end*************");
done();
});
......@@ -112,7 +112,7 @@ export default function inputMethodJSUnit() {
* @tc.level 2
*/
it('inputmethod_test_switchInputMethod_001', 0, async function (done) {
console.info("************* inputmethod_test_switchInputMethod_001 Test start*************");
console.info("====>************* inputmethod_test_switchInputMethod_001 Test start*************");
let inputMethodProperty = {
packageName: "com.example.kikakeyboard",
methodId: "ServiceExtAbility",
......@@ -121,13 +121,13 @@ export default function inputMethodJSUnit() {
extra:{}
}
inputMethod.switchInputMethod(inputMethodProperty).then(data => {
console.info("inputmethod_test_switchInputMethod_001 data:" + data)
console.info("====>inputmethod_test_switchInputMethod_001 data:" + data)
expect(data == true).assertTrue();
}).catch( err=> {
console.info("inputmethod_test_switchInputMethod_001 err:" + err)
console.info("====>inputmethod_test_switchInputMethod_001 err:" + err)
expect().assertFail();
})
console.info("************* inputmethod_test_switchInputMethod_001 Test end*************");
console.info("====>************* inputmethod_test_switchInputMethod_001 Test end*************");
done();
});
......@@ -138,7 +138,7 @@ export default function inputMethodJSUnit() {
* @tc.level 2
*/
it('inputmethod_test_switchInputMethod_002', 0, async function (done) {
console.info("************* inputmethod_test_switchInputMethod_002 Test start*************");
console.info("====>************* inputmethod_test_switchInputMethod_002 Test start*************");
let inputMethodProperty = {
packageName: "com.example.kikakeyboard",
methodId: "ServiceExtAbility",
......@@ -148,13 +148,13 @@ export default function inputMethodJSUnit() {
}
inputMethod.switchInputMethod(inputMethodProperty, (err, data)=>{
if(err){
console.info("inputmethod_test_switchInputMethod_002 error:" + err);
console.info("====>inputmethod_test_switchInputMethod_002 error:" + err);
expect().assertFail();
}
console.info("inputmethod_test_switchInputMethod_002 data:" + data)
console.info("====>inputmethod_test_switchInputMethod_002 data:" + data)
expect(data == true).assertTrue();
});
console.info("************* inputmethod_test_switchInputMethod_002 Test end*************");
console.info("====>************* inputmethod_test_switchInputMethod_002 Test end*************");
done();
});
......@@ -166,17 +166,16 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_showSoftKeyboard_001', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.showSoftKeyboard((err, data)=>{
if(data == undefined){
console.info("showSoftKeyboard callbace success" );
expect(true).assertTrue();
}else{
console.info('showSoftKeyboard callbace failed : ' + JSON.stringify(err))
expect().assertFail();
}
});
console.info("************* inputmethod_test_showSoftKeyboard_001 Test end*************");
done();
try{
inputMethodCtrl.showSoftKeyboard((err)=>{
expect(err.code).assertEqual('12800003')
console.info("====>************* inputmethod_test_showSoftKeyboard_001 Test end*************");
done();
});
}catch(err){
expect().assertFail()
done();
}
});
/*
......@@ -187,15 +186,15 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_showSoftKeyboard_002', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.showSoftKeyboard().then((data) =>{
console.info("showSoftKeyboard promise success" );
expect(true).assertTrue();
inputMethodCtrl.showSoftKeyboard().then(() =>{
expect().assertFail()
done();
}).catch((err) => {
console.info('showSoftKeyboard promise failed : ' + JSON.stringify(err))
expect().assertFail();
console.info('====>showSoftKeyboard promise failed : ' + JSON.stringify(err))
expect(err.code).assertEqual('12800003')
console.info("====>************* inputmethod_test_showSoftKeyboard_002 Test end*************");
done();
})
console.info("************* inputmethod_test_showSoftKeyboard_002 Test end*************");
done();
});
/*
......@@ -206,17 +205,17 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_hideSoftKeyboard_001', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.hideSoftKeyboard((err, data)=>{
if(data == undefined){
console.info("hideSoftKeyboard callbace success" );
expect(true).assertTrue();
}else{
console.info('hideSoftKeyboard callbace failed : ' + JSON.stringify(err))
expect().assertFail();
}
});
console.info("************* inputmethod_test_hideSoftKeyboard_001 Test end*************");
done();
try{
inputMethodCtrl.hideSoftKeyboard((err)=>{
console.info('====>hideSoftKeyboard callbacek failed : ' + JSON.stringify(err))
expect(err.code).assertEqual('12800003')
console.info("====>************* inputmethod_test_hideSoftKeyboard_001 Test end*************");
done();
})
}catch(err){
expect().assertFail();
done();
}
});
/*
......@@ -227,15 +226,15 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_hideSoftKeyboard_002', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.hideSoftKeyboard().then((data) =>{
console.info("hideSoftKeyboard promise success" );
expect(true).assertTrue();
}).catch((err) => {
console.info('hideSoftKeyboard promise failed : ' + JSON.stringify(err))
inputMethodCtrl.hideSoftKeyboard().then(() =>{
expect().assertFail();
done();
}).catch((err) => {
console.info('====>hideSoftKeyboard promise failed : ' + JSON.stringify(err))
expect(err.code).assertEqual('12800003');
console.info("====>************* inputmethod_test_hideSoftKeyboard_002 Test end*************");
done();
})
console.info("************* inputmethod_test_hideSoftKeyboard_002 Test end*************");
done();
});
/*
......@@ -246,12 +245,12 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_getCurrentInputMethod_001', 0, async function (done) {
let currentIme = inputMethod.getCurrentInputMethod();
console.info("inputmethod_test_getCurrentInputMethod_001 currentIme---" + JSON.stringify(currentIme));
console.info("====>inputmethod_test_getCurrentInputMethod_001 currentIme---" + JSON.stringify(currentIme));
console.info(currentIme.packageName);
console.info(currentIme.methodId);
expect(currentIme.packageName != null).assertTrue();
expect(currentIme.methodId != null).assertTrue();
console.info("************* inputmethod_test_getCurrentInputMethod_001 Test end*************");
expect(currentIme.packageName !== null).assertTrue();
expect(currentIme.methodId !== null).assertTrue();
console.info("====>************* inputmethod_test_getCurrentInputMethod_001 Test end*************");
done();
});
......@@ -264,13 +263,13 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_getInputMethods_001', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethod_test_getInputMethods_001 result:" + JSON.stringify(inputMethodSetting));
console.info("====>inputmethod_test_getInputMethods_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.getInputMethods(true, (err, arr) => {
if (err) {
console.error("inputmethod_test_getInputMethods_001 failed because: " + JSON.stringify(err));
expect().assertFail();
};
console.info("inputmethod_test_getInputMethods_001 listInputMethod result---" + JSON.stringify(arr));
console.info("====>inputmethod_test_getInputMethods_001 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
});
done();
......@@ -285,13 +284,13 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_getInputMethods_002', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethod_test_getInputMethods_002 result:" + JSON.stringify(inputMethodSetting));
console.info("====>inputmethod_test_getInputMethods_002 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.getInputMethods(false, (err, arr) => {
if (err) {
console.error("inputmethod_test_getInputMethods_002 failed because: " + JSON.stringify(err));
expect().assertFail();
};
console.info("inputmethod_test_getInputMethods_002 listInputMethod result---" + JSON.stringify(arr));
console.info("====>inputmethod_test_getInputMethods_002 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
});
done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册