@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
} ) ;
10
10
} ;
11
11
var __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 ;
14
14
function verb ( n ) { return function ( v ) { return step ( [ n , v ] ) ; } ; }
15
15
function step ( op ) {
16
16
if ( f ) throw new TypeError ( "Generator is already executing." ) ;
@@ -36,59 +36,57 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
}
37
37
} ;
38
38
Object . 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 ;
40
42
var test_1 = require ( "@playwright/test" ) ;
41
43
var util_1 = require ( "../util" ) ;
42
44
function defineVisualDiffConfig ( cases ) {
43
45
return new VisualDiffTestCases ( cases ) ;
44
46
}
45
- exports . defineVisualDiffConfig = defineVisualDiffConfig ;
46
47
function defaultTestFunction ( testCase , group ) {
47
48
var _this = this ;
48
49
// @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 ) {
58
70
testInfo . annotations . push ( {
59
- type : 'Description ' ,
60
- description : testCase . description ,
71
+ type : 'Representative URL ' ,
72
+ description : representativeUrl ,
61
73
} ) ;
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
+ }
88
87
} ) ;
89
- } ;
88
+ } ) ; } ;
90
89
}
91
- exports . defaultTestFunction = defaultTestFunction ;
92
90
/**
93
91
* Execute a set of visual diffs against groups of test cases.
94
92
*/
@@ -112,14 +110,12 @@ var VisualDiffTestCases = /** @class */ (function () {
112
110
var _this = this ;
113
111
if ( typeof testCase . skip !== 'undefined' && ( typeof testCase . skip . callback == 'undefined' || testCase . skip . callback ( testCase ) ) ) {
114
112
// 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*/ ] ;
121
117
} ) ;
122
- } ) ;
118
+ } ) ; } ) ;
123
119
}
124
120
}
125
121
this . config . groups . forEach ( function ( group ) {
0 commit comments