File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -205,4 +205,26 @@ describe('Studio Cloud', () => {
205
205
// Verify that the AI output is correct
206
206
cy . get ( '[data-cy="recommendation-editor"]' ) . should ( 'contain' , aiOutput )
207
207
} )
208
+
209
+ it ( 'does not exit studio mode if the spec is changed on the file system' , ( ) => {
210
+ launchStudio ( { enableCloudStudio : true } )
211
+
212
+ cy . findByTestId ( 'studio-panel' ) . should ( 'be.visible' )
213
+
214
+ // update the spec on the file system to force a rerun through watched:file:changed
215
+ cy . withCtx ( async ( ctx ) => {
216
+ await ctx . actions . file . writeFileInProject ( 'cypress/e2e/spec.cy.js' , `
217
+ describe('studio functionality', () => {
218
+ it('visits a basic html page', () => {
219
+ // new comment
220
+ cy.visit('cypress/e2e/index.html')
221
+ })
222
+ })` )
223
+ } )
224
+
225
+ cy . waitForSpecToFinish ( )
226
+
227
+ // verify studio is still open
228
+ cy . findByTestId ( 'studio-panel' ) . should ( 'be.visible' )
229
+ } )
208
230
} )
Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ interface AddGlobalListenerOptions {
43
43
const driverToLocalAndReporterEvents = 'run:start run:end' . split ( ' ' )
44
44
const driverToSocketEvents = 'backend:request automation:request mocha recorder:frame dev-server:on-spec-update' . split ( ' ' )
45
45
const driverToLocalEvents = 'viewport:changed config stop url:changed page:loading visit:failed visit:blank cypress:in:cypress:runner:event' . split ( ' ' )
46
- const socketRerunEvents = 'runner:restart watched:file:changed' . split ( ' ' )
47
46
const socketToDriverEvents = 'net:stubbing:event request:event script:error cross:origin:cookies dev-server:on-spec-updated' . split ( ' ' )
48
47
const localToReporterEvents = 'reporter:log:add reporter:log:state:changed reporter:log:remove' . split ( ' ' )
49
48
@@ -158,7 +157,11 @@ export class EventManager {
158
157
} )
159
158
160
159
this . ws . on ( 'watched:file:changed' , ( ) => {
161
- this . studioStore . cancel ( )
160
+ // only cancel studio if cloud studio was not requested
161
+ if ( ! Cypress . env ( 'LOCAL_STUDIO_PATH' ) && ! Cypress . env ( 'ENABLE_CLOUD_STUDIO' ) ) {
162
+ this . studioStore . cancel ( )
163
+ }
164
+
162
165
rerun ( )
163
166
} )
164
167
@@ -168,9 +171,7 @@ export class EventManager {
168
171
}
169
172
} )
170
173
171
- socketRerunEvents . forEach ( ( event ) => {
172
- this . ws . on ( event , rerun )
173
- } )
174
+ this . ws . on ( 'runner:restart' , rerun )
174
175
175
176
socketToDriverEvents . forEach ( ( event ) => {
176
177
this . ws . on ( event , ( ...args ) => {
You can’t perform that action at this time.
0 commit comments