tests(Playwright): Introduction of Page Object Models (POMs) to Playwright tests (#5557)

This commit is contained in:
Vinícius Alves de Faria Resende authored and GitHub committed 2025-11-20 09:29:14 -05:00
1 parent 1c991037ee
commit bdad2264ed
59 files changed
+1040 -756

No files matched your search

+9 -16
View File
@@ -1,8 +1,5 @@
import { test } from 'playwright-test-coverage';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
import { checkForScreenshot, screenShotPaths, test, visitStudy } from './utils';
import { press } from './utils/keyboardUtils';
import { simulateNormalizedDragOnElement } from './utils/simulateDragOnElement';
import { viewportLocator } from './utils/locators';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.256467663913010332776401703474716742458';
@@ -12,6 +9,7 @@ test.beforeEach(async ({ page }) => {
test('should prevent editing of label map segmentations when panelSegmentation.disableEditing is true', async ({
page,
viewportPageObject,
}) => {
// disable editing of segmentations via the customization service
await page.evaluate(() => {
@@ -45,18 +43,15 @@ test('should prevent editing of label map segmentations when panelSegmentation.d
await page.locator(`css=div[data-cy="eraser-radius"] input`).fill('1000');
// Attempt to erase the segmentations by dragging the eraser tool across the image several times.
await simulateNormalizedDragOnElement({
locator: viewportLocator({ page, viewportId: 'default' }),
await viewportPageObject.getById('default').normalizedDragAt({
start: { x: 0.01, y: 0.25 },
end: { x: 1.0, y: 0.25 },
});
await simulateNormalizedDragOnElement({
locator: viewportLocator({ page, viewportId: 'default' }),
await viewportPageObject.getById('default').normalizedDragAt({
start: { x: 0.01, y: 0.5 },
end: { x: 1.0, y: 0.5 },
});
await simulateNormalizedDragOnElement({
locator: viewportLocator({ page, viewportId: 'default' }),
await viewportPageObject.getById('default').normalizedDragAt({
start: { x: 0.01, y: 0.75 },
end: { x: 1.0, y: 0.75 },
});
@@ -66,6 +61,7 @@ test('should prevent editing of label map segmentations when panelSegmentation.d
test('should allow editing of label map segmentations when panelSegmentation.disableEditing is false', async ({
page,
viewportPageObject,
}) => {
// disable editing of segmentations via the customization service
await page.evaluate(() => {
@@ -99,18 +95,15 @@ test('should allow editing of label map segmentations when panelSegmentation.dis
await page.locator(`css=div[data-cy="eraser-radius"] input`).fill('1000');
// Attempt to erase the segmentations by dragging the eraser tool across the image several times.
await simulateNormalizedDragOnElement({
locator: viewportLocator({ page, viewportId: 'default' }),
await viewportPageObject.getById('default').normalizedDragAt({
start: { x: 0.01, y: 0.25 },
end: { x: 1.0, y: 0.25 },
});
await simulateNormalizedDragOnElement({
locator: viewportLocator({ page, viewportId: 'default' }),
await viewportPageObject.getById('default').normalizedDragAt({
start: { x: 0.01, y: 0.5 },
end: { x: 1.0, y: 0.5 },
});
await simulateNormalizedDragOnElement({
locator: viewportLocator({ page, viewportId: 'default' }),
await viewportPageObject.getById('default').normalizedDragAt({
start: { x: 0.01, y: 0.75 },
end: { x: 1.0, y: 0.75 },
});