@@ -86,7 +86,7 @@ async function uploadFile(trafficlightUrl: string, uuid: string, filename: strin
86
86
return promise ;
87
87
}
88
88
89
- async function runCypress ( trafficlightUrl : string , uuid : string ) : Promise < boolean > {
89
+ async function runCypress ( trafficlightUrl : string , uuid : string , openMode : boolean ) : Promise < boolean > {
90
90
const cypressOptions = {
91
91
headed : true ,
92
92
// @ts -ignore-next-line
@@ -101,7 +101,7 @@ async function runCypress(trafficlightUrl: string, uuid: string): Promise<boolea
101
101
} ,
102
102
config : {
103
103
retries : { // Override cypress.json - we want to run exactly once.
104
- 'openMode' : 0 ,
104
+ 'openMode' : openMode ? 1 : 0 ,
105
105
'runMode' : 0 ,
106
106
} ,
107
107
e2e : {
@@ -132,17 +132,25 @@ async function runCypress(trafficlightUrl: string, uuid: string): Promise<boolea
132
132
}
133
133
}
134
134
135
- async function runRepeatedly ( trafficlightUrl : string ) {
135
+ async function runRepeatedly ( trafficlightUrl : string , openMode : boolean ) {
136
136
// need to find an exit condition here
137
137
let shouldContinue = true ;
138
138
while ( shouldContinue ) {
139
139
const uuid = crypto . randomUUID ( ) ;
140
140
await registerClient ( trafficlightUrl , uuid ) ;
141
- shouldContinue = await runCypress ( trafficlightUrl , uuid ) ;
141
+ shouldContinue = await runCypress ( trafficlightUrl , uuid , openMode ) ;
142
142
}
143
143
}
144
144
145
145
const trafficlightUrl = process . env . TRAFFICLIGHT_URL || 'http://127.0.0.1:5000' ;
146
- runRepeatedly ( trafficlightUrl ) . then ( ( result ) => {
146
+
147
+ let openMode = false ;
148
+ for ( let i = 0 ; i < process . argv . length ; i ++ ) {
149
+ if ( process . argv [ i ] == "open" ) {
150
+ openMode = true ;
151
+ }
152
+ }
153
+
154
+ runRepeatedly ( trafficlightUrl , openMode ) . then ( ( result ) => {
147
155
console . log ( `Finished looping forever(?), got ${ result } ` ) ;
148
156
} ) ;
0 commit comments