我最近开始使用 TestCafe 测试我的 WebApp,并且遇到了我的一个页面的问题.. 该页面在元素中显示信息之前向第三方进行了昂贵的调用.. 此调用可能需要 10 秒以上返回。
在测试这个页面时,TestCafe 似乎想等到这个元素被加载之后才会执行测试(测试不引用这个元素)。
我的问题是是否有办法解决这个问题?
我本来希望不是在整个页面上调用 await ,而是在特定的选择器上调用 await 会起作用,但是没有乐趣,即使不包括等待仍然等待这个元素加载?比较迷茫!任何帮助将不胜感激!
test.before(async t => {
await t
.click('button'); //this takes the user to a new page
})
('should be on the correct page after clicking the button', async t => {
await t
//this expect wont be tested until the whole page is loaded
//(including the very slow element - hence we will time out before this expect is called)
.expect(Selector('.app-title').innerText).eql('title');
});