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]: TS style test.step trace file grouping #2988

Closed
infinitejest69 opened this issue Aug 27, 2024 · 3 comments
Closed

[Feature]: TS style test.step trace file grouping #2988

infinitejest69 opened this issue Aug 27, 2024 · 3 comments

Comments

@infinitejest69
Copy link

🚀 Feature Request

I would really like to see some way to use the grouping of steps in trace files the node test runner has into c#

so in TS you can specify

  await test.step('Add Folder Model', async () => {
   //Some Actions like clicking and filling
  });

These appear nicely in a trace and improve it readability massively
image

in c# we already have tools like specflow or Reqnroll to make these nice English readable test steps. i would like to add to a before step hook the name of the step and after step hook to close the group

Example

At a guess something that you can access from the browser context tracing ?

        [BeforeStep]
        public async Task BeforeStep(ScenarioContext scenarioContext) {
            var browserContext = scenarioContext.ScenarioContainer as IBrowserContext;
            browserContext.Tracing.StartGroup(scenarioContext.StepContext.StepInfo.Text);
            }

        [AfterStep]
        public async Task AfterStep(ScenarioContext scenarioContext) {
            var browserContext = scenarioContext.ScenarioContainer as IBrowserContext;
            browserContext.Tracing.EndGroup(scenarioContext.StepContext.StepInfo.Text);
            }

Motivation

Makes looking through trace files much nicer and easier and readable what the test is doing

@scott-au
Copy link

Related requests: microsoft/playwright-java#1565 microsoft/playwright-python#1949

hopefully it gets out of the p3-collecting-feeback boneyard 🙏🙏🙏

@mxschmitt
Copy link
Member

This will be available in v1.49.0 soon as part of Contex.Tracing.GroupAsync and Context.Tracing.GroupEndAsync API.

@infinitejest69
Copy link
Author

This works like a charm, thanks
allows me to have nice BDD English steps in my trace files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants