Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 25c33a5

Browse files
committed
some changes
1 parent 0d53b78 commit 25c33a5

4 files changed

Lines changed: 68 additions & 6 deletions

File tree

.github/workflows/reusable-take-screenshots.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ on:
1212
required: false
1313
type: boolean
1414
default: false
15+
artifact-repository:
16+
description: 'artifact repository name'
17+
required: false
18+
type: string
19+
default: ''
20+
artifact-name:
21+
description: 'artifact repository name'
22+
required: false
23+
type: string
24+
default: ''
25+
artifact-id:
26+
description: 'artifact id'
27+
required: false
28+
type: string
29+
default: ''
30+
secrets:
31+
github-token:
32+
required: true
33+
outputs:
34+
artifact-id: ${{ steps.upload-playwright-results.outputs.artifact-id }}
35+
artifact-url: ${{ steps.upload-playwright-results.outputs.artifact-url }}
36+
artifact-digest: ${{ steps.upload-playwright-results.outputs.artifact-digest }}
1537

1638
jobs:
1739
take-screenshots:
@@ -26,18 +48,24 @@ jobs:
2648
with:
2749
node-version-file: package.json
2850
- run: npm ci
51+
- uses: actions/download-artifact@v4
52+
with:
53+
name: ${{ inputs.artifact-name }}
54+
path: artifacts
55+
github-token: ${{ secrets.github-token }}
56+
repository: ${{ inputs.artifact-repository }}
57+
run-id: ${{ inputs.artifact-id }}
58+
continue-on-error: true
59+
- run: cp -f artifacts/{playwright.config.ts,global-setup.ts,global-teardown.ts} .
2960
- run: npm test ${{ inputs.update-snapshots != 'false' && '-- --update-snapshots' || '' }}
3061
- run: ls -alR
3162
- if: ${{ !cancelled() }}
63+
id: upload-playwright-results
3264
uses: actions/upload-artifact@v4
3365
with:
3466
name: playwright-results
3567
path: |
3668
playwright-report
3769
test-results
38-
- if: ${{ !cancelled() }}
39-
uses: actions/upload-artifact@v4
40-
with:
41-
name: playwright-screenshots
42-
path: screenshots
70+
screenshots
4371
if-no-files-found: ignore

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ on:
66
jobs:
77
test:
88
runs-on: ubuntu-latest
9+
outputs:
10+
artifact-id: ${{ steps.artifact.outputs.artifact-id }}
11+
artifact-url: ${{ steps.artifact.outputs.artifact-url }}
12+
artifact-digest: ${{ steps.artifact.outputs.artifact-digest }}
913
steps:
1014
- run: echo "Hello, World!"
15+
# - id: artifact
16+
# uses: actions/upload-artifact@v4
17+
# with:
18+
# name: scripts
19+
# path: |
20+
# playwright.config.ts
21+
# global-setup.ts
22+
# global-teardown.ts
23+
# retention-days: 1
24+
# include-hidden-files: true
1125
take-screenshots:
1226
needs:
1327
- test
@@ -18,3 +32,15 @@ jobs:
1832
https://example.com
1933
https://example.com/2
2034
update-snapshots: true
35+
# artifact-repository: sasaplus1-prototype/workflow-screenshot-with-playwright
36+
# artifact-name: scripts
37+
# artifact-id: ${{ needs.test.outputs.artifact-id }}
38+
secrets:
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
40+
# post:
41+
# needs:
42+
# - take-screenshots
43+
# runs-on: ubuntu-latest
44+
# steps:
45+
# - uses: actions/download-artifact@v4
46+
# with:

index.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { expect, test } from "@playwright/test";
2+
3+
test("should take a full page screenshot of the page", async ({ page }) => {
4+
await page.goto("https://example.com");
5+
await expect(page).toHaveScreenshot({
6+
fullPage: true,
7+
});
8+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
},
99
"private": true,
1010
"scripts": {
11-
"test": "playwright test --project=chromium"
11+
"test": "playwright test --project=chromium index.test.ts"
1212
}
1313
}

0 commit comments

Comments
 (0)