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

+12 -22
View File
@@ -1,5 +1,4 @@
import { test } from 'playwright-test-coverage';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } from './utils';
import { checkForScreenshot, screenShotPaths, test, visitStudy } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '1.3.6.1.4.1.25403.345050719074.3824.20170125095438.5';
@@ -7,7 +6,11 @@ test.beforeEach(async ({ page }) => {
await visitStudy(page, studyInstanceUID, mode, 5000);
});
test('should hydrate in MPR correctly', async ({ page }) => {
test('should hydrate in MPR correctly', async ({
page,
mainToolbarPageObject,
viewportPageObject,
}) => {
await page.getByTestId('side-panel-header-right').click();
await page.getByTestId('trackedMeasurements-btn').click();
@@ -38,23 +41,11 @@ test('should hydrate in MPR correctly', async ({ page }) => {
await page.waitForTimeout(5000);
await page.getByTestId('MeasurementTools-split-button-secondary').click();
await page.getByTestId('Bidirectional').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 405,
y: 277,
},
{
x: 515,
y: 339,
},
],
});
await mainToolbarPageObject.measurementTools.bidirectional.click();
await viewportPageObject.active.clickAt([
{ x: 405, y: 277 },
{ x: 515, y: 339 },
]);
// wait 2 seconds
await page.waitForTimeout(2000);
@@ -93,8 +84,7 @@ test('should hydrate in MPR correctly', async ({ page }) => {
await checkForScreenshot(page, page, screenShotPaths.jumpToMeasurementMPR.jumpToMeasurementStack);
await page.getByTestId('Layout').click();
await page.locator('div').filter({ hasText: /^MPR$/ }).first().click();
await mainToolbarPageObject.layoutSelection.MPR.click();
// wait 5 seconds
await page.waitForTimeout(5000);