@@ -17,30 +17,12 @@ const performModifiedScan = (originalFn, Subject, stateType, ...args) => {
17
17
}
18
18
function runCutomizedCommand ( ) {
19
19
if ( ! Subject ) {
20
- let orgS1 , orgS2 , cypressCommandSubject ;
21
- if ( ( orgS2 = ( orgS1 = cy ) . subject ) !== null && orgS2 !== void 0 ) {
22
- cypressCommandSubject = orgS2 . call ( orgS1 ) ;
23
- }
24
- else {
25
- cypressCommandSubject = null ;
26
- }
27
- customChaining . then ( ( ) => cypressCommandSubject ) . then ( ( ) => { originalFn ( ...args ) } ) ;
28
- }
29
- else {
30
- let orgSC1 , orgSC2 , timeO1 , cypressCommandChain , setTimeout ;
31
- if ( ( timeO1 = args . find ( arg => arg !== null && arg !== void 0 ? arg . timeout : null ) ) !== null && timeO1 !== void 0 ) {
32
- setTimeout = timeO1 . timeout ;
33
- }
34
- else {
35
- setTimeout = null ;
36
- }
37
- if ( ( orgSC1 = ( orgSC2 = cy ) . subjectChain ) !== null && orgSC1 !== void 0 ) {
38
- cypressCommandChain = orgSC1 . call ( orgSC2 ) ;
39
- }
40
- else {
41
- cypressCommandChain = null ;
42
- }
43
- customChaining . performScanSubjectQuery ( cypressCommandChain , setTimeout ) . then ( { timeout : 30000 } , ( newSubject ) => originalFn ( ...changeSub ( args , stateType , newSubject ) ) ) ;
20
+ let cypressCommandSubject = ( cy . subject ?. call ( cy ) ) ?? null ;
21
+ customChaining . then ( ( ) => cypressCommandSubject ) . then ( ( ) => { originalFn ( ...args ) ; } ) ;
22
+ } else {
23
+ let setTimeout = args . find ( arg => arg ?. timeout ) ?. timeout ?? null ;
24
+ let cypressCommandChain = ( cy . subjectChain ?. call ( cy ) ) ?? null ;
25
+ customChaining . performScanSubjectQuery ( cypressCommandChain , setTimeout ) . then ( { timeout : 30000 } , newSubject => originalFn ( ...changeSub ( args , stateType , newSubject ) ) ) ;
44
26
}
45
27
}
46
28
runCutomizedCommand ( ) ;
0 commit comments