vease 2.2.0-rc.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/.build/tests/e2e/utils/create_objects.js +2 -3
  2. package/.build/tests/e2e/utils/crs.js +4 -4
  3. package/.build/tests/e2e/utils/crs_flows.js +3 -3
  4. package/.build/tests/e2e/utils/data_manager.js +2 -2
  5. package/.build/tests/e2e/utils/extension.js +2 -2
  6. package/.build/tests/e2e/utils/fixtures.js +1 -1
  7. package/.build/tests/e2e/utils/load.js +1 -1
  8. package/.build/tests/e2e/utils/project_interaction.js +2 -2
  9. package/package.json +10 -7
  10. package/tests/e2e/utils/create_objects.ts +2 -2
  11. package/tests/e2e/utils/crs.ts +7 -4
  12. package/tests/e2e/utils/crs_flows.ts +3 -3
  13. package/tests/e2e/utils/data_manager.ts +2 -2
  14. package/tests/e2e/utils/extension.ts +2 -2
  15. package/tests/e2e/utils/fixtures.ts +1 -1
  16. package/tests/e2e/utils/load.ts +1 -1
  17. package/tests/e2e/utils/project_interaction.ts +2 -2
  18. package/.build/tests/e2e/utils/app_interaction.js +0 -24
  19. package/.build/tests/e2e/utils/basemap.js +0 -55
  20. package/.build/tests/e2e/utils/camera_filters.js +0 -105
  21. package/.build/tests/e2e/utils/camera_interaction.js +0 -107
  22. package/.build/tests/e2e/utils/camera_tools.js +0 -43
  23. package/.build/tests/e2e/utils/clipping_planes_interaction.js +0 -80
  24. package/.build/tests/e2e/utils/constants.js +0 -43
  25. package/.build/tests/e2e/utils/data/constants.js +0 -26
  26. package/.build/tests/e2e/utils/data/helpers/attribute.js +0 -85
  27. package/.build/tests/e2e/utils/data/helpers/attribute_colors.js +0 -47
  28. package/.build/tests/e2e/utils/data/helpers/attribute_menu.js +0 -13
  29. package/.build/tests/e2e/utils/data/helpers/color.js +0 -98
  30. package/.build/tests/e2e/utils/data/helpers/color_picker.js +0 -52
  31. package/.build/tests/e2e/utils/data/helpers/textures.js +0 -26
  32. package/.build/tests/e2e/utils/data/index.js +0 -28
  33. package/.build/tests/e2e/utils/data/mesh/cells/attribute.js +0 -43
  34. package/.build/tests/e2e/utils/data/mesh/cells/color.js +0 -26
  35. package/.build/tests/e2e/utils/data/mesh/cells/index.js +0 -4
  36. package/.build/tests/e2e/utils/data/mesh/cells/visibility.js +0 -9
  37. package/.build/tests/e2e/utils/data/mesh/edges/attribute.js +0 -43
  38. package/.build/tests/e2e/utils/data/mesh/edges/color.js +0 -26
  39. package/.build/tests/e2e/utils/data/mesh/edges/index.js +0 -5
  40. package/.build/tests/e2e/utils/data/mesh/edges/visibility.js +0 -9
  41. package/.build/tests/e2e/utils/data/mesh/edges/width.js +0 -9
  42. package/.build/tests/e2e/utils/data/mesh/index.js +0 -24
  43. package/.build/tests/e2e/utils/data/mesh/points/attribute.js +0 -31
  44. package/.build/tests/e2e/utils/data/mesh/points/color.js +0 -26
  45. package/.build/tests/e2e/utils/data/mesh/points/index.js +0 -5
  46. package/.build/tests/e2e/utils/data/mesh/points/size.js +0 -9
  47. package/.build/tests/e2e/utils/data/mesh/points/visibility.js +0 -9
  48. package/.build/tests/e2e/utils/data/mesh/polygon/attribute.js +0 -47
  49. package/.build/tests/e2e/utils/data/mesh/polygon/color.js +0 -26
  50. package/.build/tests/e2e/utils/data/mesh/polygon/index.js +0 -5
  51. package/.build/tests/e2e/utils/data/mesh/polygon/textures.js +0 -14
  52. package/.build/tests/e2e/utils/data/mesh/polygon/visibility.js +0 -9
  53. package/.build/tests/e2e/utils/data/mesh/polyhedra/attribute.js +0 -43
  54. package/.build/tests/e2e/utils/data/mesh/polyhedra/color.js +0 -29
  55. package/.build/tests/e2e/utils/data/mesh/polyhedra/index.js +0 -4
  56. package/.build/tests/e2e/utils/data/mesh/polyhedra/visibility.js +0 -9
  57. package/.build/tests/e2e/utils/data/model/attribute.js +0 -99
  58. package/.build/tests/e2e/utils/data/model/color.js +0 -69
  59. package/.build/tests/e2e/utils/data/model/edges/components.js +0 -50
  60. package/.build/tests/e2e/utils/data/model/edges/index.js +0 -3
  61. package/.build/tests/e2e/utils/data/model/edges/visibility.js +0 -9
  62. package/.build/tests/e2e/utils/data/model/index.js +0 -11
  63. package/.build/tests/e2e/utils/data/model/points/components.js +0 -50
  64. package/.build/tests/e2e/utils/data/model/points/index.js +0 -3
  65. package/.build/tests/e2e/utils/data/model/points/visibility.js +0 -9
  66. package/.build/tests/e2e/utils/data/model/style_menu.js +0 -10
  67. package/.build/tests/e2e/utils/data/model/surfaces/index.js +0 -2
  68. package/.build/tests/e2e/utils/data/model/surfaces/visibility.js +0 -8
  69. package/.build/tests/e2e/utils/model_tabs.js +0 -35
  70. package/.build/tests/e2e/utils/object_trees/common.js +0 -122
  71. package/.build/tests/e2e/utils/object_trees/main_object_tree.js +0 -86
  72. package/.build/tests/e2e/utils/object_trees/model_components_object_tree.js +0 -111
  73. package/.build/tests/e2e/utils/other.js +0 -13
  74. package/.build/tests/e2e/utils/viewer_canvas.js +0 -83
  75. package/.build/tests/e2e/utils/viewer_interaction.js +0 -87
  76. package/.build/tests/e2e/utils/viewer_menu.js +0 -98
  77. package/.build/tests/e2e/utils/wait_for_action_settled.js +0 -63
  78. package/tests/e2e/utils/app_interaction.ts +0 -35
  79. package/tests/e2e/utils/basemap.ts +0 -89
  80. package/tests/e2e/utils/camera_filters.ts +0 -176
  81. package/tests/e2e/utils/camera_interaction.ts +0 -179
  82. package/tests/e2e/utils/camera_tools.ts +0 -62
  83. package/tests/e2e/utils/clipping_planes_interaction.ts +0 -126
  84. package/tests/e2e/utils/constants.ts +0 -100
  85. package/tests/e2e/utils/data/constants.ts +0 -58
  86. package/tests/e2e/utils/data/helpers/attribute.ts +0 -156
  87. package/tests/e2e/utils/data/helpers/attribute_colors.ts +0 -83
  88. package/tests/e2e/utils/data/helpers/attribute_menu.ts +0 -19
  89. package/tests/e2e/utils/data/helpers/color.ts +0 -214
  90. package/tests/e2e/utils/data/helpers/color_picker.ts +0 -82
  91. package/tests/e2e/utils/data/helpers/textures.ts +0 -41
  92. package/tests/e2e/utils/data/index.ts +0 -2
  93. package/tests/e2e/utils/data/mesh/cells/attribute.ts +0 -103
  94. package/tests/e2e/utils/data/mesh/cells/color.ts +0 -52
  95. package/tests/e2e/utils/data/mesh/cells/index.ts +0 -3
  96. package/tests/e2e/utils/data/mesh/cells/visibility.ts +0 -9
  97. package/tests/e2e/utils/data/mesh/edges/attribute.ts +0 -103
  98. package/tests/e2e/utils/data/mesh/edges/color.ts +0 -52
  99. package/tests/e2e/utils/data/mesh/edges/index.ts +0 -4
  100. package/tests/e2e/utils/data/mesh/edges/visibility.ts +0 -9
  101. package/tests/e2e/utils/data/mesh/edges/width.ts +0 -9
  102. package/tests/e2e/utils/data/mesh/index.ts +0 -6
  103. package/tests/e2e/utils/data/mesh/points/attribute.ts +0 -66
  104. package/tests/e2e/utils/data/mesh/points/color.ts +0 -52
  105. package/tests/e2e/utils/data/mesh/points/index.ts +0 -4
  106. package/tests/e2e/utils/data/mesh/points/size.ts +0 -9
  107. package/tests/e2e/utils/data/mesh/points/visibility.ts +0 -9
  108. package/tests/e2e/utils/data/mesh/polygon/attribute.ts +0 -110
  109. package/tests/e2e/utils/data/mesh/polygon/color.ts +0 -52
  110. package/tests/e2e/utils/data/mesh/polygon/index.ts +0 -4
  111. package/tests/e2e/utils/data/mesh/polygon/textures.ts +0 -21
  112. package/tests/e2e/utils/data/mesh/polygon/visibility.ts +0 -9
  113. package/tests/e2e/utils/data/mesh/polyhedra/attribute.ts +0 -103
  114. package/tests/e2e/utils/data/mesh/polyhedra/color.ts +0 -58
  115. package/tests/e2e/utils/data/mesh/polyhedra/index.ts +0 -3
  116. package/tests/e2e/utils/data/mesh/polyhedra/visibility.ts +0 -9
  117. package/tests/e2e/utils/data/model/attribute.ts +0 -180
  118. package/tests/e2e/utils/data/model/color.ts +0 -110
  119. package/tests/e2e/utils/data/model/edges/components.ts +0 -97
  120. package/tests/e2e/utils/data/model/edges/index.ts +0 -2
  121. package/tests/e2e/utils/data/model/edges/visibility.ts +0 -9
  122. package/tests/e2e/utils/data/model/index.ts +0 -5
  123. package/tests/e2e/utils/data/model/points/components.ts +0 -97
  124. package/tests/e2e/utils/data/model/points/index.ts +0 -2
  125. package/tests/e2e/utils/data/model/points/visibility.ts +0 -9
  126. package/tests/e2e/utils/data/model/style_menu.ts +0 -11
  127. package/tests/e2e/utils/data/model/surfaces/index.ts +0 -1
  128. package/tests/e2e/utils/data/model/surfaces/visibility.ts +0 -8
  129. package/tests/e2e/utils/model_tabs.ts +0 -61
  130. package/tests/e2e/utils/object_trees/common.ts +0 -212
  131. package/tests/e2e/utils/object_trees/main_object_tree.ts +0 -167
  132. package/tests/e2e/utils/object_trees/model_components_object_tree.ts +0 -219
  133. package/tests/e2e/utils/other.ts +0 -15
  134. package/tests/e2e/utils/viewer_canvas.ts +0 -136
  135. package/tests/e2e/utils/viewer_interaction.ts +0 -96
  136. package/tests/e2e/utils/viewer_menu.ts +0 -205
  137. package/tests/e2e/utils/wait_for_action_settled.ts +0 -108
@@ -1,136 +0,0 @@
1
- // Third party imports
2
- import type { Locator, Page } from "@playwright/test";
3
-
4
- // Local imports
5
- import { waitForActionSettled } from "./wait_for_action_settled";
6
-
7
- function getHybridViewerCanvas(window: Page): Locator {
8
- return window.getByTestId("hybridViewer").locator("canvas");
9
- }
10
-
11
- async function getHybridViewerCanvasBoundingBox(
12
- hybridViewerCanvas: Locator,
13
- ): Promise<{ x: number; y: number; width: number; height: number }> {
14
- const box = await hybridViewerCanvas.boundingBox();
15
- if (!box) {
16
- throw new Error("Could not get bounding box of the hybrid viewer canvas.");
17
- }
18
- return box;
19
- }
20
-
21
- async function viewerContextMenu(window: Page, x: number, y: number): Promise<void> {
22
- const hybridViewerCanvas = getHybridViewerCanvas(window);
23
- await hybridViewerCanvas.click({
24
- button: "right",
25
- position: { x, y },
26
- });
27
- await waitForActionSettled(window);
28
- }
29
-
30
- const SCENE_CLICK_MARGIN = 20;
31
-
32
- async function sceneContextMenu(window: Page): Promise<void> {
33
- const box = await getHybridViewerCanvasBoundingBox(getHybridViewerCanvas(window));
34
- await viewerContextMenu(window, box.width - SCENE_CLICK_MARGIN, SCENE_CLICK_MARGIN);
35
- }
36
-
37
- interface DragOptions {
38
- startX?: number;
39
- startY?: number;
40
- targetX?: number;
41
- targetY?: number;
42
- deltaX?: number;
43
- deltaY?: number;
44
- }
45
-
46
- async function dragElement(
47
- window: Page,
48
- locator: Locator,
49
- { startX: fromX, startY: fromY, targetX, targetY, deltaX = 0, deltaY = 0 }: DragOptions = {},
50
- ): Promise<void> {
51
- const box = await locator.boundingBox();
52
- if (!box) {
53
- throw new Error("Could not get bounding box of the element to drag.");
54
- }
55
- const { x, y, width, height } = box;
56
- const startX = fromX ?? x + width / 2;
57
- const startY = fromY ?? y + height / 2;
58
- await window.mouse.move(startX, startY);
59
- await window.mouse.down();
60
- await window.mouse.move(targetX ?? startX + deltaX, targetY ?? startY + deltaY, { steps: 20 });
61
- await window.mouse.up();
62
- await waitForActionSettled(window);
63
- }
64
-
65
- async function dragContextMenu(
66
- window: Page,
67
- { targetX, targetY }: DragOptions = {},
68
- ): Promise<void> {
69
- const centerButton = window.getByTestId("circularMenuCenterButton");
70
- await dragElement(window, centerButton, { targetX, targetY });
71
- }
72
-
73
- async function hoverViewer(window: Page, position?: { x: number; y: number }): Promise<void> {
74
- const hybridViewerCanvas = getHybridViewerCanvas(window);
75
- const box = await hybridViewerCanvas.boundingBox();
76
- if (!box) {
77
- throw new Error("Could not get bounding box of the hybrid viewer canvas.");
78
- }
79
- const hoverPosition = position ?? { x: box.width / 2, y: box.height / 2 };
80
- await hybridViewerCanvas.hover({
81
- position: hoverPosition,
82
- });
83
- await waitForActionSettled(window);
84
- }
85
-
86
- async function stabilizeHoverTooltip(window: Page): Promise<void> {
87
- await window.addStyleTag({
88
- content: ".tooltip-value-dim { visibility: hidden !important; }",
89
- });
90
- }
91
-
92
- async function toggleInfoCard(window: Page): Promise<void> {
93
- const centerButton = window.getByTestId("circularMenuCenterButton");
94
- await centerButton.click();
95
- await waitForActionSettled(window);
96
- }
97
-
98
- const SCALAR_BAR_X_RATIO = 0.25;
99
- const SCALAR_BAR_Y_RATIO = 0.9;
100
-
101
- function getQuickColormapPicker(window: Page): Locator {
102
- return window
103
- .locator(".v-overlay__content")
104
- .filter({ has: window.getByTestId("colorMapListFilter") });
105
- }
106
-
107
- async function viewerQuickColormap(window: Page, x?: number, y?: number): Promise<void> {
108
- const hybridViewerCanvas = getHybridViewerCanvas(window);
109
- const box = await hybridViewerCanvas.boundingBox();
110
- if (!box) {
111
- throw new Error("Could not get bounding box of the hybrid viewer canvas.");
112
- }
113
- const targetX = x ?? Math.round(box.width * SCALAR_BAR_X_RATIO);
114
- const targetY = y ?? Math.round(box.height * SCALAR_BAR_Y_RATIO);
115
-
116
- await hybridViewerCanvas.click({
117
- button: "left",
118
- position: { x: targetX, y: targetY },
119
- force: true,
120
- });
121
- await waitForActionSettled(window);
122
- }
123
-
124
- export {
125
- dragContextMenu,
126
- dragElement,
127
- getHybridViewerCanvas,
128
- getHybridViewerCanvasBoundingBox,
129
- getQuickColormapPicker,
130
- hoverViewer,
131
- sceneContextMenu,
132
- stabilizeHoverTooltip,
133
- toggleInfoCard,
134
- viewerContextMenu,
135
- viewerQuickColormap,
136
- };
@@ -1,96 +0,0 @@
1
- // Third party imports
2
- import type { Page } from "@playwright/test";
3
-
4
- // Local imports
5
- // oxlint-disable-next-line unicorn/prefer-export-from
6
- import { afterActionWait, halfSecondWait } from "./constants";
7
- // oxlint-disable-next-line unicorn/prefer-export-from
8
- import { closeFeedbackSnackbar, moveMouseOutOfTheWay } from "./app_interaction";
9
- import { waitForActionSettled } from "./wait_for_action_settled";
10
-
11
- function noopCleanup(): unknown {
12
- return undefined;
13
- }
14
-
15
- async function findOverlappingObjectsPicker(window: Page): Promise<void> {
16
- let found = false;
17
- const points = [
18
- { x: 440, y: 530 },
19
- { x: 600, y: 400 },
20
- { x: 600, y: 500 },
21
- { x: 600, y: 300 },
22
- { x: 500, y: 400 },
23
- { x: 700, y: 400 },
24
- { x: 550, y: 450 },
25
- { x: 650, y: 350 },
26
- { x: 650, y: 450 },
27
- { x: 550, y: 350 },
28
- { x: 400, y: 400 },
29
- { x: 800, y: 400 },
30
- { x: 450, y: 550 },
31
- { x: 500, y: 500 },
32
- ];
33
-
34
- for (const { x, y } of points) {
35
- // oxlint-disable-next-line no-await-in-loop
36
- await window.getByTestId("hybridViewer").locator("canvas").click({
37
- button: "right",
38
- position: { x, y },
39
- delay: 100,
40
- });
41
- // oxlint-disable-next-line no-await-in-loop
42
- await waitForActionSettled(window);
43
-
44
- // oxlint-disable-next-line no-await-in-loop
45
- const items = await window.locator(".intermediate-picker-item").count();
46
- if (items >= 2) {
47
- found = true;
48
- break;
49
- }
50
- // oxlint-disable-next-line no-await-in-loop
51
- await window.keyboard.press("Escape");
52
- // oxlint-disable-next-line no-await-in-loop
53
- await window.waitForTimeout(halfSecondWait);
54
- }
55
-
56
- if (!found) {
57
- throw new Error(
58
- "Could not find overlapping objects picker anywhere! The test data might not be loaded or the picker is broken.",
59
- );
60
- }
61
- }
62
-
63
- export {
64
- afterActionWait,
65
- noopCleanup,
66
- closeFeedbackSnackbar,
67
- findOverlappingObjectsPicker,
68
- moveMouseOutOfTheWay,
69
- };
70
- export {
71
- dragContextMenu,
72
- dragElement,
73
- getHybridViewerCanvas,
74
- getHybridViewerCanvasBoundingBox,
75
- getQuickColormapPicker,
76
- hoverViewer,
77
- sceneContextMenu,
78
- stabilizeHoverTooltip,
79
- toggleInfoCard,
80
- viewerContextMenu,
81
- viewerQuickColormap,
82
- } from "./viewer_canvas";
83
- export {
84
- ensureFeatureVisible,
85
- ensureMenuOpen,
86
- openStyleMenu,
87
- resetMenuScroll,
88
- setCellsVisibility,
89
- setEdgesVisibility,
90
- setEdgesWidth,
91
- setPointsSize,
92
- setPointsVisibility,
93
- setPolygonsVisibility,
94
- setPolyhedraVisibility,
95
- setVisibilityGeneric,
96
- } from "./viewer_menu";
@@ -1,205 +0,0 @@
1
- // Third party imports
2
- import type { Page } from "@playwright/test";
3
-
4
- // Local imports
5
- import {
6
- COMPONENT_TYPE_TAB_SWITCHES,
7
- MODEL_TAB_SWITCHES,
8
- getActiveModelTabTestId,
9
- restoreModelTab,
10
- selectModelTab,
11
- } from "./model_tabs";
12
- import { halfSecondWait } from "./constants";
13
- import { moveMouseOutOfTheWay } from "./app_interaction";
14
- import { viewerContextMenu } from "./viewer_canvas";
15
- import { waitForActionSettled } from "./wait_for_action_settled";
16
-
17
- async function ensureMenuOpen(window: Page, menuTestId: string): Promise<void> {
18
- const centerButton = window.getByTestId("circularMenuCenterButton");
19
- if (!(await centerButton.isVisible())) {
20
- const contextMenuX = 549;
21
- const contextMenuY = 360;
22
- await viewerContextMenu(window, contextMenuX, contextMenuY);
23
- }
24
- const menuContainer = window.getByTestId(menuTestId);
25
- const activeCircularMenuItemButton = menuContainer.getByTestId("activeCircularMenuItemButton");
26
- if (!(await activeCircularMenuItemButton.isVisible())) {
27
- const activeMenuButton = window.getByTestId("activeCircularMenuItemButton");
28
- if (await activeMenuButton.isVisible()) {
29
- await activeMenuButton.click();
30
- await waitForActionSettled(window);
31
- }
32
- const menuButton = menuContainer
33
- .getByTestId("circularMenuItemButton")
34
- .or(menuContainer.getByTestId("activeCircularMenuItemButton"))
35
- .first();
36
- await menuButton.click();
37
- await waitForActionSettled(window);
38
- }
39
- }
40
-
41
- async function ensureFeatureVisible(window: Page, menuTestId: string): Promise<void> {
42
- const switchTestId = menuTestId.replace("Menu", "VisibilitySwitch");
43
- // The model switch can sit in a hidden tab
44
- const visibilitySwitch = window
45
- .getByTestId(switchTestId)
46
- .getByRole("checkbox", { includeHidden: true });
47
- if (await visibilitySwitch.isChecked()) {
48
- return;
49
- }
50
- const activeTabTestId = await getActiveModelTabTestId(window);
51
- if (MODEL_TAB_SWITCHES.has(switchTestId)) {
52
- await selectModelTab(window, "model");
53
- }
54
- await visibilitySwitch.check({ force: true });
55
- // Wait for conditionally rendered options to appear
56
- await window.waitForTimeout(halfSecondWait);
57
- await restoreModelTab(window, activeTabTestId);
58
- }
59
-
60
- async function setVisibilityGeneric(
61
- window: Page,
62
- menuTestId: string,
63
- switchTestId: string,
64
- visibility: boolean,
65
- ): Promise<void> {
66
- await ensureMenuOpen(window, menuTestId);
67
- if (MODEL_TAB_SWITCHES.has(switchTestId)) {
68
- await selectModelTab(window, "model");
69
- } else if (COMPONENT_TYPE_TAB_SWITCHES.has(switchTestId)) {
70
- await selectModelTab(window, "type");
71
- }
72
- const checkbox = window.getByTestId(switchTestId).getByRole("checkbox");
73
- if (visibility) {
74
- await checkbox.check();
75
- } else {
76
- await checkbox.uncheck();
77
- }
78
- await waitForActionSettled(window);
79
- }
80
-
81
- async function setFeatureVisibility(
82
- window: Page,
83
- viewerObjectType: string,
84
- feature: string,
85
- visibility: boolean,
86
- ): Promise<void> {
87
- const menuTestId = `${viewerObjectType}${feature}Menu`;
88
- const switchTestId = `${viewerObjectType}${feature}VisibilitySwitch`;
89
- await setVisibilityGeneric(window, menuTestId, switchTestId, visibility);
90
- }
91
-
92
- async function setFeatureSizeOrWidth(
93
- window: Page,
94
- viewerObjectType: string,
95
- feature: string,
96
- value: number,
97
- ): Promise<void> {
98
- const menuTestId = `${viewerObjectType}${feature}Menu`;
99
- let sliderTestId = `${viewerObjectType}${feature}SizeSlider`;
100
- if (feature === "Edges") {
101
- sliderTestId = `${viewerObjectType}${feature}WidthSlider`;
102
- }
103
- await ensureMenuOpen(window, menuTestId);
104
- await ensureFeatureVisible(window, menuTestId);
105
-
106
- const slider = window.getByTestId(sliderTestId);
107
- await slider
108
- .locator("input")
109
- .first()
110
- .evaluate((node: HTMLInputElement, val: string) => {
111
- node.value = val;
112
- node.dispatchEvent(new Event("input", { bubbles: true }));
113
- node.dispatchEvent(new Event("change", { bubbles: true }));
114
- }, value.toString());
115
- await waitForActionSettled(window);
116
- }
117
-
118
- // Specific feature functions
119
- async function setPointsVisibility(
120
- window: Page,
121
- viewerObjectType: string,
122
- visibility: boolean,
123
- ): Promise<void> {
124
- if (viewerObjectType === "model") {
125
- await setVisibilityGeneric(
126
- window,
127
- "modelPointsMenu",
128
- "modelPointsVisibilitySwitch",
129
- visibility,
130
- );
131
- return;
132
- }
133
- await setFeatureVisibility(window, viewerObjectType, "Points", visibility);
134
- }
135
- async function setEdgesVisibility(
136
- window: Page,
137
- viewerObjectType: string,
138
- visibility: boolean,
139
- ): Promise<void> {
140
- await setFeatureVisibility(window, viewerObjectType, "Edges", visibility);
141
- }
142
- async function setPolygonsVisibility(
143
- window: Page,
144
- viewerObjectType: string,
145
- visibility: boolean,
146
- ): Promise<void> {
147
- await setFeatureVisibility(window, viewerObjectType, "Polygons", visibility);
148
- }
149
- async function setPolyhedraVisibility(
150
- window: Page,
151
- viewerObjectType: string,
152
- visibility: boolean,
153
- ): Promise<void> {
154
- await setFeatureVisibility(window, viewerObjectType, "Polyhedra", visibility);
155
- }
156
- async function setCellsVisibility(
157
- window: Page,
158
- viewerObjectType: string,
159
- visibility: boolean,
160
- ): Promise<void> {
161
- await setFeatureVisibility(window, viewerObjectType, "Cells", visibility);
162
- }
163
-
164
- async function setPointsSize(window: Page, viewerObjectType: string, value: number): Promise<void> {
165
- await setFeatureSizeOrWidth(window, viewerObjectType, "Points", value);
166
- }
167
- async function setEdgesWidth(window: Page, viewerObjectType: string, value: number): Promise<void> {
168
- await setFeatureSizeOrWidth(window, viewerObjectType, "Edges", value);
169
- }
170
-
171
- async function resetMenuScroll(window: Page, scrollTop = 0): Promise<void> {
172
- await window.evaluate((top) => {
173
- const cardTexts = document.querySelectorAll(".v-card-text");
174
- for (const cardTextElement of cardTexts) {
175
- cardTextElement.scrollTop = top;
176
- }
177
- }, scrollTop);
178
- }
179
-
180
- async function openStyleMenu(window: Page, menuTestId: string): Promise<void> {
181
- const activeMenuButton = window.getByTestId("activeCircularMenuItemButton");
182
- if (await activeMenuButton.isVisible()) {
183
- await activeMenuButton.click();
184
- await waitForActionSettled(window);
185
- }
186
- await ensureMenuOpen(window, menuTestId);
187
- await resetMenuScroll(window, 0);
188
- await moveMouseOutOfTheWay(window);
189
- await waitForActionSettled(window);
190
- }
191
-
192
- export {
193
- ensureFeatureVisible,
194
- ensureMenuOpen,
195
- openStyleMenu,
196
- resetMenuScroll,
197
- setCellsVisibility,
198
- setEdgesVisibility,
199
- setEdgesWidth,
200
- setPointsSize,
201
- setPointsVisibility,
202
- setPolygonsVisibility,
203
- setPolyhedraVisibility,
204
- setVisibilityGeneric,
205
- };
@@ -1,108 +0,0 @@
1
- // Third party imports
2
- import type { Page } from "@playwright/test";
3
-
4
- // Local imports
5
- import { afterActionWait } from "./constants";
6
-
7
- // Browser-side state kept across page.evaluate calls by waitForDomSettled
8
- declare global {
9
- var e2eLastMutationAt: number | undefined;
10
- var e2eMutationObserver: MutationObserver | undefined;
11
- }
12
-
13
- function noopCleanup(): unknown {
14
- return undefined;
15
- }
16
-
17
- // App/layouts/default.vue renders a fixed top-of-page progress bar (data-testid "microservicesBusyIndicator") whenever infraStore.microservices_busy is true.
18
- // That getter is driven by each microservice's own request counter, so the indicator is the app's own authoritative signal that a backend or viewer RPC is in flight — waiting on it directly is more reliable than inferring activity from console log text.
19
- const BUSY_INDICATOR_TEST_ID = "microservicesBusyIndicator";
20
- const REQUEST_DISPATCH_GRACE_MS = 50;
21
- // Some backend RPCs (attribute-name lookups on a component with many items, for example) occasionally take several seconds under CI load, so the indicator gets generous headroom to clear.
22
- const BUSY_INDICATOR_HARD_CEILING_MS = 10_000;
23
-
24
- async function waitForMicroservicesIdle(window: Page, timeoutMs: number): Promise<void> {
25
- await window
26
- .getByTestId(BUSY_INDICATOR_TEST_ID)
27
- .waitFor({ state: "hidden", timeout: timeoutMs })
28
- .catch(noopCleanup);
29
- }
30
-
31
- async function isMicroservicesBusy(window: Page): Promise<boolean> {
32
- const busy = await window
33
- .getByTestId(BUSY_INDICATOR_TEST_ID)
34
- .isVisible()
35
- .catch(() => false);
36
- return busy;
37
- }
38
-
39
- const MUTATION_QUIET_MS = 250;
40
- const MUTATION_POLL_INTERVAL_MS = 20;
41
-
42
- async function waitForDomSettled(window: Page, budgetMs: number): Promise<void> {
43
- await window.evaluate((quietMs: number) => {
44
- globalThis.e2eLastMutationAt = performance.now();
45
- if (!globalThis.e2eMutationObserver) {
46
- const observer = new MutationObserver(() => {
47
- globalThis.e2eLastMutationAt = performance.now();
48
- });
49
- observer.observe(document.body, { attributes: true, childList: true, subtree: true });
50
- globalThis.e2eMutationObserver = observer;
51
- }
52
- void quietMs;
53
- }, MUTATION_QUIET_MS);
54
-
55
- await window
56
- .waitForFunction(
57
- (quietMs: number) => performance.now() - (globalThis.e2eLastMutationAt ?? 0) >= quietMs,
58
- MUTATION_QUIET_MS,
59
- { polling: MUTATION_POLL_INTERVAL_MS, timeout: budgetMs },
60
- )
61
- .catch(noopCleanup);
62
- }
63
-
64
- const MIN_DOM_SETTLE_BUDGET_MS = 250;
65
-
66
- // Vtk.js draws camera/colormap results straight to a <canvas>; that paint never touches the DOM, so neither the busy indicator nor the mutation observer can see it.
67
- // Waiting for two real animation frames after everything else has settled ensures the last frame is actually on screen before a screenshot is taken.
68
- async function waitForNextPaint(window: Page): Promise<void> {
69
- await window
70
- .evaluate(async () => {
71
- // oxlint-disable-next-line promise/avoid-new
72
- await new Promise<void>((resolve) => {
73
- requestAnimationFrame(() => {
74
- requestAnimationFrame(() => {
75
- resolve();
76
- });
77
- });
78
- });
79
- })
80
- .catch(noopCleanup);
81
- }
82
-
83
- // Multi-step actions (project import, for example) chain several requests with short gaps in between: the indicator briefly hides, then shows again.
84
- // The indeterminate bar animates through CSS only, so the DOM can look quiet while it is visible: re-check it after the DOM settles and start over if it came back.
85
- async function waitForIdleAndSettled(
86
- window: Page,
87
- startedAt: number,
88
- ceilingMs: number,
89
- deadline: number,
90
- ): Promise<void> {
91
- // A zero timeout means "no timeout" in Playwright
92
- await waitForMicroservicesIdle(window, Math.max(1, deadline - Date.now()));
93
- const remainingMs = Math.max(MIN_DOM_SETTLE_BUDGET_MS, ceilingMs - (Date.now() - startedAt));
94
- await waitForDomSettled(window, remainingMs);
95
- if (Date.now() < deadline && (await isMicroservicesBusy(window))) {
96
- await waitForIdleAndSettled(window, startedAt, ceilingMs, deadline);
97
- }
98
- }
99
-
100
- async function waitForActionSettled(window: Page, ceilingMs = afterActionWait): Promise<void> {
101
- const startedAt = Date.now();
102
- const deadline = startedAt + Math.max(ceilingMs, BUSY_INDICATOR_HARD_CEILING_MS);
103
- await window.waitForTimeout(Math.min(REQUEST_DISPATCH_GRACE_MS, ceilingMs));
104
- await waitForIdleAndSettled(window, startedAt, ceilingMs, deadline);
105
- await waitForNextPaint(window);
106
- }
107
-
108
- export { waitForActionSettled };