@owlmeans/test-ui 0.1.18-rc.47 → 0.1.18-rc.48
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/README.md +1 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/testing-ui/SKILL.md +1 -1
- package/build/consts.local.d.ts +3 -0
- package/build/consts.local.d.ts.map +1 -0
- package/build/consts.local.js +3 -0
- package/build/consts.local.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/build/marketing-consent.d.ts +1 -19
- package/build/marketing-consent.d.ts.map +1 -1
- package/build/marketing-consent.js +1 -1
- package/build/marketing-consent.js.map +1 -1
- package/build/mount.d.ts +1 -39
- package/build/mount.d.ts.map +1 -1
- package/build/mount.js.map +1 -1
- package/build/supervisor.d.ts +1 -67
- package/build/supervisor.d.ts.map +1 -1
- package/build/supervisor.js +1 -1
- package/build/supervisor.js.map +1 -1
- package/build/types.d.ts +126 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/package.json +10 -10
- package/src/consts.local.ts +3 -0
- package/src/index.ts +1 -0
- package/src/marketing-consent.ts +2 -22
- package/src/mount.ts +1 -41
- package/src/supervisor.ts +3 -71
- package/src/types.ts +127 -0
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
58
58
|
your project's skill store (`.agents/skills/`):
|
|
59
59
|
|
|
60
60
|
```sh
|
|
61
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
61
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.48
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/test-ui",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.48",
|
|
5
|
+
"generatedAt": "2026-10-05T08:32:19.090Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -6,7 +6,7 @@ description: Category-D component-level acceptance tests for OwlMeans Common UI
|
|
|
6
6
|
|
|
7
7
|
# UI Acceptance Tests — Category D (bun test + Playwright as a library)
|
|
8
8
|
|
|
9
|
-
**Install:** `"@owlmeans/test-ui": "^0.1.18-rc.
|
|
9
|
+
**Install:** `"@owlmeans/test-ui": "^0.1.18-rc.48"` in `devDependencies`
|
|
10
10
|
|
|
11
11
|
`@owlmeans/test-ui` depends on `playwright`, so the browser library arrives with it; add
|
|
12
12
|
`playwright` to `devDependencies` as well when a spec imports a launcher itself. The Vite harness
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iCAAiC,QAAS,CAAA;AAEvD,eAAO,MAAM,uBAAuB,wCAAwC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAA;AAEvD,MAAM,CAAC,MAAM,uBAAuB,GAAG,qCAAqC,CAAA"}
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AACtC,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AACtC,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA"}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AAEtC,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA"}
|
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
import type { Page } from 'playwright';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Which choice to save when the step is shown. `'all'` (the default) ticks the "select all"
|
|
5
|
-
* checkbox (every consent, and the Terms row while it is up — see {@link terms} for what is left
|
|
6
|
-
* of that) before saving; `'none'` saves with every item left unchecked, which is a valid,
|
|
7
|
-
* fully-compliant state on its own; `'skip'` clicks "Skip for now" instead of saving anything —
|
|
8
|
-
* only valid when a Terms box is not on screen (nothing calls it there; see {@link terms}).
|
|
9
|
-
*/
|
|
10
|
-
accept?: 'none' | 'all' | 'skip';
|
|
11
|
-
/**
|
|
12
|
-
* When a Terms row is on screen (`appendMarketingConsent({ terms: 'step' })`), `'accept'` (the
|
|
13
|
-
* default) ends with it ticked. `'leave'` ends with it unticked, even after a select-all — for a
|
|
14
|
-
* spec that means to drive the blocked state itself; the confirm click below still fires (with `{ force: true }`, since
|
|
15
|
-
* the control is never truly `disabled`), and this helper then EXPECTS the box to still be up
|
|
16
|
-
* afterward rather than treating that as a failure.
|
|
17
|
-
*/
|
|
18
|
-
terms?: 'accept' | 'leave';
|
|
19
|
-
timeout?: number;
|
|
20
|
-
}
|
|
2
|
+
import type { AnswerMarketingConsentOptions } from './types.js';
|
|
21
3
|
/**
|
|
22
4
|
* Answer the marketing-consent full-page step (`@owlmeans/web-marketing-consent`) if it is shown
|
|
23
5
|
* right after login, so a spec driving {@link loginViaSupervisorForm} or {@link loginViaDispatcher}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketing-consent.d.ts","sourceRoot":"","sources":["../src/marketing-consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,
|
|
1
|
+
{"version":3,"file":"marketing-consent.d.ts","sourceRoot":"","sources":["../src/marketing-consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAA;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB,SAC3B,IAAI,SAAS,6BAA6B,KAC/C,OAAO,CAAC,OAAO,CA2FjB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { DEFAULT_MARKETING_CONSENT_TIMEOUT } from './consts.local.js';
|
|
2
2
|
/**
|
|
3
3
|
* Answer the marketing-consent full-page step (`@owlmeans/web-marketing-consent`) if it is shown
|
|
4
4
|
* right after login, so a spec driving {@link loginViaSupervisorForm} or {@link loginViaDispatcher}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketing-consent.js","sourceRoot":"","sources":["../src/marketing-consent.ts"],"names":[],"mappings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AAM,IAAI,MAAM,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;YACnC,2FAA2F;YAC3F,wFAAwF;YACxF,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAA;QAClG,CAAC;IACH,CAAC;IAED,6FAA6F;IAC7F,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
package/build/mount.d.ts
CHANGED
|
@@ -1,42 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface MountOptions {
|
|
3
|
-
/**
|
|
4
|
-
* URL the harness is reachable at. The consuming package is in charge
|
|
5
|
-
* of producing it — typically a Vite dev server pointed at
|
|
6
|
-
* `node_modules/@owlmeans/test-ui/harness/` plus a per-package
|
|
7
|
-
* `mount.tsx` that registers the components under test, OR an
|
|
8
|
-
* inlined `data:text/html,...` URL for the simplest smoke tests.
|
|
9
|
-
*/
|
|
10
|
-
url: string;
|
|
11
|
-
/**
|
|
12
|
-
* Component name registered in the harness. Appended as `?component=`.
|
|
13
|
-
* Omit when the harness mounts a single fixed root.
|
|
14
|
-
*/
|
|
15
|
-
component?: string;
|
|
16
|
-
/**
|
|
17
|
-
* JSON-serialisable props passed to the component. Encoded into the
|
|
18
|
-
* URL as `?props=<json>` for the harness's `mount.tsx` to read.
|
|
19
|
-
*/
|
|
20
|
-
props?: Record<string, unknown>;
|
|
21
|
-
/**
|
|
22
|
-
* What counts as "arrived". Defaults to `domcontentloaded`.
|
|
23
|
-
*
|
|
24
|
-
* NOT `load`, which is playwright's own default and is wrong for any page that is a real
|
|
25
|
-
* application: `load` waits for EVERY subresource, and an analytics beacon, a long-poll or a
|
|
26
|
-
* third-party pixel that never settles holds it open until the navigation times out — with the
|
|
27
|
-
* page fully rendered and working the whole time. The failure reads as "the site is down".
|
|
28
|
-
*
|
|
29
|
-
* A spec waits for the selector it actually needs; that is the assertion, not the load event.
|
|
30
|
-
*/
|
|
31
|
-
waitUntil?: 'commit' | 'domcontentloaded' | 'load' | 'networkidle';
|
|
32
|
-
/** Navigation timeout in ms. */
|
|
33
|
-
timeout?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface Mounted {
|
|
36
|
-
page: Page;
|
|
37
|
-
/** Closes the page's browser context — the shared browser stays alive. */
|
|
38
|
-
close: () => Promise<void>;
|
|
39
|
-
}
|
|
1
|
+
import type { Mounted, MountOptions } from './types.js';
|
|
40
2
|
/**
|
|
41
3
|
* Open a fresh browser context, navigate to the harness URL with the
|
|
42
4
|
* `component` and `props` query parameters set, and return the `Page`
|
package/build/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAYvD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,SAAgB,YAAY,KAAG,OAAO,CAAC,OAAO,CAYxE,CAAA"}
|
package/build/mount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAG5C,MAAM,QAAQ,GAAG,CAAC,IAAkB,EAAU,EAAE;IAC9C,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAA;IACpC,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI;QAAE,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IACnE,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI;QAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IACvE,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAC5B,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC,GAAG,CAAA;IAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;IAC9C,OAAO,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,EAAE,EAAE,CAAA;AACjC,CAAC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,IAAkB,EAAoB,EAAE;IAC3E,MAAM,OAAO,GAAG,MAAM,aAAa,EAAE,CAAA;IACrC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;IAC1C,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;IACpC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC9B,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,kBAAkB;QAC/C,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3D,CAAC,CAAA;IACF,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA,CAAC,CAAC;KAC7C,CAAA;AACH,CAAC,CAAA"}
|
package/build/supervisor.d.ts
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import type { Page } from 'playwright';
|
|
2
|
-
import type {
|
|
3
|
-
export interface PregenerateAuthTokenOptions {
|
|
4
|
-
/** Target user id / email the token represents. */
|
|
5
|
-
userId: string;
|
|
6
|
-
/**
|
|
7
|
-
* Private key to sign the bearer with, e.g. `ed25519:<base64>` from
|
|
8
|
-
* `.env.dev.secrets`. MUST be the key the target backend trusts as its own
|
|
9
|
-
* signing key (it verifies bearers against `cfg.alias`/`cfg.service`).
|
|
10
|
-
*/
|
|
11
|
-
pk: string;
|
|
12
|
-
scopes?: string[];
|
|
13
|
-
role?: AuthRole;
|
|
14
|
-
entityId?: string;
|
|
15
|
-
profileId?: string;
|
|
16
|
-
/** `source` recorded in the Auth payload (usually the backend service alias). */
|
|
17
|
-
source?: string;
|
|
18
|
-
}
|
|
2
|
+
import type { PregenerateAuthTokenOptions, SupervisorApiAuthOptions, SupervisorFormLoginOptions } from './types.js';
|
|
19
3
|
/**
|
|
20
4
|
* Mint a ready-to-use `ED25519-BASIC-TOKEN ...` bearer offline, reusing
|
|
21
5
|
* `@owlmeans/test-auth`'s `makeBearer`. This is the "set a token directly"
|
|
@@ -42,21 +26,6 @@ export declare const loginViaDispatcher: (page: Page, baseUrl: string, token: st
|
|
|
42
26
|
*/
|
|
43
27
|
marketingConsent?: 'save' | 'ignore';
|
|
44
28
|
}) => Promise<void>;
|
|
45
|
-
export interface SupervisorApiAuthOptions {
|
|
46
|
-
/** Auth-manager API base URL (the backend serving /authentication/* and /authenticate). */
|
|
47
|
-
apiBaseUrl: string;
|
|
48
|
-
/** Target user id / email to authenticate (and register on first use). */
|
|
49
|
-
userId: string;
|
|
50
|
-
/** Supervisor private key, e.g. `ed25519:<base64>` from `.env.dev.secrets`. */
|
|
51
|
-
pk: string;
|
|
52
|
-
/** Paths, overridable for non-default routing. */
|
|
53
|
-
paths?: {
|
|
54
|
-
init?: string;
|
|
55
|
-
authenticate?: string;
|
|
56
|
-
dispatch?: string;
|
|
57
|
-
};
|
|
58
|
-
fetchImpl?: typeof fetch;
|
|
59
|
-
}
|
|
60
29
|
/**
|
|
61
30
|
* Pregenerate a real bearer by driving the live PK-based supervisor flow over the
|
|
62
31
|
* backend API (no browser): `/authentication/init` -> sign the challenge with the
|
|
@@ -74,41 +43,6 @@ export declare const authenticateViaSupervisorApi: (opts: SupervisorApiAuthOptio
|
|
|
74
43
|
* host or inside a dev container.
|
|
75
44
|
*/
|
|
76
45
|
export declare const saveScreenshot: (page: Page, dir: string, name: string) => Promise<string>;
|
|
77
|
-
export interface SupervisorFormLoginOptions {
|
|
78
|
-
baseUrl: string;
|
|
79
|
-
/** Target user id / email. */
|
|
80
|
-
userId: string;
|
|
81
|
-
/** Supervisor private key (e.g. `ed25519:<base64>` from `.env.dev.secrets`). */
|
|
82
|
-
pk: string;
|
|
83
|
-
/** Login path; defaults to the standard supervisor route. */
|
|
84
|
-
path?: string;
|
|
85
|
-
/** Predicate/URL fragment that signals a successful landing (default: leaving the login path). */
|
|
86
|
-
expectPath?: string;
|
|
87
|
-
timeout?: number;
|
|
88
|
-
/**
|
|
89
|
-
* What counts as "arrived" for the initial navigation. Defaults to `domcontentloaded`.
|
|
90
|
-
*
|
|
91
|
-
* See the note on `MountOptions.waitUntil`: `load` is playwright's default and is wrong for a
|
|
92
|
-
* real application, because it waits for every subresource — a tag manager, an analytics beacon
|
|
93
|
-
* or any pixel that never settles holds it open until the navigation times out, with the login
|
|
94
|
-
* form rendered and fillable the whole time.
|
|
95
|
-
*/
|
|
96
|
-
waitUntil?: 'commit' | 'domcontentloaded' | 'load' | 'networkidle';
|
|
97
|
-
/**
|
|
98
|
-
* What to do about a cookie-consent dialog covering the form. Defaults to `accept`, because an
|
|
99
|
-
* OwlMeans app will not start an authentication flow until consent is answered — see
|
|
100
|
-
* {@link acceptConsent}. Pass `ignore` only in a spec that answers the dialog itself.
|
|
101
|
-
*/
|
|
102
|
-
consent?: 'accept' | 'ignore';
|
|
103
|
-
/** When set, capture the filled login form (`supervisor-login-form.png`) before submit. */
|
|
104
|
-
screenshotDir?: string;
|
|
105
|
-
/**
|
|
106
|
-
* Answer the marketing-consent step if it is shown right after landing. Defaults to `'save'`
|
|
107
|
-
* (select-all and save) — see {@link answerMarketingConsent}. Pass `'ignore'` to skip the call
|
|
108
|
-
* entirely, e.g. in a spec that answers the step itself.
|
|
109
|
-
*/
|
|
110
|
-
marketingConsent?: 'save' | 'ignore';
|
|
111
|
-
}
|
|
112
46
|
/**
|
|
113
47
|
* Answer the cookie-consent dialog if one is up, so the page underneath can be driven.
|
|
114
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAQtC,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAEnH;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,SAAgB,2BAA2B,KAAG,OAAO,CAAC,MAAM,CAe5F,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,SACvB,IAAI,WAAW,MAAM,SAAS,MAAM,SACnC;IACL,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,kBAAkB,GAAG,MAAM,GAAG,aAAa,CAAA;IAC3F;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;CACrC,KACA,OAAO,CAAC,IAAI,CAYd,CAAA;AAgBD;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,SACjC,wBAAwB,KAC7B,OAAO,CAAC,MAAM,CAkChB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,SAAgB,IAAI,OAAO,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,MAAM,CAM1F,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,SAClB,IAAI,SAAS;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KACtC,OAAO,CAAC,OAAO,CAajB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAC3B,IAAI,QAAQ,0BAA0B,KAC3C,OAAO,CAAC,IAAI,CAuCd,CAAA"}
|
package/build/supervisor.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createIdOfLength } from '@owlmeans/basic-ids';
|
|
|
6
6
|
import { EnvelopeKind, makeEnvelopeModel } from '@owlmeans/basic-envelope';
|
|
7
7
|
import { makeBearer } from '@owlmeans/test-auth';
|
|
8
8
|
import { answerMarketingConsent } from './marketing-consent.js';
|
|
9
|
+
import { DEFAULT_SUPERVISOR_PATH } from './consts.local.js';
|
|
9
10
|
/**
|
|
10
11
|
* Mint a ready-to-use `ED25519-BASIC-TOKEN ...` bearer offline, reusing
|
|
11
12
|
* `@owlmeans/test-auth`'s `makeBearer`. This is the "set a token directly"
|
|
@@ -110,7 +111,6 @@ export const saveScreenshot = async (page, dir, name) => {
|
|
|
110
111
|
await page.screenshot({ path: file, fullPage: true });
|
|
111
112
|
return file;
|
|
112
113
|
};
|
|
113
|
-
const DEFAULT_SUPERVISOR_PATH = '/authentication/login/pk-supervisor';
|
|
114
114
|
/**
|
|
115
115
|
* Answer the cookie-consent dialog if one is up, so the page underneath can be driven.
|
|
116
116
|
*
|
package/build/supervisor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,E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AAI,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;IAC3E,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;IAElE,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAA;IACzE,CAAC;IAED,MAAM,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;IAE9D,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC5B,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAW,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;IACtF,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,6FAA6F;IAC7F,8FAA8F;IAC9F,iGAAiG;IACjG,sCAAsC;IACtC,IAAI,IAAI,CAAC,gBAAgB,KAAK,QAAQ;QAAE,MAAM,sBAAsB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AACxG,CAAC,CAAA"}
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Page } from 'playwright';
|
|
2
|
+
import type { AuthRole } from '@owlmeans/auth';
|
|
3
|
+
export interface AnswerMarketingConsentOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Which choice to save when the step is shown. `'all'` (the default) ticks the "select all"
|
|
6
|
+
* checkbox (every consent, and the Terms row while it is up — see {@link terms} for what is left
|
|
7
|
+
* of that) before saving; `'none'` saves with every item left unchecked, which is a valid,
|
|
8
|
+
* fully-compliant state on its own; `'skip'` clicks "Skip for now" instead of saving anything —
|
|
9
|
+
* only valid when a Terms box is not on screen (nothing calls it there; see {@link terms}).
|
|
10
|
+
*/
|
|
11
|
+
accept?: 'none' | 'all' | 'skip';
|
|
12
|
+
/**
|
|
13
|
+
* When a Terms row is on screen (`appendMarketingConsent({ terms: 'step' })`), `'accept'` (the
|
|
14
|
+
* default) ends with it ticked. `'leave'` ends with it unticked, even after a select-all — for a
|
|
15
|
+
* spec that means to drive the blocked state itself; the confirm click below still fires (with `{ force: true }`, since
|
|
16
|
+
* the control is never truly `disabled`), and this helper then EXPECTS the box to still be up
|
|
17
|
+
* afterward rather than treating that as a failure.
|
|
18
|
+
*/
|
|
19
|
+
terms?: 'accept' | 'leave';
|
|
20
|
+
timeout?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface MountOptions {
|
|
23
|
+
/**
|
|
24
|
+
* URL the harness is reachable at. The consuming package is in charge
|
|
25
|
+
* of producing it — typically a Vite dev server pointed at
|
|
26
|
+
* `node_modules/@owlmeans/test-ui/harness/` plus a per-package
|
|
27
|
+
* `mount.tsx` that registers the components under test, OR an
|
|
28
|
+
* inlined `data:text/html,...` URL for the simplest smoke tests.
|
|
29
|
+
*/
|
|
30
|
+
url: string;
|
|
31
|
+
/**
|
|
32
|
+
* Component name registered in the harness. Appended as `?component=`.
|
|
33
|
+
* Omit when the harness mounts a single fixed root.
|
|
34
|
+
*/
|
|
35
|
+
component?: string;
|
|
36
|
+
/**
|
|
37
|
+
* JSON-serialisable props passed to the component. Encoded into the
|
|
38
|
+
* URL as `?props=<json>` for the harness's `mount.tsx` to read.
|
|
39
|
+
*/
|
|
40
|
+
props?: Record<string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* What counts as "arrived". Defaults to `domcontentloaded`.
|
|
43
|
+
*
|
|
44
|
+
* NOT `load`, which is playwright's own default and is wrong for any page that is a real
|
|
45
|
+
* application: `load` waits for EVERY subresource, and an analytics beacon, a long-poll or a
|
|
46
|
+
* third-party pixel that never settles holds it open until the navigation times out — with the
|
|
47
|
+
* page fully rendered and working the whole time. The failure reads as "the site is down".
|
|
48
|
+
*
|
|
49
|
+
* A spec waits for the selector it actually needs; that is the assertion, not the load event.
|
|
50
|
+
*/
|
|
51
|
+
waitUntil?: 'commit' | 'domcontentloaded' | 'load' | 'networkidle';
|
|
52
|
+
/** Navigation timeout in ms. */
|
|
53
|
+
timeout?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface Mounted {
|
|
56
|
+
page: Page;
|
|
57
|
+
/** Closes the page's browser context — the shared browser stays alive. */
|
|
58
|
+
close: () => Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
export interface PregenerateAuthTokenOptions {
|
|
61
|
+
/** Target user id / email the token represents. */
|
|
62
|
+
userId: string;
|
|
63
|
+
/**
|
|
64
|
+
* Private key to sign the bearer with, e.g. `ed25519:<base64>` from
|
|
65
|
+
* `.env.dev.secrets`. MUST be the key the target backend trusts as its own
|
|
66
|
+
* signing key (it verifies bearers against `cfg.alias`/`cfg.service`).
|
|
67
|
+
*/
|
|
68
|
+
pk: string;
|
|
69
|
+
scopes?: string[];
|
|
70
|
+
role?: AuthRole;
|
|
71
|
+
entityId?: string;
|
|
72
|
+
profileId?: string;
|
|
73
|
+
/** `source` recorded in the Auth payload (usually the backend service alias). */
|
|
74
|
+
source?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface SupervisorApiAuthOptions {
|
|
77
|
+
/** Auth-manager API base URL (the backend serving /authentication/* and /authenticate). */
|
|
78
|
+
apiBaseUrl: string;
|
|
79
|
+
/** Target user id / email to authenticate (and register on first use). */
|
|
80
|
+
userId: string;
|
|
81
|
+
/** Supervisor private key, e.g. `ed25519:<base64>` from `.env.dev.secrets`. */
|
|
82
|
+
pk: string;
|
|
83
|
+
/** Paths, overridable for non-default routing. */
|
|
84
|
+
paths?: {
|
|
85
|
+
init?: string;
|
|
86
|
+
authenticate?: string;
|
|
87
|
+
dispatch?: string;
|
|
88
|
+
};
|
|
89
|
+
fetchImpl?: typeof fetch;
|
|
90
|
+
}
|
|
91
|
+
export interface SupervisorFormLoginOptions {
|
|
92
|
+
baseUrl: string;
|
|
93
|
+
/** Target user id / email. */
|
|
94
|
+
userId: string;
|
|
95
|
+
/** Supervisor private key (e.g. `ed25519:<base64>` from `.env.dev.secrets`). */
|
|
96
|
+
pk: string;
|
|
97
|
+
/** Login path; defaults to the standard supervisor route. */
|
|
98
|
+
path?: string;
|
|
99
|
+
/** Predicate/URL fragment that signals a successful landing (default: leaving the login path). */
|
|
100
|
+
expectPath?: string;
|
|
101
|
+
timeout?: number;
|
|
102
|
+
/**
|
|
103
|
+
* What counts as "arrived" for the initial navigation. Defaults to `domcontentloaded`.
|
|
104
|
+
*
|
|
105
|
+
* See the note on `MountOptions.waitUntil`: `load` is playwright's default and is wrong for a
|
|
106
|
+
* real application, because it waits for every subresource — a tag manager, an analytics beacon
|
|
107
|
+
* or any pixel that never settles holds it open until the navigation times out, with the login
|
|
108
|
+
* form rendered and fillable the whole time.
|
|
109
|
+
*/
|
|
110
|
+
waitUntil?: 'commit' | 'domcontentloaded' | 'load' | 'networkidle';
|
|
111
|
+
/**
|
|
112
|
+
* What to do about a cookie-consent dialog covering the form. Defaults to `accept`, because an
|
|
113
|
+
* OwlMeans app will not start an authentication flow until consent is answered — see
|
|
114
|
+
* {@link acceptConsent}. Pass `ignore` only in a spec that answers the dialog itself.
|
|
115
|
+
*/
|
|
116
|
+
consent?: 'accept' | 'ignore';
|
|
117
|
+
/** When set, capture the filled login form (`supervisor-login-form.png`) before submit. */
|
|
118
|
+
screenshotDir?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Answer the marketing-consent step if it is shown right after landing. Defaults to `'save'`
|
|
121
|
+
* (select-all and save) — see {@link answerMarketingConsent}. Pass `'ignore'` to skip the call
|
|
122
|
+
* entirely, e.g. in a spec that answers the step itself.
|
|
123
|
+
*/
|
|
124
|
+
marketingConsent?: 'save' | 'ignore';
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,MAAM,WAAW,6BAA6B;IAC5C;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;IAChC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,kBAAkB,GAAG,MAAM,GAAG,aAAa,CAAA;IAClE,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,IAAI,CAAA;IACV,0EAA0E;IAC1E,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAED,MAAM,WAAW,2BAA2B;IAC1C,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,2FAA2F;IAC3F,UAAU,EAAE,MAAM,CAAA;IAClB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAA;IACd,+EAA+E;IAC/E,EAAE,EAAE,MAAM,CAAA;IACV,kDAAkD;IAClD,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACnE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CACzB;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAA;IACV,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kGAAkG;IAClG,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,kBAAkB,GAAG,MAAM,GAAG,aAAa,CAAA;IAClE;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC7B,2FAA2F;IAC3F,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;CACrC"}
|
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/test-ui",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.48",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"./harness": "./harness/index.html"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
26
|
-
"@owlmeans/basic-envelope": "^0.1.18-rc.
|
|
27
|
-
"@owlmeans/basic-ids": "^0.1.18-rc.
|
|
28
|
-
"@owlmeans/basic-keys": "^0.1.18-rc.
|
|
29
|
-
"@owlmeans/test": "^0.1.18-rc.
|
|
30
|
-
"@owlmeans/test-auth": "^0.1.18-rc.
|
|
31
|
-
"playwright": "^1.
|
|
25
|
+
"@owlmeans/auth": "^0.1.18-rc.39",
|
|
26
|
+
"@owlmeans/basic-envelope": "^0.1.18-rc.45",
|
|
27
|
+
"@owlmeans/basic-ids": "^0.1.18-rc.36",
|
|
28
|
+
"@owlmeans/basic-keys": "^0.1.18-rc.47",
|
|
29
|
+
"@owlmeans/test": "^0.1.18-rc.34",
|
|
30
|
+
"@owlmeans/test-auth": "^0.1.18-rc.45",
|
|
31
|
+
"playwright": "^1.63.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "*",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@owlmeans/dep-config": "^0.1.18-rc.6",
|
|
47
|
-
"@types/bun": "^1.4.
|
|
48
|
-
"@types/react": "^19.
|
|
47
|
+
"@types/bun": "^1.4.2",
|
|
48
|
+
"@types/react": "^19.3.0",
|
|
49
49
|
"nodemon": "^3.1.14",
|
|
50
50
|
"typescript": "^7.0.2"
|
|
51
51
|
},
|
package/src/index.ts
CHANGED
package/src/marketing-consent.ts
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
import type { Page } from 'playwright'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Which choice to save when the step is shown. `'all'` (the default) ticks the "select all"
|
|
6
|
-
* checkbox (every consent, and the Terms row while it is up — see {@link terms} for what is left
|
|
7
|
-
* of that) before saving; `'none'` saves with every item left unchecked, which is a valid,
|
|
8
|
-
* fully-compliant state on its own; `'skip'` clicks "Skip for now" instead of saving anything —
|
|
9
|
-
* only valid when a Terms box is not on screen (nothing calls it there; see {@link terms}).
|
|
10
|
-
*/
|
|
11
|
-
accept?: 'none' | 'all' | 'skip'
|
|
12
|
-
/**
|
|
13
|
-
* When a Terms row is on screen (`appendMarketingConsent({ terms: 'step' })`), `'accept'` (the
|
|
14
|
-
* default) ends with it ticked. `'leave'` ends with it unticked, even after a select-all — for a
|
|
15
|
-
* spec that means to drive the blocked state itself; the confirm click below still fires (with `{ force: true }`, since
|
|
16
|
-
* the control is never truly `disabled`), and this helper then EXPECTS the box to still be up
|
|
17
|
-
* afterward rather than treating that as a failure.
|
|
18
|
-
*/
|
|
19
|
-
terms?: 'accept' | 'leave'
|
|
20
|
-
timeout?: number
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const DEFAULT_MARKETING_CONSENT_TIMEOUT = 30_000
|
|
2
|
+
import { DEFAULT_MARKETING_CONSENT_TIMEOUT } from './consts.local.js'
|
|
3
|
+
import type { AnswerMarketingConsentOptions } from './types.js'
|
|
24
4
|
|
|
25
5
|
/**
|
|
26
6
|
* Answer the marketing-consent full-page step (`@owlmeans/web-marketing-consent`) if it is shown
|
package/src/mount.ts
CHANGED
|
@@ -1,45 +1,5 @@
|
|
|
1
|
-
import type { Page } from 'playwright'
|
|
2
1
|
import { launchBrowser } from './browser.js'
|
|
3
|
-
|
|
4
|
-
export interface MountOptions {
|
|
5
|
-
/**
|
|
6
|
-
* URL the harness is reachable at. The consuming package is in charge
|
|
7
|
-
* of producing it — typically a Vite dev server pointed at
|
|
8
|
-
* `node_modules/@owlmeans/test-ui/harness/` plus a per-package
|
|
9
|
-
* `mount.tsx` that registers the components under test, OR an
|
|
10
|
-
* inlined `data:text/html,...` URL for the simplest smoke tests.
|
|
11
|
-
*/
|
|
12
|
-
url: string
|
|
13
|
-
/**
|
|
14
|
-
* Component name registered in the harness. Appended as `?component=`.
|
|
15
|
-
* Omit when the harness mounts a single fixed root.
|
|
16
|
-
*/
|
|
17
|
-
component?: string
|
|
18
|
-
/**
|
|
19
|
-
* JSON-serialisable props passed to the component. Encoded into the
|
|
20
|
-
* URL as `?props=<json>` for the harness's `mount.tsx` to read.
|
|
21
|
-
*/
|
|
22
|
-
props?: Record<string, unknown>
|
|
23
|
-
/**
|
|
24
|
-
* What counts as "arrived". Defaults to `domcontentloaded`.
|
|
25
|
-
*
|
|
26
|
-
* NOT `load`, which is playwright's own default and is wrong for any page that is a real
|
|
27
|
-
* application: `load` waits for EVERY subresource, and an analytics beacon, a long-poll or a
|
|
28
|
-
* third-party pixel that never settles holds it open until the navigation times out — with the
|
|
29
|
-
* page fully rendered and working the whole time. The failure reads as "the site is down".
|
|
30
|
-
*
|
|
31
|
-
* A spec waits for the selector it actually needs; that is the assertion, not the load event.
|
|
32
|
-
*/
|
|
33
|
-
waitUntil?: 'commit' | 'domcontentloaded' | 'load' | 'networkidle'
|
|
34
|
-
/** Navigation timeout in ms. */
|
|
35
|
-
timeout?: number
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface Mounted {
|
|
39
|
-
page: Page
|
|
40
|
-
/** Closes the page's browser context — the shared browser stays alive. */
|
|
41
|
-
close: () => Promise<void>
|
|
42
|
-
}
|
|
2
|
+
import type { Mounted, MountOptions } from './types.js'
|
|
43
3
|
|
|
44
4
|
const buildUrl = (opts: MountOptions): string => {
|
|
45
5
|
const params = new URLSearchParams()
|
package/src/supervisor.ts
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
import { mkdir } from 'node:fs/promises'
|
|
2
2
|
import { join, resolve } from 'node:path'
|
|
3
3
|
import type { Page } from 'playwright'
|
|
4
|
-
import type
|
|
5
|
-
import {
|
|
6
|
-
AuthroizationType, AuthRole as Role, AuthenticationType, buildSupervisorPayload
|
|
7
|
-
} from '@owlmeans/auth'
|
|
4
|
+
import { type Auth, type AuthCredentials, AuthroizationType, AuthRole as Role, AuthenticationType, buildSupervisorPayload } from '@owlmeans/auth'
|
|
8
5
|
import { makeKeyPairModel } from '@owlmeans/basic-keys'
|
|
9
6
|
import { createIdOfLength } from '@owlmeans/basic-ids'
|
|
10
7
|
import { EnvelopeKind, makeEnvelopeModel } from '@owlmeans/basic-envelope'
|
|
11
8
|
import { makeBearer } from '@owlmeans/test-auth'
|
|
12
9
|
import { answerMarketingConsent } from './marketing-consent.js'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** Target user id / email the token represents. */
|
|
16
|
-
userId: string
|
|
17
|
-
/**
|
|
18
|
-
* Private key to sign the bearer with, e.g. `ed25519:<base64>` from
|
|
19
|
-
* `.env.dev.secrets`. MUST be the key the target backend trusts as its own
|
|
20
|
-
* signing key (it verifies bearers against `cfg.alias`/`cfg.service`).
|
|
21
|
-
*/
|
|
22
|
-
pk: string
|
|
23
|
-
scopes?: string[]
|
|
24
|
-
role?: AuthRole
|
|
25
|
-
entityId?: string
|
|
26
|
-
profileId?: string
|
|
27
|
-
/** `source` recorded in the Auth payload (usually the backend service alias). */
|
|
28
|
-
source?: string
|
|
29
|
-
}
|
|
10
|
+
import { DEFAULT_SUPERVISOR_PATH } from './consts.local.js'
|
|
11
|
+
import type { PregenerateAuthTokenOptions, SupervisorApiAuthOptions, SupervisorFormLoginOptions } from './types.js'
|
|
30
12
|
|
|
31
13
|
/**
|
|
32
14
|
* Mint a ready-to-use `ED25519-BASIC-TOKEN ...` bearer offline, reusing
|
|
@@ -85,18 +67,6 @@ export const loginViaDispatcher = async (
|
|
|
85
67
|
}
|
|
86
68
|
}
|
|
87
69
|
|
|
88
|
-
export interface SupervisorApiAuthOptions {
|
|
89
|
-
/** Auth-manager API base URL (the backend serving /authentication/* and /authenticate). */
|
|
90
|
-
apiBaseUrl: string
|
|
91
|
-
/** Target user id / email to authenticate (and register on first use). */
|
|
92
|
-
userId: string
|
|
93
|
-
/** Supervisor private key, e.g. `ed25519:<base64>` from `.env.dev.secrets`. */
|
|
94
|
-
pk: string
|
|
95
|
-
/** Paths, overridable for non-default routing. */
|
|
96
|
-
paths?: { init?: string, authenticate?: string, dispatch?: string }
|
|
97
|
-
fetchImpl?: typeof fetch
|
|
98
|
-
}
|
|
99
|
-
|
|
100
70
|
const postJson = async (
|
|
101
71
|
fetchImpl: typeof fetch, url: string, body: unknown
|
|
102
72
|
): Promise<any> => {
|
|
@@ -172,44 +142,6 @@ export const saveScreenshot = async (page: Page, dir: string, name: string): Pro
|
|
|
172
142
|
return file
|
|
173
143
|
}
|
|
174
144
|
|
|
175
|
-
export interface SupervisorFormLoginOptions {
|
|
176
|
-
baseUrl: string
|
|
177
|
-
/** Target user id / email. */
|
|
178
|
-
userId: string
|
|
179
|
-
/** Supervisor private key (e.g. `ed25519:<base64>` from `.env.dev.secrets`). */
|
|
180
|
-
pk: string
|
|
181
|
-
/** Login path; defaults to the standard supervisor route. */
|
|
182
|
-
path?: string
|
|
183
|
-
/** Predicate/URL fragment that signals a successful landing (default: leaving the login path). */
|
|
184
|
-
expectPath?: string
|
|
185
|
-
timeout?: number
|
|
186
|
-
/**
|
|
187
|
-
* What counts as "arrived" for the initial navigation. Defaults to `domcontentloaded`.
|
|
188
|
-
*
|
|
189
|
-
* See the note on `MountOptions.waitUntil`: `load` is playwright's default and is wrong for a
|
|
190
|
-
* real application, because it waits for every subresource — a tag manager, an analytics beacon
|
|
191
|
-
* or any pixel that never settles holds it open until the navigation times out, with the login
|
|
192
|
-
* form rendered and fillable the whole time.
|
|
193
|
-
*/
|
|
194
|
-
waitUntil?: 'commit' | 'domcontentloaded' | 'load' | 'networkidle'
|
|
195
|
-
/**
|
|
196
|
-
* What to do about a cookie-consent dialog covering the form. Defaults to `accept`, because an
|
|
197
|
-
* OwlMeans app will not start an authentication flow until consent is answered — see
|
|
198
|
-
* {@link acceptConsent}. Pass `ignore` only in a spec that answers the dialog itself.
|
|
199
|
-
*/
|
|
200
|
-
consent?: 'accept' | 'ignore'
|
|
201
|
-
/** When set, capture the filled login form (`supervisor-login-form.png`) before submit. */
|
|
202
|
-
screenshotDir?: string
|
|
203
|
-
/**
|
|
204
|
-
* Answer the marketing-consent step if it is shown right after landing. Defaults to `'save'`
|
|
205
|
-
* (select-all and save) — see {@link answerMarketingConsent}. Pass `'ignore'` to skip the call
|
|
206
|
-
* entirely, e.g. in a spec that answers the step itself.
|
|
207
|
-
*/
|
|
208
|
-
marketingConsent?: 'save' | 'ignore'
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const DEFAULT_SUPERVISOR_PATH = '/authentication/login/pk-supervisor'
|
|
212
|
-
|
|
213
145
|
/**
|
|
214
146
|
* Answer the cookie-consent dialog if one is up, so the page underneath can be driven.
|
|
215
147
|
*
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { Page } from 'playwright'
|
|
2
|
+
import type { AuthRole } from '@owlmeans/auth'
|
|
3
|
+
|
|
4
|
+
export interface AnswerMarketingConsentOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Which choice to save when the step is shown. `'all'` (the default) ticks the "select all"
|
|
7
|
+
* checkbox (every consent, and the Terms row while it is up — see {@link terms} for what is left
|
|
8
|
+
* of that) before saving; `'none'` saves with every item left unchecked, which is a valid,
|
|
9
|
+
* fully-compliant state on its own; `'skip'` clicks "Skip for now" instead of saving anything —
|
|
10
|
+
* only valid when a Terms box is not on screen (nothing calls it there; see {@link terms}).
|
|
11
|
+
*/
|
|
12
|
+
accept?: 'none' | 'all' | 'skip'
|
|
13
|
+
/**
|
|
14
|
+
* When a Terms row is on screen (`appendMarketingConsent({ terms: 'step' })`), `'accept'` (the
|
|
15
|
+
* default) ends with it ticked. `'leave'` ends with it unticked, even after a select-all — for a
|
|
16
|
+
* spec that means to drive the blocked state itself; the confirm click below still fires (with `{ force: true }`, since
|
|
17
|
+
* the control is never truly `disabled`), and this helper then EXPECTS the box to still be up
|
|
18
|
+
* afterward rather than treating that as a failure.
|
|
19
|
+
*/
|
|
20
|
+
terms?: 'accept' | 'leave'
|
|
21
|
+
timeout?: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface MountOptions {
|
|
25
|
+
/**
|
|
26
|
+
* URL the harness is reachable at. The consuming package is in charge
|
|
27
|
+
* of producing it — typically a Vite dev server pointed at
|
|
28
|
+
* `node_modules/@owlmeans/test-ui/harness/` plus a per-package
|
|
29
|
+
* `mount.tsx` that registers the components under test, OR an
|
|
30
|
+
* inlined `data:text/html,...` URL for the simplest smoke tests.
|
|
31
|
+
*/
|
|
32
|
+
url: string
|
|
33
|
+
/**
|
|
34
|
+
* Component name registered in the harness. Appended as `?component=`.
|
|
35
|
+
* Omit when the harness mounts a single fixed root.
|
|
36
|
+
*/
|
|
37
|
+
component?: string
|
|
38
|
+
/**
|
|
39
|
+
* JSON-serialisable props passed to the component. Encoded into the
|
|
40
|
+
* URL as `?props=<json>` for the harness's `mount.tsx` to read.
|
|
41
|
+
*/
|
|
42
|
+
props?: Record<string, unknown>
|
|
43
|
+
/**
|
|
44
|
+
* What counts as "arrived". Defaults to `domcontentloaded`.
|
|
45
|
+
*
|
|
46
|
+
* NOT `load`, which is playwright's own default and is wrong for any page that is a real
|
|
47
|
+
* application: `load` waits for EVERY subresource, and an analytics beacon, a long-poll or a
|
|
48
|
+
* third-party pixel that never settles holds it open until the navigation times out — with the
|
|
49
|
+
* page fully rendered and working the whole time. The failure reads as "the site is down".
|
|
50
|
+
*
|
|
51
|
+
* A spec waits for the selector it actually needs; that is the assertion, not the load event.
|
|
52
|
+
*/
|
|
53
|
+
waitUntil?: 'commit' | 'domcontentloaded' | 'load' | 'networkidle'
|
|
54
|
+
/** Navigation timeout in ms. */
|
|
55
|
+
timeout?: number
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface Mounted {
|
|
59
|
+
page: Page
|
|
60
|
+
/** Closes the page's browser context — the shared browser stays alive. */
|
|
61
|
+
close: () => Promise<void>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface PregenerateAuthTokenOptions {
|
|
65
|
+
/** Target user id / email the token represents. */
|
|
66
|
+
userId: string
|
|
67
|
+
/**
|
|
68
|
+
* Private key to sign the bearer with, e.g. `ed25519:<base64>` from
|
|
69
|
+
* `.env.dev.secrets`. MUST be the key the target backend trusts as its own
|
|
70
|
+
* signing key (it verifies bearers against `cfg.alias`/`cfg.service`).
|
|
71
|
+
*/
|
|
72
|
+
pk: string
|
|
73
|
+
scopes?: string[]
|
|
74
|
+
role?: AuthRole
|
|
75
|
+
entityId?: string
|
|
76
|
+
profileId?: string
|
|
77
|
+
/** `source` recorded in the Auth payload (usually the backend service alias). */
|
|
78
|
+
source?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface SupervisorApiAuthOptions {
|
|
82
|
+
/** Auth-manager API base URL (the backend serving /authentication/* and /authenticate). */
|
|
83
|
+
apiBaseUrl: string
|
|
84
|
+
/** Target user id / email to authenticate (and register on first use). */
|
|
85
|
+
userId: string
|
|
86
|
+
/** Supervisor private key, e.g. `ed25519:<base64>` from `.env.dev.secrets`. */
|
|
87
|
+
pk: string
|
|
88
|
+
/** Paths, overridable for non-default routing. */
|
|
89
|
+
paths?: { init?: string, authenticate?: string, dispatch?: string }
|
|
90
|
+
fetchImpl?: typeof fetch
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface SupervisorFormLoginOptions {
|
|
94
|
+
baseUrl: string
|
|
95
|
+
/** Target user id / email. */
|
|
96
|
+
userId: string
|
|
97
|
+
/** Supervisor private key (e.g. `ed25519:<base64>` from `.env.dev.secrets`). */
|
|
98
|
+
pk: string
|
|
99
|
+
/** Login path; defaults to the standard supervisor route. */
|
|
100
|
+
path?: string
|
|
101
|
+
/** Predicate/URL fragment that signals a successful landing (default: leaving the login path). */
|
|
102
|
+
expectPath?: string
|
|
103
|
+
timeout?: number
|
|
104
|
+
/**
|
|
105
|
+
* What counts as "arrived" for the initial navigation. Defaults to `domcontentloaded`.
|
|
106
|
+
*
|
|
107
|
+
* See the note on `MountOptions.waitUntil`: `load` is playwright's default and is wrong for a
|
|
108
|
+
* real application, because it waits for every subresource — a tag manager, an analytics beacon
|
|
109
|
+
* or any pixel that never settles holds it open until the navigation times out, with the login
|
|
110
|
+
* form rendered and fillable the whole time.
|
|
111
|
+
*/
|
|
112
|
+
waitUntil?: 'commit' | 'domcontentloaded' | 'load' | 'networkidle'
|
|
113
|
+
/**
|
|
114
|
+
* What to do about a cookie-consent dialog covering the form. Defaults to `accept`, because an
|
|
115
|
+
* OwlMeans app will not start an authentication flow until consent is answered — see
|
|
116
|
+
* {@link acceptConsent}. Pass `ignore` only in a spec that answers the dialog itself.
|
|
117
|
+
*/
|
|
118
|
+
consent?: 'accept' | 'ignore'
|
|
119
|
+
/** When set, capture the filled login form (`supervisor-login-form.png`) before submit. */
|
|
120
|
+
screenshotDir?: string
|
|
121
|
+
/**
|
|
122
|
+
* Answer the marketing-consent step if it is shown right after landing. Defaults to `'save'`
|
|
123
|
+
* (select-all and save) — see {@link answerMarketingConsent}. Pass `'ignore'` to skip the call
|
|
124
|
+
* entirely, e.g. in a spec that answers the step itself.
|
|
125
|
+
*/
|
|
126
|
+
marketingConsent?: 'save' | 'ignore'
|
|
127
|
+
}
|