是否可以将 Cypress 12 与 Cucumber BDD 集成?

问题描述 投票:0回答:1

我尝试使用以下说明使用 Cucumber 配置 Cypress 12: https://testersdock.com/cypress-cucumber-bdd/

有人成功过吗?我不断收到错误,赛普拉斯将无法运行我的功能文件。我在想我可能需要回到 Cypress 10 才能让它工作。非常感谢。

testing automated-tests cucumber cypress bdd
1个回答
0
投票

在 cypress 12 中,您应该将预处理器与

spectPattern
一起添加到
cypress.config.js
文件中,这样您就可以使用黄瓜了: 文档 -> https://docs.cypress.io/api/plugins/preprocessors-api

const { defineConfig } = require("cypress");
const cucumber = require('cypress-cucumber-preprocessor').default;

module.exports = defineConfig({
  e2e: {
    baseUrl: 'https://jsonplaceholder.typicode.com',
    specPattern: '**/*.feature',
    setupNodeEvents(on, config) {
      on('file:preprocessor', cucumber())
      // implement node event listeners here
    },
  },
});
© www.soinside.com 2019 - 2024. All rights reserved.