Pau*_*aul 4 javascript testing automated-tests detox
在我的测试中,我只想在“cancelUpgrade”按钮显示时模拟点击:
it('should be in home menu', async () => {
await waitFor(element(by.id('cancelUpgrade')))
.toBeVisible()
.withTimeout(2000);
await element(by.id('cancelUpgrade')).tap();
});
Run Code Online (Sandbox Code Playgroud)
它返回预期的错误 Error: Cannot find UI element.
您可以将 tap 包裹在 try/catch 块中:
it('should be in home menu', async () => {
await waitFor(element(by.id('cancelUpgrade')))
.toBeVisible()
.withTimeout(2000);
try {
await element(by.id('cancelUpgrade')).tap();
} catch (e) {}
// continue your tests
});
Run Code Online (Sandbox Code Playgroud)
不是最好的方法,但我认为这是目前排毒中可能的方法。
| 归档时间: |
|
| 查看次数: |
3204 次 |
| 最近记录: |