@@ -125,7 +125,8 @@ describe('Studio Cloud', () => {
125
125
cy . percySnapshot ( )
126
126
} )
127
127
128
- it ( 'opens a cloud studio session with AI enabled' , ( ) => {
128
+ // TODO: un-skip this test when we enable Studio AI
129
+ it . skip ( 'opens a cloud studio session with AI enabled' , ( ) => {
129
130
cy . mockNodeCloudRequest ( {
130
131
url : '/studio/testgen/n69px6/enabled' ,
131
132
method : 'get' ,
@@ -206,6 +207,84 @@ describe('Studio Cloud', () => {
206
207
cy . get ( '[data-cy="recommendation-editor"]' ) . should ( 'contain' , aiOutput )
207
208
} )
208
209
210
+ it ( 'opens a cloud studio session with AI marked as coming soon' , ( ) => {
211
+ cy . mockNodeCloudRequest ( {
212
+ url : '/studio/testgen/n69px6/enabled' ,
213
+ method : 'get' ,
214
+ body : { enabled : true } ,
215
+ } )
216
+
217
+ // this endpoint gets called twice, so we need to mock it twice
218
+ cy . mockNodeCloudRequest ( {
219
+ url : '/studio/testgen/n69px6/enabled' ,
220
+ method : 'get' ,
221
+ body : { enabled : true } ,
222
+ } )
223
+
224
+ const aiOutput = 'cy.get(\'button\').should(\'have.text\', \'Increment\')'
225
+
226
+ cy . mockNodeCloudStreamingRequest ( {
227
+ url : '/studio/testgen/n69px6/generate' ,
228
+ method : 'post' ,
229
+ body : { recommendations : [ { content : aiOutput } ] } ,
230
+ } )
231
+
232
+ cy . mockStudioFullSnapshot ( {
233
+ fullSnapshot : {
234
+ id : 1 ,
235
+ nodeType : 1 ,
236
+ nodeName : 'div' ,
237
+ localName : 'div' ,
238
+ nodeValue : 'div' ,
239
+ children : [ ] ,
240
+ shadowRoots : [ ] ,
241
+ } ,
242
+ url : 'http://localhost:3000/cypress/e2e/index.html' ,
243
+ } )
244
+
245
+ const deferred = pDefer ( )
246
+
247
+ loadProjectAndRunSpec ( { enableCloudStudio : true } )
248
+
249
+ cy . findByTestId ( 'studio-panel' ) . should ( 'not.exist' )
250
+
251
+ cy . intercept ( '/cypress/e2e/index.html' , ( ) => {
252
+ // wait for the promise to resolve before responding
253
+ // this will ensure the studio panel is loaded before the test finishes
254
+ return deferred . promise
255
+ } ) . as ( 'indexHtml' )
256
+
257
+ cy . contains ( 'visits a basic html page' )
258
+ . closest ( '.runnable-wrapper' )
259
+ . findByTestId ( 'launch-studio' )
260
+ . click ( )
261
+
262
+ // regular studio is not loaded until after the test finishes
263
+ cy . get ( '[data-cy="hook-name-studio commands"]' ) . should ( 'not.exist' )
264
+ // cloud studio is loaded immediately
265
+ cy . findByTestId ( 'studio-panel' ) . then ( ( ) => {
266
+ // check for the loading panel from the app first
267
+ cy . get ( '[data-cy="loading-studio-panel"]' ) . should ( 'be.visible' )
268
+ // we've verified the studio panel is loaded, now resolve the promise so the test can finish
269
+ deferred . resolve ( )
270
+ } )
271
+
272
+ cy . wait ( '@indexHtml' )
273
+
274
+ // Studio re-executes spec before waiting for commands - wait for the spec to finish executing.
275
+ cy . waitForSpecToFinish ( )
276
+
277
+ // Verify the studio panel is still open
278
+ cy . findByTestId ( 'studio-panel' )
279
+ cy . get ( '[data-cy="hook-name-studio commands"]' )
280
+
281
+ // make sure studio is not loading
282
+ cy . get ( '[data-cy="loading-studio-panel"]' ) . should ( 'not.exist' )
283
+
284
+ // Verify that AI is coming soon
285
+ cy . get ( '[data-cy="ai-status-text"]' ) . should ( 'contain.text' , 'Coming soon' )
286
+ } )
287
+
209
288
it ( 'does not exit studio mode if the spec is changed on the file system' , ( ) => {
210
289
launchStudio ( { enableCloudStudio : true } )
211
290
0 commit comments