提交 824345dc 编写于 作者: E ester.zhou

Update docs (14991)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 643256c3
...@@ -108,7 +108,7 @@ You write a UI test script based on the unit test framework, adding the invoking ...@@ -108,7 +108,7 @@ You write a UI test script based on the unit test framework, adding the invoking
In this example, the UI test script is written based on the preceding unit test script. First, add the dependency package, as shown below: In this example, the UI test script is written based on the preceding unit test script. First, add the dependency package, as shown below:
```js ```js
import {UiDriver,BY,UiComponent,MatchPattern} from '@ohos.uitest' import {Driver,ON,Component,MatchPattern} from '@ohos.uitest'
``` ```
Then, write specific test code. Specifically, implement the click action on the started application page and add checkpoint check cases. Then, write specific test code. Specifically, implement the click action on the started application page and add checkpoint check cases.
...@@ -131,16 +131,16 @@ export default function abilityTest() { ...@@ -131,16 +131,16 @@ export default function abilityTest() {
expect(Ability.context.abilityInfo.name).assertEqual('MainAbility'); expect(Ability.context.abilityInfo.name).assertEqual('MainAbility');
}) })
//ui test code //ui test code
//init uidriver //init driver
var driver = await UiDriver.create(); var driver = await Driver.create();
await driver.delayMs(1000); await driver.delayMs(1000);
//find button by text 'Next' //find button by text 'Next'
var button = await driver.findComponent(BY.text('Next')); var button = await driver.findComponent(ON.text('Next'));
//click button //click button
await button.click(); await button.click();
await driver.delayMs(1000); await driver.delayMs(1000);
//check text //check text
await driver.assertComponentExist(BY.text('after click')); await driver.assertComponentExist(ON.text('after click'));
await driver.pressBack(); await driver.pressBack();
done(); done();
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册