44import { expect } from "@playwright/test" ;
55
66// Local imports
7- import { beforeAllTimeout , loadData , navigateToApp } from "@tests/utils.js" ;
7+ import {
8+ afterActionWait ,
9+ beforeAllTimeout ,
10+ loadData ,
11+ navigateToApp ,
12+ viewerContextMenu ,
13+ } from "@tests/utils.js" ;
814import { test } from "@tests/fixtures.js" ;
915
1016// Constants
1117const inputFilename = "test.og_brep" ;
12- const waitAfterActionRender = 1000 ;
1318let window = undefined ;
1419let cleanup = undefined ;
1520
@@ -27,15 +32,9 @@ test("load", async () => {
2732} ) ;
2833
2934test ( "viewer context menu" , async ( ) => {
30- console . log ( "Right click on the BRep from viewer" ) ;
31- await window . locator ( "canvas" ) . click ( {
32- button : "right" ,
33- position : {
34- x : 583 ,
35- y : 321 ,
36- } ,
37- } ) ;
38- await window . waitForTimeout ( waitAfterActionRender ) ;
35+ const x = 549 ,
36+ y = 360 ;
37+ await viewerContextMenu ( window , x , y ) ;
3938 await expect ( window ) . toHaveScreenshot ( ) ;
4039} ) ;
4140
@@ -47,7 +46,7 @@ test("points visibility", async () => {
4746 . getByTestId ( "modelPointsVisibilitySwitch" )
4847 . getByRole ( "checkbox" ) ;
4948 await modelPointsVisibilitySwitch . check ( ) ;
50- await window . waitForTimeout ( waitAfterActionRender ) ;
49+ await window . waitForTimeout ( afterActionWait ) ;
5150 await expect ( window ) . toHaveScreenshot ( ) ;
5251} ) ;
5352
@@ -63,7 +62,7 @@ test("object tree context menu", async () => {
6362 y : 10 ,
6463 } ,
6564 } ) ;
66- await window . waitForTimeout ( waitAfterActionRender ) ;
65+ await window . waitForTimeout ( afterActionWait ) ;
6766 await expect ( window ) . toHaveScreenshot ( ) ;
6867} ) ;
6968
@@ -76,7 +75,7 @@ test("edges visibility", async () => {
7675 . getByRole ( "checkbox" ) ;
7776 console . log ( "Toggle BRep edges visibility" , modelEdgesVisibilitySwitch ) ;
7877 await modelEdgesVisibilitySwitch . check ( ) ;
79- await window . waitForTimeout ( waitAfterActionRender ) ;
78+ await window . waitForTimeout ( afterActionWait ) ;
8079 await expect ( window ) . toHaveScreenshot ( ) ;
8180 await window . keyboard . press ( "Escape" ) ;
8281} ) ;
@@ -89,7 +88,7 @@ test("object tree model components", async () => {
8988 . filter ( { hasText : "test" } )
9089 . locator ( "button:has(.mdi-magnify-expand)" )
9190 . click ( ) ;
92- await window . waitForTimeout ( waitAfterActionRender ) ;
91+ await window . waitForTimeout ( afterActionWait ) ;
9392
9493 const modelComponentsObjectTree = window . getByTestId ( "modelComponentsObjectTree" ) ;
9594
@@ -98,14 +97,14 @@ test("object tree model components", async () => {
9897 . filter ( { hasText : "Blocks" } ) ;
9998
10099 await BlocksRow . locator ( ".mdi-eye" ) . first ( ) . click ( ) ;
101- await window . waitForTimeout ( waitAfterActionRender ) ;
100+ await window . waitForTimeout ( afterActionWait ) ;
102101
103102 const SurfacesRow = modelComponentsObjectTree
104103 . locator ( ".tree-row-wrapper" )
105104 . filter ( { hasText : "Surfaces" } ) ;
106105
107106 await SurfacesRow . locator ( ".mdi-menu-right" ) . first ( ) . click ( ) ;
108- await window . waitForTimeout ( waitAfterActionRender ) ;
107+ await window . waitForTimeout ( afterActionWait ) ;
109108
110109 const surfaceIds = [
111110 "00000000-8afd-4969-8000-000092a43747" ,
@@ -125,10 +124,10 @@ test("object tree model components", async () => {
125124 // oxlint-disable-next-line no-await-in-loop
126125 await surfaceRow . locator ( ".mdi-eye" ) . first ( ) . click ( { force : true } ) ;
127126 // oxlint-disable-next-line no-await-in-loop
128- await window . waitForTimeout ( waitAfterActionRender ) ;
127+ await window . waitForTimeout ( afterActionWait ) ;
129128 }
130129 const importButton = await window . getByRole ( "button" , { name : "Import" } ) ;
131130 await importButton . hover ( ) ;
132- await window . waitForTimeout ( waitAfterActionRender ) ;
131+ await window . waitForTimeout ( afterActionWait ) ;
133132 await expect ( window ) . toHaveScreenshot ( ) ;
134133} ) ;
0 commit comments