Skip to content

Commit 0648f78

Browse files
stmtk1Hiroshiba
andauthored
e2eテストが落ちたらhtmlで見れるようにしました (#1516)
Co-authored-by: Hiroshiba <[email protected]>
1 parent d7a674b commit 0648f78

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

.github/workflows/test.yml

+7
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ jobs:
104104
npm run test:electron-e2e
105105
fi
106106
107+
- name: Upload playwright report to artifact
108+
if: failure()
109+
uses: actions/upload-artifact@v3
110+
with:
111+
name: playwright-report
112+
path: playwright-report
113+
107114
lint:
108115
runs-on: ubuntu-latest
109116
steps:

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ node_modules
44

55
/tests/e2e/videos/
66
/tests/e2e/screenshots/
7+
/test-results/*
8+
/playwright-report/
79

810
# local env files
911
.env.local

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"test-watch:unit": "vitest --watch",
1818
"test:electron-e2e": "cross-env VITE_TARGET=electron playwright test",
1919
"test-watch:electron-e2e": "cross-env PWTEST_WATCH=1 VITE_TARGET=electron playwright test",
20-
"test:browser-e2e": "cross-env VITE_TARGET=browser playwright test",
21-
"test-watch:browser-e2e": "cross-env PWTEST_WATCH=1 VITE_TARGET=browser playwright test",
20+
"test:browser-e2e": "cross-env VITE_TARGET=browser playwright test --reporter=html",
21+
"test-watch:browser-e2e": "cross-env PWTEST_WATCH=1 VITE_TARGET=browser playwright test --reporter=html",
2222
"lint": "eslint --ext .js,.vue,.ts *.config.* src tests build",
2323
"fmt": "eslint --ext .js,.vue,.ts *.config.* src tests build --fix",
2424
"markdownlint": "markdownlint --ignore node_modules/ --ignore dist/ --ignore dist_electron/ ./",

playwright.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,24 @@ const config: PlaywrightTestConfig = {
5858
fullyParallel: true,
5959
/* Fail the build on CI if you accidentally left test.only in the source code. */
6060
forbidOnly: !!process.env.CI,
61+
reporter: [
62+
[
63+
"html",
64+
{
65+
open: process.env.CI ? "never" : "on-failure",
66+
},
67+
],
68+
],
6169
/* Retry on CI only */
6270
retries: process.env.CI ? 2 : 0,
6371
use: {
6472
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
6573
actionTimeout: 0,
6674
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
6775
trace: "on-first-retry",
76+
video: {
77+
mode: "retain-on-failure",
78+
},
6879
},
6980

7081
/* Configure projects for major browsers */

0 commit comments

Comments
 (0)