@elliemae/smoked-suite 26.2.21 → 26.2.23

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.
@@ -55,4 +55,32 @@ class BasePage {
55
55
  getByTitle(text, options) {
56
56
  return this.page.getByTitle(text, options);
57
57
  }
58
+ // ─── Action helpers ──────────────────────────────────────────────────────────
59
+ /**
60
+ * Click a locator that triggers a navigation (react-router `navigate()`,
61
+ * browser back/forward, an `<a>` tag, a form submit that redirects, etc.)
62
+ * and wait for the URL to match before resolving.
63
+ *
64
+ * Using this helper instead of an ad-hoc `click()` + `toBeVisible()` pattern
65
+ * eliminates the race between the router and the DOM assertion — which
66
+ * manifests as flaky/slow CI runs even though local runs pass.
67
+ * @param locator - The element to click.
68
+ * @param urlPattern - Expected post-navigation URL (string or regex).
69
+ * @param options - Forwarded to `page.waitForURL`.
70
+ * @example
71
+ * ```ts
72
+ * // In a spec
73
+ * await this.auditPage.clickAndWaitForURL(
74
+ * this.auditPage.backButton,
75
+ * /\/admin\/oneadmin\/migrate(?:\/)?$/,
76
+ * );
77
+ * await expect(this.settingsPage.container).toBeVisible();
78
+ * ```
79
+ */
80
+ async clickAndWaitForURL(locator, urlPattern, options) {
81
+ await Promise.all([
82
+ this.page.waitForURL(urlPattern, options),
83
+ locator.click()
84
+ ]);
85
+ }
58
86
  }
@@ -32,6 +32,34 @@ class BasePage {
32
32
  getByTitle(text, options) {
33
33
  return this.page.getByTitle(text, options);
34
34
  }
35
+ // ─── Action helpers ──────────────────────────────────────────────────────────
36
+ /**
37
+ * Click a locator that triggers a navigation (react-router `navigate()`,
38
+ * browser back/forward, an `<a>` tag, a form submit that redirects, etc.)
39
+ * and wait for the URL to match before resolving.
40
+ *
41
+ * Using this helper instead of an ad-hoc `click()` + `toBeVisible()` pattern
42
+ * eliminates the race between the router and the DOM assertion — which
43
+ * manifests as flaky/slow CI runs even though local runs pass.
44
+ * @param locator - The element to click.
45
+ * @param urlPattern - Expected post-navigation URL (string or regex).
46
+ * @param options - Forwarded to `page.waitForURL`.
47
+ * @example
48
+ * ```ts
49
+ * // In a spec
50
+ * await this.auditPage.clickAndWaitForURL(
51
+ * this.auditPage.backButton,
52
+ * /\/admin\/oneadmin\/migrate(?:\/)?$/,
53
+ * );
54
+ * await expect(this.settingsPage.container).toBeVisible();
55
+ * ```
56
+ */
57
+ async clickAndWaitForURL(locator, urlPattern, options) {
58
+ await Promise.all([
59
+ this.page.waitForURL(urlPattern, options),
60
+ locator.click()
61
+ ]);
62
+ }
35
63
  }
36
64
  export {
37
65
  BasePage
@@ -1,5 +1,5 @@
1
- import { Page } from '@playwright/test';
2
- import { AuthState, Credentials } from '../types.js';
1
+ import type { Page } from '@playwright/test';
2
+ import type { AuthState, Credentials } from '../types.js';
3
3
  /**
4
4
  * Manages the encw authentication lifecycle.
5
5
  *
@@ -1,5 +1,5 @@
1
- import { Page, Locator } from '@playwright/test';
2
- import { AppContext, ContextProvider } from '../types.js';
1
+ import type { Page, Locator } from '@playwright/test';
2
+ import type { AppContext, ContextProvider } from '../types.js';
3
3
  /**
4
4
  * Base page object class for encw apps.
5
5
  *
@@ -24,4 +24,26 @@ export declare abstract class BasePage {
24
24
  protected getByPlaceholder(text: string | RegExp, options?: Parameters<Page['getByPlaceholder']>[1]): Locator;
25
25
  protected getByAltText(text: string | RegExp, options?: Parameters<Page['getByAltText']>[1]): Locator;
26
26
  protected getByTitle(text: string | RegExp, options?: Parameters<Page['getByTitle']>[1]): Locator;
27
+ /**
28
+ * Click a locator that triggers a navigation (react-router `navigate()`,
29
+ * browser back/forward, an `<a>` tag, a form submit that redirects, etc.)
30
+ * and wait for the URL to match before resolving.
31
+ *
32
+ * Using this helper instead of an ad-hoc `click()` + `toBeVisible()` pattern
33
+ * eliminates the race between the router and the DOM assertion — which
34
+ * manifests as flaky/slow CI runs even though local runs pass.
35
+ * @param locator - The element to click.
36
+ * @param urlPattern - Expected post-navigation URL (string or regex).
37
+ * @param options - Forwarded to `page.waitForURL`.
38
+ * @example
39
+ * ```ts
40
+ * // In a spec
41
+ * await this.auditPage.clickAndWaitForURL(
42
+ * this.auditPage.backButton,
43
+ * /\/admin\/oneadmin\/migrate(?:\/)?$/,
44
+ * );
45
+ * await expect(this.settingsPage.container).toBeVisible();
46
+ * ```
47
+ */
48
+ clickAndWaitForURL(locator: Locator, urlPattern: string | RegExp, options?: Parameters<Page['waitForURL']>[1]): Promise<void>;
27
49
  }
@@ -1,5 +1,5 @@
1
- import { Page, Expect } from '@playwright/test';
2
- import { Credentials, GotoOptions } from '../types.js';
1
+ import type { Page, Expect } from '@playwright/test';
2
+ import type { Credentials, GotoOptions } from '../types.js';
3
3
  /**
4
4
  * Base class for Playwright test specs that run against
5
5
  * apps hosted inside the encw (Encompass Web) shell.
@@ -1,4 +1,4 @@
1
- import { type Page, PlaywrightTestConfig } from '@playwright/test';
1
+ import type { PlaywrightTestConfig, Page } from '@playwright/test';
2
2
  /**
3
3
  * Mark coverage as configured. Called by {@link createPlaywrightConfig}
4
4
  * when a `coverage` config is provided — no env var needed.
@@ -1,4 +1,4 @@
1
- import { Page } from '@playwright/test';
1
+ import type { Page } from '@playwright/test';
2
2
  /**
3
3
  * Registers init scripts and route blocks on a Playwright page.
4
4
  *
@@ -1,4 +1,5 @@
1
- import { Page } from '@playwright/test';
1
+ import type { Page, PlaywrightTestConfig } from '@playwright/test';
2
+ import type { CoverageConfig } from './monocartCoverage/index.js';
2
3
  /** Page context for element interaction. */
3
4
  export type AppContext = Page;
4
5
  /**
@@ -38,7 +39,7 @@ export interface GotoOptions {
38
39
  */
39
40
  export interface SmokedSuiteConfig {
40
41
  /** Partial Playwright config to merge with sensible defaults. */
41
- overrides?: import('@playwright/test').PlaywrightTestConfig;
42
+ overrides?: PlaywrightTestConfig;
42
43
  /**
43
44
  * When `true` (default), a `globalSetup` function runs once before
44
45
  * all workers to authenticate and persist the session to disk.
@@ -73,5 +74,5 @@ export interface SmokedSuiteConfig {
73
74
  * });
74
75
  * ```
75
76
  */
76
- coverage?: import('./monocartCoverage/index.js').CoverageConfig[];
77
+ coverage?: CoverageConfig[];
77
78
  }