diff --git a/index.js b/index.js index 2a4612e..637294c 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -const Reporter = require("./src/Reporter"); +const Reporter = require('./src/Reporter'); module.exports = Reporter; diff --git a/tests/Cypress/cypress.config.js b/tests/Cypress/cypress.config.js index 139c04a..aa6d27f 100644 --- a/tests/Cypress/cypress.config.js +++ b/tests/Cypress/cypress.config.js @@ -1,12 +1,12 @@ -import TestRailReporter from '../../index.js'; +const createBundler = require('@bahmutov/cypress-esbuild-preprocessor'); +const {addCucumberPreprocessorPlugin} = require('@badeball/cypress-cucumber-preprocessor'); +const {createEsbuildPlugin} = require('@badeball/cypress-cucumber-preprocessor/esbuild'); -import createBundler from '@bahmutov/cypress-esbuild-preprocessor'; -import {addCucumberPreprocessorPlugin} from '@badeball/cypress-cucumber-preprocessor'; -import {createEsbuildPlugin} from '@badeball/cypress-cucumber-preprocessor/esbuild'; -import {defineConfig} from 'cypress'; +const {defineConfig} = require('cypress'); +const TestRailReporter = require('../../src/../index'); -export default defineConfig({ +module.exports = defineConfig({ watchForFileChanges: false, @@ -18,9 +18,9 @@ export default defineConfig({ specPattern: ['cypress/e2e/**/*.feature', 'cypress/e2e/**/*.js'], - async setupNodeEvents(on, config) { + async setupNodeEvents(cypressOn, config) { - new TestRailReporter(on, config).register(); + const on = require('cypress-on-fix')(cypressOn) await addCucumberPreprocessorPlugin(on, config); @@ -28,6 +28,8 @@ export default defineConfig({ plugins: [createEsbuildPlugin(config)], })); + new TestRailReporter(on, config).register(); + return config }, }, diff --git a/tests/Cypress/cypress/e2e/blog.feature b/tests/Cypress/cypress/e2e/blog.feature index a94e433..5b77594 100644 --- a/tests/Cypress/cypress/e2e/blog.feature +++ b/tests/Cypress/cypress/e2e/blog.feature @@ -6,9 +6,9 @@ Feature: Login on website Rule: Happy Path @smoke - Scenario Outline: Filter blog posts by tags + Scenario Outline: C123: Filter blog posts by tags When I click on tag - Then I see the tag as title + Then I see tag <title> as title Examples: | tag | title | @@ -16,8 +16,3 @@ Feature: Login on website | DEVOPS | devops | - Rule: Edge Cases - - Scenario: Filter for invalid tag - When I enter tag "abc" in the URL - Then I must not see the blog diff --git a/tests/Cypress/cypress/support/steps/blog.ts b/tests/Cypress/cypress/support/steps/blog.ts index 0595b02..615f6a3 100644 --- a/tests/Cypress/cypress/support/steps/blog.ts +++ b/tests/Cypress/cypress/support/steps/blog.ts @@ -13,7 +13,7 @@ When(/^I click on tag (.*)$/, (tagName) => { cy.get('.article-tags__box > [href="/tags/?tag=' + tagName.toLowerCase() + '"]').first().click(); }); -Then(/^I see the tag (.*) as title$/, (tagName) => { +Then(/^I see tag (.*) as title$/, (tagName) => { cy.contains('h2', tagName); }); diff --git a/tests/Cypress/package-lock.json b/tests/Cypress/package-lock.json index 2dfba60..545b14b 100644 --- a/tests/Cypress/package-lock.json +++ b/tests/Cypress/package-lock.json @@ -12,6 +12,9 @@ "@badeball/cypress-cucumber-preprocessor": "^20.0.1", "@bahmutov/cypress-esbuild-preprocessor": "^2.2.0", "cypress": "^13.0.0" + }, + "devDependencies": { + "cypress-on-fix": "^1.0.2" } }, "node_modules/@babel/code-frame": { @@ -1858,6 +1861,12 @@ "node": "^16.0.0 || ^18.0.0 || >=20.0.0" } }, + "node_modules/cypress-on-fix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cypress-on-fix/-/cypress-on-fix-1.0.2.tgz", + "integrity": "sha512-oN/PW7FsC3Y7xC9Z76KzAVXWH5VNPrt+FWjMlSYDPQtEOYedVNBLu7dz9CEU6Ntt5kD0MHuXAyO8Ov2YNBf9lg==", + "dev": true + }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -5960,6 +5969,12 @@ "yauzl": "^2.10.0" } }, + "cypress-on-fix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cypress-on-fix/-/cypress-on-fix-1.0.2.tgz", + "integrity": "sha512-oN/PW7FsC3Y7xC9Z76KzAVXWH5VNPrt+FWjMlSYDPQtEOYedVNBLu7dz9CEU6Ntt5kD0MHuXAyO8Ov2YNBf9lg==", + "dev": true + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", diff --git a/tests/Cypress/package.json b/tests/Cypress/package.json index 7e811a4..e57706d 100644 --- a/tests/Cypress/package.json +++ b/tests/Cypress/package.json @@ -1,6 +1,5 @@ { "name": "cypress", - "type": "module", "version": "1.0.0", "description": "", "main": "index.js", @@ -13,5 +12,8 @@ "@badeball/cypress-cucumber-preprocessor": "^20.0.1", "@bahmutov/cypress-esbuild-preprocessor": "^2.2.0", "cypress": "^13.0.0" + }, + "devDependencies": { + "cypress-on-fix": "^1.0.2" } }