尝试在测试中使用 .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/