@@ -91,6 +91,15 @@ export default class RunProject {
9191 this . exitHandler ( ) ;
9292 }
9393
94+ public onReady ( ) : void {
95+ if ( this . config && this . config . run_settings . realTimeLogs ) {
96+ const realTime = io . connect ( 'https://hub.testingbot.com:3031' ) ;
97+ realTime . emit ( 'join' , `cypress_${ this . projectId } ` ) ;
98+ realTime . on ( 'cypress_data' , this . realTimeMessage . bind ( this ) ) ;
99+ realTime . on ( 'cypress_error' , this . realTimeError . bind ( this ) ) ;
100+ }
101+ }
102+
94103 private registerCloseHandlers ( ) : void {
95104 //do something when app is closing
96105 process . on ( 'exit' , this . exitHandler . bind ( this , { cleanup : true } ) ) ;
@@ -161,7 +170,7 @@ export default class RunProject {
161170
162171 this . archiver = new Archiver ( config ) ;
163172 this . uploader = new Uploader ( config ) ;
164- this . poller = new Poller ( config ) ;
173+ this . poller = new Poller ( config , this ) ;
165174 this . tunnel = new Tunnel ( config ) ;
166175
167176 let zipFile : string ;
@@ -192,13 +201,6 @@ export default class RunProject {
192201 this . projectId = response . id ;
193202 uploadSpinner . succeed ( 'Cypress Project is now running on TestingBot' ) ;
194203
195- if ( config . run_settings . realTimeLogs ) {
196- const realTime = io . connect ( 'https://hub.testingbot.com:3031' ) ;
197- realTime . emit ( 'join' , `cypress_${ response . id } ` ) ;
198- realTime . on ( 'cypress_data' , this . realTimeMessage . bind ( this ) ) ;
199- realTime . on ( 'cypress_error' , this . realTimeError . bind ( this ) ) ;
200- }
201-
202204 const poller = await this . poller . check ( response . id , uploadSpinner ) ;
203205 const testCases = this . parseTestCases ( poller . runs ) ;
204206 const success = this . parseSuccess ( poller . runs ) ;
0 commit comments