Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(increase-coverage): weekly tests PR #4202

Merged
merged 8 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tests/Angle.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 angle tool', async ({ page }) => {
await page.getByTestId('MoreTools-split-button-secondary').click();
await page.getByTestId('Angle').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 550,
y: 200,
},
{
x: 450,
y: 250,
},
{
x: 550,
y: 300,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.angle.angleDisplayedCorrectly);
});
34 changes: 34 additions & 0 deletions tests/Bidirectional.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 bidirectional tool', async ({ page }) => {
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 page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(
page,
page,
screenShotPaths.bidirectional.bidirectionalDisplayedCorrectly
);
});
29 changes: 29 additions & 0 deletions tests/Circle.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 circle tool', async ({ page }) => {
await page.getByTestId('MeasurementTools-split-button-secondary').click();
await page.getByTestId('CircleROI').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 480,
y: 205,
},
{
x: 488,
y: 247,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.circle.circleDisplayedCorrectly);
});
37 changes: 37 additions & 0 deletions tests/CobbAngle.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 cobb angle tool', async ({ page }) => {
await page.getByTestId('MoreTools-split-button-secondary').click();
await page.getByTestId('CobbAngle').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 515,
y: 212,
},
{
x: 616,
y: 207,
},
{
x: 527,
y: 293,
},
{
x: 625,
y: 291,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.cobbangle.cobbangleDisplayedCorrectly);
});
29 changes: 29 additions & 0 deletions tests/Ellipse.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 ellipse tool', async ({ page }) => {
await page.getByTestId('MeasurementTools-split-button-secondary').click();
await page.getByTestId('EllipticalROI').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 446,
y: 245,
},
{
x: 508,
y: 281,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.ellipse.ellipseDisplayedCorrectly);
});
21 changes: 17 additions & 4 deletions tests/Length.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateDrag } from './utils';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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);
await visitStudy(page, studyInstanceUID, mode, 2000);
});

test('should display the length tool', async ({ page }) => {
await page.getByTestId('MeasurementTools-split-button-primary').click();
const locator = page.locator('.cornerstone-canvas');
await simulateDrag(page, locator);
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 364,
y: 234,
},
{
x: 544,
y: 232,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.length.lengthDisplayedCorrectly);
});
45 changes: 45 additions & 0 deletions tests/Livewire.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 livewire tool', async ({ page }) => {
await page.getByTestId('MeasurementTools-split-button-secondary').click();
await page.getByTestId('LivewireContour').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 380,
y: 459,
},
{
x: 420,
y: 396,
},
{
x: 523,
y: 392,
},
{
x: 581,
y: 447,
},
{
x: 482,
y: 493,
},
{
x: 383,
y: 461,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.livewire.livewireDisplayedCorrectly);
});
2 changes: 1 addition & 1 deletion tests/MPR.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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 mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode);
await visitStudy(page, studyInstanceUID, mode, 2000);
});

test.describe('MPR Test', async () => {
Expand Down
25 changes: 25 additions & 0 deletions tests/Probe.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 probe tool', async ({ page }) => {
await page.getByTestId('MoreTools-split-button-secondary').click();
await page.getByTestId('Probe').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 550,
y: 200,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.probe.probeDisplayedCorrectly);
});
29 changes: 29 additions & 0 deletions tests/Rectangle.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 rectangle tool', async ({ page }) => {
await page.getByTestId('MeasurementTools-split-button-secondary').click();
await page.getByTestId('RectangleROI').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 476,
y: 159,
},
{
x: 591,
y: 217,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.rectangle.rectangleDisplayedCorrectly);
});
45 changes: 45 additions & 0 deletions tests/Spline.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement } 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 spline tool', async ({ page }) => {
await page.getByTestId('MeasurementTools-split-button-secondary').click();
await page.getByTestId('SplineROI').click();
const locator = page.getByTestId('viewport-pane').locator('canvas');
await simulateClicksOnElement({
locator,
points: [
{
x: 380,
y: 459,
},
{
x: 420,
y: 396,
},
{
x: 523,
y: 392,
},
{
x: 581,
y: 447,
},
{
x: 482,
y: 493,
},
{
x: 383,
y: 461,
},
],
});
await page.getByTestId('prompt-begin-tracking-yes-btn').click();
await checkForScreenshot(page, page, screenShotPaths.spline.splineDisplayedCorrectly);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/screenshots/chromium/MPR.spec.ts/mprDisplayedCorrectly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { visitStudy } from './visitStudy';
import { checkForScreenshot } from './checkForScreenshot';
import { screenShotPaths } from './screenShotPaths';
import { simulateDrag } from './simulateDrag';
import { simulateClicksOnElement } from './simulateClicksOnElement';

export { visitStudy, checkForScreenshot, screenShotPaths, simulateDrag };
export { visitStudy, checkForScreenshot, screenShotPaths, simulateClicksOnElement };
Loading
Loading