Skip to content

Commit

Permalink
Merge pull request #11 from JoanEsquivel/11.0.1
Browse files Browse the repository at this point in the history
11.0.1
  • Loading branch information
JoanEsquivel authored Nov 15, 2022
2 parents 55f685f + 8fafe2d commit 556f5b7
Show file tree
Hide file tree
Showing 4 changed files with 297 additions and 298 deletions.
40 changes: 20 additions & 20 deletions .cypress-cucumber-preprocessorrc.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"json": {
"enabled": false,
"output": "jsonlogs/log.json",
"formatter": "cucumber-json-formatter.exe"
},
"messages": {
"enabled": false,
"output": "jsonlogs/messages.ndjson"
},
"html": {
"enabled": false
},
"stepDefinitions": [
"[filepath]/**/*.{js,ts}",
"[filepath].{js,ts}",
"cypress/e2e/step_definitions/*.{js,ts}",
"[filepath]\\***.{js,ts}",
"[filepath].{js,ts}",
"cypress\\e2e\\step_definitions\\*.{js,ts}"
]
"json": {
"enabled": false,
"output": "jsonlogs/log.json",
"formatter": "cucumber-json-formatter.exe"
},
"messages": {
"enabled": false,
"output": "jsonlogs/messages.ndjson"
},
"html": {
"enabled": false
},
"stepDefinitions": [
"[filepath]/**/*.{js,ts}",
"[filepath].{js,ts}",
"cypress/e2e/step_definitions/*.{js,ts}",
"[filepath]\\***.{js,ts}",
"[filepath].{js,ts}",
"cypress\\e2e\\step_definitions\\*.{js,ts}"
]
}
47 changes: 21 additions & 26 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
const { defineConfig } = require("cypress");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const addCucumberPreprocessorPlugin =
require("@badeball/cypress-cucumber-preprocessor").addCucumberPreprocessorPlugin;
const createEsbuildPlugin =
require("@badeball/cypress-cucumber-preprocessor/esbuild").createEsbuildPlugin;
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");
const allureWriter = require("@shelex/cypress-allure-plugin/writer");

//If using this approach, just call the key "setupNodeEvents" in the E2E configurations
// async function setupNodeEvents(on, config) {
// await addCucumberPreprocessorPlugin(on, config);
// on(
// "file:preprocessor",
// createBundler({
// plugins: [createEsbuildPlugin(config)],
// })
// );
// return config;
// }
async function setupNodeEvents(on, config) {
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await preprocessor.addCucumberPreprocessorPlugin(on, config);

module.exports = defineConfig({
e2e: {
async setupNodeEvents(on, config) {
const bundler = createBundler({
plugins: [createEsbuildPlugin(config)],
});
on(
"file:preprocessor",
createBundler({
plugins: [createEsbuildPlugin.default(config)],
})
);
allureWriter(on, config);

on("file:preprocessor", bundler);
await addCucumberPreprocessorPlugin(on, config);
allureWriter(on, config);
// Make sure to return the config object as it might have been modified by the plugin.
return config;
}

return config;
},
module.exports = defineConfig({
e2e: {
setupNodeEvents,
specPattern: "cypress/e2e/features/*.feature",
baseUrl: "https://www.saucedemo.com",
chromeWebSecurity: false,
env: {
allureReuseAfterSpec: true,
},
},
});
Loading

0 comments on commit 556f5b7

Please sign in to comment.