vitalets / playwright-bdd

BDD testing with Playwright runner
https://vitalets.github.io/playwright-bdd/
MIT License
275 stars 33 forks source link

Question: Run by line number #178

Open viktor-silakov opened 2 months ago

viktor-silakov commented 2 months ago

Can I run a specific scenario by line number? It is a handy feature in cucumber-like tools. Example:

npx wdio --spec ./features/test.feature:N

where N - is the number of a scenario name line or line with a specific example in some Scenario Outline.

Yes I know about the @only tag but in some situations run by line is more suitable

alescinskis commented 2 months ago

Why not give your scenarios custom tags (e.g. @scenarioFailedLogin) and then execute by a specific tag or groups of tags? I think it's more beneficial in the long run, than relying on line number that might change.

viktor-silakov commented 2 months ago

Why not give your scenarios custom tags (e.g. @scenarioFailedLogin) and then execute by a specific tag or groups of tags? I think it's more beneficial in the long run, than relying on line number that might change.

You are right, this is not for the long run, for debugging mostly, it can be used for example to run certain scenarios via IDE extension (e.g. VScode). BTW there is no way to run certain example in Outline using the tag system.

vitalets commented 2 months ago

I saw this in Cucumber, and I also curious what is the dev flow for it?

Playwright itself does not provide such feature. It can run particular scenario by file + scenario name. So, to get it working, we need Playwright to support it on the runner side. Or generate only that scenario in spec file.

For VSCode the expected way for debugging playwright-bdd tests is using Playwright VSCode extension, that allows to run particular scenario / example just by click:

image

viktor-silakov commented 2 months ago

I saw this in Cucumber, and I also curious what is the dev flow for it?

image image

Very convenient to run certain example in such a way for example. Especially to run such things on ci/cd.

vitalets commented 2 months ago

Ok. Btw, do you the VSCode extension that allows to run example line from feature file just by click?

viktor-silakov commented 2 months ago

Ok. Btw, do you the VSCode extension that allows to run example line from feature file just by click?

I use my own one for WDIO + Cucumber. But really it is more for CI/CD not for extension, there are cases when I need to do this on some heavy e2e outlines.

vitalets commented 2 months ago

How to you run particular line on CI/CD?

viktor-silakov commented 2 months ago

How to you run particular line on CI/CD?

Just put something like test.feature:23 in the path field of my job :)