diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index a2c38505e..ca06d06d1 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -6,7 +6,7 @@ on: branches: [main, master] jobs: test: - timeout-minutes: 60 + timeout-minutes: 120 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/playwright.config.ts b/playwright.config.ts index 5d839ef3f..29385061a 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -9,7 +9,7 @@ export default defineConfig({ snapshotPathTemplate: './tests/screenshots{/projectName}/{testFilePath}/{arg}{ext}', outputDir: './tests/test-results', reporter: [['html', { outputFolder: './tests/playwright-report' }]], - timeout: 120 * 1000, + timeout: 720 * 1000, use: { baseURL: 'http://localhost:3000', trace: 'on-first-retry', diff --git a/tests/3DFourUp.spec.ts b/tests/3DFourUp.spec.ts new file mode 100644 index 000000000..333ef675c --- /dev/null +++ b/tests/3DFourUp.spec.ts @@ -0,0 +1,25 @@ +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 mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test.describe('3D four up Test', async () => { + test('should render 3D four up correctly.', async ({ page }) => { + await page.getByTestId('Layout').click(); + await page + .locator('div') + .filter({ hasText: /^3D four up$/ }) + .first() + .click(); + await checkForScreenshot( + page, + page, + screenShotPaths.threeDFourUp.threeDFourUpDisplayedCorrectly, + 200 + ); + }); +}); diff --git a/tests/3DMain.spec.ts b/tests/3DMain.spec.ts new file mode 100644 index 000000000..e30fffbea --- /dev/null +++ b/tests/3DMain.spec.ts @@ -0,0 +1,25 @@ +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 mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test.describe('3D main Test', async () => { + test('should render 3D main correctly.', async ({ page }) => { + await page.getByTestId('Layout').click(); + await page + .locator('div') + .filter({ hasText: /^3D main$/ }) + .first() + .click(); + await checkForScreenshot( + page, + page, + screenShotPaths.threeDMain.threeDMainDisplayedCorrectly, + 200 + ); + }); +}); diff --git a/tests/3DOnly.spec.ts b/tests/3DOnly.spec.ts new file mode 100644 index 000000000..115823f0c --- /dev/null +++ b/tests/3DOnly.spec.ts @@ -0,0 +1,25 @@ +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 mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test.describe('3D only Test', async () => { + test('should render 3D only correctly.', async ({ page }) => { + await page.getByTestId('Layout').click(); + await page + .locator('div') + .filter({ hasText: /^3D only$/ }) + .first() + .click(); + await checkForScreenshot( + page, + page, + screenShotPaths.threeDOnly.threeDOnlyDisplayedCorrectly, + 200 + ); + }); +}); diff --git a/tests/3DPrimary.spec.ts b/tests/3DPrimary.spec.ts new file mode 100644 index 000000000..73e853223 --- /dev/null +++ b/tests/3DPrimary.spec.ts @@ -0,0 +1,26 @@ +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 mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test.describe('3D primary Test', async () => { + test('should render 3D primary correctly.', async ({ page }) => { + await page.getByTestId('Layout').click(); + await page + .locator('div') + .filter({ hasText: /^3D primary$/ }) + .first() + .click(); + + await checkForScreenshot( + page, + page, + screenShotPaths.threeDPrimary.threeDPrimaryDisplayedCorrectly, + 200 + ); + }); +}); diff --git a/tests/AxialPrimary.spec.ts b/tests/AxialPrimary.spec.ts new file mode 100644 index 000000000..0458ac19d --- /dev/null +++ b/tests/AxialPrimary.spec.ts @@ -0,0 +1,25 @@ +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 mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test.describe('Axial Primary Test', async () => { + test('should render Axial Primary correctly.', async ({ page }) => { + await page.getByTestId('Layout').click(); + await page + .locator('div') + .filter({ hasText: /^Axial Primary$/ }) + .first() + .click(); + await checkForScreenshot( + page, + page, + screenShotPaths.axialPrimary.axialPrimaryDisplayedCorrectly, + 200 + ); + }); +}); diff --git a/tests/DicomTagBrowser.spec.ts b/tests/DicomTagBrowser.spec.ts new file mode 100644 index 000000000..1e4136c42 --- /dev/null +++ b/tests/DicomTagBrowser.spec.ts @@ -0,0 +1,18 @@ +import { test } from '@playwright/test'; +import { visitStudy, checkForScreenshot, screenShotPaths } from './utils'; + +test.beforeEach(async ({ page }) => { + const studyInstanceUID = '1.3.6.1.4.1.25403.345050719074.3824.20170125095438.5'; + const mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test('should display the dicom tag browser', async ({ page }) => { + await page.getByTestId('MoreTools-split-button-secondary').click(); + await page.getByTestId('TagBrowser').click(); + await checkForScreenshot( + page, + page, + screenShotPaths.dicomTagBrowser.dicomTagBrowserDisplayedCorrectly + ); +}); diff --git a/tests/FlipHorizontal.spec.ts b/tests/FlipHorizontal.spec.ts new file mode 100644 index 000000000..7477a050c --- /dev/null +++ b/tests/FlipHorizontal.spec.ts @@ -0,0 +1,18 @@ +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 mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test('should flip the image horizontally', async ({ page }) => { + await page.getByTestId('MoreTools-split-button-secondary').click(); + await page.getByTestId('flipHorizontal').click(); + await checkForScreenshot( + page, + page, + screenShotPaths.flipHorizontal.flipHorizontalDisplayedCorrectly + ); +}); diff --git a/tests/Invert.spec.ts b/tests/Invert.spec.ts new file mode 100644 index 000000000..bbff4657c --- /dev/null +++ b/tests/Invert.spec.ts @@ -0,0 +1,14 @@ +import { test } from '@playwright/test'; +import { visitStudy, checkForScreenshot, screenShotPaths } from './utils'; + +test.beforeEach(async ({ page }) => { + const studyInstanceUID = '1.3.6.1.4.1.25403.345050719074.3824.20170125095438.5'; + const mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test('should invert the image', async ({ page }) => { + await page.getByTestId('MoreTools-split-button-secondary').click(); + await page.getByTestId('invert').click(); + await checkForScreenshot(page, page, screenShotPaths.invert.invertDisplayedCorrectly); +}); diff --git a/tests/Reset.spec.ts b/tests/Reset.spec.ts new file mode 100644 index 000000000..b4ca11963 --- /dev/null +++ b/tests/Reset.spec.ts @@ -0,0 +1,18 @@ +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 mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test('should reset the image to its original state', async ({ page }) => { + await page.getByTestId('MoreTools-split-button-secondary').click(); + await page.getByTestId('rotate-right').click(); + await page.getByTestId('MoreTools-split-button-secondary').click(); + await page.getByTestId('invert').click(); + await page.getByTestId('MoreTools-split-button-secondary').click(); + await page.getByTestId('Reset').click(); + await checkForScreenshot(page, page, screenShotPaths.reset.resetDisplayedCorrectly); +}); diff --git a/tests/RotateRight.spec.ts b/tests/RotateRight.spec.ts new file mode 100644 index 000000000..2f6971a23 --- /dev/null +++ b/tests/RotateRight.spec.ts @@ -0,0 +1,14 @@ +import { test } from '@playwright/test'; +import { visitStudy, checkForScreenshot, screenShotPaths } from './utils'; + +test.beforeEach(async ({ page }) => { + const studyInstanceUID = '1.3.6.1.4.1.25403.345050719074.3824.20170125095438.5'; + const mode = 'Basic Viewer'; + await visitStudy(page, studyInstanceUID, mode, 2000); +}); + +test('should rotate the image to the right', async ({ page }) => { + await page.getByTestId('MoreTools-split-button-secondary').click(); + await page.getByTestId('rotate-right').click(); + await checkForScreenshot(page, page, screenShotPaths.rotateRight.rotateRightDisplayedCorrectly); +}); diff --git a/tests/screenshots/chromium/3DFourUp.spec.ts/threeDFourUpDisplayedCorrectly.png b/tests/screenshots/chromium/3DFourUp.spec.ts/threeDFourUpDisplayedCorrectly.png new file mode 100644 index 000000000..9386de049 Binary files /dev/null and b/tests/screenshots/chromium/3DFourUp.spec.ts/threeDFourUpDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/3DMain.spec.ts/threeDMainDisplayedCorrectly.png b/tests/screenshots/chromium/3DMain.spec.ts/threeDMainDisplayedCorrectly.png new file mode 100644 index 000000000..cf1a2bf3d Binary files /dev/null and b/tests/screenshots/chromium/3DMain.spec.ts/threeDMainDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/3DOnly.spec.ts/threeDOnlyDisplayedCorrectly.png b/tests/screenshots/chromium/3DOnly.spec.ts/threeDOnlyDisplayedCorrectly.png new file mode 100644 index 000000000..542c59b26 Binary files /dev/null and b/tests/screenshots/chromium/3DOnly.spec.ts/threeDOnlyDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/3DPrimary.spec.ts/threeDPrimaryDisplayedCorrectly.png b/tests/screenshots/chromium/3DPrimary.spec.ts/threeDPrimaryDisplayedCorrectly.png new file mode 100644 index 000000000..d58dd2f6f Binary files /dev/null and b/tests/screenshots/chromium/3DPrimary.spec.ts/threeDPrimaryDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/AxialPrimary.spec.ts/axialPrimaryDisplayedCorrectly.png b/tests/screenshots/chromium/AxialPrimary.spec.ts/axialPrimaryDisplayedCorrectly.png new file mode 100644 index 000000000..ac725b88e Binary files /dev/null and b/tests/screenshots/chromium/AxialPrimary.spec.ts/axialPrimaryDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/DicomTagBrowser.spec.ts/dicomTagBrowserDisplayedCorrectly.png b/tests/screenshots/chromium/DicomTagBrowser.spec.ts/dicomTagBrowserDisplayedCorrectly.png new file mode 100644 index 000000000..708ee6464 Binary files /dev/null and b/tests/screenshots/chromium/DicomTagBrowser.spec.ts/dicomTagBrowserDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/FlipHorizontal.spec.ts/flipHorizontalDisplayedCorrectly.png b/tests/screenshots/chromium/FlipHorizontal.spec.ts/flipHorizontalDisplayedCorrectly.png new file mode 100644 index 000000000..09826fd5e Binary files /dev/null and b/tests/screenshots/chromium/FlipHorizontal.spec.ts/flipHorizontalDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/Invert.spec.ts/invertDisplayedCorrectly.png b/tests/screenshots/chromium/Invert.spec.ts/invertDisplayedCorrectly.png new file mode 100644 index 000000000..a4b0ca664 Binary files /dev/null and b/tests/screenshots/chromium/Invert.spec.ts/invertDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/Reset.spec.ts/resetDisplayedCorrectly.png b/tests/screenshots/chromium/Reset.spec.ts/resetDisplayedCorrectly.png new file mode 100644 index 000000000..958da098c Binary files /dev/null and b/tests/screenshots/chromium/Reset.spec.ts/resetDisplayedCorrectly.png differ diff --git a/tests/screenshots/chromium/RotateRight.spec.ts/rotateRightDisplayedCorrectly.png b/tests/screenshots/chromium/RotateRight.spec.ts/rotateRightDisplayedCorrectly.png new file mode 100644 index 000000000..6b7bae2f0 Binary files /dev/null and b/tests/screenshots/chromium/RotateRight.spec.ts/rotateRightDisplayedCorrectly.png differ diff --git a/tests/utils/screenShotPaths.ts b/tests/utils/screenShotPaths.ts index 05c278426..64017e2d7 100644 --- a/tests/utils/screenShotPaths.ts +++ b/tests/utils/screenShotPaths.ts @@ -26,6 +26,21 @@ const screenShotPaths = { mpr: { mprDisplayedCorrectly: 'mprDisplayedCorrectly.png', }, + threeDFourUp: { + threeDFourUpDisplayedCorrectly: 'threeDFourUpDisplayedCorrectly.png', + }, + threeDMain: { + threeDMainDisplayedCorrectly: 'threeDMainDisplayedCorrectly.png', + }, + threeDPrimary: { + threeDPrimaryDisplayedCorrectly: 'threeDPrimaryDisplayedCorrectly.png', + }, + threeDOnly: { + threeDOnlyDisplayedCorrectly: 'threeDOnlyDisplayedCorrectly.png', + }, + axialPrimary: { + axialPrimaryDisplayedCorrectly: 'axialPrimaryDisplayedCorrectly.png', + }, probe: { probeDisplayedCorrectly: 'probeDisplayedCorrectly.png', }, @@ -35,6 +50,21 @@ const screenShotPaths = { spline: { splineDisplayedCorrectly: 'splineDisplayedCorrectly.png', }, + dicomTagBrowser: { + dicomTagBrowserDisplayedCorrectly: 'dicomTagBrowserDisplayedCorrectly.png', + }, + rotateRight: { + rotateRightDisplayedCorrectly: 'rotateRightDisplayedCorrectly.png', + }, + invert: { + invertDisplayedCorrectly: 'invertDisplayedCorrectly.png', + }, + flipHorizontal: { + flipHorizontalDisplayedCorrectly: 'flipHorizontalDisplayedCorrectly.png', + }, + reset: { + resetDisplayedCorrectly: 'resetDisplayedCorrectly.png', + }, }; export { screenShotPaths };