google-chrome - 无法调整在 headless Chrome 上运行 TestCafe 的窗口大小

标签 google-chrome testing automated-tests testcafe google-chrome-headless

尝试在测试中使用 .resizeWindow 时出错,但只有在针对 headless 模式运行测试时才会失败。声明为警告的错误如下:

    Warnings (1):
 --
  Was unable to resize the window due to an error.

  Cannot read property 'Emulation' of undefined

我正在运行我的测试:
 - HeadlessChrome 70.0.3538 / Mac OS X 10.13.6
 Testcafe version 0.20.4

resizeWindow 指令在我的 beforeEach 中设置如下:
 .beforeEach(async t => {
      await t.navigateTo(`${testDomain}${Var.url_listing_general}`)
        .resizeWindow(1420, 750);
    }
  });

最佳答案

您是否尝试过调整大小不在 beforeEach 中?部分,但在作为第一行的测试中?

另外,也许这很愚蠢而且不重要,但是在您的代码示例中,您还有额外的 }beforeEach部分,这可能是问题的原因吗?

关于google-chrome - 无法调整在 headless Chrome 上运行 TestCafe 的窗口大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52938684/

相关文章:

reactjs - 将 testcafe 与随机页面路径一起使用

date - 如何在 testcafe 中模拟 Date()?

c# - .net 请求浏览器版本不一致

testing - Haskell IO 测试

testing - sbt 无法识别测试

php - 为扩展另一个类的类编写 PHPUnit 测试会产生 'Class not found' 错误

unit-testing - 相互依赖的条件如何做MCDC?

google-chrome - CSS3 背景 Angular 渐变在宽屏幕上变为水平

javascript - 为什么 String.toLowerCase 在 Chrome 而不是 Firefox 中未定义?

javascript - Chrome 扩展程序 : have extension edit its web_accessible_resources