1- import { checkForScreenshot , screenShotPaths , test , visitStudy } from './utils' ;
1+ import { checkForScreenshot , screenShotPaths , test , visitStudy , expect } from './utils' ;
2+ import { press } from './utils/keyboardUtils' ;
23
34test . beforeEach ( async ( { page } ) => {
45 const studyInstanceUID = '1.3.6.1.4.1.25403.345050719074.3824.20170125095438.5' ;
@@ -25,3 +26,70 @@ test('should display the livewire tool', async ({
2526 await DOMOverlayPageObject . viewport . measurementTracking . confirm . click ( ) ;
2627 await checkForScreenshot ( page , page , screenShotPaths . livewire . livewireDisplayedCorrectly ) ;
2728} ) ;
29+
30+ test ( 'should restore viewport interactivity after deleting an in-progress Livewire annotation via context menu' , async ( {
31+ DOMOverlayPageObject,
32+ mainToolbarPageObject,
33+ viewportPageObject,
34+ } ) => {
35+ await mainToolbarPageObject . measurementTools . livewireContour . click ( ) ;
36+ const activeViewport = await viewportPageObject . active ;
37+ await activeViewport . clickAt ( [
38+ { x : 380 , y : 299 } ,
39+ { x : 420 , y : 236 } ,
40+ { x : 523 , y : 232 } ,
41+ ] ) ;
42+
43+ await activeViewport . clickAt ( [ { x : 550 , y : 312 } ] , 'right' ) ;
44+
45+ const deleteButton = DOMOverlayPageObject . viewport . annotationContextMenu . delete ;
46+ await expect ( deleteButton . locator ) . toBeVisible ( ) ;
47+ await deleteButton . click ( ) ;
48+
49+ await expect ( activeViewport . nthAnnotation ( 0 ) . locator ) . toBeHidden ( ) ;
50+
51+ // Draw and complete a new Livewire annotation to verify interactivity is restored
52+ await activeViewport . clickAt ( [
53+ { x : 380 , y : 299 } ,
54+ { x : 420 , y : 236 } ,
55+ { x : 523 , y : 232 } ,
56+ { x : 581 , y : 287 } ,
57+ { x : 482 , y : 333 } ,
58+ { x : 383 , y : 301 } ,
59+ ] ) ;
60+ await DOMOverlayPageObject . viewport . measurementTracking . confirm . click ( ) ;
61+ await expect ( activeViewport . nthAnnotation ( 0 ) . locator ) . toBeVisible ( ) ;
62+ } ) ;
63+
64+ test ( 'should restore viewport interactivity after deleting an in-progress Livewire annotation via Backspace' , async ( {
65+ page,
66+ DOMOverlayPageObject,
67+ mainToolbarPageObject,
68+ viewportPageObject,
69+ } ) => {
70+ await mainToolbarPageObject . measurementTools . livewireContour . click ( ) ;
71+ const activeViewport = await viewportPageObject . active ;
72+ await activeViewport . clickAt ( [
73+ { x : 380 , y : 299 } ,
74+ { x : 420 , y : 236 } ,
75+ { x : 523 , y : 232 } ,
76+ ] ) ;
77+
78+ // Ensure the three points clicked above are rendered in the DOM before pressing Backspace
79+ await expect ( activeViewport . svg ( 'circle' ) ) . toHaveCount ( 3 ) ;
80+ await press ( { page, key : 'Backspace' } ) ;
81+
82+ await expect ( activeViewport . nthAnnotation ( 0 ) . locator ) . toBeHidden ( ) ;
83+
84+ // Draw and complete a new Livewire annotation to verify interactivity is restored
85+ await activeViewport . clickAt ( [
86+ { x : 380 , y : 299 } ,
87+ { x : 420 , y : 236 } ,
88+ { x : 523 , y : 232 } ,
89+ { x : 581 , y : 287 } ,
90+ { x : 482 , y : 333 } ,
91+ { x : 383 , y : 301 } ,
92+ ] ) ;
93+ await DOMOverlayPageObject . viewport . measurementTracking . confirm . click ( ) ;
94+ await expect ( activeViewport . nthAnnotation ( 0 ) . locator ) . toBeVisible ( ) ;
95+ } ) ;
0 commit comments