Skip to content

Commit 6ebe199

Browse files
authored
Merge pull request #567 from Geode-solutions/feat/camera-tests
feat(cameraTests): Add e2e tests for camera related tools
2 parents 4aa95ba + 21e1a3d commit 6ebe199

24 files changed

Lines changed: 175 additions & 6 deletions

tests/e2e/tests/camera_tools.test.js

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@ import {
1111
dragContextMenu,
1212
focusObjectInTree,
1313
hideObjectInTree,
14+
hoverViewerCenter,
1415
loadData,
1516
navigateToApp,
17+
showObjectInTree,
1618
viewerContextMenu,
1719
} from "@tests/utils/viewer_interaction.js";
1820
import {
1921
changeZScaling,
22+
closeCameraManager,
2023
resetCamera,
24+
restoreCameraPosition,
2125
rotateCamera,
26+
saveCameraPosition,
27+
selectCameraOrientation,
28+
toggleCameraManager,
29+
toggleCameraOrientation,
2230
toggleCenterOnClick,
2331
toggleGridScale,
2432
} from "@tests/utils/camera_interaction.js";
@@ -112,3 +120,102 @@ test("z scaling value 6.6", async () => {
112120
await resetCamera(window);
113121
await expect(window).toHaveScreenshot();
114122
});
123+
124+
test("save camera position", async () => {
125+
await toggleCameraManager(window);
126+
await saveCameraPosition(window, "angle 1");
127+
await expect(window).toHaveScreenshot();
128+
await closeCameraManager(window);
129+
});
130+
131+
test("camera orientation", async () => {
132+
await toggleCameraOrientation(window);
133+
await selectCameraOrientation(window, "X+");
134+
await expect(window).toHaveScreenshot();
135+
await window.keyboard.press("Escape");
136+
await window.waitForTimeout(afterActionWait);
137+
});
138+
139+
test("z scaling value 1", async () => {
140+
await changeZScaling(window, 1);
141+
await resetCamera(window);
142+
await expect(window).toHaveScreenshot();
143+
});
144+
145+
test("cells hover highlight on brep", async () => {
146+
await window.getByTestId("highlightOnHoverButton").click();
147+
await window.waitForTimeout(afterActionWait);
148+
await window.getByTestId("highlightOnHoverCellsButton").click();
149+
await window.waitForTimeout(afterActionWait);
150+
await hoverViewerCenter(window);
151+
await expect(window).toHaveScreenshot();
152+
await window.keyboard.press("Escape");
153+
await window.waitForTimeout(afterActionWait);
154+
});
155+
156+
test("points hover highlight on brep", async () => {
157+
await window.getByTestId("highlightOnHoverButton").click();
158+
await window.waitForTimeout(afterActionWait);
159+
await window.getByTestId("highlightOnHoverPointsButton").click();
160+
await window.waitForTimeout(afterActionWait);
161+
await hoverViewerCenter(window);
162+
await expect(window).toHaveScreenshot();
163+
await window.getByTestId("hoverHighlightChip").click();
164+
await window.waitForTimeout(afterActionWait);
165+
});
166+
167+
test("highlight cells on grid", async () => {
168+
await showObjectInTree(window, "RegularGrid3D");
169+
await hideObjectInTree(window, "BRep");
170+
await resetCamera(window);
171+
await window.getByTestId("highlightOnHoverButton").click();
172+
await window.waitForTimeout(afterActionWait);
173+
await window.getByTestId("highlightOnHoverCellsButton").click();
174+
await window.waitForTimeout(afterActionWait);
175+
await hoverViewerCenter(window);
176+
await expect(window).toHaveScreenshot();
177+
await window.getByTestId("highlightOnHoverButton").click();
178+
await window.waitForTimeout(afterActionWait);
179+
});
180+
181+
test("highlight points on grid", async () => {
182+
await window.getByTestId("highlightOnHoverButton").click();
183+
await window.waitForTimeout(afterActionWait);
184+
await window.getByTestId("highlightOnHoverPointsButton").click();
185+
await window.waitForTimeout(afterActionWait);
186+
await hoverViewerCenter(window);
187+
await expect(window).toHaveScreenshot();
188+
await window.keyboard.press("Escape");
189+
await window.waitForTimeout(afterActionWait);
190+
});
191+
192+
test("restore camera position", async () => {
193+
await toggleCameraManager(window);
194+
await restoreCameraPosition(window, "angle 1");
195+
await expect(window).toHaveScreenshot();
196+
await closeCameraManager(window);
197+
});
198+
199+
test("screenshot file without background", async () => {
200+
await window.getByTestId("screenshotButton").click();
201+
await window.waitForTimeout(afterActionWait);
202+
await window.getByTestId("screenshotFileNameInput").locator("input").fill("screenshot 1");
203+
await window.waitForTimeout(afterActionWait);
204+
await window.getByTestId("screenshotIncludeBackgroundSwitch").getByRole("checkbox").uncheck();
205+
await window.waitForTimeout(afterActionWait);
206+
await window.getByTestId("screenshotActionButton").click();
207+
await window.waitForTimeout(afterActionWait);
208+
await expect(window).toHaveScreenshot();
209+
});
210+
211+
test("screenshot clipboard with background", async () => {
212+
await window.getByTestId("screenshotButton").click();
213+
await window.waitForTimeout(afterActionWait);
214+
await window.getByTestId("screenshotClipboardButton").click();
215+
await window.waitForTimeout(afterActionWait);
216+
await window.getByTestId("screenshotIncludeBackgroundSwitch").getByRole("checkbox").check();
217+
await window.waitForTimeout(afterActionWait);
218+
await window.getByTestId("screenshotActionButton").click();
219+
await window.waitForTimeout(afterActionWait);
220+
await expect(window).toHaveScreenshot();
221+
});
110 KB
Loading
118 KB
Loading
-182 Bytes
Loading
96.2 KB
Loading
103 KB
Loading
-1.35 KB
Loading
-614 Bytes
Loading
-4.18 KB
Loading
114 KB
Loading

0 commit comments

Comments
 (0)