@@ -39,7 +39,7 @@ export const COMPASS_PATH = path.dirname(
39
39
) ;
40
40
export const LOG_PATH = path . resolve ( __dirname , '..' , '.log' ) ;
41
41
const OUTPUT_PATH = path . join ( LOG_PATH , 'output' ) ;
42
- const SCREENSHOTS_PATH = path . join ( LOG_PATH , 'screenshots' ) ;
42
+ export const SCREENSHOTS_PATH = path . join ( LOG_PATH , 'screenshots' ) ;
43
43
const COVERAGE_PATH = path . join ( LOG_PATH , 'coverage' ) ;
44
44
45
45
let MONGODB_VERSION = '' ;
@@ -106,8 +106,6 @@ export const serverSatisfies = (
106
106
107
107
// For the user data dirs
108
108
let i = 0 ;
109
- // For the screenshots
110
- let j = 0 ;
111
109
112
110
interface Coverage {
113
111
main ?: string ;
@@ -377,18 +375,6 @@ export class Compass {
377
375
await fs . writeFile ( compassLogPath , compassLog . raw ) ;
378
376
this . logs = compassLog . structured ;
379
377
}
380
-
381
- async capturePage (
382
- imgPathName = `screenshot-${ formattedDate ( ) } -${ ++ j } .png`
383
- ) : Promise < boolean > {
384
- try {
385
- await this . browser . saveScreenshot ( path . join ( LOG_PATH , imgPathName ) ) ;
386
- return true ;
387
- } catch ( err ) {
388
- console . warn ( ( err as Error ) . stack ) ;
389
- return false ;
390
- }
391
- }
392
378
}
393
379
394
380
interface StartCompassOptions {
@@ -987,9 +973,11 @@ export async function screenshotIfFailed(
987
973
if ( test ) {
988
974
if ( test . state === undefined ) {
989
975
// if there's no state, then it is probably because the before() hook failed
990
- await compass . capturePage ( screenshotPathName ( `${ test . fullTitle ( ) } -hook` ) ) ;
976
+ await compass . browser . screenshot (
977
+ screenshotPathName ( `${ test . fullTitle ( ) } -hook` )
978
+ ) ;
991
979
} else if ( test . state === 'failed' ) {
992
- await compass . capturePage ( screenshotPathName ( test . fullTitle ( ) ) ) ;
980
+ await compass . browser . screenshot ( screenshotPathName ( test . fullTitle ( ) ) ) ;
993
981
}
994
982
}
995
983
}
0 commit comments