@@ -13,6 +13,7 @@ import {
1313 countCineRulerLines ,
1414 getCineCanvasCenter ,
1515 getCineFrame ,
16+ retreatCineFrame ,
1617 waitForFrame ,
1718} from './cineTestUtils' ;
1819
@@ -25,7 +26,7 @@ const placeRulerAtCanvasCenter = async () => {
2526} ;
2627
2728describe ( 'Cine ruler survives save/reload at its placed frame' , ( ) => {
28- it ( 'reloads with the ruler hidden on frame 1 and visible on the placed frame' , async ( ) => {
29+ it ( 'reloads at the persisted frame with the ruler visible and hides it on frame 1 ' , async ( ) => {
2930 await openUrls ( [ CINE_US_DATASET ] ) ;
3031 await $ ( '.play-controls' ) . waitForDisplayed ( ) ;
3132 await waitForFrame ( 1 ) ;
@@ -55,13 +56,14 @@ describe('Cine ruler survives save/reload at its placed frame', () => {
5556 await volViewPage . open ( `?urls=[tmp/${ sessionFileName } ]` ) ;
5657 await volViewPage . waitForViews ( ) ;
5758 await $ ( '.play-controls' ) . waitForDisplayed ( { timeout : 30000 } ) ;
58- await waitForFrame ( 1 ) ;
59+ // The cine frame is persisted, so reload restores the cursor to
60+ // placementFrame rather than frame 1.
61+ await waitForFrame ( placementFrame ) ;
5962
6063 // Wait for the deserialized ruler to surface in the Measurements list
61- // before asserting it's hidden on the canvas. Without this anchor a
62- // regression that loses `frame` (ruler tagged frame 1 instead) could
63- // race the assertion and pass for the wrong reason; the list entry
64- // proves deserialization has completed.
64+ // before asserting visibility on the canvas. The list entry proves
65+ // deserialization has completed, so the subsequent canvas checks
66+ // can't race the load.
6567 const annotationsTab = await $ (
6668 'button[data-testid="module-tab-Annotations"]'
6769 ) ;
@@ -77,18 +79,21 @@ describe('Cine ruler survives save/reload at its placed frame', () => {
7779 }
7880 ) ;
7981
80- // On reload the cursor lives at frame 1 (playback frame is not
81- // persisted). The ruler must be hidden here — if `frame` was lost
82- // during serialize/deserialize, it would render at frame 1 instead.
83- expect ( await countCineRulerLines ( ) ) . toBe ( 0 ) ;
82+ // The ruler must be visible at the persisted placement frame — if
83+ // `frame` was lost during serialize/deserialize, it would still
84+ // render here, so we also need to verify it hides elsewhere.
85+ await browser . waitUntil ( async ( ) => ( await countCineRulerLines ( ) ) >= 1 , {
86+ timeoutMsg : `Expected the ruler to be visible at the persisted placement frame (${ placementFrame } ) after reload` ,
87+ } ) ;
8488
85- // Scrub forward to the placement frame and the ruler should reappear.
89+ // Scrub back to frame 1 — the ruler must hide there. A regression
90+ // that dropped `frame` would leave it visible on every frame.
8691 await volViewPage . focusFirst2DView ( ) ;
87- while ( ( await getCineFrame ( ) ) ! < placementFrame ) {
88- await advanceCineFrame ( ) ;
92+ while ( ( await getCineFrame ( ) ) ! > 1 ) {
93+ await retreatCineFrame ( ) ;
8994 }
90- await browser . waitUntil ( async ( ) => ( await countCineRulerLines ( ) ) >= 1 , {
91- timeoutMsg : ` Expected the ruler to reappear at the placement frame ( ${ placementFrame } ) after reload` ,
95+ await browser . waitUntil ( async ( ) => ( await countCineRulerLines ( ) ) === 0 , {
96+ timeoutMsg : ' Expected the ruler to hide on frame 1 after reload' ,
9297 } ) ;
9398 } ) ;
9499} ) ;
0 commit comments