question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Json report is not generated with Allure Writer

See original GitHub issue

Current behavior

When my automation is finished and I expect Json to be generated with active Allure Writer - createPickle() function returns an error. Removing/commenting part with allure writer fixes this.

Console log from cypress-cucumber-preprocessor:

{ function: 'createPickle', fileUrl: 'hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature', originalFile: 'node_modules/@badeball/cypress-cucumber-preprocessor/lib/create-tests.js', relativeFile: 'node_modules/@badeball/cypress-cucumber-preprocessor/lib/create-tests.js', absoluteFile: 'C:\\Users\\user\\IdeaProjects\\ui-functional/node_modules/@badeball/cypress-cucumber-preprocessor/lib/create-tests.js', line: 240, column: 1, whitespace: '    ', stack: 'Error\n' + '    at createPickle (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:6660:5)\n' + '    at createScenario (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:6577:9)\n' + '    at Suite.eval (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:6500:21)\n' + '    at createFeature (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:6496:5)\n' + '    at createTests (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:6876:9)\n' + '    at 1.C:/Users/user/IdeaProjects/ui-functional/cypress/stepdefs/addAuthorizationSteps.js (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:23:5)\n' + '    at o (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:1:265)\n' + '    at r (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:1:431)\n' + '    at eval (hostname/__cypress/tests?p=cypress\\features\\connectivity\\FacebookAds.feature:1:460)\n' + '    at eval (<anonymous>)' }

Desired behavior

Json should be generated (according to doc) with active Allure Writer.

Test code to reproduce

  • Run any cucumber scenario with below cypress.config.js and package.json

cypress.config.js

const {defineConfig} = require('cypress')
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const browserify = require("@badeball/cypress-cucumber-preprocessor/browserify");
const allureWriter = require("@shelex/cypress-allure-plugin/writer");

async function setupNodeEvents(on, config) {
    await preprocessor.addCucumberPreprocessorPlugin(on, config);

    on("file:preprocessor", browserify.default(config));

    allureWriter(on, config);
    
    return config
}


module.exports = defineConfig({
    projectId: 'cypress-e2e',
    downloadsFolder: 'downloads',
    env: {
        username: 'atf_user'
    },
    video: false,
    watchForFileChanges: false,
    reporter: 'junit',
    chromeWebSecurity: false,
    reporterOptions: {
        mochaFile: 'results/cypress-report-[hash].xml',
        toConsole: true,
    },
    numTestsKeptInMemory: 0,
    e2e: {
        baseUrl: 'hostname',
        specPattern: 'cypress/features/**/*.{feature,features}',
        setupNodeEvents
    },
})

package.json

{
  "name": "ui-functional",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "devDependencies": {
    "@badeball/cypress-cucumber-preprocessor": "^12.0.1",
    "@cypress/browserify-preprocessor": "^3.0.2",
    "@shelex/cypress-allure-plugin": "^2.28.4",
    "cucumber-json-merge": "^0.0.8",
    "cypress": "^10.3.1",
    "cypress-wait-until": "^1.7.2",
    "cypress-xpath": "^1.6.2"
  },
  "dependencies": {
    "cy2": "^2.0.0",
    "lodash": "^4.17.21"
  },
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/stepdefs/*.{js,ts}",
    "filterSpecs": true,
    "omitFiltered": true,
    "json": {
      "enabled": true,
      "output": "cypress/cucumber-json/cucumber-json.json",
      "formatter": "cucumber-json-formatter"
    },
    "messages": {
      "enabled": true,
      "output": "cypress/cucumber-json/messages.ndjson"
    }
  }
}

Versions

  • Cypress version: 10.3.1
  • Preprocessor version: 12.0.1
  • Node version: 17.9.0

Checklist

  • I’ve read the FAQ.
  • I’ve read Instructions for logging issues.
  • I’m not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
badeballcommented, Aug 10, 2022

Can’t reproduce. You have to provide me a cloneable repository that illustrates the error.

0reactions
badeballcommented, Aug 12, 2022

Yeah, I followed your steps and observed no error.

Either way, you’re not going to get any JSON report because @shelex/cypress-allure-plugin appears to be incompatible with other plugins that listens to Cypress events such as after:run (this has come up before). The authors of the plugin must to modify it to play nicer with other plugins, similar to what I did in 15ae6d0, if this is to be supported. Feel free to open up an issue in their repository to bring it to their attention (reference this comment).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allure report not generated using allure results #1614 - GitHub
I am new to Selenium learning to generate reports from Allure ... can see the report are falling in the allure-results folder(.json files)....
Read more >
Allure is not generating report on cucumber 7 - Stack Overflow
Allure report have to write allure-result to any folder on test executing so you can use this commandline under <argLine> raw your pom....
Read more >
Allure Framework
Allure Framework is a flexible lightweight multi-language test report tool that not only shows a very concise representation of what have ...
Read more >
allure-framework/allure-core - Gitter
Hi, I need some help to get Emailable reports as extent reports in selenium, the sceenshots of errors dont get emailed. Is it...
Read more >
Allure Report Selenium and TestNG Tutorial
Step-1: Modify Maven pom.xml · Step-2: Configure Allure Report Features and Modify Test Codes · Step-3: Run the Test and Generate Allure Report....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found