mirror of
https://gitee.com/openharmony/applications_app_samples
synced 2024-11-24 00:50:03 +00:00
modify inputmethod testcase
Signed-off-by: zhaojunxia <zhaojunxia@kaihong.com>
This commit is contained in:
parent
98ea81fc9d
commit
43154909da
@ -18,6 +18,7 @@ import UIAbility from '@ohos.app.ability.UIAbility';
|
|||||||
import { describe, it, expect, TestType } from '@ohos/hypium';
|
import { describe, it, expect, TestType } from '@ohos/hypium';
|
||||||
import { Driver, ON, MatchPattern } from '@ohos.UiTest';
|
import { Driver, ON, MatchPattern } from '@ohos.UiTest';
|
||||||
import { logger } from '../util/Logger';
|
import { logger } from '../util/Logger';
|
||||||
|
import inputMethod from '@ohos.inputMethod';
|
||||||
|
|
||||||
const TAG: string = 'Sample_KikaInput_Test';
|
const TAG: string = 'Sample_KikaInput_Test';
|
||||||
const BUNDLE = 'KikaInput_';
|
const BUNDLE = 'KikaInput_';
|
||||||
@ -47,28 +48,19 @@ export default function abilityTest() {
|
|||||||
it('SwitchInputMethod_001',TestType.FUNCTION, async (done: Function) => {
|
it('SwitchInputMethod_001',TestType.FUNCTION, async (done: Function) => {
|
||||||
logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 begin`);
|
logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 begin`);
|
||||||
let driver: Driver = Driver.create();
|
let driver: Driver = Driver.create();
|
||||||
let delegator = AbilityDelegatorRegistry.getAbilityDelegator();
|
await inputMethod.getSetting().showOptionalInputMethods();
|
||||||
// -a ServiceExtAbility -b com.samples.kikainput
|
logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 11`);
|
||||||
// -a InputMethod -b cn.openharmony.inputmethodchoosedialog
|
await driver.delayMs(1000);
|
||||||
await delegator.executeShellCommand('aa start ability -a ServiceExtAbility -b com.samples.kikainput')
|
await driver.assertComponentExist(ON.type('List'));
|
||||||
.then(result => {
|
logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 22`);
|
||||||
logger.info(TAG, `${BUNDLE}start ability finished, result = ${JSON.stringify(result)}`);
|
|
||||||
})
|
let list = await driver.findComponent(ON.type('List'));
|
||||||
.catch((err: Error) => {
|
let kikainput = await list.scrollSearch(ON.text('kikainput', MatchPattern.CONTAINS));
|
||||||
logger.info(TAG, `${BUNDLE}start ability failed, err = ${JSON.stringify(err)}`);
|
logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 33 kikainput` + kikainput);
|
||||||
})
|
await driver.delayMs(1000);
|
||||||
// logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 11`);
|
let bound = await kikainput.getBounds();
|
||||||
// await driver.delayMs(1000);
|
await driver.click(bound.right - 10, bound.bottom - 10);
|
||||||
// await driver.assertComponentExist(ON.type('List'));
|
await driver.delayMs(1000);
|
||||||
// logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 22`);
|
|
||||||
//
|
|
||||||
// let list = await driver.findComponent(ON.type('List'));
|
|
||||||
// let kikainput = await list.scrollSearch(ON.text('kikainput', MatchPattern.CONTAINS));
|
|
||||||
// logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 33 kikainput` + kikainput);
|
|
||||||
// await driver.delayMs(1000);
|
|
||||||
// let bound = await kikainput.getBounds();
|
|
||||||
// await driver.click(bound.right - 10, bound.bottom - 10);
|
|
||||||
// await driver.delayMs(1000);
|
|
||||||
logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 end`);
|
logger.info(TAG, `${BUNDLE}SwitchInputMethod_001 end`);
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user