[按照the documentation instructions之后,我一直没有成功尝试使TestCafe测试本地HTML文件。我正在使用Windows 10计算机,并且已将静态HTML放置在与.testcaferc.json和my_testing_script.js(TestCafe脚本)相同的本地目录中。这是我的TestCafe脚本当前的样子,也许有人可以告诉我我做错了什么:
// my_testing_script.js
import { Selector } from 'testcafe';
import { ClientFunction } from 'testcafe';
fixture `MyFixture`
.page(`file:\\Users\User\Desktop\\page.html`);
test('myTest' , async t =>{
await t
.wait(1000)
});
同样,主要问题是这部分:
.page(`file:\\Users\User\Desktop\\page.html`);
如何在Windows机器上正确声明呢?
在Windows中,该页面声明经常失败。测试只是没有成功完成。
路径应指定如下:
fixture('MyFixture')
.page('file:///Users/User/Desktop/page.html');