The cucumber_report.json file will not update to reflect the most recent test steps

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.

Answer №1

The reason for this is you are utilizing 'multiCapabilities'. When testing with just one browser, opt for 'capabilities' instead to eliminate the timestamp.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Stop the controller from reloading when navigating in Angular2/Ionic2

Initially, I developed my app using tabs. When navigating to a page, the view would load for the first time (fetch data from API and display it), and upon returning to the same page, nothing would reload because the controller did not run again. Recently, ...

The width of the Ion-slide is dynamically determined by the styling

After transitioning my Ionic 2 project to Ionic 3, I encountered issues with ion-slides which are affecting my app's functionality. Upon app loading, specific widths are being defined in the style tags on the slides, disrupting the intended styling. ...

Angular Form customizable field

I'm trying to figure out how to create an angular form with a dynamic step. Currently, my form in TypeScript looks like this: this.registerForm = new FormGroup({ role: new FormControl('', [ Validators.required, ]), firstName: ...

typescript What is the best approach to searching within a nested array?

I am struggling to extract a specific value from a nested array within an array. Here is an example structure of my array: [ { ConcessionId: 1, ConcessionName: "Coyotes", KnownAs: [ { TeamId: 1, ...

Verify if the application is installed on the device through programmatic means

Some may argue that this question is duplicated, but I believe it's not. I have installed an app on the emulator and am currently running the following code to check if the app is available. If the app is indeed available, it returns true. See the co ...

Choose does not showcase the updated value

My form contains a form control for currency selection Each currency object has the properties {id: string; symbol: string}; Upon initialization, the currency select component loops through an array of currencies; After meeting a specific condition, I need ...

Angular 8 Refresh Token Implementation

I am currently working on an Angular 8 app that is integrated with .NET Core. My goal is to find a way to refresh a JWT token within the application. Within the integration, users are able to validate and receive a token which expires after 30 minutes. T ...

What are the reasons for deprecating bindToController in Typescript?

When I am creating an AngularJS directive using TypeScript, I typically use the bindToController property to bind parameters to the controller for easy access. export class MyDirective implements IDirective { controller = MyController; controllerA ...

Refresh your webpage automatically using Typescript and Angular

Currently facing an issue and seeking assistance. My query is regarding reloading a website after 5 minutes in a Typescript/Angular application. Can anyone help with this? ...

Tips for extracting specific information from a nested object in MongoDB

I am currently storing data for a NestJs based web application in MongoDB. My MongoDB data has the following structure: "gameId": "1a2b3c4d5e" "rounds": [ { "matches": [ { "match_id& ...

Using Node.js to inject dependencies into the app.js file

As I work on my node.js and typescript application, I followed the approach outlined in an article by Brian Love. You can find a sample code for the server.ts file below: import * as bodyParser from "body-parser"; import * as cookieParser from "cookie-par ...

Leverage the power of forkJoin in JavaScript by utilizing objects or sourcesObject

I'm currently facing an issue with my code snippet below: getInformations().subscribe( informations => { let subs = []; for (const information of informations) { subs.push(getOtherDetails(information.id)); } ...

Changing a date format in typescript: Here is how you can easily convert a date from one

Using React with Typescript: I am currently working with a date picker from material-ui version 5. The date picker requires the date value to be in the format "yyyy-MM-dd". However, the API returns a Date object in the format "2022-01-12T00:00:00.000+00:0 ...

Can you use getters and setters in a TypeScript declaration file?

I am facing an issue with a declaration file for the openUi framework. The framework utilizes a get<propname>() and set<propname>(var) syntax for its properties. In traditional JavaScript, the setup would look like this: sap.ui.getCore().atta ...

Exploring the functionality of surveyjs in conjunction with react and typescript

Does anyone have any code samples showcasing how to integrate Surveyjs with React and TypeScript? I attempted to import it into my project and utilized the code provided in this resource. https://stackblitz.com/edit/surveyjs-react-stackoverflow45544026 H ...

When using Angular 10 or later, the mouseclick event will consistently trigger Angular's change detection mechanism

When I bind an event to elements on a component's HTML page, the component continues to detect changes even when the element event is fired. Despite setting the change detection mode of the component to OnPush, this behavior persists. To test this, I ...

Can a JavaScript object be created in TypeScript?

Looking for a way to utilize an existing JavaScript "class" within an Angular2 component written in TypeScript? The class is currently defined as follows: function Person(name, age) { this.name = name; this.age = age; } Despite the fact that Java ...

When invoking a JavaScript method, the context variable 'this' is lost

I have developed a basic pointer to a method like this: export class SmbwaService { getExistingArsByLab(labId: number): Observable<SmwbaAr[]> { this.otherMethod(); } otherMethod(): void { } } let method: (x: number) => ...

What exactly is the data type of setInterval in TypeScript?

If I want to define the type of a variable that will be used with setInterval in the following code snippet: this.autoSaveInterval = setInterval(function(){ if(this.car.id){ this.save(); } else{ this.create(); } ...

Error: Trying to access the 'keyboard' property of an undefined object

I am encountering an error message 'Cannot read property 'keyboard' of undefined' and I'm not sure how to fix it. I just want to check if the keyboard is visible on the screen, but this specific line of code seems to be causing the ...