2

使用最新的 Testcafe,通过gherkin-testcafe

console.log('Before');
await t.navigateTo( page.url );
console.log('After');

尽管被测服务器似乎响应迅速,但我看到两个输出之间存在 2 到 20 秒的延迟。

在延迟期间,Chrome 显示 Testcafe 指向http://localhost:1337/B1tY5nMdM/about:blank.

开发工具显示,在延迟期间,重复调用类似 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,并且假设在 headless chrome 中也发生了同样的情况,尽管我显然看不到那里的开发工具......afaik......

[954-e2e 13:57]$ testcafe --version
Using locally installed version of TestCafe.
0.18.6
4

0 回答 0