-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[Feature] Combine sharding with html reporter #10437
Comments
Sounds reasonable to me! What kind of api would you like to combine the reports together? |
I personally have no preferences for how to merge the reports together. Whatever I can do on CI in a fast way. |
Since I'm currently using https://plugins.jenkins.io/allure-jenkins-plugin/ to merge multiple Allure reports and it is as simple as 👇 then I'd favor a similar approach to HTML reporter but any other out-of-the-box no-brainer solution would work as well.
|
This feature would be great to have. We are looking to migrate our E2E testing solution to Playwright. We have a component library where each test runs several variations of a particular test to check for visual regressions. Some of the variants we have are:
Right now the results for these tests can get split up across multiple shards. It would be great to have a single result where we can see all of the test results. |
I was able to build one solution for my use case (in Node.js). I had multiple reports from different shards (tests distributed with a custom logic) in a single run and wanted to send a single merged html report. Hope it helps. Installationnpm install playwright-merge-html-reports --dev Usageconst { mergeHTMLReports } = require("playwright-merge-html-reports");
mergeHTMLReports([
process.cwd() + "/html_report-1",
process.cwd() + "/html_report-2"
])
|
@anooprav7 thanks kind men. I will try this in a week or two. |
Is this feature still in progress? |
My test suite becomes bigger and bigger every week, and this is a blocker for my team to start using sharding. The solution mentioned by anooprav7 seems cool, but we would like to have a stable version of such toolkit. I was really hoping for it to appear in 1.22 :( |
We're running our tests on GitHub Actions. We'd ideally like a single report, but for now will create a report per shard/matrix runner. I'm not sure how this should work - there's no easy mechanism for the runners to talk to each other to combine a report. |
wanting this too. We run our tests back to back with various different configurations and want to combine the final test results into a single html. So pls team at MS and Playwright, at some point in future, make this a native playwright feature.
|
Feel free to install from my (unpublished) fork in the meantime, @mstepin. We're using this on one of our repositories at Vercel right now and it seems like we have everything working.
|
The fix has been merged and published - |
Looking forward to this feature. |
@TimeInvestor just to be clear, you can currently shard your playwright tests across multiple machines and use |
Thanks @nickofthyme. Will check it out although I am not sure if it works well for my scenario that the test results are residing with multiple Jenkins jobs over different Jenkins slaves. |
I came back to this issue today to check on any progress and I noticed the blob reporter merged back in April in v1.35.1. There was no doc on it so I wasn't sure if if the feature fully addressed this issue. For me at least, this turned out to be pretty great.
then I ran and I then ran
and it produced the xml output. |
It would be pretty cool if it produced a merged report for every report type that was already defined in the report config. If I left off the |
@damongabrielle oh wow, i just replicated your steps and got it working against 3 shards. Im a little reluctant to use it though without any official support from Playwright. This is pretty awesome though |
@damongabrielle @costa-collibra, yeah, it's working 😮, but I'm facing a problem when running on CI. The HTML report opens automatically if some of the tests fail. Unfortunately, merge-reports is ignoring the 'open' property in the Playwright config, and I don't see any other way to configure that. 😢 I'm not sure if I'm missing something, if there's a workaround for it, or maybe that's the reason why merging multiple reports is not officially supported yet. There is even a documentation https://playwright.dev/docs/next/test-merge-report (it's marked as 'Version: Next' though) |
try setting env variable |
@MindaugasMateika Oh, now I see where I have made a mistake (I forgot to pass |
I have noticed one problem with merging when using the setup test (https://playwright.dev/docs/test-global-setup-teardown#setup-example). When running with When I click on these two tests, most of the resulting page is empty. Other than that, it looks great! |
@swetrify is is running the global setup twice or just reporting on it twice? If its running setup twice that seems a pretty big bug/oversight |
@damongabrielle @MindaugasMateika I have this set const reportList: ReporterDescription[] = [['list'], ['blob'], ['html', { open: 'never' }]]; to prevent the report from opening |
The setup is running on each shard once, resulting in the global setup being executed twice (in my example with 2 shards). When I don't merge the reports, each HTML file contains a result of the global setup that differs from each other. I am not sure if it's a bug or a feature. The documentation for sharding and global setup is not clear on this matter. Edit: I think it's a feature. It does make sense in the context of the login example. You need to create |
I'm surprised @costa-collibra that the report config |
@damongabrielle actually you are correct on that part I misread. The report does open when I merged. Its great though that you have a solution as we will need to set this in the pipeline. |
Here's another example of an Actions file using the blob reporter and merging CLI. This merges to XML for use with dorny-test-reporter and deploys the HTML report to GH Pages:
|
Hey everybody, This has been released in 1.37.
Thank you all for the feedback! |
Hi, does this also support mergin of custom reports? For example we use a custom json reporter. I assume I can implement a merge method in my reporter? |
@marwie custom reports are supported as well. Make sure to specify it when using the |
Hi @aslushnikov thanks for the reply. Should i pass in the path to my reporter as an argument then and is it possible to specify multiple reporters (e.g. can I both use the html and my reporter like so: |
@marwie you'd need to:
|
Hi, |
Currently there is no way to combine test results into one html report, while using sharding on multiple machines. (v1.17.0-rc1)
I end up with multiple reports which makes it harder for sharing with others in case of failures.
It would be nice to be able to combine multiple executions into 1 report.
I believe anyone who wants to scale tests horizontally might benefit from such feature
The text was updated successfully, but these errors were encountered: