在使用webpack-dev-server迁移到最新的Cypress版本(7.0.1、7.2.0、7.3.0)之后,在使用Cypress cypress/browsers:node14.16.0-chrome89-ff86停靠映像在IC (Jenkins)中运行React测试时,遇到了同样的问题,而一切都在本地正常工作(Windows 10)。这项工作取决于:
ℹ 「wdm」: wait until bundle finished: /__cypress/src/index.html
因为超时而在15分钟后停止之前。
这是启动测试的脚本:
cypress run-ct --browser chrome --headless --config screenshotsFolder=/reports/cypress/screenshots这是我的cypress/plugins/index.js
const { startDevServer } = require('@cypress/webpack-dev-server')
const injectReactScriptsDevServer = require('@cypress/react/plugins/react-scripts')
const webpackConfig = require('../webpack.config.js')
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
if (config.testingType === 'component') {
injectReactScriptsDevServer(on, config)
on('dev-server:start', async (options) => startDevServer({options, webpackConfig}))
}
return config
}这是我的cypress/webpack.config.js
module.exports = {
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts", ".json"]
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'ts-loader',
options: {
compilerOptions: {
"noEmit": false
}
}
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['@babel/preset-env','@babel/react']
}
}
]
}
};这些是我使用的依赖项:
"cypress": "7.3.0",
"@cypress/react": "5.7.0",
"@cypress/webpack-dev-server": "1.3.0",
"ts-loader": "8.2.0",有什么想法吗?
谢谢你的帮助
发布于 2022-03-14 17:55:04
下面这些对我来说很有用
cypress run-ct --浏览器铬--无头配置screenshotsFolder=/reports/cypress/screenshots --规范
这两个额外的破折号是需要在-规范之前,以一个文件或文件夹为目标。
https://stackoverflow.com/questions/67587204
复制相似问题