在TestCafe中使用嵌套内部iframe中的Expect

时间:2019-02-07 11:51:06

标签: automated-tests e2e-testing testcafe

我在悬挂测试的Google表格上的嵌套iframe中使用Expect语句时遇到问题。 (用于测试模态内的内容)

这是我要实施的测试:

const modaldialogFrame = Selector(
  '.modal-dialog-content.script-app-contents'
).find('iframe');
const sandboxFrame = Selector('#sandboxFrame');
const userHtmlFrame = Selector('#userHtmlFrame');

test('Check for email input', async browser => {
await browser.switchToIframe(modaldialogFrame);
await browser.switchToIframe(sandboxFrame);
await browser.switchToIframe(userHtmlFrame);

await browser.expect(Selector('#email').exists).ok();
})

但是期望会挂起测试,还会添加

 await browser.switchToMainWindow();

expect语句后无济于事。

但是,只有点击该元素并输入文字才能使用

await browser.typeText('#email', 'name@email.com');
await browser.typeText('#password', 'mypassword');
await browser.click('#login-button');

因此,进入iframe可以正常工作,但是期望语句却不能,我该怎么做才能克服这个问题?

如果这是一个错误,我愿意尽快解决。

1 个答案:

答案 0 :(得分:3)

谢谢您的反馈,我已重现了该问题,并在我们的存储库中创建了一个问题:

https://github.com/DevExpress/testcafe/issues/3422

您可以使用它来跟踪进度。我需要一些时间来找到其原因,因为Google Spreadsheets在页面上执行了很多非常复杂的脚本。

相关问题