Deploying Playwright reports to Vercel
The default option for running Playwright tests in Github actions is to generate a playwright report that you can download and view locally.
This is frustrating for two reasons
- Downloading a zip and unzippipping takes longer than simply clicking a link.
- Viewing traces requires hosting the report with a local server.
There are several paid solutions that will host reports and provide CI analytics, but if you simply want to easily view the report there aren't any documented options.
#Enter Vercel
The obvious solution is to deploy the playwright report to Vercel. Vercel satisfies a couple of requirements
- Vercel is super flexible and even supports hosting simple HTML web pages
- Vercel supports preview branches which gives you a unique URL for each report
The way I got setup was to first deploy a playwright-report which i had locally.
Deploying the report locally created a new Vercel project which I was able to re-use in the Github workflow. If you already have playwright github action, all you'll need to do is add this step to your workflow.
The step uses vercel link
to tell Vercel which project I want to deploy to. And then uses vercel deploy
to create a new preview branch for the report.