Skip to content

Commit 893f37e

Browse files
authored
Merge pull request #466 from Geode-solutions/fix/add_more_e2e_tests
Fix/add more e2e tests
2 parents 4612e95 + a836088 commit 893f37e

20 files changed

Lines changed: 92 additions & 28 deletions

File tree

tests/e2e/tests/edged_curve.test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { expect } from "@playwright/test";
55

66
// Local imports
7-
import { beforeAllTimeout, loadData, navigateToApp } from "@tests/utils.js";
7+
import { beforeAllTimeout, loadData, navigateToApp, viewerContextMenu } from "@tests/utils.js";
88
import { test } from "@tests/fixtures.js";
99

1010
// Constants
@@ -24,3 +24,10 @@ test("load", async () => {
2424
await loadData(window, inputFilename);
2525
await expect(window).toHaveScreenshot();
2626
});
27+
28+
test("viewer context menu", async () => {
29+
const x = 549,
30+
y = 210;
31+
await viewerContextMenu(window, x, y);
32+
await expect(window).toHaveScreenshot();
33+
});

tests/e2e/tests/grid2d.test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { expect } from "@playwright/test";
55

66
// Local imports
7-
import { beforeAllTimeout, loadData, navigateToApp } from "@tests/utils.js";
7+
import { beforeAllTimeout, loadData, navigateToApp, viewerContextMenu } from "@tests/utils.js";
88
import { test } from "@tests/fixtures.js";
99

1010
// Constants
@@ -24,3 +24,10 @@ test("load", async () => {
2424
await loadData(window, inputFilename);
2525
await expect(window).toHaveScreenshot();
2626
});
27+
28+
test("viewer context menu", async () => {
29+
const x = 549,
30+
y = 360;
31+
await viewerContextMenu(window, x, y);
32+
await expect(window).toHaveScreenshot();
33+
});

tests/e2e/tests/grid3d.test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { expect } from "@playwright/test";
55

66
// Local imports
7-
import { beforeAllTimeout, loadData, navigateToApp } from "@tests/utils.js";
7+
import { beforeAllTimeout, loadData, navigateToApp, viewerContextMenu } from "@tests/utils.js";
88
import { test } from "@tests/fixtures.js";
99

1010
// Constants
@@ -24,3 +24,10 @@ test("load", async () => {
2424
await loadData(window, inputFilename);
2525
await expect(window).toHaveScreenshot();
2626
});
27+
28+
test("viewer context menu", async () => {
29+
const x = 549,
30+
y = 360;
31+
await viewerContextMenu(window, x, y);
32+
await expect(window).toHaveScreenshot();
33+
});

tests/e2e/tests/model.test.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
import { expect } from "@playwright/test";
55

66
// Local imports
7-
import { beforeAllTimeout, loadData, navigateToApp } from "@tests/utils.js";
7+
import {
8+
afterActionWait,
9+
beforeAllTimeout,
10+
loadData,
11+
navigateToApp,
12+
viewerContextMenu,
13+
} from "@tests/utils.js";
814
import { test } from "@tests/fixtures.js";
915

1016
// Constants
1117
const inputFilename = "test.og_brep";
12-
const waitAfterActionRender = 1000;
1318
let window = undefined;
1419
let cleanup = undefined;
1520

@@ -27,15 +32,9 @@ test("load", async () => {
2732
});
2833

2934
test("viewer context menu", async () => {
30-
console.log("Right click on the BRep from viewer");
31-
await window.locator("canvas").click({
32-
button: "right",
33-
position: {
34-
x: 583,
35-
y: 321,
36-
},
37-
});
38-
await window.waitForTimeout(waitAfterActionRender);
35+
const x = 549,
36+
y = 360;
37+
await viewerContextMenu(window, x, y);
3938
await expect(window).toHaveScreenshot();
4039
});
4140

@@ -47,7 +46,7 @@ test("points visibility", async () => {
4746
.getByTestId("modelPointsVisibilitySwitch")
4847
.getByRole("checkbox");
4948
await modelPointsVisibilitySwitch.check();
50-
await window.waitForTimeout(waitAfterActionRender);
49+
await window.waitForTimeout(afterActionWait);
5150
await expect(window).toHaveScreenshot();
5251
});
5352

@@ -63,7 +62,7 @@ test("object tree context menu", async () => {
6362
y: 10,
6463
},
6564
});
66-
await window.waitForTimeout(waitAfterActionRender);
65+
await window.waitForTimeout(afterActionWait);
6766
await expect(window).toHaveScreenshot();
6867
});
6968

@@ -76,7 +75,7 @@ test("edges visibility", async () => {
7675
.getByRole("checkbox");
7776
console.log("Toggle BRep edges visibility", modelEdgesVisibilitySwitch);
7877
await modelEdgesVisibilitySwitch.check();
79-
await window.waitForTimeout(waitAfterActionRender);
78+
await window.waitForTimeout(afterActionWait);
8079
await expect(window).toHaveScreenshot();
8180
await window.keyboard.press("Escape");
8281
});
@@ -89,7 +88,7 @@ test("object tree model components", async () => {
8988
.filter({ hasText: "test" })
9089
.locator("button:has(.mdi-magnify-expand)")
9190
.click();
92-
await window.waitForTimeout(waitAfterActionRender);
91+
await window.waitForTimeout(afterActionWait);
9392

9493
const modelComponentsObjectTree = window.getByTestId("modelComponentsObjectTree");
9594

@@ -98,14 +97,14 @@ test("object tree model components", async () => {
9897
.filter({ hasText: "Blocks" });
9998

10099
await BlocksRow.locator(".mdi-eye").first().click();
101-
await window.waitForTimeout(waitAfterActionRender);
100+
await window.waitForTimeout(afterActionWait);
102101

103102
const SurfacesRow = modelComponentsObjectTree
104103
.locator(".tree-row-wrapper")
105104
.filter({ hasText: "Surfaces" });
106105

107106
await SurfacesRow.locator(".mdi-menu-right").first().click();
108-
await window.waitForTimeout(waitAfterActionRender);
107+
await window.waitForTimeout(afterActionWait);
109108

110109
const surfaceIds = [
111110
"00000000-8afd-4969-8000-000092a43747",
@@ -125,10 +124,10 @@ test("object tree model components", async () => {
125124
// oxlint-disable-next-line no-await-in-loop
126125
await surfaceRow.locator(".mdi-eye").first().click({ force: true });
127126
// oxlint-disable-next-line no-await-in-loop
128-
await window.waitForTimeout(waitAfterActionRender);
127+
await window.waitForTimeout(afterActionWait);
129128
}
130129
const importButton = await window.getByRole("button", { name: "Import" });
131130
await importButton.hover();
132-
await window.waitForTimeout(waitAfterActionRender);
131+
await window.waitForTimeout(afterActionWait);
133132
await expect(window).toHaveScreenshot();
134133
});

tests/e2e/tests/point_set.test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { expect } from "@playwright/test";
55

66
// Local imports
7-
import { beforeAllTimeout, loadData, navigateToApp } from "@tests/utils.js";
7+
import { beforeAllTimeout, loadData, navigateToApp, viewerContextMenu } from "@tests/utils.js";
88
import { test } from "@tests/fixtures.js";
99

1010
// Constants
@@ -24,3 +24,10 @@ test("load", async () => {
2424
await loadData(window, inputFilename);
2525
await expect(window).toHaveScreenshot();
2626
});
27+
28+
test("viewer context menu", async () => {
29+
const x = 549,
30+
y = 360;
31+
await viewerContextMenu(window, x, y);
32+
await expect(window).toHaveScreenshot();
33+
});

tests/e2e/tests/polygonal_surface.test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { expect } from "@playwright/test";
55

66
// Local imports
7-
import { beforeAllTimeout, loadData, navigateToApp } from "@tests/utils.js";
7+
import { beforeAllTimeout, loadData, navigateToApp, viewerContextMenu } from "@tests/utils.js";
88
import { test } from "@tests/fixtures.js";
99

1010
// Constants
@@ -24,3 +24,10 @@ test("load", async () => {
2424
await loadData(window, inputFilename);
2525
await expect(window).toHaveScreenshot();
2626
});
27+
28+
test("viewer context menu", async () => {
29+
const x = 549,
30+
y = 360;
31+
await viewerContextMenu(window, x, y);
32+
await expect(window).toHaveScreenshot();
33+
});
92.3 KB
Loading
74.7 KB
Loading
77.3 KB
Loading
-246 Bytes
Loading

0 commit comments

Comments
 (0)