@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
99 } ) ;
1010} ;
1111var __generator = ( this && this . __generator ) || function ( thisArg , body ) {
12- var _ = { label : 0 , sent : function ( ) { if ( t [ 0 ] & 1 ) throw t [ 1 ] ; return t [ 1 ] ; } , trys : [ ] , ops : [ ] } , f , y , t , g ;
13- return g = { next : verb ( 0 ) , "throw" : verb ( 1 ) , "return" : verb ( 2 ) } , typeof Symbol === "function" && ( g [ Symbol . iterator ] = function ( ) { return this ; } ) , g ;
12+ var _ = { label : 0 , sent : function ( ) { if ( t [ 0 ] & 1 ) throw t [ 1 ] ; return t [ 1 ] ; } , trys : [ ] , ops : [ ] } , f , y , t , g = Object . create ( ( typeof Iterator === "function" ? Iterator : Object ) . prototype ) ;
13+ return g . next = verb ( 0 ) , g [ "throw" ] = verb ( 1 ) , g [ "return" ] = verb ( 2 ) , typeof Symbol === "function" && ( g [ Symbol . iterator ] = function ( ) { return this ; } ) , g ;
1414 function verb ( n ) { return function ( v ) { return step ( [ n , v ] ) ; } ; }
1515 function step ( op ) {
1616 if ( f ) throw new TypeError ( "Generator is already executing." ) ;
@@ -36,59 +36,57 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
3636 }
3737} ;
3838Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
39- exports . VisualDiffTestCases = exports . defaultTestFunction = exports . defineVisualDiffConfig = void 0 ;
39+ exports . VisualDiffTestCases = void 0 ;
40+ exports . defineVisualDiffConfig = defineVisualDiffConfig ;
41+ exports . defaultTestFunction = defaultTestFunction ;
4042var test_1 = require ( "@playwright/test" ) ;
4143var util_1 = require ( "../util" ) ;
4244function defineVisualDiffConfig ( cases ) {
4345 return new VisualDiffTestCases ( cases ) ;
4446}
45- exports . defineVisualDiffConfig = defineVisualDiffConfig ;
4647function defaultTestFunction ( testCase , group ) {
4748 var _this = this ;
4849 // @ts -ignore
49- return function ( _a , testInfo ) {
50- var page = _a . page , context = _a . context ;
51- return __awaiter ( _this , void 0 , void 0 , function ( ) {
52- var representativeUrl , path ;
53- return __generator ( this , function ( _b ) {
54- switch ( _b . label ) {
55- case 0 :
56- // Log any errors to the Playwright console too.
57- context . on ( 'weberror' , function ( webError ) { return console . log ( webError . error ( ) ) ; } ) ;
50+ return function ( _a , testInfo_1 ) { return __awaiter ( _this , [ _a , testInfo_1 ] , void 0 , function ( _b , testInfo ) {
51+ var representativeUrl , path ;
52+ var page = _b . page , context = _b . context ;
53+ return __generator ( this , function ( _c ) {
54+ switch ( _c . label ) {
55+ case 0 :
56+ // Log any errors to the Playwright console too.
57+ context . on ( 'weberror' , function ( webError ) { return console . log ( webError . error ( ) ) ; } ) ;
58+ testInfo . annotations . push ( {
59+ type : 'Description' ,
60+ description : testCase . description ,
61+ } ) ;
62+ representativeUrl = "" ;
63+ if ( testCase . representativeUrl ) {
64+ representativeUrl = testCase . representativeUrl ;
65+ }
66+ else if ( group . representativeUrl ) {
67+ representativeUrl = group . representativeUrl ;
68+ }
69+ if ( representativeUrl ) {
5870 testInfo . annotations . push ( {
59- type : 'Description ' ,
60- description : testCase . description ,
71+ type : 'Representative URL ' ,
72+ description : representativeUrl ,
6173 } ) ;
62- representativeUrl = "" ;
63- if ( testCase . representativeUrl ) {
64- representativeUrl = testCase . representativeUrl ;
65- }
66- else if ( group . representativeUrl ) {
67- representativeUrl = group . representativeUrl ;
68- }
69- if ( representativeUrl ) {
70- testInfo . annotations . push ( {
71- type : 'Representative URL' ,
72- description : representativeUrl ,
73- } ) ;
74- }
75- path = testCase . path ;
76- if ( group . pathPrefix ) {
77- path = group . pathPrefix + path ;
78- }
79- return [ 4 /*yield*/ , page . goto ( path ) ] ;
80- case 1 :
81- _b . sent ( ) ;
82- return [ 4 /*yield*/ , ( 0 , util_1 . takeAccessibleScreenshot ) ( page , testInfo , { fullPage : true } ) ] ;
83- case 2 :
84- _b . sent ( ) ;
85- return [ 2 /*return*/ ] ;
86- }
87- } ) ;
74+ }
75+ path = testCase . path ;
76+ if ( group . pathPrefix ) {
77+ path = group . pathPrefix + path ;
78+ }
79+ return [ 4 /*yield*/ , page . goto ( path ) ] ;
80+ case 1 :
81+ _c . sent ( ) ;
82+ return [ 4 /*yield*/ , ( 0 , util_1 . takeAccessibleScreenshot ) ( page , testInfo , { fullPage : true } ) ] ;
83+ case 2 :
84+ _c . sent ( ) ;
85+ return [ 2 /*return*/ ] ;
86+ }
8887 } ) ;
89- } ;
88+ } ) ; } ;
9089}
91- exports . defaultTestFunction = defaultTestFunction ;
9290/**
9391 * Execute a set of visual diffs against groups of test cases.
9492 */
@@ -112,14 +110,12 @@ var VisualDiffTestCases = /** @class */ (function () {
112110 var _this = this ;
113111 if ( typeof testCase . skip !== 'undefined' && ( typeof testCase . skip . callback == 'undefined' || testCase . skip . callback ( testCase ) ) ) {
114112 // eslint-disable-ext-line @typescript-eslint/no-unused-vars
115- test_1 . test . skip ( "" . concat ( testCase . name , ": " ) . concat ( testCase . skip . reason , " <" ) . concat ( testCase . skip . willBeFixedIn , ">" ) , function ( _a , testInfo ) {
116- var page = _a . page ;
117- return __awaiter ( _this , void 0 , void 0 , function ( ) {
118- return __generator ( this , function ( _b ) {
119- return [ 2 /*return*/ ] ;
120- } ) ;
113+ test_1 . test . skip ( "" . concat ( testCase . name , ": " ) . concat ( testCase . skip . reason , " <" ) . concat ( testCase . skip . willBeFixedIn , ">" ) , function ( _a , testInfo_1 ) { return __awaiter ( _this , [ _a , testInfo_1 ] , void 0 , function ( _b , testInfo ) {
114+ var page = _b . page ;
115+ return __generator ( this , function ( _c ) {
116+ return [ 2 /*return*/ ] ;
121117 } ) ;
122- } ) ;
118+ } ) ; } ) ;
123119 }
124120 }
125121 this . config . groups . forEach ( function ( group ) {
0 commit comments