You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the willBeRetried flag is set with this line:
willBeRetried: currentRetry<retries,
however if a test is retried, but succeeds before currentRetry is >= retries that test will not be reported in the cucumber-reports.json and look like this: []
Desired behavior
The desired behavior is to have the retried test be reported in the cucumber-reports.json regardless of how many retries are remaining. I believe the fix would be as simple as changing the referenced line 832 in create-tests.ts to this:
Here is some code to reproduce the issue cypress.config.jsswap retries between 1 (good) and 2 (bad) to see the bug
const{ defineConfig }=require("cypress");constcreateBundler=require("@bahmutov/cypress-esbuild-preprocessor");const{ addCucumberPreprocessorPlugin }=require("@badeball/cypress-cucumber-preprocessor");const{createEsbuildPlugin}=require("@badeball/cypress-cucumber-preprocessor/esbuild");module.exports=defineConfig({e2e: {retries: 1,specPattern: "**/*.feature",asyncsetupNodeEvents(on,config){// This is required for the preprocessor to be able to generate JSON reports after each run, and more,awaitaddCucumberPreprocessorPlugin(on,config);on("file:preprocessor",createBundler({plugins: [createEsbuildPlugin(config)],}));// Make sure to return the config object as it might have been modified by the plugin.returnconfig;},},});
'use strict';const{ Given }=require('@badeball/cypress-cucumber-preprocessor');letcount=0;Given('it succeeds the second time',()=>{count++;if(count===1){cy.log(`Fail on count ${count}`);thrownewError('fail on purpose');}cy.log(`Succeed on count ${count}`);});
retry.feature
Feature: Retry testScenario: Fail first Pass secondGiven it succeeds the second time
Just want to add, that willBeRetried condition for v16 means here in @cucumber/cucumber won't necessarily be false, and thus won't be included in the report.
In v15 when willBeRetried was always false, that actually resulted in both the failure and success being included in the json report, which was also not desired behavior at least for us
Current behavior
Currently, the willBeRetried flag is set with this line:
however if a test is retried, but succeeds before currentRetry is >= retries that test will not be reported in the cucumber-reports.json and look like this:
[]
Desired behavior
The desired behavior is to have the retried test be reported in the
cucumber-reports.json
regardless of how many retries are remaining. I believe the fix would be as simple as changing the referenced line 832 in create-tests.ts to this:this should result in retried tests being added to the
cucumber-report.json
looking like this:Test code to reproduce
Here is some code to reproduce the issue
cypress.config.js
swap retries between 1 (good) and 2 (bad) to see the bugpackage.json
steps.js
retry.feature
Versions
Checklist
cypress-cucumber-preprocessor@4.3.1
(package name has changed and it is no longer the most recent version, see #689).The text was updated successfully, but these errors were encountered: