-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Duplicate tests getting generated to handle Outline Scenarios #3
Comments
Playwright itself does not allow duplicate test titles. For example this produces error: test('test', () => {});
test('test', () => {});
// Error: duplicate test title "test", first declared in test/gen/gen.spec.ts:10 That's why for scenario outline playwright-bdd tests has index in title: test('test', () => {});
test('test (1)', () => {}); We can wrap it into test.describe('test', () => {
test('product=english,title=Home', () => {});
test('product=xxx,title=YYY', () => {});
}); But this also generates new "test entities" that does not match grouping from cucumber. Maybe it can be solved on reporting level..
Could you show an example of Cucumber Json File with scenario outline? |
thanks for quick response. your solution of "test.describe" seems okay to me. that will solve half problem. I will provide you Cucumber Json report for Outline Tests tomorrow. If we can manipulate and output the Cucumber Json to align with Cucumber.js pattern for Outline Scenarios that will solve 100% of issue. |
Since Feature: Feature: scenario-outline
Scenario Outline: Check doubled
Then Doubled <start> to equal <end>
Examples:
| start | end |
| 2 | 4 |
| 3 | 6 | Test: test.describe("scenario-outline", () => {
test.describe("Check doubled", () => {
test("Example #1", async ({ Given, Then }) => {
await Then("Doubled 2 to equal 4");
});
test("Example #2", async ({ Given, Then }) => {
await Then("Doubled 3 to equal 6");
});
});
}); |
I started exploring "Playwright-BDD" extension and I see the test cases are getting duplicates for "Scenario Outline" which is not the case in Cucumber.js. Is there a way we can handle this as well in future ? Basically instead of generating duplicate tests, we need to find a way to consume data from parameters grid while executing tests. I do understand this is best option you had for handling Scenario Outline. Is it possible for Playwright Test and Playwright BDD extension to work together to come up with better solution ?
Potential Solution:
Generate in-line csv in to "test.describe" block and make the Tests repeat using the csv ? Is something like that possible using this playwright pattern for csv test repeats ?
Some background why I ask for this:
The text was updated successfully, but these errors were encountered: