-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Can we run the tests by cucumber tags like cucumber-js --tags "@foo or @bar" #36
Comments
Short answer: no (for now)
The problem here is that Playwright's tags can be defined only in test titles: test('Test login page @fast', async ({ page }) => { ... });
test('Test full report @slow', async ({ page }) => { ... }); With Feature: my feature
Scenario: Test login page @fast
... Run with tags:
But this is not how we used to work with tags in Cucumber. What I want is to define tags in usual way: Feature: my feature
@fast
Scenario: Test login page
... Currently The ideal solution is to have alternative way of defining tags in Playwright - without modifying test titles. I've already created issue for that microsoft/playwright#23180, you can add thumbs there :) Until this is done I think of option in const testDir = defineBddConfig({
appendTagsToTitle: ['@fast'],
...
}); Then the following scenario Feature: my feature
@fast
Scenario: Test login page
... will be converted into: test('Test login page @fast', async ({ page }) => { ... }); and you will be able to run only
|
In my project, I'm using the playwright tagging approach. At the moment, appending the tag in the scenario name does not look so bad, in fact, it adds a little more information about the scenario. But I'm agree if I wanted to add more tags, it would look overloaded. Additionally, my scenarios already have a [testId] tag because, I'm using alexneo lib to do the integration with azure testplans.
On the other hand, appendTagsToTitle could be useful. Let's say, I have a global tag called login in the feature name. What would I expect is to have that tag in each of every scenario related to that feature.
|
Will add test.describe('Do login @login', () => {
test('Login ok', async ({ page }) => { ... });
test('Login ko', async ({ page }) => { ... });
}); Instead of: test('Login ok @login', async ({ page }) => { ... });
test('Login ko @login', async ({ page }) => { ... }); |
@vitalets you're right, I did a test appending the tag in the test.describe() and it seems to work. |
Looking forward for this feature, as this would also be helpful in case we want to run multiple scenarios based on tags like |
Ok, already in progress. For now you can workaround it by adding tags manually to feature/scenario names @smoke
Feature: Do login @smoke
... |
also really looking forward to this one, this was very useful in other company where we've used cucumber+webdriverio, and were able to launch specific groups of tests based on provided tags. |
@alescinskis, @magarwal19, just as information, you already have that possibility, as vitalets wrote above, you can append the tags in the scenario title and use this example command to run only those tests that has
|
I think this solution is ok for newly created features. |
@vitalets @NikkTod I am using grep for a single tag, but i am also looking for a option where i can give multiple tags, let us say i want to executed four tests which has tag there are other tests also in repository with tags 5/6/7/8 and so on. |
For my framework, we already have tagging done at scenario level, but need support to run scenarios which match any of given tags |
Released v5.1.0 with tags filtering support. While implementing I've realized that instead of Playwright's
Example command:
@magarwal19 for your case with several tags:
Although |
@vitalets, that sounds great, I very much like the --tags option approach |
I have an issue when trying to run tests by tags, it checks incorrect path for screenshots. when trying to launch without specifying tags:
When adding a
screenshots are actually saved under
|
@alescinskis yes, it's a bug, thanks for reporting! |
@alescinskis could you check with |
previous issue no longer reproducible without tags
with tags
|
Closing as fixed. |
No description provided.
The text was updated successfully, but these errors were encountered: