I have encountered an issue with the cucumber_reporter.json file not overwriting under the reports/html folder in my framework. To address this, I made changes to the cucumberOpts option within my config.ts file. By modifying the format setting to "json:./reports/json/cucumber_report.json", a new report file (cucumber_report.58053.json) is generated in the reports/html directory with a timestamp attached. However, if I remove the format option and run the test, a new file is not created.
In my config.ts:
import {Config} from 'protractor';
import * as tsNode from 'ts-node';
import { Reporter } from "../support/reporter";
const jsonReports = process.cwd() + "/reports/json";
export let config: Config = {
specs: [
'../../features/*.feature'
],
onPrepare: () => {
Reporter.createDirectory(jsonReports);
tsNode.register({
project: './tsconfig.json'
});
},
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
compiler: "ts:ts-node/register",
glue : [ "steps" ],
plugin: [
"com.cucumber.listener.ExtentCucumberFormatter:",
"rerun:target/rerun.txt",
],
format: [
"json:./reports/json/cucumber_report.json",
],
require: ['supports/timeout.js', '../../stepdefinitions/*.ts'],
tags: "@firstPurchasePopup",
},
onComplete: () => {
Reporter.createHTMLReport();
},
};
I expect the cucumber_report.json file to be updated every time the test is run, without creating a new timestamped file. The HTML report should reflect any changes made to the test steps in the .feature file.
If I modify the test steps in the .feature file and rerun the test, the report does not update accordingly but retains the previous test steps.
===Further details======== If I disable the format line in the code snippet above, the cucumber_report.json file will not be generated.
cucumberOpts: {
compiler: "ts:ts-node/register",
glue : [ "steps" ],
format: [
"json:./reports/json/cucumber_report.json",
],
If I keep the format setting as-is, a new file is created with a timestamp like cucumber_report.8561.json for each run, which seems incorrect. It should not append a timestamp to the file name, and I need assistance in understanding why it is doing so. This causes the .html report to look for the cucumber_report.json file that does not exist, leading to a failure in generating the HTML report.