【发布时间】:2023-01-05 20:57:08
【问题描述】:
我在这个网站上看到过其他类似的问题,但没有一个能给我一个令人满意的解决方案。我没有任何 webpack.config.js 文件,因为我们从 angular 获取默认配置。请查看下面相应的图片,以便更好地了解我的问题。
我项目中的其他配置:
包.json
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"json": {
"enabled": true
},
"stepDefinitions": "**/cypress/e2e/**/*.js",
"step_definitions": "**/cypress/e2e/**/*.js"
},
赛普拉斯.config.ts
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
specPattern: '**/e2e/**/*.feature',
"supportFile": false,
chromeWebSecurity: false
},
})
更新 1:您好@Wirtuald,感谢您回复我。 我开始在一个相当复杂的角度项目中遇到这个问题。所以,我从头开始创建了一个基本项目我仍然有同样的问题.然后,我在下面给你这个新项目的所有信息:
-
我没有“插件”文件夹
-
package.json 上的版本:
"devDependencies": { "@badeball/cypress-cucumber-preprocessor": "^11.2.0", "cypress": "^10.2.0" }, -
package.json 上的预处理器配置
"cypress-cucumber-preprocessor": { "nonGlobalStepDefinitions": true, "json": { "enabled": true }, "stepDefinitions": [ "[filepath].{js,ts}", "cypress/e2e/**/*.{js,ts}" ]}
-
赛普拉斯.config.js:
const { defineConfig } = require("cypress"); module.exports = defineConfig({ e2e: { specPattern: "**/*.feature", chromeWebSecurity: false, setupNodeEvents(on, config) { // implement node event listeners here }, }, });
-项目结构
- direct-attention-steps.js
import { Given, When, Then } from "@badeball/cypress-cucumber-preprocessor";
Given("Access to NXSuite", () => {
cy.visit("https://www.nxsuite.com");
})
【问题讨论】:
-
最后,我已经按照这里的步骤解决了这个问题:testersdock.com/cypress-10-upgrade 希望它对那些面临类似问题的人有所帮助。
标签: angular webpack cucumber cypress cypress-cucumber-preprocessor