@geode/opengeodeweb-front 12.2.0-rc.1 → 12.2.0-rc.2

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 (46) hide show
  1. package/.build/server/utils/microservices_process.js +1 -1
  2. package/.build/tests/browser/helpers/crs.js +136 -0
  3. package/.build/tests/browser/helpers/crs_flows.js +60 -0
  4. package/.build/tests/browser/helpers/crs_shortlist.js +13 -0
  5. package/.build/tests/browser/helpers/crs_test_data.js +40 -0
  6. package/.build/tests/browser/suites/crs.js +142 -0
  7. package/.build/tests/browser/suites/crs_harmonize.js +63 -0
  8. package/.build/tests/browser/suites/crs_shortlist.js +31 -0
  9. package/.build/tests/browser/suites/index.js +6 -0
  10. package/app/app.config.ts +4 -0
  11. package/app/components/CrsAlign.vue +207 -0
  12. package/app/components/CrsDialog.vue +400 -0
  13. package/app/components/CrsDialogHost.vue +66 -0
  14. package/app/components/CrsSelector.vue +100 -3
  15. package/app/components/PickButton.vue +43 -0
  16. package/app/components/ProjectCrsDialog.vue +109 -0
  17. package/app/components/ToolPanel.vue +5 -2
  18. package/app/components/Viewer/CrsOverlays.vue +29 -0
  19. package/app/components/Viewer/Ui.vue +3 -2
  20. package/app/composables/crs.ts +197 -0
  21. package/app/composables/crs_align.ts +206 -0
  22. package/app/composables/crs_assign.ts +102 -0
  23. package/app/composables/crs_link.ts +22 -0
  24. package/app/composables/crs_shortlist.ts +63 -0
  25. package/app/composables/project_crs.ts +197 -0
  26. package/app/composables/user_setting.ts +140 -0
  27. package/app/stores/basemap.ts +19 -2
  28. package/app/stores/crs.ts +11 -106
  29. package/app/stores/crs_helpers/geographic_list.ts +44 -0
  30. package/app/stores/crs_helpers/project_crs.ts +60 -0
  31. package/app/stores/crs_helpers/requests.ts +60 -0
  32. package/app/utils/crs.ts +17 -1
  33. package/app/utils/import_item.ts +87 -0
  34. package/app/utils/import_workflow.ts +36 -94
  35. package/app/utils/reload_object.ts +26 -0
  36. package/package.json +1 -1
  37. package/server/utils/microservices_process.ts +4 -1
  38. package/tests/browser/data/test_lambert93_no_crs.og_pts3d +0 -0
  39. package/tests/browser/data/test_utm31n.og_pts3d +0 -0
  40. package/tests/browser/helpers/crs.ts +250 -0
  41. package/tests/browser/helpers/crs_flows.ts +115 -0
  42. package/tests/browser/helpers/crs_shortlist.ts +27 -0
  43. package/tests/browser/helpers/crs_test_data.ts +34 -0
  44. package/tests/browser/suites/crs.ts +228 -0
  45. package/tests/browser/suites/crs_harmonize.ts +96 -0
  46. package/tests/browser/suites/crs_shortlist.ts +37 -0
@@ -1,86 +1,26 @@
1
- // oxlint-disable promise/prefer-await-to-then
2
1
  // Third party imports
3
2
  import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
4
3
  import { consola } from "consola";
5
4
 
6
5
  // Local imports
7
- import { type LegacyDataId, fromLegacyDataId } from "@ogw_front/utils/legacy_data_id";
8
6
  import { type NewDataItem, useDataStore } from "@ogw_front/stores/data";
7
+ import type { CRS } from "@geode/opengeodeweb-back/schema_types";
9
8
  import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
10
9
  import type { GeodeObjectType } from "@geode/opengeodeweb-microservice/data_types";
11
10
  import type { GeodeObjectTyped } from "@ogw_front/types/identifiers";
11
+ import type { LegacyDataId } from "@ogw_front/utils/legacy_data_id";
12
+ import { importItem } from "@ogw_front/utils/import_item";
13
+ import { reloadObject } from "@ogw_front/utils/reload_object";
12
14
  import { useBackStore } from "@ogw_front/stores/back";
13
- import { useDataStyleStore } from "@ogw_front/stores/data_style";
14
- import { useFeedbackStore } from "@ogw_front/stores/feedback";
15
+ import { useCrsStore } from "@ogw_front/stores/crs";
15
16
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
17
+ import { useProjectCrs } from "@ogw_front/composables/project_crs";
16
18
  import { useTreeviewStore } from "@ogw_front/stores/treeview";
17
19
 
18
20
  interface FileToImport extends Readonly<GeodeObjectTyped> {
19
21
  readonly filename: string;
20
22
  }
21
23
 
22
- // NewDataItem has mutable array fields (mesh_components, collection_components), so it can't
23
- // Satisfy prefer-readonly-parameter-types deeply; left unfixed (same pattern as app/plugins/auto_store_register.ts).
24
- async function importDataItem(item: NewDataItem): Promise<string> {
25
- const dataStore = useDataStore();
26
- const dataStyleStore = useDataStyleStore();
27
- const hybridViewerStore = useHybridViewerStore();
28
- const treeviewStore = useTreeviewStore();
29
- if (item.nb_vertices === 0) {
30
- const feedbackStore = useFeedbackStore();
31
- feedbackStore.add_warning(`"${item.geode_object_type}" with name "${item.name}" is empty`);
32
- }
33
- const addDataTask = dataStore.addItem(item);
34
- const registerTask = addDataTask.then(async () => {
35
- if (!(await dataStore.isItemViewable(item))) {
36
- return undefined;
37
- }
38
- return dataStore.registerObject(item.data_id, item.name ?? item.data_id);
39
- });
40
- let addDataComponentsTask: Promise<string | undefined> = Promise.resolve(undefined);
41
- let addDataRelationsTask: Promise<string | undefined> = Promise.resolve(undefined);
42
- if (item.viewer_object_type === "model") {
43
- addDataComponentsTask = dataStore.addComponents(item);
44
- addDataRelationsTask = dataStore.addComponentRelations(item);
45
- }
46
- treeviewStore.addItem(
47
- item.geode_object_type,
48
- item.name ?? item.data_id,
49
- item.data_id,
50
- item.geode_id,
51
- item.viewer_object_type,
52
- );
53
- const addDataStyleTask = dataStyleStore.addDataStyle(item.data_id, item.geode_object_type);
54
- const addViewerTask = addDataTask.then(async () => {
55
- if (!(await dataStore.isItemViewable(item))) {
56
- return undefined;
57
- }
58
- return hybridViewerStore.addItem(item.data_id);
59
- });
60
- const applyStyleTask = Promise.all([registerTask, addDataComponentsTask, addDataStyleTask]).then(
61
- async () => {
62
- if (await dataStore.isItemViewable(item)) {
63
- return dataStyleStore.applyDefaultStyle(item.data_id);
64
- }
65
- return undefined;
66
- },
67
- );
68
- await Promise.all([
69
- registerTask,
70
- addDataTask,
71
- addDataComponentsTask,
72
- addDataRelationsTask,
73
- addViewerTask,
74
- applyStyleTask,
75
- ]);
76
- return item.data_id;
77
- }
78
- // Every item comes through here: from the back-end, which still names its data id `id`, or from a project
79
- async function importItem(imported: LegacyDataId<NewDataItem> | NewDataItem): Promise<string> {
80
- const item = fromLegacyDataId(imported);
81
- const dataId = await useTreeviewStore().untilLoaded(item.data_id, importDataItem(item));
82
- return dataId;
83
- }
84
24
  // A single file can hold several objects: every one of them is imported, ids are returned in the response order
85
25
  async function importFile(filename: string, geode_object_type: GeodeObjectType): Promise<string[]> {
86
26
  const backStore = useBackStore();
@@ -103,7 +43,7 @@ async function importFile(filename: string, geode_object_type: GeodeObjectType):
103
43
  return dataIds;
104
44
  }
105
45
 
106
- async function importWorkflow(files: readonly FileToImport[]): Promise<string[]> {
46
+ async function importFiles(files: readonly FileToImport[]): Promise<string[]> {
107
47
  const hybridViewerStore = useHybridViewerStore();
108
48
  // Files are imported concurrently and the viewer only frames the first actor to arrive, so the camera is reset once everything is loaded
109
49
  const wasSceneEmpty = Object.keys(hybridViewerStore.hybridDb).length === 0;
@@ -148,6 +88,32 @@ async function importWorkflow(files: readonly FileToImport[]): Promise<string[]>
148
88
  return results;
149
89
  }
150
90
 
91
+ // A harmonization failure is only logged: the import outcome does not depend on it
92
+ async function harmonize(ids: string[], projectCrs: CRS | undefined): Promise<void> {
93
+ try {
94
+ await useProjectCrs().harmonizeImportedCrs(ids, projectCrs);
95
+ } catch (error) {
96
+ consola.error("CRS harmonization failed:", error);
97
+ }
98
+ }
99
+
100
+ // When a file fails, the workflow throws without returning the imported ids: they are found by difference.
101
+ // The project CRS is read before the import, as the project follows the data as they land.
102
+ async function importWorkflow(files: readonly FileToImport[]): Promise<string[]> {
103
+ const { projectCrs } = useCrsStore();
104
+ const existingItems = await useDataStore().allItems();
105
+ const existingIds = new Set(existingItems.map((item) => item.data_id));
106
+ try {
107
+ const ids = await importFiles(files);
108
+ return ids;
109
+ } finally {
110
+ const items = await useDataStore().allItems();
111
+ const importedIds = items.map((item) => item.data_id).filter((id) => !existingIds.has(id));
112
+ // Conversions can be long: the caller is not kept waiting, the snackbars report the outcome
113
+ void harmonize(importedIds, projectCrs);
114
+ }
115
+ }
116
+
151
117
  // NewDataItem has mutable array fields (mesh_components, collection_components), so a readonly array of it can't satisfy prefer-readonly-parameter-types deeply; left unfixed (same pattern as app/plugins/auto_store_register.ts).
152
118
  async function importWorkflowFromSnapshot(
153
119
  items: readonly (LegacyDataId<NewDataItem> | NewDataItem)[],
@@ -182,25 +148,6 @@ async function importWorkflowFromSnapshot(
182
148
  return ids;
183
149
  }
184
150
 
185
- // Reloads the viewer object under the same id with its stored style, after the back rewrote its files.
186
- async function reloadObject(
187
- dataId: DataId,
188
- { rebuildActor = false }: { rebuildActor?: boolean } = {},
189
- ): Promise<void> {
190
- const dataStore = useDataStore();
191
- const dataStyleStore = useDataStyleStore();
192
- const hybridViewerStore = useHybridViewerStore();
193
- const item = await dataStore.item(dataId);
194
- await dataStore.deregisterObject(dataId);
195
- await dataStore.registerObject(dataId, item.name ?? dataId);
196
- // Only when the geometry moved: the local actor is rebuilt from the stored light viewable
197
- if (rebuildActor) {
198
- await hybridViewerStore.addItem(dataId);
199
- }
200
- await dataStyleStore.applyDefaultStyle(dataId);
201
- await hybridViewerStore.remoteRender();
202
- }
203
-
204
151
  // The time series only adds attributes to the model, so the viewer object is reloaded.
205
152
  async function applyTimeSeriesWorkflow(filename: string, dataId: DataId): Promise<string> {
206
153
  const backStore = useBackStore();
@@ -212,11 +159,6 @@ async function applyTimeSeriesWorkflow(filename: string, dataId: DataId): Promis
212
159
  return dataId;
213
160
  }
214
161
 
215
- export {
216
- importFile,
217
- importWorkflow,
218
- importWorkflowFromSnapshot,
219
- importItem,
220
- applyTimeSeriesWorkflow,
221
- reloadObject,
222
- };
162
+ export { importFile, importWorkflow, importWorkflowFromSnapshot, applyTimeSeriesWorkflow };
163
+ export { importItem } from "@ogw_front/utils/import_item";
164
+ export { reloadObject } from "@ogw_front/utils/reload_object";
@@ -0,0 +1,26 @@
1
+ // Local imports
2
+ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
3
+ import { useDataStore } from "@ogw_front/stores/data";
4
+ import { useDataStyleStore } from "@ogw_front/stores/data_style";
5
+ import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
6
+
7
+ // Reloads the viewer object under the same id with its stored style, after the back rewrote its files.
8
+ async function reloadObject(
9
+ dataId: DataId,
10
+ { rebuildActor = false }: { rebuildActor?: boolean } = {},
11
+ ): Promise<void> {
12
+ const dataStore = useDataStore();
13
+ const dataStyleStore = useDataStyleStore();
14
+ const hybridViewerStore = useHybridViewerStore();
15
+ const item = await dataStore.item(dataId);
16
+ await dataStore.deregisterObject(dataId);
17
+ await dataStore.registerObject(dataId, item.name ?? dataId);
18
+ // Only when the geometry moved: the local actor is rebuilt from the stored light viewable
19
+ if (rebuildActor) {
20
+ await hybridViewerStore.addItem(dataId);
21
+ }
22
+ await dataStyleStore.applyDefaultStyle(dataId);
23
+ await hybridViewerStore.remoteRender();
24
+ }
25
+
26
+ export { reloadObject };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "12.2.0-rc.1",
3
+ "version": "12.2.0-rc.2",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -55,8 +55,11 @@ async function runScript(
55
55
  }
56
56
  }
57
57
 
58
+ // Windows reports a taken port as WinError 10048 ("only one usage of each socket address")
58
59
  function isPortInUseError(error: unknown): boolean {
59
- return /EADDRINUSE|address already in use|port already in use/iu.test(String(error));
60
+ return /EADDRINUSE|address already in use|port already in use|only one usage of each socket address/iu.test(
61
+ String(error),
62
+ );
60
63
  }
61
64
 
62
65
  function resolveUploadFolderPath(
@@ -0,0 +1,250 @@
1
+ // Third party imports
2
+ import { type Locator, type Page, expect } from "@playwright/test";
3
+
4
+ // Local imports
5
+ import { closeFeedbackSnackbar, moveMouseOutOfTheWay } from "./app_interaction";
6
+ import { expandGeodeObjectTypeInTree, getTreeRowByTextAndParent } from "./object_trees/common";
7
+ import { getMainObjectTree } from "./object_trees/main_object_tree";
8
+ import { waitForActionSettled } from "./wait_for_action_settled";
9
+
10
+ const TOOLTIP_TIMEOUT_MS = 2000;
11
+ const TOOLTIP_HOVER_ATTEMPTS = 3;
12
+
13
+ async function getDataTreeRow(
14
+ window: Page,
15
+ geodeObjectType: string,
16
+ dataName: string,
17
+ ): Promise<Locator> {
18
+ const tree = getMainObjectTree(window);
19
+ await expandGeodeObjectTypeInTree(window, geodeObjectType, tree);
20
+ return getTreeRowByTextAndParent(window, geodeObjectType, dataName, tree);
21
+ }
22
+
23
+ // The tooltip opens on mouseenter: a hover landing while the tree re-renders misses it, so it is retried from
24
+ // Outside the row
25
+ async function hoverTreeRowTooltip(window: Page, row: Locator, target: Locator): Promise<void> {
26
+ // Each attempt waits for the previous hover: they must run one after another
27
+ // oxlint-disable no-await-in-loop
28
+ for (let attempt = 1; attempt <= TOOLTIP_HOVER_ATTEMPTS; attempt += 1) {
29
+ await moveMouseOutOfTheWay(window);
30
+ await row.getByTestId("treeItemLabel").first().hover();
31
+ const shown = await target
32
+ .waitFor({ state: "visible", timeout: TOOLTIP_TIMEOUT_MS })
33
+ .then(() => true)
34
+ .catch(() => false);
35
+ if (shown) {
36
+ return;
37
+ }
38
+ }
39
+ // oxlint-enable no-await-in-loop
40
+ throw new Error(`The tree tooltip did not open after ${TOOLTIP_HOVER_ATTEMPTS} hovers`);
41
+ }
42
+
43
+ async function openCrsFromTree(
44
+ window: Page,
45
+ geodeObjectType: string,
46
+ dataName: string,
47
+ ): Promise<void> {
48
+ const row = await getDataTreeRow(window, geodeObjectType, dataName);
49
+ const editButton = window.locator(".v-overlay--active").getByTestId("editCrsBtn");
50
+ await hoverTreeRowTooltip(window, row, editButton);
51
+ await editButton.click();
52
+ await waitForActionSettled(window);
53
+ }
54
+
55
+ // The tooltip of the tree row shows the crs of the data
56
+ async function expectTreeCrs(
57
+ window: Page,
58
+ geodeObjectType: string,
59
+ dataName: string,
60
+ expected: string,
61
+ ): Promise<void> {
62
+ const row = await getDataTreeRow(window, geodeObjectType, dataName);
63
+ const crsValue = window.locator(".v-overlay--active").getByTestId("tooltipCrsValue");
64
+ await hoverTreeRowTooltip(window, row, crsValue);
65
+ await expect(crsValue).toContainText(expected);
66
+ }
67
+
68
+ async function openCrsFromInfoCard(
69
+ window: Page,
70
+ geodeObjectType: string,
71
+ dataName: string,
72
+ ): Promise<void> {
73
+ const row = await getDataTreeRow(window, geodeObjectType, dataName);
74
+ await row.click({ button: "right" });
75
+ await waitForActionSettled(window);
76
+ await window.getByTestId("circularMenuCenterButton").click();
77
+ await window.getByTestId("infoEditCrsBtn").click();
78
+ await waitForActionSettled(window);
79
+ }
80
+
81
+ // The warning icon of the tree opens the crs dialog of the data
82
+ async function openCrsFromWarning(
83
+ window: Page,
84
+ geodeObjectType: string,
85
+ dataName: string,
86
+ ): Promise<void> {
87
+ const row = await getDataTreeRow(window, geodeObjectType, dataName);
88
+ await row.getByTestId("crsMismatchIcon").click();
89
+ await waitForActionSettled(window);
90
+ }
91
+
92
+ async function openCrsFromFeedback(window: Page, text: string): Promise<void> {
93
+ const snackbar = window.getByTestId("feedbackSnackbar").filter({ hasText: text });
94
+ await expect(snackbar).toBeVisible();
95
+ await snackbar.getByTestId("feedbackActionBtn").click();
96
+ await waitForActionSettled(window);
97
+ }
98
+
99
+ // Selecting is its own step so the dialog state is captured before the action
100
+ async function selectCrs(window: Page, crsName: string): Promise<void> {
101
+ await window.getByTestId("crsSearchInput").locator("input").fill(crsName);
102
+ // A click on the row selects it: the list has no checkbox column
103
+ await window.locator("tbody tr").filter({ hasText: crsName }).first().click();
104
+ await waitForActionSettled(window);
105
+ }
106
+
107
+ async function confirmAssign(window: Page): Promise<void> {
108
+ await window.getByTestId("crsAssignButton").click();
109
+ await waitForActionSettled(window);
110
+ // The global feedback snackbar outlives the next step: close it so screenshots stay stable
111
+ await closeFeedbackSnackbar(window);
112
+ }
113
+
114
+ async function expectCurrentCrs(window: Page, expected: string): Promise<void> {
115
+ await expect(window.getByTestId("crsCurrentValue")).toContainText(expected);
116
+ }
117
+
118
+ // A georeferenced data opens on convert
119
+ async function selectAssignMode(window: Page): Promise<void> {
120
+ await window.getByTestId("crsModeAssign").click();
121
+ await waitForActionSettled(window);
122
+ }
123
+
124
+ // Without closing the feedback: the step checks the dialog or the warning it shows
125
+ async function clickAssign(window: Page): Promise<void> {
126
+ await window.getByTestId("crsAssignButton").click();
127
+ await waitForActionSettled(window);
128
+ }
129
+
130
+ // The snackbar leaves after 10s: a slow basemap build (external tile servers) can outlast it while the action
131
+ // Settles, so it is watched from before the action
132
+ const FEEDBACK_TIMEOUT_MS = 60_000;
133
+
134
+ async function expectFeedback(
135
+ window: Page,
136
+ text: string,
137
+ action: () => Promise<void>,
138
+ ): Promise<void> {
139
+ const shown = window
140
+ .getByTestId("feedbackSnackbar")
141
+ .filter({ hasText: text })
142
+ // Several builds can fail with the same message (e.g. one per aligned data): any of them will do
143
+ .first()
144
+ .waitFor({ state: "visible", timeout: FEEDBACK_TIMEOUT_MS });
145
+ await Promise.all([shown, action()]);
146
+ await closeFeedbackSnackbar(window);
147
+ }
148
+
149
+ async function selectConvertMode(window: Page): Promise<void> {
150
+ await window.getByTestId("crsModeConvert").click();
151
+ await waitForActionSettled(window);
152
+ }
153
+
154
+ async function confirmConvert(window: Page): Promise<void> {
155
+ await window.getByTestId("crsConvertButton").click();
156
+ await waitForActionSettled(window);
157
+ await closeFeedbackSnackbar(window);
158
+ }
159
+
160
+ async function startAlignment(window: Page): Promise<void> {
161
+ await window.getByTestId("crsModeAlign").click();
162
+ await window.getByTestId("crsStartAlignButton").click();
163
+ await waitForActionSettled(window);
164
+ // The mouse left on the button would open its tooltip over the panel
165
+ await moveMouseOutOfTheWay(window);
166
+ }
167
+
168
+ async function fillAlignPoints(
169
+ window: Page,
170
+ prefix: "crsAlignSource" | "crsAlignTarget",
171
+ points: { x: number; y: number }[],
172
+ ): Promise<void> {
173
+ // Fills share the keyboard focus: they must run one after another
174
+ // oxlint-disable no-await-in-loop
175
+ for (const [index, { x, y }] of points.entries()) {
176
+ const inputs = window.getByTestId(`${prefix}-${index}`).locator("input");
177
+ await inputs.nth(0).fill(String(x));
178
+ await inputs.nth(1).fill(String(y));
179
+ }
180
+ // oxlint-enable no-await-in-loop
181
+ }
182
+
183
+ async function selectAlignmentCrs(window: Page, crsName: string): Promise<void> {
184
+ const panel = window.getByTestId("crsAlignPanel");
185
+ await panel.getByTestId("crsSearchInput").locator("input").fill(crsName);
186
+ await panel.locator("tbody tr").filter({ hasText: crsName }).first().click();
187
+ await waitForActionSettled(window);
188
+ }
189
+
190
+ // "All data" or "This data only", in the crs dialog (crsScope) or the align panel (crsAlignScope)
191
+ async function selectScope(
192
+ window: Page,
193
+ scope: "all" | "one",
194
+ testId: "crsScope" | "crsAlignScope" = "crsScope",
195
+ ): Promise<void> {
196
+ await window.getByTestId(`${testId}-${scope}`).locator("input").check();
197
+ await waitForActionSettled(window);
198
+ }
199
+
200
+ async function expectCrsMismatch(
201
+ window: Page,
202
+ geodeObjectType: string,
203
+ dataName: string,
204
+ expected: boolean,
205
+ ): Promise<void> {
206
+ const row = await getDataTreeRow(window, geodeObjectType, dataName);
207
+ // The icon only exists on a mismatched data
208
+ await expect(row.getByTestId("crsMismatchIcon")).toHaveCount(expected ? 1 : 0);
209
+ }
210
+
211
+ async function openProjectCrs(window: Page): Promise<void> {
212
+ await window.getByTestId("projectCrs").click();
213
+ await waitForActionSettled(window);
214
+ }
215
+
216
+ async function confirmProjectCrs(window: Page): Promise<void> {
217
+ await window.getByTestId("projectCrsApply").click();
218
+ await waitForActionSettled(window);
219
+ await closeFeedbackSnackbar(window);
220
+ }
221
+
222
+ async function applyAlignment(window: Page): Promise<void> {
223
+ await window.getByTestId("crsAlignApplyButton").click();
224
+ await waitForActionSettled(window);
225
+ await closeFeedbackSnackbar(window);
226
+ }
227
+
228
+ export {
229
+ applyAlignment,
230
+ clickAssign,
231
+ confirmAssign,
232
+ confirmConvert,
233
+ confirmProjectCrs,
234
+ expectCrsMismatch,
235
+ expectCurrentCrs,
236
+ expectFeedback,
237
+ expectTreeCrs,
238
+ fillAlignPoints,
239
+ openCrsFromFeedback,
240
+ openCrsFromInfoCard,
241
+ openCrsFromTree,
242
+ openCrsFromWarning,
243
+ openProjectCrs,
244
+ selectAlignmentCrs,
245
+ selectAssignMode,
246
+ selectConvertMode,
247
+ selectCrs,
248
+ selectScope,
249
+ startAlignment,
250
+ };
@@ -0,0 +1,115 @@
1
+ // Third party imports
2
+ import { type Page, expect } from "@playwright/test";
3
+
4
+ // Local imports
5
+ import { BREP_NAME, CURVE_NAME, POINTSET_NAME } from "./crs_test_data";
6
+ import {
7
+ applyAlignment,
8
+ clickAssign,
9
+ confirmConvert,
10
+ expectFeedback,
11
+ expectTreeCrs,
12
+ fillAlignPoints,
13
+ openCrsFromTree,
14
+ selectAlignmentCrs,
15
+ selectAssignMode,
16
+ selectConvertMode,
17
+ selectCrs,
18
+ selectScope,
19
+ } from "./crs";
20
+ import {
21
+ brepGeodeObjectType,
22
+ edgedCurveGeodeObjectType,
23
+ pointSetGeodeObjectType,
24
+ } from "./constants";
25
+ import { closeFeedbackSnackbar, moveMouseOutOfTheWay } from "./app_interaction";
26
+ import { getMainObjectTree } from "./object_trees/main_object_tree";
27
+ import { waitForActionSettled } from "./wait_for_action_settled";
28
+
29
+ async function closeCrsDialog(window: Page): Promise<void> {
30
+ await window.keyboard.press("Escape");
31
+ await moveMouseOutOfTheWay(window);
32
+ }
33
+
34
+ // The point set, the model and the curve of the crs suite
35
+ async function expectEveryRowCrs(window: Page, expected: string): Promise<void> {
36
+ await expectTreeCrs(window, pointSetGeodeObjectType, POINTSET_NAME, expected);
37
+ await expectTreeCrs(window, brepGeodeObjectType, BREP_NAME, expected);
38
+ await expectTreeCrs(window, edgedCurveGeodeObjectType, CURVE_NAME, expected);
39
+ }
40
+
41
+ async function fillAlignment(
42
+ window: Page,
43
+ source: { x: number; y: number }[],
44
+ target: { x: number; y: number }[],
45
+ crsName: string,
46
+ ): Promise<void> {
47
+ await fillAlignPoints(window, "crsAlignSource", source);
48
+ await fillAlignPoints(window, "crsAlignTarget", target);
49
+ await selectAlignmentCrs(window, crsName);
50
+ await moveMouseOutOfTheWay(window);
51
+ }
52
+
53
+ async function convertAloneTo(
54
+ window: Page,
55
+ geodeObjectType: string,
56
+ dataName: string,
57
+ crsName: string,
58
+ ): Promise<void> {
59
+ await openCrsFromTree(window, geodeObjectType, dataName);
60
+ await selectConvertMode(window);
61
+ await selectScope(window, "one");
62
+ await selectCrs(window, crsName);
63
+ await confirmConvert(window);
64
+ await moveMouseOutOfTheWay(window);
65
+ }
66
+
67
+ async function startMisfitAssign(
68
+ window: Page,
69
+ geodeObjectType: string,
70
+ dataName: string,
71
+ crsName: string,
72
+ ): Promise<void> {
73
+ await openCrsFromTree(window, geodeObjectType, dataName);
74
+ await selectAssignMode(window);
75
+ await selectCrs(window, crsName);
76
+ await clickAssign(window);
77
+ }
78
+
79
+ async function assignAnywayToAll(window: Page, crsName: string): Promise<void> {
80
+ await selectAssignMode(window);
81
+ await selectScope(window, "all");
82
+ await selectCrs(window, crsName);
83
+ await clickAssign(window);
84
+ await window.getByTestId("crsAssignAnyway").click();
85
+ await waitForActionSettled(window);
86
+ await closeFeedbackSnackbar(window);
87
+ await moveMouseOutOfTheWay(window);
88
+ }
89
+
90
+ // With a basemap (only in the apps that opt in), an alignment moving the data out of the domain of the project CRS
91
+ // Makes the basemap build fail: its message shows and the basemap is hidden. Without one, nothing else happens
92
+ async function applyAlignmentOffTheMap(window: Page): Promise<void> {
93
+ const basemapRow = getMainObjectTree(window)
94
+ .getByTestId("treeRowWrapper")
95
+ .filter({ hasText: "Basemap" });
96
+ if ((await basemapRow.count()) === 0) {
97
+ await applyAlignment(window);
98
+ return;
99
+ }
100
+ await expectFeedback(window, "Area outside the map projection limits", async () => {
101
+ await applyAlignment(window);
102
+ });
103
+ // Only the last build hides the basemap: no other message comes after
104
+ await expect(basemapRow.getByTestId("hiddenObjectEyeButton")).toBeVisible();
105
+ }
106
+
107
+ export {
108
+ applyAlignmentOffTheMap,
109
+ assignAnywayToAll,
110
+ closeCrsDialog,
111
+ convertAloneTo,
112
+ expectEveryRowCrs,
113
+ fillAlignment,
114
+ startMisfitAssign,
115
+ };
@@ -0,0 +1,27 @@
1
+ // Third party imports
2
+ import { type Page, expect } from "@playwright/test";
3
+
4
+ // Local imports
5
+ import { waitForActionSettled } from "./wait_for_action_settled";
6
+
7
+ // The star of a CRS row adds it to the favorites, kept as a chip above the search
8
+ async function toggleFavoriteCrs(window: Page, crsName: string): Promise<void> {
9
+ await window.getByTestId("crsSearchInput").locator("input").fill(crsName);
10
+ await window
11
+ .locator("tbody tr")
12
+ .filter({ hasText: crsName })
13
+ .first()
14
+ .getByTestId("crsFavoriteToggle")
15
+ .click();
16
+ await waitForActionSettled(window);
17
+ }
18
+
19
+ async function expectCrsChip(
20
+ window: Page,
21
+ kind: "crsFavoriteChip" | "crsRecentChip",
22
+ code: string,
23
+ ): Promise<void> {
24
+ await expect(window.getByTestId(kind).filter({ hasText: code })).toBeVisible();
25
+ }
26
+
27
+ export { expectCrsChip, toggleFavoriteCrs };
@@ -0,0 +1,34 @@
1
+ const BREP_FILE = "test.og_brep";
2
+ const POINTSET_FILE = "test.og_pts3d";
3
+ // Wells-like data sharing the local frame of the model: aligned with it
4
+ const CURVE_FILE = "test.og_edc3d";
5
+ const POINTSET_NAME = "test";
6
+ const BREP_NAME = "test";
7
+ const CURVE_NAME = "test";
8
+ const LAMBERT_93 = "RGF93 v1 / Lambert-93";
9
+ const UTM_31N = "WGS 84 / UTM zone 31N";
10
+ const CC42 = "RGF93 v1 / CC42";
11
+ const ALIGN_SOURCE = [
12
+ { x: 0, y: 0 },
13
+ { x: 1, y: 0 },
14
+ { x: 0, y: 1 },
15
+ ];
16
+ const ALIGN_TARGET = [
17
+ { x: 700_000, y: 6_600_000 },
18
+ { x: 700_010, y: 6_600_000 },
19
+ { x: 700_000, y: 6_600_010 },
20
+ ];
21
+
22
+ export {
23
+ ALIGN_SOURCE,
24
+ ALIGN_TARGET,
25
+ BREP_FILE,
26
+ BREP_NAME,
27
+ CC42,
28
+ CURVE_FILE,
29
+ CURVE_NAME,
30
+ LAMBERT_93,
31
+ POINTSET_FILE,
32
+ POINTSET_NAME,
33
+ UTM_31N,
34
+ };