File tree 3 files changed +16
-1
lines changed
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 22
22
run : |
23
23
npm ci
24
24
npm run check-ci
25
+
26
+ - name : Upload Artifact ⬆️
27
+ uses : actions/upload-artifact@v4
28
+ with :
29
+ path : ./screenshots/*.png
30
+ overwrite : true
Original file line number Diff line number Diff line change 2
2
.DS_Store
3
3
.esm-cache
4
4
.tscache
5
+ screenshots
5
6
node_modules
6
7
package-lock.json
7
8
test /src /ts /dist /*
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ function getExamples(port) {
17
17
. map ( f => ( {
18
18
url : `http://localhost:${ port } /examples/${ f } ` ,
19
19
js : exampleInjectJS ,
20
+ screenshot : true ,
20
21
} ) ) ;
21
22
}
22
23
@@ -65,7 +66,7 @@ async function test(port) {
65
66
...getExamples ( port ) ,
66
67
] ;
67
68
68
- for ( const { url, js} of testPages ) {
69
+ for ( const { url, js, screenshot } of testPages ) {
69
70
waitingPromiseInfo = makePromiseInfo ( ) ;
70
71
console . log ( `===== [ ${ url } ] =====` ) ;
71
72
if ( js ) {
@@ -81,6 +82,13 @@ async function test(port) {
81
82
} ) ;
82
83
}
83
84
await waitingPromiseInfo . promise ;
85
+ if ( screenshot ) {
86
+ const dir = 'screenshots' ;
87
+ fs . mkdirSync ( dir , { recursive : true } ) ;
88
+ const name = / \/ ( [ a - z 0 - 9 _ - ] + ) .h t m l / . exec ( url ) ;
89
+ const path = `${ dir } /${ name } .png` ;
90
+ await page . screenshot ( { path} ) ;
91
+ }
84
92
}
85
93
86
94
await browser . close ( ) ;
You can’t perform that action at this time.
0 commit comments