@untestutils/utils 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +37 -0
- package/dist/browser.d.ts +6 -8
- package/dist/browser.d.ts.map +1 -1
- package/package.json +15 -15
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Page, Response } from "playwright-core";
|
|
2
|
+
/**
|
|
3
|
+
* Proxy browser requests from `emulatedOrigin` to `realBaseURL`, forwarding
|
|
4
|
+
* `X-Forwarded-Host` / `X-Forwarded-Proto` so SSR sees the public domain.
|
|
5
|
+
*/
|
|
6
|
+
export declare function emulateDomain(page: Page, emulatedOrigin: string, realBaseURL: string): Promise<void>;
|
|
7
|
+
export type TrackedResponse = {
|
|
8
|
+
url: string;
|
|
9
|
+
status: number;
|
|
10
|
+
response: Response;
|
|
11
|
+
};
|
|
12
|
+
/** Collect HTTP responses for redirect assertions. Returns live array + disposer. */
|
|
13
|
+
export declare function trackResponses(page: Page): {
|
|
14
|
+
responses: TrackedResponse[];
|
|
15
|
+
stop: () => void;
|
|
16
|
+
findByPath: (pathname: string) => TrackedResponse | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type ConsoleMatch = {
|
|
19
|
+
type: string;
|
|
20
|
+
text: string;
|
|
21
|
+
};
|
|
22
|
+
export type ConsoleCollector = {
|
|
23
|
+
messages: ConsoleMatch[];
|
|
24
|
+
stop: () => void;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Collect console messages matching a predicate (hydration warnings, etc.).
|
|
28
|
+
* Call `stop()` when done; `messages` stays filled.
|
|
29
|
+
*/
|
|
30
|
+
export declare function collectConsole(page: Page, predicate?: (msg: {
|
|
31
|
+
type: () => string;
|
|
32
|
+
text: () => string;
|
|
33
|
+
}) => boolean): ConsoleCollector;
|
|
34
|
+
/** Collect hydration / mismatch console errors & warnings. */
|
|
35
|
+
export declare function collectHydrationIssues(page: Page): ConsoleCollector;
|
|
36
|
+
/** Apply `Accept-Language` for subsequent navigations on this page. */
|
|
37
|
+
export declare function setAcceptLanguage(page: Page, value: string): Promise<void>;
|
package/dist/browser.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export type ConsoleMatch = {
|
|
|
19
19
|
type: string;
|
|
20
20
|
text: string;
|
|
21
21
|
};
|
|
22
|
+
export type ConsoleCollector = {
|
|
23
|
+
messages: ConsoleMatch[];
|
|
24
|
+
stop: () => void;
|
|
25
|
+
};
|
|
22
26
|
/**
|
|
23
27
|
* Collect console messages matching a predicate (hydration warnings, etc.).
|
|
24
28
|
* Call `stop()` when done; `messages` stays filled.
|
|
@@ -26,15 +30,9 @@ export type ConsoleMatch = {
|
|
|
26
30
|
export declare function collectConsole(page: Page, predicate?: (msg: {
|
|
27
31
|
type: () => string;
|
|
28
32
|
text: () => string;
|
|
29
|
-
}) => boolean):
|
|
30
|
-
messages: ConsoleMatch[];
|
|
31
|
-
stop: () => void;
|
|
32
|
-
};
|
|
33
|
+
}) => boolean): ConsoleCollector;
|
|
33
34
|
/** Collect hydration / mismatch console errors & warnings. */
|
|
34
|
-
export declare function collectHydrationIssues(page: Page):
|
|
35
|
-
messages: ConsoleMatch[];
|
|
36
|
-
stop: () => void;
|
|
37
|
-
};
|
|
35
|
+
export declare function collectHydrationIssues(page: Page): ConsoleCollector;
|
|
38
36
|
/** Apply `Accept-Language` for subsequent navigations on this page. */
|
|
39
37
|
export declare function setAcceptLanguage(page: Page, value: string): Promise<void>;
|
|
40
38
|
//# sourceMappingURL=browser.d.ts.map
|
package/dist/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,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,EAAE,CAAC;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;CAC/D,CAkBA;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAE9E;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,SAAS,GAAE,CAAC,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,MAAM,CAAA;CAAE,KAAK,OAAoB,GACnF,gBAAgB,CAUlB;AAED,8DAA8D;AAC9D,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB,CAMnE;AAED,uEAAuE;AACvE,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@untestutils/utils",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Shared e2e/test utilities — cookies, SEO head, poll, browser helpers",
|
|
5
|
+
"homepage": "https://s00d.github.io/untestutils/",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/s00d/untestutils.git",
|
|
10
|
+
"directory": "packages/utils"
|
|
11
|
+
},
|
|
5
12
|
"files": [
|
|
6
13
|
"dist"
|
|
7
14
|
],
|
|
8
15
|
"type": "module",
|
|
9
16
|
"sideEffects": false,
|
|
17
|
+
"main": "./dist/index.mjs",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
10
19
|
"exports": {
|
|
11
20
|
".": {
|
|
12
21
|
"types": "./dist/index.d.ts",
|
|
@@ -15,12 +24,15 @@
|
|
|
15
24
|
},
|
|
16
25
|
"./package.json": "./package.json"
|
|
17
26
|
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
18
30
|
"devDependencies": {
|
|
19
31
|
"@types/node": "^26.6.1",
|
|
32
|
+
"obuild": "^0.4.40",
|
|
20
33
|
"playwright-core": "^1.63.0",
|
|
21
34
|
"publint": "^0.3.24",
|
|
22
|
-
"typescript": "^6.0.3"
|
|
23
|
-
"obuild": "^0.4.40"
|
|
35
|
+
"typescript": "^6.0.3"
|
|
24
36
|
},
|
|
25
37
|
"peerDependencies": {
|
|
26
38
|
"playwright-core": "^1.63.0"
|
|
@@ -33,18 +45,6 @@
|
|
|
33
45
|
"engines": {
|
|
34
46
|
"node": ">=20"
|
|
35
47
|
},
|
|
36
|
-
"license": "MIT",
|
|
37
|
-
"homepage": "https://s00d.github.io/untestutils/",
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "git+https://github.com/s00d/untestutils.git",
|
|
41
|
-
"directory": "packages/utils"
|
|
42
|
-
},
|
|
43
|
-
"main": "./dist/index.mjs",
|
|
44
|
-
"types": "./dist/index.d.ts",
|
|
45
|
-
"publishConfig": {
|
|
46
|
-
"access": "public"
|
|
47
|
-
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
50
50
|
"build": "obuild && tsc -p tsconfig.build.json",
|