使用最新的Testcafe,通过gherkin-testcafe
:
console.log('Before');
await t.navigateTo( page.url );
console.log('After');
我看到两个输出之间有2到20秒的延迟,尽管被测服务器似乎很快就会响应。
在延迟期间,Chrome会显示Testcafe指向http://localhost:1337/B1tY5nMdM/about:blank
。
dev工具显示,在延迟期间,重复调用类似Fe2Box1的URI(每次都有变化),JSON响应为{"code":"ok","url":""}
。在延迟之前或期间没有给我的服务打电话。
我认为正是这种延迟导致随机测试失败,所有这些都是因为我做错了什么:
const selectSelector = Selector( 'select' )
.withAttribute( 'name', elName )
.with({
timeout: this.INITIAL_TIMEOUT_MS,
visibilityCheck: true,
boundTestRun: this.t,
});
await selectSelector();
// The next line sometimes fails
await this.t.expect( selectSelector.exists ).ok();
await this.t.click( selectSelector );
标记的线有时会失败,有时会通过,显然取决于负载延迟的长度。但是从文档来看,我认为只有点击才会失败?
我看到这是最新的Chrome,并假设在无头镀铬中也是如此,虽然我显然无法在那里看到开发工具...... afaik ....
[954-e2e 13:57]$ testcafe --version
Using locally installed version of TestCafe.
0.18.6