File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Playwright-TypeScript/src/utils Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,22 @@ const TEST_SEPARATOR = "##################";
77const STEP_SEPARATOR = "------------------" ;
88
99export default class TestListener implements Reporter {
10+ totalTests : number = 0 ;
11+ passedTests : number = 0 ;
12+ failedTests : number = 0 ;
13+
1014 onTestBegin ( test : TestCase , result : TestResult ) : void {
1115 this . printLogs ( `Test: ${ test . title } - Started` , TEST_SEPARATOR ) ;
16+ this . totalTests ++ ;
1217 }
1318
1419 onTestEnd ( test : TestCase , result : TestResult ) : void {
1520 if ( result . status === 'failed' ) {
21+ this . failedTests ++ ;
1622 const erroMessage = result . error ? result . error . stack : 'No error stack available' ;
1723 Logger . error ( `Test: ${ test . title } - ${ result . status } \n${ erroMessage } ` ) ;
24+ } else if ( result . status === 'passed' ) {
25+ this . passedTests ++ ;
1826 }
1927 this . printLogs ( `Test: ${ test . title } - ${ result . status } ` , TEST_SEPARATOR ) ;
2028 }
@@ -49,6 +57,12 @@ export default class TestListener implements Reporter {
4957 Logger . error ( `Value: ${ error . value } ` ) ;
5058 }
5159
60+ onEnd ( ) {
61+ console . log ( `\nTotal Tests: ${ this . totalTests } ` ) ;
62+ console . log ( `Passed: ${ this . passedTests } ` ) ;
63+ console . log ( `Failed: ${ this . failedTests } ` ) ;
64+ }
65+
5266 private printLogs ( msg : string , separator : string ) {
5367 Logger . info ( separator ) ;
5468 Logger . info ( `${ msg . toUpperCase ( ) } ` ) ;
You can’t perform that action at this time.
0 commit comments