我遇到了非常奇怪的重复问题,连接到本地服务的vuejs应用程序(nodejs)。localhost:8080在本地浏览器中成功加载,但不管配置如何测试咖啡馆返回:Failed to find a DNS-record for the resource at "http://localhost:3000/".
我清空了.testcaferc.json并创建了以下最低工作示例:testcafe "chrome" tests/testcafe_debug.test.js --app "npm run serve" --app-init-delay 1 -S -s
tests/testcafe_调试器.test.js:
fixture `Fixture`
.page('http://localhost:8080/login');
test('test', async t => {
await t
.click('body')
.expect(Selector('div p a').text).eql('Register Here');
});这是我第二次看到这个问题了。在新网络上访问朋友时,连接失败,直到我将--proxyBypass localhost添加到测试运行中。这暂时解决了这个问题,但几周后我也犯了同样的错误。我调查过的事情:
--hostname localhost没有任何效果,,
。
发布于 2022-02-10 09:51:03
在TestCafe启动命令中,只允许应用程序加载一毫秒(--app-init-delay 1)。看起来,TestCafe在服务器准备好之前请求页面。尝试增加这个延迟(以毫秒为单位),这样您的应用服务器就可以启动和服务测试的应用程序了。
下面的示例指定了10秒的延迟:
testcafe "chrome" tests/testcafe_debug.test.js --app "npm run serve" --app-init-delay 10000 -S -sUPD:看起来类似于https://github.com/DevExpress/testcafe/issues/6844
发布于 2022-07-03 21:48:03
我也遇到了同样的问题,因为我在运行过程中更改了节点版本。
感谢@vasily.strelyaev的评论,我找到了解决方案。
https://stackoverflow.com/questions/71022754
复制相似问题