测试 cafe + electron + create-react-app 未正确加载 bundle.js
test cafe + electron + create-react-app not loading bundle.js properly
我 运行 遇到无法正确加载 testcafe 的问题。它启动 testcafe 服务并加载 index.html 文件,但包从未加载,因此任何 DOM 选择失败,因为它不可用。
由于 create-react-app,我们从示例中获得了不同的文件夹结构,我不想偏离这些结构。
文件夹结构
|-_e2eTest
|--...testFiles
|-build
|-public
|--index.html
|-src
|--index.js
|--electron-starter.js
|-.testcafe-electron-rc
|-package.json
package.json
{
...
"main": "./src/electron-starter.js",
"scripts": {
...
"testcafe": "testcafe electron:. ./_e2eTest/**/*.js"
...
}
}
.testcafe-electron-rc
{
"mainWindowUrl": "./build/index.html", // works similarly with "./public/index.html"
"appPath": "./"
}
参考链接
https://github.com/DevExpress/testcafe-browser-provider-electron
https://github.com/DevExpress/testcafe-browser-provider-electron/issues/25
https://github.com/DevExpress/testcafe-browser-provider-electron/issues/30
我 运行 遇到无法正确加载 testcafe 的问题。它启动 testcafe 服务并加载 index.html 文件,但包从未加载,因此任何 DOM 选择失败,因为它不可用。
由于 create-react-app,我们从示例中获得了不同的文件夹结构,我不想偏离这些结构。
文件夹结构
|-_e2eTest
|--...testFiles
|-build
|-public
|--index.html
|-src
|--index.js
|--electron-starter.js
|-.testcafe-electron-rc
|-package.json
package.json
{
...
"main": "./src/electron-starter.js",
"scripts": {
...
"testcafe": "testcafe electron:. ./_e2eTest/**/*.js"
...
}
}
.testcafe-electron-rc
{
"mainWindowUrl": "./build/index.html", // works similarly with "./public/index.html"
"appPath": "./"
}
参考链接
https://github.com/DevExpress/testcafe-browser-provider-electron
https://github.com/DevExpress/testcafe-browser-provider-electron/issues/25
https://github.com/DevExpress/testcafe-browser-provider-electron/issues/30