Я работаю над Cypress BBD Framework, используя огурец:
Установлены следующие зависимости:
"devDependencies": {
"cypress": "^13.11.0",
"cypress-cucumber-preprocessor": "^4.3.1"
},
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "cypress/e2e/Cucumber/tests/"
}
Моя текущая структура папок:
.
└── CypressCucumberFramework-Version1/
├── cypress/
│ ├── e2e/
│ │ └── Cucumber/
│ │ ├── features/
│ │ │ ├── flightReservation.feature
│ │ │ ├── registerPage.feature
│ │ │ └── signOn.feature
│ │ ├── pages/
│ │ │ ├── flightReservation.js
│ │ │ ├── registerPage.js
│ │ │ └── signOn.js
│ │ └── tests/
│ │ ├── testFlightReservation.cy.js
│ │ ├── testRegisterPage.cy.js
│ │ └── testSignOnPage.cy.js
│ ├── fixtures/
│ │ └── testData.json
│ ├── support/
│ │ ├── commands.js
│ │ └── e2e.js
│ ├── screenshots
│ └── videos
├── node_modules
├── cypress.config.js
├── package-lock.json
└── package.json
Я могу успешно выполнять тесты с помощью Cypress Test Runner и терминала VScode, когда зависимости Allure Cypress Reporting не установлены.
Итак, когда я добавляю зависимости отчетов Allure Cypress ниже"
пакет.json
"devDependencies": {
"allure-commandline": "^2.29.0",
"allure-cypress": "^3.0.0-beta.3",
"cypress": "^13.11.0",
"cypress-cucumber-preprocessor": "^4.3.1"
},
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "cypress/e2e/Cucumber/tests/"
}
кипарис.config.js
const { defineConfig } = require("cypress");
const cucumber = require('cypress-cucumber-preprocessor').default
const { allureCypress } = require("allure-cypress/reporter");
module.exports = defineConfig({
video:true,
screenshotOnRunFailure: true,
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
//Cucumber PreProcessor
on('file:preprocessor', cucumber())
//Allure Reports
allureCypress(on);
},
specPattern: "cypress/e2e/Cucumber/features/*.feature"
},
env:{
registerPageURL:'https://demo.guru99.com/test/newtours/register.php',
signOnPageURL:'https://demo.guru99.com/test/newtours/login.php',
flightReservation: 'https://demo.guru99.com/test/newtours/reservation.php',
}
});
e2e.js
// Import commands.js using ES2015 syntax:
import './commands';
import "allure-cypress/commands";
Итак, при выполнении тестов с вышеупомянутыми конфигурациями и зависимостями для отчетов Allure Cypress Reporting я столкнулся со следующими проблемами:
Ссылка: https://allurereport.org/docs/cypress/
Ошибка:
The error was:
Error: Can't walk dependency graph: Cannot find module 'allure-cypress/commands' from 'C:\Users\angshumanbasak\CypressCucumberFramework-Version1\cypress\support\e2e.js'
required by C:\Users\angshumanbasak\CypressCucumberFramework-Version1\cypress\support\e2e.js
at C:\Users\angshumanbasak\CypressCucumberFramework-Version1\node_modules\resolve\lib\async.js:146:35
at processDirs (C:\Users\angshumanbasak\CypressCucumberFramework-Version1\node_modules\resolve\lib\async.js:299:39)
at isdir (C:\Users\angshumanbasak\CypressCucumberFramework-Version1\node_modules\resolve\lib\async.js:306:32)
at C:\Users\angshumanbasak\CypressCucumberFramework-Version1\node_modules\resolve\lib\async.js:34:69
at callback (C:\Users\angshumanbasak\AppData\Local\Cypress\Cache\13.11.0\Cypress\resources\app\node_modules\@packages\server\node_modules\graceful-fs\polyfills.js:299:20)
at callback (C:\Users\angshumanbasak\AppData\Local\Cypress\Cache\13.11.0\Cypress\resources\app\node_modules\@packages\server\node_modules\graceful-fs\polyfills.js:299:20)
at FSReqCallback.oncomplete (node:fs:197:21)
This occurred while Cypress was compiling and bundling your test code. This is usually caused by:
- A missing file or dependency
- A syntax error in the file or one of its dependencies
Fix the error in your code and re-run your tests.
Пока у меня есть импорт «allure-cypress/commands»; в e2e.js я не могу понять, почему я сталкиваюсь с этой ошибкой зависимости модуля. Любая помощь в решении проблемы будет оценена по достоинству!





В версии beta.3 нет папки allure-cypress/commands, загляните под папку node-modules/allure-cypress - там есть только папка /dist.
Поэтому уберите строку import "allure-cypress/commands". Если вы получили это из старых заметок и хотите следовать им, перейдите на v.2.15.1.
Хорошо, переход на версию 2.15.1 и удаление импорта «allure-cypress/commands» сработало. Но не allure-results не генерирует нужные файлы, это пустая папка. @Ева Сорхауг