refactor(tests): update viewport page object usage to async and update all effected tests (#5927)

This commit is contained in:
Ghadeer Albattarni authored and GitHub committed 2026-03-27 16:37:42 -04:00
1 parent 485f0d75d9
commit 2a728b244c
46 files changed
+240 -181

No files matched your search

+13 -8
View File
@@ -20,11 +20,12 @@ async function performDrawingToolInteraction(
rightPanelPageObject: RightPanelPageObject,
viewportPageObject: ViewportPageObject
) {
const activeViewport = await viewportPageObject.active;
const brushRadiusInput = rightPanelPageObject.labelMapSegmentationPanel.tools[toolName].input;
const circle = viewportPageObject.active.svg('circle').first();
const circle = activeViewport.svg('circle').first();
await expect(brushRadiusInput).toHaveValue('25');
await viewportPageObject.active.clickAt([{ x: 275, y: 300 }]);
await activeViewport.clickAt([{ x: 275, y: 300 }]);
let radius = parseFloat(await circle.getAttribute('r'));
expect(radius).toBeGreaterThanOrEqual(65);
expect(radius).toBeLessThanOrEqual(68);
@@ -32,7 +33,7 @@ async function performDrawingToolInteraction(
await page.waitForTimeout(500);
await press({ page, key: '[', nTimes: 2 });
await expect(brushRadiusInput).toHaveValue('19');
await viewportPageObject.active.clickAt([{ x: 500, y: 300 }]);
await activeViewport.clickAt([{ x: 500, y: 300 }]);
radius = parseFloat(await circle.getAttribute('r'));
expect(radius).toBeGreaterThanOrEqual(49);
expect(radius).toBeLessThanOrEqual(52);
@@ -41,7 +42,7 @@ async function performDrawingToolInteraction(
await press({ page, key: ']', nTimes: 5 });
await expect(brushRadiusInput).toHaveValue('34');
await viewportPageObject.active.clickAt([{ x: 275, y: 500 }]);
await activeViewport.clickAt([{ x: 275, y: 500 }]);
radius = parseFloat(await circle.getAttribute('r'));
expect(radius).toBeGreaterThanOrEqual(87);
expect(radius).toBeLessThanOrEqual(90);
@@ -49,7 +50,7 @@ async function performDrawingToolInteraction(
await page.waitForTimeout(500);
await brushRadiusInput.fill('42');
await viewportPageObject.active.clickAt([{ x: 500, y: 500 }]);
await activeViewport.clickAt([{ x: 500, y: 500 }]);
radius = parseFloat(await circle.getAttribute('r'));
expect(radius).toBeGreaterThanOrEqual(108);
expect(radius).toBeLessThanOrEqual(111);
@@ -62,13 +63,15 @@ test('should resize segmentation brush tool', async ({
rightPanelPageObject,
viewportPageObject,
}) => {
const activeViewport = await viewportPageObject.active;
await page.getByTestId('Brush-btn').click();
await performDrawingToolInteraction(page, 'brush', rightPanelPageObject, viewportPageObject);
await checkForScreenshot(
page,
viewportPageObject.active.pane,
activeViewport.pane,
screenShotPaths.segDrawingToolsResizing.brushTool
);
});
@@ -78,10 +81,12 @@ test('should resize segmentation eraser tool', async ({
rightPanelPageObject,
viewportPageObject,
}) => {
const activeViewport = await viewportPageObject.active;
await page.getByTestId('Brush-btn').click();
await page.getByTestId('brush-radius').locator('input').fill('99.5');
await viewportPageObject.active.clickAt([{ x: 400, y: 400 }]);
await activeViewport.clickAt([{ x: 400, y: 400 }]);
await page.waitForTimeout(500);
@@ -94,7 +99,7 @@ test('should resize segmentation eraser tool', async ({
await checkForScreenshot(
page,
viewportPageObject.active.pane,
activeViewport.pane,
screenShotPaths.segDrawingToolsResizing.eraserTool
);
});