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

+13 -10
View File
@@ -1,11 +1,12 @@
import { test, expect } from 'playwright-test-coverage';
import { visitStudy } from './utils';
import { viewportSVGPathLocator } from './utils/locators';
import { expect, test, visitStudy } from './utils';
import { simulateNormalizedDragOnElement } from './utils/simulateDragOnElement';
const studyInstanceUID = '1.2.840.113619.2.290.3.3767434740.226.1600859119.501';
test('should not allow contours to be edited in basic viewer mode', async ({ page }) => {
test('should not allow contours to be edited in basic viewer mode', async ({
page,
viewportPageObject,
}) => {
const mode = 'viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
@@ -19,7 +20,7 @@ test('should not allow contours to be edited in basic viewer mode', async ({ pag
// Wait for the segmentation to hydrate.
await page.waitForTimeout(5000);
const svgPathLocatorPreEdit = viewportSVGPathLocator({ page, viewportId: 'default' });
const svgPathLocatorPreEdit = viewportPageObject.getById('default').svg();
expect(
await svgPathLocatorPreEdit.count(),
@@ -35,7 +36,7 @@ test('should not allow contours to be edited in basic viewer mode', async ({ pag
end: { x: 0.1, y: -0.2 },
});
const svgPathLocatorPostEdit = viewportSVGPathLocator({ page, viewportId: 'default' });
const svgPathLocatorPostEdit = viewportPageObject.getById('default').svg();
expect(
await svgPathLocatorPostEdit.getAttribute('d'),
@@ -45,6 +46,7 @@ test('should not allow contours to be edited in basic viewer mode', async ({ pag
test('should not allow contours to be edited when panelSegmentation.disableEditing is true', async ({
page,
viewportPageObject,
}) => {
const mode = 'segmentation';
await visitStudy(page, studyInstanceUID, mode, 2000);
@@ -69,7 +71,7 @@ test('should not allow contours to be edited when panelSegmentation.disableEditi
// Wait for the segmentation to hydrate.
await page.waitForTimeout(5000);
const svgPathLocatorPreEdit = viewportSVGPathLocator({ page, viewportId: 'default' });
const svgPathLocatorPreEdit = viewportPageObject.getById('default').svg();
expect(
await svgPathLocatorPreEdit.count(),
@@ -85,7 +87,7 @@ test('should not allow contours to be edited when panelSegmentation.disableEditi
end: { x: 0.1, y: -0.2 },
});
const svgPathLocatorPostEdit = viewportSVGPathLocator({ page, viewportId: 'default' });
const svgPathLocatorPostEdit = viewportPageObject.getById('default').svg();
expect(
await svgPathLocatorPostEdit.getAttribute('d'),
@@ -95,6 +97,7 @@ test('should not allow contours to be edited when panelSegmentation.disableEditi
test('should allow contours to be edited when panelSegmentation.disableEditing is false', async ({
page,
viewportPageObject,
}) => {
const mode = 'segmentation';
await visitStudy(page, studyInstanceUID, mode, 2000);
@@ -119,7 +122,7 @@ test('should allow contours to be edited when panelSegmentation.disableEditing i
// Wait for the segmentation to hydrate.
await page.waitForTimeout(5000);
const svgPathLocatorPreEdit = viewportSVGPathLocator({ page, viewportId: 'default' });
const svgPathLocatorPreEdit = viewportPageObject.getById('default').svg('path');
expect(
await svgPathLocatorPreEdit.count(),
@@ -135,7 +138,7 @@ test('should allow contours to be edited when panelSegmentation.disableEditing i
end: { x: 0.1, y: -0.2 },
});
const svgPathLocatorPostEdit = viewportSVGPathLocator({ page, viewportId: 'default' });
const svgPathLocatorPostEdit = viewportPageObject.getById('default').svg('path');
expect(
await svgPathLocatorPostEdit.getAttribute('d'),