-
-
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
Support Cucumber reporters #9
Comments
Not elegant, and my needs are currently minimal. I'm supporting tests against multiple environments at the project level via extending PlaywrightTestProject
My thought was there might be a slick way to make this more dynamic to support the scenario outlines. |
import { defineConfig, devices } from '@playwright/test'; export default defineConfig({ Hi @vitalets , when can we expect cucumberReporter function? It would be great if get this up running soon..Thank you..! |
@Jag46 can't give concrete date but will increase the priority for that. |
Thanks @vitalets , we are looking for a cucumber html report. That would great addition if you can help us with this blocker. Thanks |
We are looking for a cucumber style html report as well, the current report is poorly formatted in playwright style and is not really making use of the BDD style reporting. If we can bring this enhancement soon, it will help our team use the html report without much hassle. |
Ok, got it. Could you clarify what parts of cucumber html reporter are the most important for you? E.g. formatting Scenario Outlines or something else? As there are a lot of events in both playwright and cucumber test run flows. |
Hi @vitalets - It would be helpful if we can cover: 'Feature, Scenario Outline, Scenario, Given, When, Then & Examples' in the report |
Cucumber messages can be validated with https://github.com/cucumber/compatibility-kit |
@vitalets please inform me if i can help you. I love this project and want to support it! |
Looking forward for this feature!! |
It's already 80% complete. Planning to include it in the nearest release. |
Hi @vitalets |
Hi @magarwal19 , I would say it's within 1-2 weeks. Cucumber json will be supported. |
This is great news!! |
Hi @vitalets |
Hi @magarwal19 |
Hi @vitalets |
I've published 1.Install
2.Use import { defineConfig } from '@playwright/test';
import { defineBddConfig, cucumberReporter } from 'playwright-bdd';
const testDir = defineBddConfig({
importTestFrom: 'steps/fixtures.ts',
paths: ['features'],
require: ['steps/*.ts'],
});
export default defineConfig({
testDir,
reporter: [
cucumberReporter('html', { outputFile: 'cucumber-report/report.html' }),
cucumberReporter('json', { outputFile: 'cucumber-report/report.json' }),
cucumberReporter('junit', { outputFile: 'cucumber-report/report.xml' }),
cucumberReporter('message', { outputFile: 'cucumber-report/report.ndjson' }),
],
}); Here is the diff example. Please note that minimal Playwright version is 1.34. |
Hi @vitalets
HTML reports look good :) |
@magarwal19 could you provide more details on both two points? |
Hi @vitalets
|
Hi @vitalets If we can remove this, it will make this result json more light and easy to read |
Yes, Playwright's automatic screenshots are attached as an after step, b/c we need some entity to attach them. |
Hi @vitalets |
We would definitely need them in report, but in my case we did not need in json file but in html file.. |
|
@vitalets thank you for thinking about point 2 :) |
@magarwal19 I've checked original Cucumber junit report, it returns the same structure as playwright-bdd:
This is the full Cucumber report. Could you try to load it with your tool? <?xml version="1.0"?>
<testsuite failures="4" skipped="0" name="cucumber-js" time="0.004758075" tests="4">
<testcase classname="Playwright site" name="Check title" time="0.000913249">
<failure type="Error" message="foo"><![CDATA[Error: foo
at World.<anonymous> (/Users/vitalets/projects/bdd-playground/steps/cucumber-raw/index.ts:15:10)
at processTicksAndRejections (node:internal/process/task_queues:95:5)]]></failure>
<system-out><![CDATA[Given I open url "https://playwright.dev".................................failed
When I click link "Get started"..........................................skipped
Then I see in title "Playwright".........................................skipped]]></system-out>
</testcase>
<testcase classname="Playwright site" name="Check title 2" time="0.000599414">
<failure type="Error" message="foo"><![CDATA[Error: foo
at World.<anonymous> (/Users/vitalets/projects/bdd-playground/steps/cucumber-raw/index.ts:15:10)
at processTicksAndRejections (node:internal/process/task_queues:95:5)]]></failure>
<system-out><![CDATA[Given I open url "https://playwright.dev".................................failed
When I click link "Get started"..........................................skipped
Then I see in title "Playwright".........................................skipped]]></system-out>
</testcase>
<testcase classname="Playwright site" name="A Get started step is Playwright" time="0.002910996">
<failure type="Error" message="foo"><![CDATA[Error: foo
at World.<anonymous> (/Users/vitalets/projects/bdd-playground/steps/cucumber-raw/index.ts:15:10)
at processTicksAndRejections (node:internal/process/task_queues:95:5)]]></failure>
<system-out><![CDATA[Given I open url "https://playwright.dev".................................failed
When I click link "Get started"..........................................skipped
Then I see in title "Playwright".........................................skipped]]></system-out>
</testcase>
<testcase classname="Playwright site" name="A Get started step is Play" time="0.00033441600000000003">
<failure type="Error" message="foo"><![CDATA[Error: foo
at World.<anonymous> (/Users/vitalets/projects/bdd-playground/steps/cucumber-raw/index.ts:15:10)
at processTicksAndRejections (node:internal/process/task_queues:95:5)]]></failure>
<system-out><![CDATA[Given I open url "https://playwright.dev".................................failed
When I click link "Get started"..........................................skipped
Then I see in title "Play"...............................................skipped]]></system-out>
</testcase>
</testsuite> |
Hi @vitalets |
Hi @vitalets, the html report looks great. Within TeamCity when I am using the playwright html report I also have the option to just click it and it will open in a frame, so no need to download it. this is sample from the html how it is opened in TeamCity iframe Maybe passing the URL of the traces could help |
@NikkTod |
Finally, Cucumber reporters are released in playwright-bdd v6 🥳
Thank you all for your help to achieve this goal. Feel free to share your feedback in separate issues ❤️ |
Cucumber has several built-in reporters (also called formatters). It would be useful to output results of Playwright test runner to these reporters (especially html-reporter or
messages
reporter).There are different approaches:
Ideally, final usage should allow to use any Cucumber report:
Known problem - reporting Scenario Outline.
In Cucumber it is possible to have the same test title with different data. In Playwright each test must have unique title (it was also discussed in #3 (comment)). Example of Cucumber html report for Scenario Outline:
I would appreciate more ideas on that from your reporting usage.
The text was updated successfully, but these errors were encountered: