My playwright.config.ts includes:
use: {
...
screenshot: 'only-on-failure',
}
and test failures result in screenshots being saved in /test-results when they fail locally. But when the tests fail when run in Github Actions, no screenshots are taken. So it's impossible for me to tell what's going wrong in my tests, which pass fine locally.
The only CI-specific parts of my config are:
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI ? 'github' : 'list',
ETA: my action.yml attempts to upload the /test-results folder but it's always completely empty, as no screenshots were taken:
- uses: actions/upload-artifact@v2
if: always()
with:
name: playwright-test-results
path: test-results/