@@ -13,37 +13,32 @@ const commandsToOverride = [
1313const commandsToWrap = [ 'visit' , 'click' , 'type' , 'request' , 'dblclick' , 'rightclick' , 'clear' , 'check' , 'uncheck' , 'select' , 'trigger' , 'selectFile' , 'scrollIntoView' , 'scroll' , 'scrollTo' , 'blur' , 'focus' , 'go' , 'reload' , 'submit' , 'viewport' , 'origin' ] ;
1414
1515const 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 = ( ) => {
2124 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 ) ;
2628 }
27- cycustomChaining
28- . then ( ( ) => cypressCommandSubject )
29- . then ( ( ) => {
30- originalFn ( ...args ) ;
31- } ) ;
29+ customChaining . then ( ( ) => cypressCommandSubject ) . then ( ( ) => { originalFn ( ...args ) } ) ;
3230 } 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 ;
3834 }
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 ) ;
4237 }
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 ) ) ) ;
4439 }
4540 }
46- runCustomizedChainingCommand ( ) ;
41+ runCustomizedCommand ( ) ;
4742}
4843
4944Cypress . Commands . add ( 'processAccessibilityReport' , ( ) => {
0 commit comments