File tree Expand file tree Collapse file tree 2 files changed +36
-8
lines changed Expand file tree Collapse file tree 2 files changed +36
-8
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ const config: PlaywrightTestConfig = {
57
57
/* Retry on CI only */
58
58
retries : process . env . CI ? 2 : 0 ,
59
59
/* Opt out of parallel tests on CI. */
60
- workers : process . env . CI ? 2 : 2 ,
60
+ workers : process . env . CI ? 4 : 4 ,
61
61
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
62
62
reporter : [
63
63
[ 'list' ] ,
@@ -71,6 +71,7 @@ const config: PlaywrightTestConfig = {
71
71
) ,
72
72
} ,
73
73
] ,
74
+ [ './slow-tests-reporter.ts' ] ,
74
75
] ,
75
76
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
76
77
use : {
@@ -94,13 +95,6 @@ const config: PlaywrightTestConfig = {
94
95
deviceScaleFactor : 2 ,
95
96
} ,
96
97
} ,
97
- {
98
- name : 'webkit' ,
99
- use : {
100
- ...devices [ 'Desktop Safari' ] ,
101
- deviceScaleFactor : 2 ,
102
- } ,
103
- } ,
104
98
] ,
105
99
} ;
106
100
Original file line number Diff line number Diff line change
1
+ import type { Reporter , TestCase , TestResult } from '@playwright/test/reporter' ;
2
+
3
+ const DELTA = 5000 ;
4
+ const ONE_SECOND = 1000 ;
5
+
6
+ class SlowTestsReporter implements Reporter {
7
+ private slowTests : { title : string ; duration : number } [ ] = [ ] ;
8
+
9
+ onTestEnd ( test : TestCase , { duration} : TestResult ) {
10
+ if ( duration > DELTA ) {
11
+ const [ _ , browser , ...rest ] = test . titlePath ( ) ;
12
+ this . slowTests . push ( {
13
+ title : `[${ browser } ] › ${ rest . join ( ' › ' ) } ` ,
14
+ duration,
15
+ } ) ;
16
+ }
17
+ }
18
+
19
+ onEnd ( ) {
20
+ if ( this . slowTests . length > 0 ) {
21
+ console . log ( '---' ) ;
22
+ console . log ( `Slow tests (duration > ${ DELTA } ), total ${ this . slowTests . length } :` ) ;
23
+
24
+ const sorted = this . slowTests . sort ( ( a , b ) => b . duration - a . duration ) ;
25
+ sorted . forEach ( ( test , index ) => {
26
+ console . log (
27
+ `${ index + 1 } . ${ test . title } (${ ( test . duration / ONE_SECOND ) . toFixed ( 1 ) } s)` ,
28
+ ) ;
29
+ } ) ;
30
+ }
31
+ }
32
+ }
33
+
34
+ export default SlowTestsReporter ;
You can’t perform that action at this time.
0 commit comments