@@ -267,6 +267,8 @@ profile001 = startProfile(sketch001, at = [12.34, -12.34])
267
267
async ( { page, homePage, scene, cmdBar, toolbar } ) => {
268
268
const u = await getUtils ( page )
269
269
const networkToggle = page . getByTestId ( 'network-toggle' )
270
+ const networkToggleConnectedText = page . getByText ( 'Connected' )
271
+ const networkToggleWeakText = page . getByText ( 'Network health (Weak)' )
270
272
const userSettingsTab = page . getByRole ( 'radio' , { name : 'User' } )
271
273
const appStreamIdleModeSetting = page . getByTestId ( 'app-streamIdleMode' )
272
274
const settingsCloseButton = page . getByTestId ( 'settings-close-button' )
@@ -275,44 +277,21 @@ profile001 = startProfile(sketch001, at = [12.34, -12.34])
275
277
localStorage . setItem (
276
278
'persistCode' ,
277
279
`sketch001 = startSketchOn(XY)
278
- profile001 = startProfile(sketch001, at = [44.41, 59.65])
279
- |> line(end = [205.52, 251.67])
280
- |> line(end = [184.62, -219.45])
281
- |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
280
+ profile001 = startProfile(sketch001, at = [0.0, 0.0])
281
+ |> line(end = [10.0, 0])
282
+ |> line(end = [0, 10.0])
282
283
|> close()`
283
284
)
284
285
} )
285
286
286
- const dim = { width : 1200 , height : 800 }
287
+ const dim = { width : 1200 , height : 500 }
287
288
await page . setBodyDimensions ( dim )
288
289
289
290
await test . step ( 'Go to modeling scene' , async ( ) => {
290
291
await homePage . goToModelingScene ( )
291
292
await scene . settled ( cmdBar )
292
293
} )
293
294
294
- // GRAB THE COORDINATES OF A POINT ON A LINE.
295
- // Use the right side of the square (not covered by panes)
296
- // Trigger highlight by hovering over the space
297
- await circleMove ( page , dim . width / 2 , dim . height / 2 , 20 , 10 )
298
-
299
- // Double click to edit sketch.
300
- await page . mouse . dblclick ( dim . width / 2 , dim . height / 2 , { delay : 100 } )
301
- await toolbar . waitUntilSketchingReady ( )
302
-
303
- // We need to be in sketch mode to access this data.
304
- const line = await u . getBoundingBox ( '[data-overlay-index="0"]' )
305
- const angle = await u . getAngle ( '[data-overlay-index="0"]' )
306
- const midPoint = {
307
- x : line . x + ( Math . sin ( ( angle / 360 ) * Math . PI * 2 ) * line . width ) / 2 ,
308
- // Different coordinate space, need to -1 to fix it up
309
- y :
310
- ( line . y +
311
- ( Math . cos ( ( angle / 360 ) * Math . PI * 2 ) * line . height ) / 2 ) *
312
- - 1 ,
313
- }
314
- await page . getByRole ( 'button' , { name : 'Exit Sketch' } ) . click ( )
315
-
316
295
await test . step ( 'Set stream idle pause time to 5s' , async ( ) => {
317
296
await page . getByRole ( 'link' , { name : 'Settings' } ) . last ( ) . click ( )
318
297
await expect (
@@ -333,25 +312,39 @@ profile001 = startProfile(sketch001, at = [44.41, 59.65])
333
312
334
313
// We should now be paused. To the user, it should appear we're still
335
314
// connected.
336
- await expect ( networkToggle ) . toContainText ( 'Connected' )
315
+ await networkToggle . hover ( )
316
+ await expect ( networkToggleConnectedText . or ( networkToggleWeakText ) ) . toBeVisible ( )
317
+
318
+ const center = {
319
+ x : dim . width / 2 ,
320
+ y : dim . height / 2 ,
321
+ }
322
+
323
+ let probe = { x : 0 , y : 0 }
337
324
338
325
// ... and the model's still visibly there
339
- console . log ( midPoint )
340
- await scene . expectPixelColor ( TEST_COLORS . OFFWHITE , midPoint , 15 )
326
+ probe . x = center . x + ( dim . width / 100 )
327
+ probe . y = center . y
328
+ await scene . expectPixelColor ( TEST_COLORS . GREY , probe , 15 )
329
+ probe = { ...center }
341
330
342
331
// Now move the mouse around to unpause!
343
- await circleMove ( page , dim . width / 2 , dim . height / 2 , 20 , 10 )
332
+ await circleMove ( page , probe . x , probe . y , 20 , 10 )
344
333
345
334
// ONCE AGAIN! Check the view area hasn't changed at all.
346
335
// Check the pixel a couple times as it reconnects.
347
336
// NOTE: Remember, idle behavior is still on at this point -
348
337
// if this test takes longer than 5s shit WILL go south!
349
- await scene . expectPixelColor ( TEST_COLORS . OFFWHITE , midPoint , 15 )
338
+ probe . x = center . x + ( dim . width / 100 )
339
+ probe . y = center . y
340
+ await scene . expectPixelColor ( TEST_COLORS . GREY , probe , 15 )
350
341
await page . waitForTimeout ( 1000 )
351
- await scene . expectPixelColor ( TEST_COLORS . OFFWHITE , midPoint , 15 )
342
+ await scene . expectPixelColor ( TEST_COLORS . GREY , probe , 15 )
343
+ probe = { ...center }
352
344
353
345
// Ensure we're still connected
354
- await expect ( networkToggle ) . toContainText ( 'Connected' )
346
+ await networkToggle . hover ( )
347
+ await expect ( networkToggleConnectedText . or ( networkToggleWeakText ) ) . toBeVisible ( )
355
348
} )
356
349
}
357
350
)
0 commit comments