@sumaris-net/ngx-components 21.0.0-rc5 → 21.0.0-rc7

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.
package/doc/changelog.md CHANGED
@@ -2197,7 +2197,7 @@ enh: Environment: add useHash property to configure Angular router to use hash U
2197
2197
 
2198
2198
  ## 18.23.68
2199
2199
  - enh(theme): add responsive `min-width` utility classes for select panel - Allow to use panelClass with :
2200
- * mobile/desktop: `min-width-fit-content`, `min-width-medium`, `min-width-large`, `min-width-xlarge` , `min-width-80vw` :
2200
+ * mobile/desktop: `min-width-fit-content`, `min-width-medium`, `min-width-large`, `min-width-xlarge` , `min-width-80vw` :
2201
2201
  * mobile only: `mat-select-panel-fit-content`|`mat-select-panel-medium-size`|`mat-select-panel-large-size`|`mat-select-panel-xlarge-size`|`mat-select-panel-80vw-size`
2202
2202
 
2203
2203
  ## 18.23.69
@@ -2213,7 +2213,7 @@ enh: Environment: add useHash property to configure Angular router to use hash U
2213
2213
  ## 18.24.0
2214
2214
  - enh(form-container) Allow to call `addForm()`, `addForms()` and `removeForm()` with a FormGroup argument (it will be wrapped into AppForm)
2215
2215
 
2216
- ## 18.24.1 - 18.24.2
2216
+ ## 18.24.1 - 18.24.2
2217
2217
  - enh(editor) Fix error in `saveDirtyChildren()` error, when having no children
2218
2218
 
2219
2219
  ## 18.24.3
@@ -2224,3 +2224,22 @@ enh: Environment: add useHash property to configure Angular router to use hash U
2224
2224
 
2225
2225
  ## 18.24.7
2226
2226
  - fix(menu): fix color in svg icon
2227
+
2228
+ ## 18.24.9
2229
+ - fix(platform) Fix version.appup parsing (avoid infinite loop when on '-alpha' versions)
2230
+ - enh(upload-popover) Allow overriding buttons text
2231
+
2232
+ ## 18.24.12
2233
+ - enh(images.utils) Add `ImagesUtils.writeBase64ToFile`
2234
+
2235
+ ## 18.24.14
2236
+ - enh(form.pipes): Add new pipes for accessing FormArray controls and groups
2237
+ - fix(dates) Fix fromDateISOString() when requiredTime and no millisecond given
2238
+ - test(validators): Add unit tests for `validDate` and `validDateAllowNoTime` validation methods
2239
+
2240
+ ## 18.24.18
2241
+ - fix(tab-editor) Fix event argument typing, in `AppTabEditor.onSwipeTab()`
2242
+
2243
+ ## 21.0.0
2244
+ - enh(core) Migration to Angular 21 and Ionic 8
2245
+ - enh(e2e) Allow to run e2e on many peer/login, using file `e2e/.environments.json` or `.environments.json` (or `.local/environments.json`)
@@ -0,0 +1,496 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
3
+ import { test } from '@playwright/test';
4
+
5
+ /**
6
+ * Utility selectors and helpers for Ionic components in e2e tests.
7
+ */
8
+ const IonicSelectors = {
9
+ /** Ionic button */
10
+ button: 'ion-button',
11
+ /** Ionic modal */
12
+ modal: 'ion-modal',
13
+ /** Ionic content area */
14
+ content: 'ion-content',
15
+ /** Ionic item */
16
+ item: 'ion-item',
17
+ /** Ionic label */
18
+ label: 'ion-label',
19
+ /** Ionic spinner */
20
+ spinner: 'ion-spinner',
21
+ /** Ionic skeleton text (loading placeholder) */
22
+ skeletonText: 'ion-skeleton-text',
23
+ /** Ionic back button */
24
+ backButton: 'ion-back-button',
25
+ /** Ionic toolbar */
26
+ toolbar: 'ion-toolbar',
27
+ /** Ionic footer */
28
+ footer: 'ion-footer',
29
+ /** Ionic header */
30
+ header: 'ion-header',
31
+ };
32
+ /**
33
+ * Helper functions for interacting with Ionic components.
34
+ */
35
+ class IonicHelper {
36
+ page;
37
+ constructor(page) {
38
+ this.page = page;
39
+ }
40
+ /** Get an Ionic button by text content */
41
+ buttonByText(text) {
42
+ return this.page.locator(IonicSelectors.button, { hasText: text });
43
+ }
44
+ /** Get an Ionic button by CSS selector */
45
+ button(selector, options) {
46
+ const fullSelector = selector ? `${IonicSelectors.button}${selector}` : IonicSelectors.button;
47
+ return this.page.locator(fullSelector, options);
48
+ }
49
+ /**
50
+ * Get an Ionic modal by its inner component selector (e.g. 'app-auth-form').
51
+ * Automatically wraps the selector in `ion-modal:has(...)` so callers
52
+ * only need to provide the component tag name.
53
+ */
54
+ modal(selector) {
55
+ const fullSelector = selector.startsWith('ion-modal') ? selector : `ion-modal:has(${selector})`;
56
+ return this.page.locator(fullSelector);
57
+ }
58
+ /** Wait for the Ionic app to be ready */
59
+ async waitForAppReady(timeout = 15_000) {
60
+ // Wait for ion-app to be attached (Angular bootstrap complete)
61
+ await this.page.waitForSelector('ion-app', { state: 'attached', timeout });
62
+ }
63
+ /** Wait for loading spinners to disappear */
64
+ async waitForLoadingComplete(timeout = 15_000) {
65
+ await this.page.locator(IonicSelectors.spinner).waitFor({ state: 'hidden', timeout }).catch(() => {
66
+ // Spinner may not appear at all — that's fine
67
+ });
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Utility selectors and helpers for Angular Material components in e2e tests.
73
+ */
74
+ const MaterialSelectors = {
75
+ /** Material table row */
76
+ row: 'mat-row, tr[mat-row]',
77
+ /** Material header row */
78
+ headerRow: 'mat-header-row, tr[mat-header-row]',
79
+ /** Material cell */
80
+ cell: 'mat-cell, td[mat-cell]',
81
+ /** Material form field */
82
+ formField: 'mat-form-field',
83
+ /** Material input */
84
+ input: 'input[matInput]',
85
+ /** Material tab group */
86
+ tabGroup: 'mat-tab-group',
87
+ /** Material tab label */
88
+ tabLabel: '.mat-mdc-tab',
89
+ /** Material paginator */
90
+ paginator: 'mat-paginator',
91
+ /** Material icon */
92
+ icon: 'mat-icon',
93
+ /** Material autocomplete panel */
94
+ autocompletePanel: '.mat-mdc-autocomplete-panel',
95
+ /** Material autocomplete option */
96
+ autocompleteOption: 'mat-option',
97
+ };
98
+ /**
99
+ * Helper functions for interacting with Angular Material components.
100
+ */
101
+ class MaterialHelper {
102
+ page;
103
+ constructor(page) {
104
+ this.page = page;
105
+ }
106
+ /** Get all visible table rows, optionally scoped to a parent locator */
107
+ tableRows(scope) {
108
+ const root = scope ?? this.page;
109
+ return root.locator(MaterialSelectors.row);
110
+ }
111
+ /** Get a single table row by index (0-based), optionally scoped to a parent locator */
112
+ tableRow(index, scope) {
113
+ return this.tableRows(scope).nth(index);
114
+ }
115
+ /** Click on a table row by index (0-based), optionally scoped to a parent locator */
116
+ async clickRow(index, scope) {
117
+ await this.tableRow(index, scope).click();
118
+ }
119
+ /** Get a tab by its label text */
120
+ tabByLabel(text) {
121
+ return this.page.locator(MaterialSelectors.tabLabel, { hasText: text });
122
+ }
123
+ /** Click a tab by its label text */
124
+ async clickTab(text) {
125
+ await this.tabByLabel(text).click();
126
+ }
127
+ /** Fill a mat-form-field input identified by its formControlName.
128
+ * Supports both native inputs with formcontrolname and custom components (e.g. mat-autocomplete-field) wrapping an input. */
129
+ async fillFormControl(formControlName, value) {
130
+ // Try native input first, then fall back to custom component wrapper
131
+ const nativeInput = this.page.locator(`${MaterialSelectors.formField} input[formcontrolname="${formControlName}"]`);
132
+ const wrappedInput = this.page.locator(`[formcontrolname="${formControlName}"] input`);
133
+ const input = (await nativeInput.count()) > 0 ? nativeInput : wrappedInput;
134
+ // Click the parent mat-form-field to ensure focus reaches the input
135
+ const formField = input.locator('xpath=ancestor::mat-form-field');
136
+ if ((await formField.count()) > 0) {
137
+ await formField.first().click();
138
+ }
139
+ else {
140
+ await input.click({ force: true });
141
+ }
142
+ await input.pressSequentially(value, { delay: 50 });
143
+ }
144
+ /**
145
+ * Select an option from a mat-select dropdown by formControlName.
146
+ * Opens the dropdown, waits for options to render, clicks the matching option, then waits for the dropdown to close.
147
+ */
148
+ async selectMatSelectOption(formControlName, optionText) {
149
+ const select = this.page.locator(`mat-select[formcontrolname="${formControlName}"]`);
150
+ await select.click();
151
+ // Use role-based selector: mat-select renders options with role="option" in a listbox
152
+ const option = this.page.getByRole('option', { name: optionText });
153
+ await option.waitFor({ state: 'visible', timeout: 10_000 });
154
+ await option.click();
155
+ // Wait for the option to disappear (dropdown closed)
156
+ await option.waitFor({ state: 'hidden', timeout: 5_000 });
157
+ }
158
+ /** Select an autocomplete option by text after typing in a form control */
159
+ async selectAutocompleteOption(formControlName, searchText, optionText) {
160
+ await this.fillFormControl(formControlName, searchText);
161
+ const panel = this.page.locator(MaterialSelectors.autocompletePanel);
162
+ await panel.waitFor({ state: 'visible', timeout: 10_000 });
163
+ await panel.locator(MaterialSelectors.autocompleteOption, { hasText: optionText }).click();
164
+ }
165
+ /** Wait for table rows to be loaded (at least one row visible), optionally scoped to a parent locator */
166
+ async waitForTableRows(timeout = 15_000, scope) {
167
+ await this.tableRows(scope).first().waitFor({ state: 'visible', timeout });
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Common UI helper functions to improve readability of e2e tests.
173
+ * This helper centralizes access to Ionic and Material specific helpers.
174
+ */
175
+ class UiHelper {
176
+ page;
177
+ ionic;
178
+ mat;
179
+ constructor(page) {
180
+ this.page = page;
181
+ this.ionic = new IonicHelper(page);
182
+ this.mat = new MaterialHelper(page);
183
+ }
184
+ /**
185
+ * Click an element and wait for it to be ready.
186
+ * @param locator The locator to click.
187
+ * @param timeout The maximum time to wait.
188
+ */
189
+ async click(locator, timeout = 10_000) {
190
+ await locator.waitFor({ state: 'visible', timeout });
191
+ // force: true bypasses Ionic overlay elements (ion-col, ion-toolbar) that intercept pointer events
192
+ await locator.click({ force: true });
193
+ }
194
+ /**
195
+ * Fill an input and wait for it to be ready.
196
+ * @param locator The locator to fill.
197
+ * @param value The value to enter.
198
+ * @param timeout The maximum time to wait.
199
+ */
200
+ async fill(locator, value, timeout = 10_000) {
201
+ await locator.waitFor({ state: 'visible', timeout });
202
+ await locator.fill(value);
203
+ }
204
+ /**
205
+ * Wait for an element to be visible.
206
+ * @param locator The locator to wait for.
207
+ * @param timeout The maximum time to wait.
208
+ */
209
+ async waitForVisible(locator, timeout = 10_000) {
210
+ await locator.waitFor({ state: 'visible', timeout });
211
+ }
212
+ /**
213
+ * Wait for an element to be hidden.
214
+ * @param locator The locator to wait for.
215
+ * @param timeout The maximum time to wait.
216
+ */
217
+ async waitForHidden(locator, timeout = 15_000) {
218
+ await locator.waitFor({ state: 'hidden', timeout });
219
+ }
220
+ /* --- Unified Selectors --- */
221
+ /**
222
+ * Get a button by its text content.
223
+ * Supports both Ionic and Material buttons.
224
+ * @param text The text content to match.
225
+ * @param scope Optional locator to scope the search within.
226
+ */
227
+ button(text, scope) {
228
+ // Combine selectors for both Ionic and Material buttons
229
+ const selectors = [
230
+ IonicSelectors.button,
231
+ 'button[mat-button]',
232
+ 'button[mat-raised-button]',
233
+ 'button[mat-flat-button]',
234
+ 'button[mat-stroked-button]',
235
+ 'button[mat-icon-button]',
236
+ 'button[mat-fab]',
237
+ 'button[mat-mini-fab]',
238
+ ].join(', ');
239
+ const root = scope ?? this.page;
240
+ return root.locator(selectors, { hasText: text });
241
+ }
242
+ /**
243
+ * Get an icon button by its icon name.
244
+ * Supports both Ionic and Material icon buttons.
245
+ * @param iconName The icon name (e.g. 'mail', 'search', 'ellipsis-horizontal').
246
+ * @param scope Optional locator to scope the search within.
247
+ */
248
+ iconButton(iconName, scope) {
249
+ const matIconSelector = `${MaterialSelectors.icon}:has-text("${iconName}")`;
250
+ const ionIconSelector = `ion-icon[name="${iconName}"]`;
251
+ const root = scope ?? this.page;
252
+ return root.locator(`button, ion-button`).filter({
253
+ has: this.page.locator(`${matIconSelector}, ${ionIconSelector}`),
254
+ });
255
+ }
256
+ /**
257
+ * Access to the underlying Playwright Page object.
258
+ */
259
+ get pageObj() {
260
+ return this.page;
261
+ }
262
+ /** Get a modal by its selector */
263
+ modal(selector) {
264
+ return this.ionic.modal(selector);
265
+ }
266
+ /** Get a tab by its label text */
267
+ tab(text) {
268
+ return this.mat.tabByLabel(text);
269
+ }
270
+ /* --- Specialized Helpers (delegated) --- */
271
+ /** Wait for the app to be ready */
272
+ async waitForAppReady(timeout = 15_000) {
273
+ await this.ionic.waitForAppReady(timeout);
274
+ }
275
+ /** Wait for loading spinners to disappear */
276
+ async waitForLoadingComplete(timeout = 15_000) {
277
+ await this.ionic.waitForLoadingComplete(timeout);
278
+ }
279
+ /** Wait for table rows to be loaded, optionally scoped to a parent locator */
280
+ async waitForTableRows(timeout = 15_000, scope) {
281
+ await this.mat.waitForTableRows(timeout, scope);
282
+ }
283
+ /** Get a single table row by index (0-based), optionally scoped to a parent locator */
284
+ tableRow(index, scope) {
285
+ return this.mat.tableRow(index, scope);
286
+ }
287
+ /** Click on a table row by index, optionally scoped to a parent locator */
288
+ async clickRow(index, scope) {
289
+ await this.click(this.tableRow(index, scope));
290
+ }
291
+ /** Fill a mat-form-field input identified by its formControlName */
292
+ async fillFormControl(formControlName, value) {
293
+ await this.mat.fillFormControl(formControlName, value);
294
+ }
295
+ /** Select an autocomplete option */
296
+ async selectAutocompleteOption(formControlName, searchText, optionText) {
297
+ await this.mat.selectAutocompleteOption(formControlName, searchText, optionText);
298
+ }
299
+ /**
300
+ * Select an option from a mat-select dropdown.
301
+ * Opens the dropdown, waits for options, clicks the matching one, then waits for the dropdown to close.
302
+ */
303
+ async selectOption(formControlName, optionText) {
304
+ await this.mat.selectMatSelectOption(formControlName, optionText);
305
+ }
306
+ }
307
+
308
+ const STARTUP_DATA_STORAGE_KEY = '__appStartupData';
309
+ /**
310
+ * Helper for authentication in e2e tests.
311
+ */
312
+ class AuthHelper {
313
+ page;
314
+ ui;
315
+ constructor(page, ui) {
316
+ this.page = page;
317
+ this.ui = ui ?? new UiHelper(page);
318
+ }
319
+ /** Login with given test credentials */
320
+ async login(username, password) {
321
+ const ui = this.ui;
322
+ await this.page.goto('/');
323
+ // Wait for the app to fully load (backend connection can take time)
324
+ await ui.waitForAppReady(30_000);
325
+ await ui.waitForLoadingComplete(30_000);
326
+ // Click the login button on the home page
327
+ const loginButton = ui.button(/Se connecter|Log In/).first();
328
+ await ui.click(loginButton, 30_000);
329
+ // Wait for the auth modal to appear
330
+ const modal = ui.modal('app-auth-form');
331
+ await ui.waitForVisible(modal);
332
+ // Fill credentials (may or may not be pre-filled depending on the environment)
333
+ const usernameInput = modal.locator('input[formcontrolname="username"]');
334
+ await usernameInput.click({ force: true });
335
+ await usernameInput.fill(username);
336
+ const passwordInput = modal.locator('input[formcontrolname="password"]');
337
+ await passwordInput.click({ force: true });
338
+ await passwordInput.fill(password);
339
+ // Click the submit button in the modal footer
340
+ const ionModal = ui.pageObj.locator('ion-modal:has(app-auth-form)');
341
+ const submitButton = ionModal.locator('ion-footer ion-button[color="tertiary"]');
342
+ await submitButton.waitFor({ state: 'visible', timeout: 10_000 });
343
+ // Wait for the button to be enabled (form valid)
344
+ await ui.pageObj.waitForFunction((btn) => !btn.hasAttribute('disabled'), await submitButton.elementHandle(), { timeout: 5_000 });
345
+ await submitButton.click();
346
+ // Wait for the modal to close and verify the user is logged in
347
+ await ui.waitForHidden(modal, 30_000);
348
+ // After login, the login button should no longer be visible (replaced by user menu)
349
+ await loginButton.waitFor({ state: 'hidden', timeout: 10_000 });
350
+ }
351
+ /** Wait until the user is logged in and return the email shown in the side menu */
352
+ async waitForLoggedIn() {
353
+ const emailEl = this.page.locator('ion-menu h4').first();
354
+ await emailEl.waitFor({ state: 'visible', timeout: 30_000 });
355
+ return emailEl.textContent();
356
+ }
357
+ /** Setup startup data with provided credentials or environment variables */
358
+ async loginByEnv(opts) {
359
+ const username = opts?.username ?? process.env.E2E_USERNAME;
360
+ const password = opts?.password ?? process.env.E2E_PASSWORD;
361
+ const offline = opts?.offline ?? process.env.E2E_OFFLINE === 'true';
362
+ const peerUrl = opts?.peerUrl ?? process.env.E2E_PEER_URL;
363
+ if (!username && !password && !peerUrl)
364
+ return;
365
+ await this.page.addInitScript(({ key, username, password, offline, peerUrl }) => {
366
+ window[key] = { username, password, offline, peerUrl };
367
+ }, { key: STARTUP_DATA_STORAGE_KEY, username, password, offline, peerUrl });
368
+ }
369
+ }
370
+
371
+ // GPL v3 License
372
+ /**
373
+ * Search environments based on provided criteria.
374
+ *
375
+ * Use when you need to run tests with one or more environments.
376
+ * Test can use `testWithEnv` to run tests with a specific environment.
377
+ * Example :
378
+ *
379
+ * ```
380
+ * test.describe('Sample test with environment', () => {
381
+ * withEnvs({
382
+ * peerTags: ['local'],
383
+ * userTags: ['admin'],
384
+ * }).forEach((env) => {
385
+ * testWithEnv(env)(`Some test with environment ${env.id}`, async ({ page }) => {
386
+ * // Test implementation
387
+ * });
388
+ * });
389
+ * });
390
+ * ```
391
+ *
392
+ * Environments are loaded from a JSON config file located at one of four paths :
393
+ * - `LOGIN_ENVS_PATH` environment variable
394
+ * - `.environments.json` in the current directory (e.g. `.environments.json`)
395
+ * - `.environments.json` in the `.local` directory (e.g. `.local/environments.json`)
396
+ * - `.environments.json` in the `e2e` directory (e.g. `e2e/.environments.json`)
397
+ *
398
+ * Example of JSON :
399
+ *
400
+ * ```
401
+ * {
402
+ * "peers": [
403
+ * {
404
+ * "id": "local",
405
+ * "tags": ["local"],
406
+ * "url": "http://localhost:8080",
407
+ * "users": [
408
+ * {
409
+ * "tags": ["admin"],
410
+ * "username": "admin@sumaris.net",
411
+ * "password": "admin"
412
+ * }
413
+ * ]
414
+ * }
415
+ * ]
416
+ * }
417
+ * ```
418
+ *
419
+ * @see testWithEnv
420
+ * @param filter Search criteria.
421
+ */
422
+ function withEnvs(filter) {
423
+ const startupEnvs = [];
424
+ // Search startup env config file
425
+ const candidates = [
426
+ process.env.LOGIN_ENVS_PATH,
427
+ path.resolve(process.cwd(), '.environments.json'),
428
+ path.resolve(process.cwd(), '.local/environments.json'),
429
+ path.resolve(process.cwd(), 'e2e/.environments.json'),
430
+ ].filter(Boolean);
431
+ const environmentsFile = candidates.find((p) => fs.existsSync(p));
432
+ if (!environmentsFile) {
433
+ throw new Error(`Startup envs config file not found.\nTried: ${candidates.join('\n')}`);
434
+ }
435
+ // Load startup config file
436
+ let config;
437
+ try {
438
+ config = JSON.parse(fs.readFileSync(environmentsFile, 'utf8'));
439
+ }
440
+ catch (error) {
441
+ console.error('Error parsing startup envs config file:', error);
442
+ throw error;
443
+ }
444
+ finally {
445
+ fs.closeSync(fs.openSync(environmentsFile, 'r'));
446
+ }
447
+ // Filter startup envs based on criteria
448
+ for (const peerConfig of config.peers) {
449
+ const matchPeerId = filter.peerId && peerConfig.id === filter.peerId;
450
+ const matchPeerTag = filter.peerTags && peerConfig.tags.some((tag) => filter.peerTags?.includes(tag));
451
+ if (!matchPeerId && !matchPeerTag)
452
+ continue;
453
+ for (const userConfig of peerConfig.users) {
454
+ const matchUserTag = filter.userTags && userConfig.tags.some((tag) => filter.userTags?.includes(tag));
455
+ if (!matchUserTag)
456
+ continue;
457
+ startupEnvs.push({
458
+ id: peerConfig.id,
459
+ peerUrl: peerConfig.url,
460
+ username: userConfig.username,
461
+ password: userConfig.password,
462
+ });
463
+ }
464
+ }
465
+ return startupEnvs;
466
+ }
467
+ /**
468
+ * Currying function that returns a test function that can be used to run tests with a specific environment.
469
+ *
470
+ * ```
471
+ * testWithEnv(env)(`Some test with environment ${env.id}`, async ({ page }) => {
472
+ * // Test implementation
473
+ * })
474
+ * ```
475
+ *
476
+ * @see withEnvs
477
+ * @param env Environment to use for the test.
478
+ */
479
+ function testWithEnv(env) {
480
+ return (title, testFn) => {
481
+ test(title, async ({ page, context: playwrightContext, browser, request }) => {
482
+ const auth = new AuthHelper(page);
483
+ await auth.loginByEnv(env);
484
+ await testFn({ page, context: playwrightContext, browser, request });
485
+ });
486
+ };
487
+ }
488
+
489
+ // utils
490
+
491
+ /**
492
+ * Generated bundle index. Do not edit.
493
+ */
494
+
495
+ export { AuthHelper, IonicHelper, IonicSelectors, MaterialHelper, MaterialSelectors, UiHelper, testWithEnv, withEnvs };
496
+ //# sourceMappingURL=sumaris-net-ngx-components-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sumaris-net-ngx-components-testing.mjs","sources":["../../testing/utils/ionic.utils.ts","../../testing/utils/material.utils.ts","../../testing/utils/ui.utils.ts","../../testing/utils/auth.utils.ts","../../testing/test/login-env.ts","../../testing/testing_api.ts","../../testing/sumaris-net-ngx-components-testing.ts"],"sourcesContent":["// GPL v3 License\nimport { Locator, Page } from 'playwright';\n\n/**\n * Utility selectors and helpers for Ionic components in e2e tests.\n */\nexport const IonicSelectors = {\n /** Ionic button */\n button: 'ion-button',\n /** Ionic modal */\n modal: 'ion-modal',\n /** Ionic content area */\n content: 'ion-content',\n /** Ionic item */\n item: 'ion-item',\n /** Ionic label */\n label: 'ion-label',\n /** Ionic spinner */\n spinner: 'ion-spinner',\n /** Ionic skeleton text (loading placeholder) */\n skeletonText: 'ion-skeleton-text',\n /** Ionic back button */\n backButton: 'ion-back-button',\n /** Ionic toolbar */\n toolbar: 'ion-toolbar',\n /** Ionic footer */\n footer: 'ion-footer',\n /** Ionic header */\n header: 'ion-header',\n};\n\n/**\n * Helper functions for interacting with Ionic components.\n */\nexport class IonicHelper {\n constructor(private page: Page) {}\n\n /** Get an Ionic button by text content */\n buttonByText(text: string | RegExp): Locator {\n return this.page.locator(IonicSelectors.button, { hasText: text });\n }\n\n /** Get an Ionic button by CSS selector */\n button(selector?: string, options?: { hasText?: string | RegExp }): Locator {\n const fullSelector = selector ? `${IonicSelectors.button}${selector}` : IonicSelectors.button;\n return this.page.locator(fullSelector, options);\n }\n\n /**\n * Get an Ionic modal by its inner component selector (e.g. 'app-auth-form').\n * Automatically wraps the selector in `ion-modal:has(...)` so callers\n * only need to provide the component tag name.\n */\n modal(selector: string): Locator {\n const fullSelector = selector.startsWith('ion-modal') ? selector : `ion-modal:has(${selector})`;\n return this.page.locator(fullSelector);\n }\n\n /** Wait for the Ionic app to be ready */\n async waitForAppReady(timeout = 15_000): Promise<void> {\n // Wait for ion-app to be attached (Angular bootstrap complete)\n await this.page.waitForSelector('ion-app', { state: 'attached', timeout });\n }\n\n /** Wait for loading spinners to disappear */\n async waitForLoadingComplete(timeout = 15_000): Promise<void> {\n await this.page.locator(IonicSelectors.spinner).waitFor({ state: 'hidden', timeout }).catch(() => {\n // Spinner may not appear at all — that's fine\n });\n }\n}\n","// GPL v3 License\nimport { Locator, Page } from 'playwright';\n\n/**\n * Utility selectors and helpers for Angular Material components in e2e tests.\n */\nexport const MaterialSelectors = {\n /** Material table row */\n row: 'mat-row, tr[mat-row]',\n /** Material header row */\n headerRow: 'mat-header-row, tr[mat-header-row]',\n /** Material cell */\n cell: 'mat-cell, td[mat-cell]',\n /** Material form field */\n formField: 'mat-form-field',\n /** Material input */\n input: 'input[matInput]',\n /** Material tab group */\n tabGroup: 'mat-tab-group',\n /** Material tab label */\n tabLabel: '.mat-mdc-tab',\n /** Material paginator */\n paginator: 'mat-paginator',\n /** Material icon */\n icon: 'mat-icon',\n /** Material autocomplete panel */\n autocompletePanel: '.mat-mdc-autocomplete-panel',\n /** Material autocomplete option */\n autocompleteOption: 'mat-option',\n};\n\n/**\n * Helper functions for interacting with Angular Material components.\n */\nexport class MaterialHelper {\n constructor(private page: Page) {}\n\n /** Get all visible table rows, optionally scoped to a parent locator */\n tableRows(scope?: Locator): Locator {\n const root = scope ?? this.page;\n return root.locator(MaterialSelectors.row);\n }\n\n /** Get a single table row by index (0-based), optionally scoped to a parent locator */\n tableRow(index: number, scope?: Locator): Locator {\n return this.tableRows(scope).nth(index);\n }\n\n /** Click on a table row by index (0-based), optionally scoped to a parent locator */\n async clickRow(index: number, scope?: Locator): Promise<void> {\n await this.tableRow(index, scope).click();\n }\n\n /** Get a tab by its label text */\n tabByLabel(text: string | RegExp): Locator {\n return this.page.locator(MaterialSelectors.tabLabel, { hasText: text });\n }\n\n /** Click a tab by its label text */\n async clickTab(text: string | RegExp): Promise<void> {\n await this.tabByLabel(text).click();\n }\n\n /** Fill a mat-form-field input identified by its formControlName.\n * Supports both native inputs with formcontrolname and custom components (e.g. mat-autocomplete-field) wrapping an input. */\n async fillFormControl(formControlName: string, value: string): Promise<void> {\n // Try native input first, then fall back to custom component wrapper\n const nativeInput = this.page.locator(`${MaterialSelectors.formField} input[formcontrolname=\"${formControlName}\"]`);\n const wrappedInput = this.page.locator(`[formcontrolname=\"${formControlName}\"] input`);\n const input = (await nativeInput.count()) > 0 ? nativeInput : wrappedInput;\n // Click the parent mat-form-field to ensure focus reaches the input\n const formField = input.locator('xpath=ancestor::mat-form-field');\n if ((await formField.count()) > 0) {\n await formField.first().click();\n } else {\n await input.click({ force: true });\n }\n await input.pressSequentially(value, { delay: 50 });\n }\n\n /**\n * Select an option from a mat-select dropdown by formControlName.\n * Opens the dropdown, waits for options to render, clicks the matching option, then waits for the dropdown to close.\n */\n async selectMatSelectOption(formControlName: string, optionText: string | RegExp): Promise<void> {\n const select = this.page.locator(`mat-select[formcontrolname=\"${formControlName}\"]`);\n await select.click();\n // Use role-based selector: mat-select renders options with role=\"option\" in a listbox\n const option = this.page.getByRole('option', { name: optionText });\n await option.waitFor({ state: 'visible', timeout: 10_000 });\n await option.click();\n // Wait for the option to disappear (dropdown closed)\n await option.waitFor({ state: 'hidden', timeout: 5_000 });\n }\n\n /** Select an autocomplete option by text after typing in a form control */\n async selectAutocompleteOption(formControlName: string, searchText: string, optionText: string | RegExp): Promise<void> {\n await this.fillFormControl(formControlName, searchText);\n const panel = this.page.locator(MaterialSelectors.autocompletePanel);\n await panel.waitFor({ state: 'visible', timeout: 10_000 });\n await panel.locator(MaterialSelectors.autocompleteOption, { hasText: optionText }).click();\n }\n\n /** Wait for table rows to be loaded (at least one row visible), optionally scoped to a parent locator */\n async waitForTableRows(timeout = 15_000, scope?: Locator): Promise<void> {\n await this.tableRows(scope).first().waitFor({ state: 'visible', timeout });\n }\n}\n","// GPL v3 License\nimport { Locator, Page } from 'playwright';\nimport { IonicHelper, IonicSelectors } from './ionic.utils';\nimport { MaterialHelper, MaterialSelectors } from './material.utils';\n\n/**\n * Common UI helper functions to improve readability of e2e tests.\n * This helper centralizes access to Ionic and Material specific helpers.\n */\nexport class UiHelper {\n protected ionic: IonicHelper;\n protected mat: MaterialHelper;\n\n constructor(protected page: Page) {\n this.ionic = new IonicHelper(page);\n this.mat = new MaterialHelper(page);\n }\n\n /**\n * Click an element and wait for it to be ready.\n * @param locator The locator to click.\n * @param timeout The maximum time to wait.\n */\n async click(locator: Locator, timeout = 10_000): Promise<void> {\n await locator.waitFor({ state: 'visible', timeout });\n // force: true bypasses Ionic overlay elements (ion-col, ion-toolbar) that intercept pointer events\n await locator.click({ force: true });\n }\n\n /**\n * Fill an input and wait for it to be ready.\n * @param locator The locator to fill.\n * @param value The value to enter.\n * @param timeout The maximum time to wait.\n */\n async fill(locator: Locator, value: string, timeout = 10_000): Promise<void> {\n await locator.waitFor({ state: 'visible', timeout });\n await locator.fill(value);\n }\n\n /**\n * Wait for an element to be visible.\n * @param locator The locator to wait for.\n * @param timeout The maximum time to wait.\n */\n async waitForVisible(locator: Locator, timeout = 10_000): Promise<void> {\n await locator.waitFor({ state: 'visible', timeout });\n }\n\n /**\n * Wait for an element to be hidden.\n * @param locator The locator to wait for.\n * @param timeout The maximum time to wait.\n */\n async waitForHidden(locator: Locator, timeout = 15_000): Promise<void> {\n await locator.waitFor({ state: 'hidden', timeout });\n }\n\n /* --- Unified Selectors --- */\n\n /**\n * Get a button by its text content.\n * Supports both Ionic and Material buttons.\n * @param text The text content to match.\n * @param scope Optional locator to scope the search within.\n */\n button(text: string | RegExp, scope?: Locator): Locator {\n // Combine selectors for both Ionic and Material buttons\n const selectors = [\n IonicSelectors.button,\n 'button[mat-button]',\n 'button[mat-raised-button]',\n 'button[mat-flat-button]',\n 'button[mat-stroked-button]',\n 'button[mat-icon-button]',\n 'button[mat-fab]',\n 'button[mat-mini-fab]',\n ].join(', ');\n\n const root = scope ?? this.page;\n return root.locator(selectors, { hasText: text });\n }\n\n /**\n * Get an icon button by its icon name.\n * Supports both Ionic and Material icon buttons.\n * @param iconName The icon name (e.g. 'mail', 'search', 'ellipsis-horizontal').\n * @param scope Optional locator to scope the search within.\n */\n iconButton(iconName: string, scope?: Locator): Locator {\n const matIconSelector = `${MaterialSelectors.icon}:has-text(\"${iconName}\")`;\n const ionIconSelector = `ion-icon[name=\"${iconName}\"]`;\n const root = scope ?? this.page;\n return root.locator(`button, ion-button`).filter({\n has: this.page.locator(`${matIconSelector}, ${ionIconSelector}`),\n });\n }\n\n /**\n * Access to the underlying Playwright Page object.\n */\n get pageObj(): Page {\n return this.page;\n }\n\n /** Get a modal by its selector */\n modal(selector: string): Locator {\n return this.ionic.modal(selector);\n }\n\n /** Get a tab by its label text */\n tab(text: string | RegExp): Locator {\n return this.mat.tabByLabel(text);\n }\n\n /* --- Specialized Helpers (delegated) --- */\n\n /** Wait for the app to be ready */\n async waitForAppReady(timeout = 15_000): Promise<void> {\n await this.ionic.waitForAppReady(timeout);\n }\n\n /** Wait for loading spinners to disappear */\n async waitForLoadingComplete(timeout = 15_000): Promise<void> {\n await this.ionic.waitForLoadingComplete(timeout);\n }\n\n /** Wait for table rows to be loaded, optionally scoped to a parent locator */\n async waitForTableRows(timeout = 15_000, scope?: Locator): Promise<void> {\n await this.mat.waitForTableRows(timeout, scope);\n }\n\n /** Get a single table row by index (0-based), optionally scoped to a parent locator */\n tableRow(index: number, scope?: Locator): Locator {\n return this.mat.tableRow(index, scope);\n }\n\n /** Click on a table row by index, optionally scoped to a parent locator */\n async clickRow(index: number, scope?: Locator): Promise<void> {\n await this.click(this.tableRow(index, scope));\n }\n\n /** Fill a mat-form-field input identified by its formControlName */\n async fillFormControl(formControlName: string, value: string): Promise<void> {\n await this.mat.fillFormControl(formControlName, value);\n }\n\n /** Select an autocomplete option */\n async selectAutocompleteOption(formControlName: string, searchText: string, optionText: string | RegExp): Promise<void> {\n await this.mat.selectAutocompleteOption(formControlName, searchText, optionText);\n }\n\n /**\n * Select an option from a mat-select dropdown.\n * Opens the dropdown, waits for options, clicks the matching one, then waits for the dropdown to close.\n */\n async selectOption(formControlName: string, optionText: string | RegExp): Promise<void> {\n await this.mat.selectMatSelectOption(formControlName, optionText);\n }\n}\n","// GPL v3 License\nimport { Page } from 'playwright';\nimport { UiHelper } from './ui.utils';\n\nconst STARTUP_DATA_STORAGE_KEY = '__appStartupData';\n\n/**\n * Helper for authentication in e2e tests.\n */\nexport class AuthHelper {\n protected ui: UiHelper;\n\n constructor(\n private page: Page,\n ui?: UiHelper\n ) {\n this.ui = ui ?? new UiHelper(page);\n }\n\n /** Login with given test credentials */\n async login(username: string, password: string): Promise<void> {\n const ui = this.ui;\n\n await this.page.goto('/');\n\n // Wait for the app to fully load (backend connection can take time)\n await ui.waitForAppReady(30_000);\n await ui.waitForLoadingComplete(30_000);\n\n // Click the login button on the home page\n const loginButton = ui.button(/Se connecter|Log In/).first();\n await ui.click(loginButton, 30_000);\n\n // Wait for the auth modal to appear\n const modal = ui.modal('app-auth-form');\n await ui.waitForVisible(modal);\n\n // Fill credentials (may or may not be pre-filled depending on the environment)\n const usernameInput = modal.locator('input[formcontrolname=\"username\"]');\n await usernameInput.click({ force: true });\n await usernameInput.fill(username);\n const passwordInput = modal.locator('input[formcontrolname=\"password\"]');\n await passwordInput.click({ force: true });\n await passwordInput.fill(password);\n\n // Click the submit button in the modal footer\n const ionModal = ui.pageObj.locator('ion-modal:has(app-auth-form)');\n const submitButton = ionModal.locator('ion-footer ion-button[color=\"tertiary\"]');\n await submitButton.waitFor({ state: 'visible', timeout: 10_000 });\n // Wait for the button to be enabled (form valid)\n await ui.pageObj.waitForFunction(\n (btn) => !btn.hasAttribute('disabled'),\n await submitButton.elementHandle(),\n { timeout: 5_000 }\n );\n await submitButton.click();\n\n // Wait for the modal to close and verify the user is logged in\n await ui.waitForHidden(modal, 30_000);\n\n // After login, the login button should no longer be visible (replaced by user menu)\n await loginButton.waitFor({ state: 'hidden', timeout: 10_000 });\n }\n\n /** Wait until the user is logged in and return the email shown in the side menu */\n async waitForLoggedIn(): Promise<string | null> {\n const emailEl = this.page.locator('ion-menu h4').first();\n await emailEl.waitFor({ state: 'visible', timeout: 30_000 });\n return emailEl.textContent();\n }\n\n /** Setup startup data with provided credentials or environment variables */\n async loginByEnv(opts?: { username?: string; password?: string; offline?: boolean; peerUrl?: string }): Promise<void> {\n const username = opts?.username ?? process.env.E2E_USERNAME;\n const password = opts?.password ?? process.env.E2E_PASSWORD;\n const offline = opts?.offline ?? process.env.E2E_OFFLINE === 'true';\n const peerUrl = opts?.peerUrl ?? process.env.E2E_PEER_URL;\n\n if (!username && !password && !peerUrl) return;\n\n await this.page.addInitScript(\n ({ key, username, password, offline, peerUrl }) => {\n (window as any)[key] = { username, password, offline, peerUrl };\n },\n { key: STARTUP_DATA_STORAGE_KEY, username, password, offline, peerUrl }\n );\n }\n}\n","// GPL v3 License\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport { PlaywrightTestArgs, test } from '@playwright/test';\nimport { AuthHelper } from '../utils/auth.utils';\n\n/**\n * Search environments based on provided criteria.\n *\n * Use when you need to run tests with one or more environments.\n * Test can use `testWithEnv` to run tests with a specific environment.\n * Example :\n *\n * ```\n * test.describe('Sample test with environment', () => {\n * withEnvs({\n * peerTags: ['local'],\n * userTags: ['admin'],\n * }).forEach((env) => {\n * testWithEnv(env)(`Some test with environment ${env.id}`, async ({ page }) => {\n * // Test implementation\n * });\n * });\n * });\n * ```\n *\n * Environments are loaded from a JSON config file located at one of four paths :\n * - `LOGIN_ENVS_PATH` environment variable\n * - `.environments.json` in the current directory (e.g. `.environments.json`)\n * - `.environments.json` in the `.local` directory (e.g. `.local/environments.json`)\n * - `.environments.json` in the `e2e` directory (e.g. `e2e/.environments.json`)\n *\n * Example of JSON :\n *\n * ```\n * {\n * \"peers\": [\n * {\n * \"id\": \"local\",\n * \"tags\": [\"local\"],\n * \"url\": \"http://localhost:8080\",\n * \"users\": [\n * {\n * \"tags\": [\"admin\"],\n * \"username\": \"admin@sumaris.net\",\n * \"password\": \"admin\"\n * }\n * ]\n * }\n * ]\n * }\n * ```\n *\n * @see testWithEnv\n * @param filter Search criteria.\n */\nexport function withEnvs(filter: EnvFilter): LoginEnv[] {\n const startupEnvs: LoginEnv[] = [];\n\n // Search startup env config file\n const candidates = [\n process.env.LOGIN_ENVS_PATH,\n path.resolve(process.cwd(), '.environments.json'),\n path.resolve(process.cwd(), '.local/environments.json'),\n path.resolve(process.cwd(), 'e2e/.environments.json'),\n ].filter(Boolean);\n const environmentsFile = candidates.find((p) => fs.existsSync(p!));\n if (!environmentsFile) {\n throw new Error(`Startup envs config file not found.\\nTried: ${candidates.join('\\n')}`);\n }\n\n // Load startup config file\n let config: TestEnvironments;\n try {\n config = JSON.parse(fs.readFileSync(environmentsFile, 'utf8'));\n } catch (error) {\n console.error('Error parsing startup envs config file:', error);\n throw error;\n } finally {\n fs.closeSync(fs.openSync(environmentsFile, 'r'));\n }\n\n // Filter startup envs based on criteria\n for (const peerConfig of config.peers) {\n const matchPeerId = filter.peerId && peerConfig.id === filter.peerId;\n const matchPeerTag = filter.peerTags && peerConfig.tags.some((tag) => filter.peerTags?.includes(tag));\n if (!matchPeerId && !matchPeerTag) continue;\n\n for (const userConfig of peerConfig.users) {\n const matchUserTag = filter.userTags && userConfig.tags.some((tag) => filter.userTags?.includes(tag));\n if (!matchUserTag) continue;\n\n startupEnvs.push({\n id: peerConfig.id,\n peerUrl: peerConfig.url,\n username: userConfig.username,\n password: userConfig.password,\n });\n }\n }\n\n return startupEnvs;\n}\n\n/**\n * Currying function that returns a test function that can be used to run tests with a specific environment.\n *\n * ```\n * testWithEnv(env)(`Some test with environment ${env.id}`, async ({ page }) => {\n * // Test implementation\n * })\n * ```\n *\n * @see withEnvs\n * @param env Environment to use for the test.\n */\nexport function testWithEnv(env: LoginEnv) {\n return (title: string, testFn: (args: PlaywrightTestArgs) => Promise<void>) => {\n test(title, async ({ page, context: playwrightContext, browser, request }) => {\n const auth = new AuthHelper(page);\n await auth.loginByEnv(env);\n\n await testFn({ page, context: playwrightContext, browser, request } as any);\n });\n };\n}\n\nexport interface EnvFilter {\n peerId?: string;\n peerTags?: string[];\n userTags?: string[];\n}\n\nexport interface LoginEnv {\n id?: string;\n peerUrl: string;\n username: string;\n password: string;\n}\n\ninterface TestEnvironments {\n peers: TestPeer[];\n}\n\ninterface TestPeer {\n id?: string;\n tags: string[];\n url: string;\n users: TestUser[];\n}\n\ninterface TestUser {\n tags: string[];\n username: string;\n password: string;\n}\n","// utils\nexport * from './utils/auth.utils';\nexport * from './utils/ionic.utils';\nexport * from './utils/material.utils';\nexport * from './utils/ui.utils';\n\n// test\nexport * from './test/login-env';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './testing_api';\n"],"names":[],"mappings":";;;;AAGA;;AAEG;AACI,MAAM,cAAc,GAAG;;AAE5B,IAAA,MAAM,EAAE,YAAY;;AAEpB,IAAA,KAAK,EAAE,WAAW;;AAElB,IAAA,OAAO,EAAE,aAAa;;AAEtB,IAAA,IAAI,EAAE,UAAU;;AAEhB,IAAA,KAAK,EAAE,WAAW;;AAElB,IAAA,OAAO,EAAE,aAAa;;AAEtB,IAAA,YAAY,EAAE,mBAAmB;;AAEjC,IAAA,UAAU,EAAE,iBAAiB;;AAE7B,IAAA,OAAO,EAAE,aAAa;;AAEtB,IAAA,MAAM,EAAE,YAAY;;AAEpB,IAAA,MAAM,EAAE,YAAY;;AAGtB;;AAEG;MACU,WAAW,CAAA;AACF,IAAA,IAAA;AAApB,IAAA,WAAA,CAAoB,IAAU,EAAA;QAAV,IAAA,CAAA,IAAI,GAAJ,IAAI;IAAS;;AAGjC,IAAA,YAAY,CAAC,IAAqB,EAAA;AAChC,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACpE;;IAGA,MAAM,CAAC,QAAiB,EAAE,OAAuC,EAAA;AAC/D,QAAA,MAAM,YAAY,GAAG,QAAQ,GAAG,GAAG,cAAc,CAAC,MAAM,CAAA,EAAG,QAAQ,EAAE,GAAG,cAAc,CAAC,MAAM;QAC7F,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;IACjD;AAEA;;;;AAIG;AACH,IAAA,KAAK,CAAC,QAAgB,EAAA;AACpB,QAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,QAAQ,GAAG,CAAA,cAAA,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