Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature file lines are not visible in console #48

Closed
umerhamdan10 opened this issue Jun 7, 2021 · 5 comments
Closed

Feature file lines are not visible in console #48

umerhamdan10 opened this issue Jun 7, 2021 · 5 comments

Comments

@umerhamdan10
Copy link

image

Only the scenario line show in the console. Is it possible to show successfull line in console at run time?

@Arthy000
Copy link
Owner

Arthy000 commented Jun 8, 2021

Hello.
Sadly, that's actually testcafe showing the name of the test, not gherkin-testcafe.
To display the steps, we would need to add the whole scenario to the test name, not just the scenario title. But even then it would display the whole name at once, not successful steps when they finish running.

@thelazurite-cell
Copy link

I have done something like this, but from what I can tell there doesn't seem to be a way/easy way to get the step type (given/when/then/etc.)

    protected async runScenario(scenario: messages.Pickle, error: Error, ...params: ExecutorSpecificParams): Promise<Error> {
        try {
            for (const step of scenario.steps) {
                await this.resolveAndRunStepDefinition(<messages.Pickle.PickleStep>step, ...params).catch(reason => error = reason);
                if (error) {
                    console.log(`${ConsoleColor.FgRed}\t${symbols.err} ${scenario.name} - ${step.text} ${ConsoleColor.Reset}`);
                    break;
                } else {
                    console.log(`${ConsoleColor.FgGreen}\t${symbols.ok} ${scenario.name} - ${step.text} ${ConsoleColor.Reset}`);
                }
            }
        } catch (e) {
            error = e;
        }

        return error;
    }

@Arthy000
Copy link
Owner

Arthy000 commented Jun 8, 2021

There may be a way to do this with a custom testcafe reporter, but that would require some modifications in this package anyway. And it would be a custom that would not be compatible with vanilla testcafe so it would need to be included in this package, and not standalone.

Console.log is more of an incomplete workaround because it would not get included if you wanted to have your report in a file instead of the console.

And then you would probably want to do this for each type of report (TeamCity, JSON, XML, plain text, ...).

All this to say that I don't really have the time to do this in the foreseeable future, but you are welcome to try.

@Arthy000
Copy link
Owner

Arthy000 commented Jun 2, 2022

hello @umerhamdan10
IDK if you are still interested but I finally started working on this yesterday, and the results are promising.

Arthy000 added a commit that referenced this issue Jun 3, 2022
steps and failure index are added to the metadata of the step, and the reporter from testcafe has
been rewired to use a custom version of spec by default

re #48
Arthy000 added a commit that referenced this issue Jun 4, 2022
steps and failure index are added to the metadata of the step, and the reporter from testcafe has
been rewired to use a custom version of spec by default

re #48
Arthy000 added a commit that referenced this issue Jun 4, 2022
steps and failure index are added to the metadata of the step, and the reporter from testcafe has
been rewired to use a custom version of spec by default

re #48
Arthy000 added a commit that referenced this issue Jun 4, 2022
steps and failure index are added to the metadata of the step, and the reporter from testcafe has
been rewired to use a custom version of spec by default

re #48
Arthy000 added a commit that referenced this issue Jun 4, 2022
steps and failure index are added to the metadata of the step, and the reporter from testcafe has
been rewired to use a custom version of spec by default

re #48
@Arthy000
Copy link
Owner

Arthy000 commented Jun 4, 2022

New version 5.4 released, includes 3 custom reporters (gtc-reporter-spec, gtc-reporter-list and gtc-reporter-minimal)
=> gtc-reporter-spec is used by default so if you didn't explicitly set a reporter you'll get the new behavior as soon as you update.

Steps and the index of the failed step are included in the metadata, so you can create/adapt your own reporter to display the steps information.
Testcafé's json reporter already includes the metadata for the tests so no change needed on my part.
Full documentation here

@Arthy000 Arthy000 closed this as completed Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants