@@ -13,37 +13,32 @@ const commandsToOverride = [
13
13
const commandsToWrap = [ 'visit' , 'click' , 'type' , 'request' , 'dblclick' , 'rightclick' , 'clear' , 'check' , 'uncheck' , 'select' , 'trigger' , 'selectFile' , 'scrollIntoView' , 'scroll' , 'scrollTo' , 'blur' , 'focus' , 'go' , 'reload' , 'submit' , 'viewport' , 'origin' ] ;
14
14
15
15
const performNewLambdaScan = ( originalFn , Subject , stateType , ...args ) => {
16
- let cycustomChaining = cy . wrap ( null ) . processAccessibilityReport ( ) ;
17
- const updateSubj = ( args , stateType , newSubject ) =>
18
- stateType === 'parent' ? args : [ newSubject , ...args . slice ( 1 ) ] ;
19
-
20
- const runCustomizedChainingCommand = ( ) => {
16
+ let customChaining = cy . wrap ( null ) . processAccessibilityReport ( ) ;
17
+ const changeSub = ( args , stateType , newSubject ) => {
18
+ if ( stateType !== 'parent' ) {
19
+ return [ newSubject , ...args . slice ( 1 ) ] ;
20
+ }
21
+ return args ;
22
+ }
23
+ const runCustomizedCommand = ( ) => {
21
24
if ( ! Subject ) {
22
- let cypressCommandSubject = null ;
23
- const subjectFn = cy && cy . subject ;
24
- if ( subjectFn !== null && subjectFn !== void 0 ) {
25
- cypressCommandSubject = subjectFn . call ( cy ) ;
25
+ let orgS1 , orgS2 , cypressCommandSubject = null ;
26
+ if ( ( orgS2 = ( orgS1 = cy ) . subject ) !== null && orgS2 !== void 0 ) {
27
+ cypressCommandSubject = orgS2 . call ( orgS1 ) ;
26
28
}
27
- cycustomChaining
28
- . then ( ( ) => cypressCommandSubject )
29
- . then ( ( ) => {
30
- originalFn ( ...args ) ;
31
- } ) ;
29
+ customChaining . then ( ( ) => cypressCommandSubject ) . then ( ( ) => { originalFn ( ...args ) } ) ;
32
30
} else {
33
- let cypressCommandChain = null , setTimeout = null ;
34
- // Extract timeout value if present
35
- const timeoutArg = args . find ( arg => arg !== null && arg !== void 0 ? arg . timeout : null ) ;
36
- if ( timeoutArg !== null && timeoutArg !== void 0 ) {
37
- setTimeout = timeoutArg . timeout ;
31
+ let orgSC1 , orgSC2 , timeO1 , cypressCommandChain = null , setTimeout = null ;
32
+ if ( ( timeO1 = args . find ( arg => arg !== null && arg !== void 0 ? arg . timeout : null ) ) !== null && timeO1 !== void 0 ) {
33
+ setTimeout = timeO1 . timeout ;
38
34
}
39
- const subjectChainFn = cy && cy . subjectChain ;
40
- if ( subjectChainFn !== null && subjectChainFn !== void 0 ) {
41
- cypressCommandChain = subjectChainFn . call ( cy ) ;
35
+ if ( ( orgSC1 = ( orgSC2 = cy ) . subjectChain ) !== null && orgSC1 !== void 0 ) {
36
+ cypressCommandChain = orgSC1 . call ( orgSC2 ) ;
42
37
}
43
- cycustomChaining . performScanSubjectQuery ( cypressCommandChain , setTimeout ) . then ( { timeout : 30000 } , ( newSubject ) => originalFn ( ...updateSubj ( args , stateType , newSubject ) ) ) ;
38
+ customChaining . performScanSubjectQuery ( cypressCommandChain , setTimeout ) . then ( { timeout : 30000 } , ( newSubject ) => originalFn ( ...changeSub ( args , stateType , newSubject ) ) ) ;
44
39
}
45
40
}
46
- runCustomizedChainingCommand ( ) ;
41
+ runCustomizedCommand ( ) ;
47
42
}
48
43
49
44
Cypress . Commands . add ( 'processAccessibilityReport' , ( ) => {
0 commit comments