test(improve-setup): sharding configuration, allow accessing cornerstone methods and events in tests, and add types (#4255)

This commit is contained in:
Ibrahim authored and GitHub committed 2024-06-25 10:16:51 -04:00
1 parent 2bcdb52db9
commit c9cc372581
21 files changed
+113 -26

No files matched your search

+3 -2
View File
@@ -1,8 +1,8 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
import { visitStudy, checkForScreenshot, screenShotPaths, reduce3DViewportSize } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '2.16.840.1.114362.1.11972228.22789312658.616067305.306.2';
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.1706.8374.643249677828306008300337414785';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
@@ -15,6 +15,7 @@ test.describe('3D four up Test', async () => {
.filter({ hasText: /^3D four up$/ })
.first()
.click();
await reduce3DViewportSize(page);
await checkForScreenshot(
page,
page,
+3 -2
View File
@@ -1,8 +1,8 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
import { visitStudy, checkForScreenshot, screenShotPaths, reduce3DViewportSize } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '2.16.840.1.114362.1.11972228.22789312658.616067305.306.2';
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.1706.8374.643249677828306008300337414785';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
@@ -15,6 +15,7 @@ test.describe('3D main Test', async () => {
.filter({ hasText: /^3D main$/ })
.first()
.click();
await reduce3DViewportSize(page);
await checkForScreenshot(
page,
page,
+3 -2
View File
@@ -1,8 +1,8 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
import { visitStudy, checkForScreenshot, screenShotPaths, reduce3DViewportSize } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '2.16.840.1.114362.1.11972228.22789312658.616067305.306.2';
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.1706.8374.643249677828306008300337414785';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
@@ -15,6 +15,7 @@ test.describe('3D only Test', async () => {
.filter({ hasText: /^3D only$/ })
.first()
.click();
await reduce3DViewportSize(page);
await checkForScreenshot(
page,
page,
+3 -2
View File
@@ -1,8 +1,8 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
import { visitStudy, checkForScreenshot, screenShotPaths, reduce3DViewportSize } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '2.16.840.1.114362.1.11972228.22789312658.616067305.306.2';
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.1706.8374.643249677828306008300337414785';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
@@ -16,6 +16,7 @@ test.describe('3D primary Test', async () => {
.first()
.click();
await reduce3DViewportSize(page);
await checkForScreenshot(
page,
page,
+1 -1
View File
@@ -2,7 +2,7 @@ import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '2.16.840.1.114362.1.11972228.22789312658.616067305.306.2';
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.1706.8374.643249677828306008300337414785';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
+1 -1
View File
@@ -2,7 +2,7 @@ import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils/index';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '2.16.840.1.114362.1.11972228.22789312658.616067305.306.2';
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.1706.8374.643249677828306008300337414785';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 KiB

After

Width:  |  Height:  |  Size: 332 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 KiB

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 KiB

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 KiB

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

After

Width:  |  Height:  |  Size: 212 KiB

+3 -1
View File
@@ -2,5 +2,7 @@ import { visitStudy } from './visitStudy';
import { checkForScreenshot } from './checkForScreenshot';
import { screenShotPaths } from './screenShotPaths';
import { simulateClicksOnElement } from './simulateClicksOnElement';
import { reduce3DViewportSize } from './reduce3DviewportSize';
export { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement };
export { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement, reduce3DViewportSize };
+9
View File
@@ -0,0 +1,9 @@
export const reduce3DViewportSize = async (page: any) => {
await page.evaluate(({ cornerstone }: AppTypes.Test) => {
const enabledElement = cornerstone.getEnabledElements().filter(element => element.viewport.type === 'volume3d')[0]
const { viewport } = enabledElement;
viewport.setZoom(0.5);
viewport.render()
}, await page.evaluateHandle('window'));
}