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

Question: Is it possible to get feature name and line number in console error and report? #181

Open
viktor-silakov opened this issue Jul 14, 2024 · 5 comments
Labels
question Further information is requested

Comments

@viktor-silakov
Copy link

image It would be very nice to have such an opportunity to go to the desired location of the error using a mouse click in the console, now there is a link only to the compiled js, which is better than nothing, but I would also like to have the ability to quickly go to the desired step using path like `./features/test.featute:123` this would greatly improve the dev experience
@viktor-silakov viktor-silakov added the question Further information is requested label Jul 14, 2024
@viktor-silakov
Copy link
Author

Are there any workarounds available for this functionality? Additionally, are there any plans to implement this feature in the near future? If so, I would be happy to contribute and assist in its development if needed.

@vitalets
Copy link
Owner

Hi @viktor-silakov !
Yes, I will up priority on that. Btw, what reporter do you primary use?

Currently, there is a workaround how to get original location of scenario. There are 2 undocumented fixtures: $uri and $bddTestMeta. Example:

Given("I am on Playwright home page", async ({ page, $uri, $bddTestMeta }) => {
  console.log($uri, $bddTestMeta);
});

Output:

features/homepage.feature { pickleLocation: '3:5' }

@viktor-silakov
Copy link
Author

Thanks for the workaround and the response. Currently, I am using a standard HTML reporter for now, but my issue is more related to console errors.

By the way, have you ever considered creating a community chat, for example, on Gitter or Discord? There are some questions that might not be suitable for the GitHub issues format, and a chat could be really helpful.

@vitalets
Copy link
Owner

Thanks for the workaround and the response.

I'm investigating how to implement it natively. But looks like we need to patch Playwright on some level, to change test location in error output.

I've noticed that for regular Playwright tests output paths are also non-navigatebale by click. For example, if I have e2e/sample.spec.ts, then error output will contain only sample.spec.ts, not e2e/sample.spec.ts. Is it same for you?

By the way, have you ever considered creating a community chat, for example, on Gitter or Discord? There are some questions that might not be suitable for the GitHub issues format, and a chat could be really helpful.

That's good idea! Done. You are welcome to join: https://github.com/vitalets/playwright-bdd?tab=readme-ov-file#community

Note: and big thanks for your support ❤️

@vitalets
Copy link
Owner

I've noticed that for regular Playwright tests output paths are also non-navigatebale by click. For example, if I have e2e/sample.spec.ts, then error output will contain only sample.spec.ts, not e2e/sample.spec.ts.

Opened as issue in Playwright: microsoft/playwright#34125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants