@empiricalrun/playwright-utils 0.70.3 → 0.71.1
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/CHANGELOG.md +21 -0
- package/dist/api-worker-client.d.ts +5 -1
- package/dist/api-worker-client.d.ts.map +1 -1
- package/dist/api-worker-client.js +15 -0
- package/dist/generated/api-worker-openapi.d.ts +609 -383
- package/dist/generated/api-worker-openapi.d.ts.map +1 -1
- package/dist/overlay-test-expectations.d.ts +10 -0
- package/dist/overlay-test-expectations.d.ts.map +1 -0
- package/dist/overlay-test-expectations.js +51 -0
- package/dist/overlay-tests/click.spec.js +26 -94
- package/dist/overlay-tests/dropdown.spec.js +10 -9
- package/dist/overlay-tests/fixtures.d.ts +1 -0
- package/dist/overlay-tests/fixtures.d.ts.map +1 -1
- package/dist/overlay-tests/fixtures.js +24 -0
- package/dist/overlay-tests/visual.spec.js +1 -11
- package/dist/test/cross-shard-locks.d.ts +1 -1
- package/dist/test/cross-shard-locks.d.ts.map +1 -1
- package/dist/test/cross-shard-locks.js +71 -25
- package/dist/test/index.d.ts +1 -0
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +10 -0
- package/dist/test/locator-handler-log.spec.d.ts +2 -0
- package/dist/test/locator-handler-log.spec.d.ts.map +1 -0
- package/dist/test/locator-handler-log.spec.js +44 -0
- package/dist/test/scripts/locator-handler-log.d.ts +23 -0
- package/dist/test/scripts/locator-handler-log.d.ts.map +1 -0
- package/dist/test/scripts/locator-handler-log.js +105 -0
- package/dist/test/scripts/pw-locator-patch/actions/click.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/actions/click.js +17 -34
- package/dist/test/scripts/pw-locator-patch/actions/hover.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/actions/hover.js +11 -25
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/index.d.ts +21 -4
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/index.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/index.js +113 -18
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/prompt.d.ts +2 -3
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/prompt.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/prompt.js +6 -52
- package/dist/webhook.d.ts +1 -6
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +12 -124
- package/package.json +3 -3
- package/playwright.config.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/overlay-tests/typesafe-hit-check.spec.d.ts +0 -2
- package/dist/overlay-tests/typesafe-hit-check.spec.d.ts.map +0 -1
- package/dist/overlay-tests/typesafe-hit-check.spec.js +0 -57
- package/dist/overlay-tests/typesafe.spec.d.ts +0 -2
- package/dist/overlay-tests/typesafe.spec.d.ts.map +0 -1
- package/dist/overlay-tests/typesafe.spec.js +0 -88
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/typesafe.d.ts +0 -38
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/typesafe.d.ts.map +0 -1
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/typesafe.js +0 -159
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Page } from "@playwright/test";
|
|
2
|
+
type GiveUp = {
|
|
3
|
+
sideEffect: (page: Page, dialogs: string[]) => Promise<boolean>;
|
|
4
|
+
};
|
|
5
|
+
export declare function knownDefaultAgentFailure(title: string): string | undefined;
|
|
6
|
+
export declare const GIVE_UP_TIMEOUT = 450000;
|
|
7
|
+
export declare const GIVES_UP: Record<string, GiveUp>;
|
|
8
|
+
export declare function expectCachedDismissal(title: string, cacheFile: string): void;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=overlay-test-expectations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-test-expectations.d.ts","sourceRoot":"","sources":["../src/overlay-test-expectations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIrD,KAAK,MAAM,GAAG;IACZ,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACjE,CAAC;AAUF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI1E;AAED,eAAO,MAAM,eAAe,SAAU,CAAC;AAEvC,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQ3C,CAAC;AASF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAerE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GIVES_UP = exports.GIVE_UP_TIMEOUT = void 0;
|
|
7
|
+
exports.knownDefaultAgentFailure = knownDefaultAgentFailure;
|
|
8
|
+
exports.expectCachedDismissal = expectCachedDismissal;
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const test_1 = require("@playwright/test");
|
|
11
|
+
const DEFAULT_AGENT_FAILURES = {
|
|
12
|
+
"loading page target": "gpt-5.4 sometimes tabs to the target behind the glass pane and presses Enter",
|
|
13
|
+
"filters search results to verified assets": "gpt-5.4 often clears the search query while closing the results",
|
|
14
|
+
"saves the picked date": "gpt-5.4 sometimes loses the picked date",
|
|
15
|
+
};
|
|
16
|
+
function knownDefaultAgentFailure(title) {
|
|
17
|
+
return process.env.EMPIRICALRUN_OVERLAY_AGENT === "investigator"
|
|
18
|
+
? undefined
|
|
19
|
+
: DEFAULT_AGENT_FAILURES[title];
|
|
20
|
+
}
|
|
21
|
+
exports.GIVE_UP_TIMEOUT = 450_000;
|
|
22
|
+
exports.GIVES_UP = {
|
|
23
|
+
"project settings target": {
|
|
24
|
+
sideEffect: async (page) => (await page.locator("#status").textContent()) === "Project closed",
|
|
25
|
+
},
|
|
26
|
+
"loading page target": {
|
|
27
|
+
sideEffect: async (_page, dialogs) => dialogs.length > 0,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const CACHES = {
|
|
31
|
+
"target shows a confirmation": {
|
|
32
|
+
dom: 'id="hearAboutUs"',
|
|
33
|
+
textContent: "How did you hear about us",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
function expectCachedDismissal(title, cacheFile) {
|
|
37
|
+
const expected = CACHES[title];
|
|
38
|
+
if (!expected) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const cache = JSON.parse(node_fs_1.default.readFileSync(cacheFile, "utf8"));
|
|
42
|
+
(0, test_1.expect)(cache.data).toEqual([
|
|
43
|
+
{
|
|
44
|
+
element: {
|
|
45
|
+
dom: test_1.expect.stringContaining(expected.dom),
|
|
46
|
+
textContent: test_1.expect.stringContaining(expected.textContent),
|
|
47
|
+
},
|
|
48
|
+
code: test_1.expect.stringMatching(/\S/),
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
@@ -1,121 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_1 = __importDefault(require("fs"));
|
|
7
3
|
const test_1 = require("../test");
|
|
8
|
-
const cache_1 = require("../test/scripts/pw-locator-patch/dismiss-overlays/cache");
|
|
9
4
|
const fixtures_1 = require("./fixtures");
|
|
10
5
|
fixtures_1.test.beforeEach(async ({ page }) => {
|
|
11
6
|
(0, test_1.injectLocatorHighlightScripts)(page, fixtures_1.test);
|
|
12
7
|
});
|
|
13
|
-
|
|
14
|
-
const cacheData = JSON.parse(fs_1.default.readFileSync((0, cache_1.cacheFile)(), "utf8"));
|
|
15
|
-
return cacheData.data.find(({ element }) => {
|
|
16
|
-
if (dom) {
|
|
17
|
-
return element.dom.includes(dom);
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function getCacheDataWithTextContent({ textContent }) {
|
|
23
|
-
const cacheData = JSON.parse(fs_1.default.readFileSync((0, cache_1.cacheFile)(), "utf8"));
|
|
24
|
-
return cacheData.data.find(({ element }) => {
|
|
25
|
-
if (textContent) {
|
|
26
|
-
return element.textContent.includes(textContent);
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
(0, fixtures_1.test)("should dismiss survicate for hover", async ({ page, server }) => {
|
|
8
|
+
(0, fixtures_1.test)("hovering the target keeps its styling", async ({ page, server }) => {
|
|
32
9
|
await page.goto(`${server.baseURL}/survey.html`);
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
await
|
|
36
|
-
|
|
37
|
-
await targetButton.hover();
|
|
38
|
-
const finalZIndex = await targetButton.evaluate((el) => window.getComputedStyle(el).getPropertyValue("z-index"));
|
|
39
|
-
(0, fixtures_1.expect)(finalZIndex).toBe(initialZIndex);
|
|
10
|
+
const target = page.getByRole("button", { name: "Target" });
|
|
11
|
+
const zIndex = await target.evaluate((el) => getComputedStyle(el).zIndex);
|
|
12
|
+
await target.hover();
|
|
13
|
+
(0, fixtures_1.expect)(await target.evaluate((el) => getComputedStyle(el).zIndex)).toBe(zIndex);
|
|
40
14
|
});
|
|
41
|
-
fixtures_1.test
|
|
15
|
+
(0, fixtures_1.test)("main action confirms the click", async ({ page, server }) => {
|
|
42
16
|
await page.goto(`${server.baseURL}/tos.html`);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
await (0, fixtures_1.expect)(page.getByRole("heading", { name: "Terms of Service" })).not.toBeVisible();
|
|
47
|
-
const withDom = getCacheDataWithDom({
|
|
48
|
-
dom: '<div class="terms-text">',
|
|
49
|
-
});
|
|
50
|
-
(0, fixtures_1.expect)(withDom).toBeTruthy();
|
|
51
|
-
const withText = getCacheDataWithTextContent({
|
|
52
|
-
textContent: "By accepting these terms, you agree to our Terms of Service",
|
|
17
|
+
const messages = [];
|
|
18
|
+
page.on("dialog", (dialog) => {
|
|
19
|
+
messages.push(dialog.message());
|
|
53
20
|
});
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(0, fixtures_1.expect)(code).toContain("await page.getByRole('button', { name: 'Accept' }).click()");
|
|
21
|
+
await page.getByRole("button", { name: "Target" }).click();
|
|
22
|
+
await fixtures_1.expect
|
|
23
|
+
.poll(() => messages)
|
|
24
|
+
.toContain("Button clicked! Terms were accepted.");
|
|
59
25
|
});
|
|
60
|
-
(0, fixtures_1.test)("
|
|
26
|
+
(0, fixtures_1.test)("target shows a confirmation", async ({ page, server }) => {
|
|
61
27
|
await page.goto(`${server.baseURL}/overlay-form.html`);
|
|
62
28
|
await page.getByRole("button", { name: "Target" }).click();
|
|
63
29
|
await (0, fixtures_1.expect)(page.getByText("Target was clicked")).toBeVisible();
|
|
64
|
-
const withDom = getCacheDataWithDom({
|
|
65
|
-
dom: 'id="hearAboutUs"',
|
|
66
|
-
});
|
|
67
|
-
(0, fixtures_1.expect)(withDom).toBeTruthy();
|
|
68
|
-
const withText = getCacheDataWithTextContent({
|
|
69
|
-
textContent: "How did you hear about us",
|
|
70
|
-
});
|
|
71
|
-
(0, fixtures_1.expect)(withText).toBeTruthy();
|
|
72
|
-
(0, fixtures_1.expect)(withDom).toEqual(withText);
|
|
73
|
-
const code = withDom?.code;
|
|
74
|
-
(0, fixtures_1.expect)(code).toBeDefined();
|
|
75
|
-
(0, fixtures_1.expect)(code).toContain("await page.getByPlaceholder('Please enter at least 4').fill");
|
|
76
|
-
(0, fixtures_1.expect)(code).toContain("await page.getByRole('button', { name: 'Submit' }).click()");
|
|
77
30
|
});
|
|
78
|
-
(0, fixtures_1.test)("
|
|
31
|
+
(0, fixtures_1.test)("clicks target, then closes the dialog", async ({ page, server }) => {
|
|
79
32
|
await page.goto(`${server.baseURL}/choose-an-overlay.html`);
|
|
80
|
-
await (0, fixtures_1.expect)(page.getByRole("button", { name: "Target" })).toBeVisible();
|
|
81
|
-
await (0, fixtures_1.expect)(page.getByText("This is a toast message")).toBeVisible();
|
|
82
|
-
await (0, fixtures_1.expect)(page.getByRole("button", { name: "Close" })).toBeVisible();
|
|
83
33
|
await page.getByRole("button", { name: "Target" }).click();
|
|
84
|
-
await
|
|
85
|
-
await (0, fixtures_1.expect)(page.getByRole("button", { name: "Close" })).toBeVisible();
|
|
86
|
-
const withDom = getCacheDataWithDom({
|
|
87
|
-
dom: '<div id="toast" class="z-[100]">',
|
|
88
|
-
});
|
|
89
|
-
(0, fixtures_1.expect)(withDom).toBeTruthy();
|
|
90
|
-
const withText = getCacheDataWithTextContent({
|
|
91
|
-
textContent: "This is a toast message",
|
|
92
|
-
});
|
|
93
|
-
(0, fixtures_1.expect)(withText).toBeTruthy();
|
|
94
|
-
(0, fixtures_1.expect)(withDom).toEqual(withText);
|
|
95
|
-
const code = withDom?.code;
|
|
96
|
-
(0, fixtures_1.expect)(code).toBeDefined();
|
|
97
|
-
(0, fixtures_1.expect)(code).toContain("await page.getByRole('button', { name: '×' }).click()");
|
|
34
|
+
await page.getByRole("button", { name: "Close" }).click({ timeout: 3000 });
|
|
98
35
|
});
|
|
99
|
-
fixtures_1.test
|
|
100
|
-
await page.goto(`${server.baseURL}/no-overlay.html`);
|
|
101
|
-
let error;
|
|
102
|
-
try {
|
|
103
|
-
await page.getByRole("button", { name: "Bottom Button" }).click();
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
error = e;
|
|
107
|
-
}
|
|
108
|
-
console.log(fixtures_1.test.info().annotations);
|
|
109
|
-
(0, fixtures_1.expect)(error).toBeDefined();
|
|
110
|
-
(0, fixtures_1.expect)(error.message).toContain('<button type="button" class="top-button">Top Button</button> intercepts pointer events');
|
|
111
|
-
});
|
|
112
|
-
(0, fixtures_1.test)("should be able to pass through pf overlay", async ({ page, server }) => {
|
|
36
|
+
(0, fixtures_1.test)("opens Customise UI from the sidebar", async ({ page, server }) => {
|
|
113
37
|
await page.goto(`${server.baseURL}/productfruits.html`);
|
|
114
38
|
await page.locator("#sidebar-menu").getByText("Customise UI").click();
|
|
115
39
|
await (0, fixtures_1.expect)(page.getByText("This is the Customise UI page")).toBeVisible();
|
|
116
40
|
});
|
|
117
|
-
fixtures_1.test
|
|
41
|
+
(0, fixtures_1.test)("target button reports the click", async ({ page, server }) => {
|
|
118
42
|
await page.goto(`${server.baseURL}/loop-to-dismiss.html`);
|
|
119
43
|
await page.getByRole("button", { name: "Target" }).click();
|
|
120
44
|
await (0, fixtures_1.expect)(page.getByText("Clicked!")).toBeVisible();
|
|
121
45
|
});
|
|
46
|
+
(0, fixtures_1.test)("project settings target", async ({ page, server }) => {
|
|
47
|
+
await page.goto(`${server.baseURL}/toast-without-close.html`);
|
|
48
|
+
await page.getByRole("button", { name: "Target" }).click();
|
|
49
|
+
});
|
|
50
|
+
(0, fixtures_1.test)("loading page target", async ({ page, server }) => {
|
|
51
|
+
await page.goto(`${server.baseURL}/glass-pane.html`);
|
|
52
|
+
await page.getByRole("button", { name: "Target" }).click();
|
|
53
|
+
});
|
|
@@ -35,19 +35,20 @@ for (const clickMode of ["mouse", "dispatch"]) {
|
|
|
35
35
|
page.getByRole("option", { name: "September" }).click(),
|
|
36
36
|
]);
|
|
37
37
|
});
|
|
38
|
-
(0, fixtures_1.test)("saves
|
|
39
|
-
fixtures_1.test.skip(true, "Not deterministic: the agent keeps the picked date in some runs and loses it in others");
|
|
38
|
+
(0, fixtures_1.test)("saves the picked date", async ({ page, server }) => {
|
|
40
39
|
await page.goto(`${server.baseURL}/datepicker.html`);
|
|
41
40
|
await page.getByPlaceholder("Pick a date").click();
|
|
42
41
|
await page.getByRole("grid").getByRole("button", { name: "15" }).click();
|
|
43
42
|
await page.getByRole("button", { name: "Save" }).click();
|
|
44
43
|
await (0, fixtures_1.expect)(page.locator("#status")).toHaveText("Saved for 2026-09-15");
|
|
45
44
|
});
|
|
46
|
-
|
|
47
|
-
fixtures_1.test.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
fixtures_1.test.describe(() => {
|
|
46
|
+
fixtures_1.test.describe.configure({ retries: 2 });
|
|
47
|
+
(0, fixtures_1.test)("filters search results to verified assets", async ({ page, server, }) => {
|
|
48
|
+
await page.goto(`${server.baseURL}/search-results.html`);
|
|
49
|
+
await page.getByRole("searchbox", { name: "Search assets" }).fill("orders");
|
|
50
|
+
await (0, fixtures_1.expect)(page.getByText("Showing 74 results")).toBeVisible();
|
|
51
|
+
await page.getByRole("button", { name: "Verified" }).click();
|
|
52
|
+
await (0, fixtures_1.expect)(page.locator("#status")).toHaveText('Query "orders", verified only: true');
|
|
53
|
+
});
|
|
53
54
|
});
|
|
@@ -5,6 +5,7 @@ type ServerFixture = {
|
|
|
5
5
|
export declare const expect: import("@playwright/test").Expect<{}>;
|
|
6
6
|
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
|
|
7
7
|
overlayCacheFile: string;
|
|
8
|
+
expectedOutcome: void;
|
|
8
9
|
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & {
|
|
9
10
|
server: ServerFixture;
|
|
10
11
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/overlay-tests/fixtures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/overlay-tests/fixtures.ts"],"names":[],"mappings":"AAYA,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,MAAM,uCAAc,CAAC;AAClC,eAAO,MAAM,IAAI;sBACK,MAAM;qBAAmB,IAAI;;YACvC,aAAa;EA6DvB,CAAC"}
|
|
@@ -8,8 +8,32 @@ const test_1 = require("@playwright/test");
|
|
|
8
8
|
const http_1 = __importDefault(require("http"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const serve_handler_1 = __importDefault(require("serve-handler"));
|
|
11
|
+
const overlay_test_expectations_1 = require("../overlay-test-expectations");
|
|
11
12
|
exports.expect = test_1.test.expect;
|
|
12
13
|
exports.test = test_1.test.extend({
|
|
14
|
+
expectedOutcome: [
|
|
15
|
+
async ({ page, overlayCacheFile }, use, testInfo) => {
|
|
16
|
+
const knownFailure = (0, overlay_test_expectations_1.knownDefaultAgentFailure)(testInfo.title);
|
|
17
|
+
testInfo.skip(knownFailure !== undefined, knownFailure);
|
|
18
|
+
const giveUp = overlay_test_expectations_1.GIVES_UP[testInfo.title];
|
|
19
|
+
if (giveUp) {
|
|
20
|
+
testInfo.setTimeout(overlay_test_expectations_1.GIVE_UP_TIMEOUT);
|
|
21
|
+
}
|
|
22
|
+
const dialogs = [];
|
|
23
|
+
page.on("dialog", (dialog) => {
|
|
24
|
+
dialogs.push(dialog.message());
|
|
25
|
+
return dialog.dismiss();
|
|
26
|
+
});
|
|
27
|
+
await use();
|
|
28
|
+
if (testInfo.status === "passed") {
|
|
29
|
+
(0, overlay_test_expectations_1.expectCachedDismissal)(testInfo.title, overlayCacheFile);
|
|
30
|
+
}
|
|
31
|
+
if (giveUp && !(await giveUp.sideEffect(page, dialogs))) {
|
|
32
|
+
testInfo.fail();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{ auto: true },
|
|
36
|
+
],
|
|
13
37
|
overlayCacheFile: [
|
|
14
38
|
async ({}, use, testInfo) => {
|
|
15
39
|
const previous = process.env.EMPIRICALRUN_OVERLAY_CACHE_FILE;
|
|
@@ -3,23 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const test_1 = require("../test");
|
|
4
4
|
const fixtures_1 = require("./fixtures");
|
|
5
5
|
const expect = (0, test_1.extendExpect)(fixtures_1.expect);
|
|
6
|
-
fixtures_1.test.skip("toLookRight on page attaches screenshot", async ({ page, server, }, testInfo) => {
|
|
7
|
-
await page.goto(`${server.baseURL}/visual-test.html`);
|
|
8
|
-
await expect(page).toLookRight("A welcome page with a heading and a paragraph of text");
|
|
9
|
-
const pageAttachment = testInfo.attachments.find((a) => a.name.startsWith("toLookRight-"));
|
|
10
|
-
expect(pageAttachment).toBeDefined();
|
|
11
|
-
expect(pageAttachment.name).toBe("toLookRight-L11-a-welcome-page-with-a-heading-and-a-paragraph-of-text");
|
|
12
|
-
expect(pageAttachment.contentType).toBe("image/png");
|
|
13
|
-
expect(pageAttachment.path).toBeDefined();
|
|
14
|
-
expect(pageAttachment.path).toMatch(/\.png$/);
|
|
15
|
-
});
|
|
16
6
|
(0, fixtures_1.test)("toLookRight on locator attaches screenshot", async ({ page, server, }, testInfo) => {
|
|
17
7
|
await page.goto(`${server.baseURL}/visual-test.html`);
|
|
18
8
|
const heading = page.locator("h1");
|
|
19
9
|
await expect(heading).toLookRight("A heading that says Welcome to the App");
|
|
20
10
|
const locatorAttachment = testInfo.attachments.find((a) => a.name.startsWith("toLookRight-"));
|
|
21
11
|
expect(locatorAttachment).toBeDefined();
|
|
22
|
-
expect(locatorAttachment.name).toBe("toLookRight-
|
|
12
|
+
expect(locatorAttachment.name).toBe("toLookRight-L12-a-heading-that-says-welcome-to-the-app");
|
|
23
13
|
expect(locatorAttachment.contentType).toBe("image/png");
|
|
24
14
|
expect(locatorAttachment.path).toBeDefined();
|
|
25
15
|
expect(locatorAttachment.path).toMatch(/\.png$/);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-shard-locks.d.ts","sourceRoot":"","sources":["../../src/test/cross-shard-locks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,KAAK,QAAQ,EAA6B,MAAM,OAAO,CAAC;AAGjE,KAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"cross-shard-locks.d.ts","sourceRoot":"","sources":["../../src/test/cross-shard-locks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,KAAK,QAAQ,EAA6B,MAAM,OAAO,CAAC;AAGjE,KAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC;AAM3D,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAkBrC,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,iBACa,GACnB,MAAM,EAAE,CAEV;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI3D;AAmCD,wBAAsB,SAAS,CAAC,EAC9B,EAAE,EACF,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,GAAc,EACd,KAAiE,GAClE,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACtE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CA2E/B;AAED,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,MAAM,GACrB,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAmB9B"}
|
|
@@ -37,15 +37,26 @@ function lockKey(runId, name) {
|
|
|
37
37
|
const digest = (0, node_crypto_1.createHash)("sha256").update(name).digest("hex").slice(0, 12);
|
|
38
38
|
return `pw-lock:${runId}:${readable}:${digest}`;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
function ownVersionAfterConflict(error, lease) {
|
|
41
|
+
if (!(error instanceof kv_1.KvPreconditionFailedError) || !error.current) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const value = error.current.value;
|
|
45
|
+
return value?.lease === lease ? error.current.version : null;
|
|
46
|
+
}
|
|
47
|
+
async function acquire(kv, key, value, sleep) {
|
|
41
48
|
for (let attempt = 0;; attempt++) {
|
|
42
49
|
try {
|
|
43
|
-
const entry = await kv.set(key,
|
|
50
|
+
const entry = await kv.set(key, value, exports.LOCK_LEASE_SECONDS, {
|
|
44
51
|
ifAbsent: true,
|
|
45
52
|
});
|
|
46
53
|
return entry.version;
|
|
47
54
|
}
|
|
48
55
|
catch (error) {
|
|
56
|
+
const ownVersion = ownVersionAfterConflict(error, value.lease);
|
|
57
|
+
if (ownVersion !== null) {
|
|
58
|
+
return ownVersion;
|
|
59
|
+
}
|
|
49
60
|
if (!(error instanceof kv_1.KvPreconditionFailedError)) {
|
|
50
61
|
throw error;
|
|
51
62
|
}
|
|
@@ -54,39 +65,74 @@ async function acquire(kv, key, holder, sleep) {
|
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
67
|
async function holdLocks({ kv, runId, names, holder, annotate, now = Date.now, sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), }) {
|
|
68
|
+
const value = { ...holder, lease: (0, node_crypto_1.randomUUID)() };
|
|
57
69
|
const held = [];
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
type: "lock",
|
|
65
|
-
description: `${name}: waited ${Math.round((now() - startedAt) / 1000)}s across shards`,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
const leaseLost = (lock) => annotate({ type: "lock", description: `${lock.name}: lease lost` });
|
|
69
|
-
let renewing = Promise.resolve();
|
|
70
|
-
const renewal = setInterval(() => {
|
|
71
|
-
renewing = Promise.allSettled(held.map((lock) => kv
|
|
72
|
-
.refresh(lock.key, exports.LOCK_LEASE_SECONDS, { ifVersion: lock.version })
|
|
73
|
-
.then((entry) => {
|
|
70
|
+
const note = (lock, what) => annotate({ type: "lock", description: `${lock.name}: ${what}` });
|
|
71
|
+
const renew = async (lock) => {
|
|
72
|
+
try {
|
|
73
|
+
const entry = await kv.refresh(lock.key, exports.LOCK_LEASE_SECONDS, {
|
|
74
|
+
ifVersion: lock.version,
|
|
75
|
+
});
|
|
74
76
|
if (entry) {
|
|
75
77
|
lock.version = entry.version;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const ownVersion = ownVersionAfterConflict(error, value.lease);
|
|
83
|
+
if (ownVersion !== null) {
|
|
84
|
+
lock.version = ownVersion;
|
|
85
|
+
return;
|
|
76
86
|
}
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
if (!(error instanceof kv_1.KvPreconditionFailedError)) {
|
|
88
|
+
note(lock, `lease renewal failed, retrying in ${RENEW_EVERY_MS / 1000}s`);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
lock.lost = true;
|
|
93
|
+
note(lock, "lease lost");
|
|
94
|
+
};
|
|
95
|
+
const releaseLock = async (lock) => {
|
|
96
|
+
if (lock.lost) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
await kv.delete(lock.key, { ifVersion: lock.version });
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
const ownVersion = ownVersionAfterConflict(error, value.lease);
|
|
104
|
+
if (ownVersion !== null) {
|
|
105
|
+
await kv.delete(lock.key, { ifVersion: ownVersion });
|
|
79
106
|
}
|
|
80
|
-
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
let renewing = Promise.resolve();
|
|
110
|
+
const renewal = setInterval(() => {
|
|
111
|
+
renewing = Promise.allSettled(held.filter((lock) => !lock.lost).map(renew));
|
|
81
112
|
}, RENEW_EVERY_MS);
|
|
82
113
|
renewal.unref();
|
|
83
|
-
|
|
114
|
+
const release = async () => {
|
|
84
115
|
clearInterval(renewal);
|
|
85
116
|
await renewing;
|
|
86
|
-
await Promise.allSettled(held
|
|
87
|
-
.reverse()
|
|
88
|
-
.map((lock) => kv.delete(lock.key, { ifVersion: lock.version })));
|
|
117
|
+
await Promise.allSettled([...held].reverse().map(releaseLock));
|
|
89
118
|
};
|
|
119
|
+
try {
|
|
120
|
+
for (const name of names) {
|
|
121
|
+
const key = lockKey(runId, name);
|
|
122
|
+
const startedAt = now();
|
|
123
|
+
const version = await acquire(kv, key, value, sleep);
|
|
124
|
+
held.push({ name, key, version });
|
|
125
|
+
annotate({
|
|
126
|
+
type: "lock",
|
|
127
|
+
description: `${name}: waited ${Math.round((now() - startedAt) / 1000)}s across shards`,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
await release();
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
return release;
|
|
90
136
|
}
|
|
91
137
|
async function holdCrossShardLocks(testInfo, createKv) {
|
|
92
138
|
const names = lockNamesFor(testInfo.testId);
|
package/dist/test/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ type TestOptions = {
|
|
|
26
26
|
}>;
|
|
27
27
|
saveVideos: void;
|
|
28
28
|
crossShardLocks: void;
|
|
29
|
+
locatorHandlerLog: void;
|
|
29
30
|
};
|
|
30
31
|
declare const baseTestFixture: (testFn: TestType<PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>, options?: BaseTestFixtureOpts) => TestType<PlaywrightTestArgs & PlaywrightTestOptions & TestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
31
32
|
export type { CustomContextOptions, ScopedHTTPHeaders };
|
package/dist/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,MAAM,EACN,IAAI,EACJ,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,iBAAiB,EACtB,gBAAgB,EAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,MAAM,EACN,IAAI,EACJ,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,iBAAiB,EACtB,gBAAgB,EAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAK1D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAA8B,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,cAAc,CAAC;QACvB,UAAU,QAAQ,CAAC,CAAC;YAClB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC7C,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;SACnE;KACF;CACF;AAED,QAAA,MAAM,YAAY,mBAA6B,OAAO,MAAM,0CAG3D,CAAC;AAEF,KAAK,oBAAoB,GAAG,qBAAqB,GAAG;IAClD,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,QAAQ,CAAC;IACb,yBAAyB,EAAE,CACzB,OAAO,CAAC,EAAE,oBAAoB,KAC3B,OAAO,CAAC;QAAE,OAAO,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IACtD,UAAU,EAAE,IAAI,CAAC;IACjB,eAAe,EAAE,IAAI,CAAC;IACtB,iBAAiB,EAAE,IAAI,CAAC;CACzB,CAAC;AAIF,QAAA,MAAM,eAAe,WACX,QAAQ,CACd,kBAAkB,GAAG,qBAAqB,EAC1C,oBAAoB,GAAG,uBAAuB,CAC/C,YACQ,mBAAmB,uHAoJ7B,CAAC;AAEF,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,CAAC;AACxD,OAAO,EACL,eAAe,EACf,YAAY,EACZ,6BAA6B,EAC7B,gBAAgB,EAChB,aAAa,GACd,CAAC"}
|
package/dist/test/index.js
CHANGED
|
@@ -13,6 +13,7 @@ const scoped_http_headers_1 = require("./scoped-http-headers");
|
|
|
13
13
|
Object.defineProperty(exports, "scopeHTTPHeaders", { enumerable: true, get: function () { return scoped_http_headers_1.scopeHTTPHeaders; } });
|
|
14
14
|
const scripts_1 = require("./scripts");
|
|
15
15
|
Object.defineProperty(exports, "injectLocatorHighlightScripts", { enumerable: true, get: function () { return scripts_1.injectLocatorHighlightScripts; } });
|
|
16
|
+
const locator_handler_log_1 = require("./scripts/locator-handler-log");
|
|
16
17
|
const video_labels_1 = require("./video-labels");
|
|
17
18
|
Object.defineProperty(exports, "setVideoLabel", { enumerable: true, get: function () { return video_labels_1.setVideoLabel; } });
|
|
18
19
|
const extendExpect = function (expectInstance) {
|
|
@@ -50,6 +51,7 @@ const baseTestFixture = function (testFn, options = {}) {
|
|
|
50
51
|
await context.close();
|
|
51
52
|
},
|
|
52
53
|
page: async ({ page }, use) => {
|
|
54
|
+
(0, locator_handler_log_1.patchLocatorHandlers)(page, extendedTestFn);
|
|
53
55
|
(0, scripts_1.injectLocatorHighlightScripts)(page, extendedTestFn, options);
|
|
54
56
|
await use(page);
|
|
55
57
|
},
|
|
@@ -74,6 +76,7 @@ const baseTestFixture = function (testFn, options = {}) {
|
|
|
74
76
|
await (0, scoped_http_headers_1.scopeHTTPHeaders)(pageContext, scopedHTTPHeaders);
|
|
75
77
|
}
|
|
76
78
|
contexts.push({ context: pageContext, pages });
|
|
79
|
+
(0, locator_handler_log_1.patchLocatorHandlers)(customPage, extendedTestFn);
|
|
77
80
|
(0, scripts_1.injectLocatorHighlightScripts)(customPage, extendedTestFn, options);
|
|
78
81
|
return { context: pageContext, page: customPage };
|
|
79
82
|
}
|
|
@@ -133,6 +136,13 @@ const baseTestFixture = function (testFn, options = {}) {
|
|
|
133
136
|
},
|
|
134
137
|
{ auto: true, timeout: 0 },
|
|
135
138
|
],
|
|
139
|
+
locatorHandlerLog: [
|
|
140
|
+
async ({}, use, testInfo) => {
|
|
141
|
+
await use();
|
|
142
|
+
await (0, locator_handler_log_1.attachLocatorHandlerLog)(testInfo);
|
|
143
|
+
},
|
|
144
|
+
{ auto: true },
|
|
145
|
+
],
|
|
136
146
|
});
|
|
137
147
|
return extendedTestFn;
|
|
138
148
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locator-handler-log.spec.d.ts","sourceRoot":"","sources":["../../src/test/locator-handler-log.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const test_1 = require("@playwright/test");
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
const locator_handler_log_1 = require("./scripts/locator-handler-log");
|
|
6
|
+
const test = (0, index_1.baseTestFixture)(test_1.test);
|
|
7
|
+
const pageWithCookieBanner = `
|
|
8
|
+
<button id="save" onclick="document.body.dataset.saved = 'yes'">Save</button>
|
|
9
|
+
<div id="banner" style="position:fixed;inset:0;background:#fff">
|
|
10
|
+
<button onclick="document.getElementById('banner').remove()">Accept cookies</button>
|
|
11
|
+
</div>
|
|
12
|
+
`;
|
|
13
|
+
test("records each handler run with its duration", async ({ page, }, testInfo) => {
|
|
14
|
+
await page.setContent(pageWithCookieBanner);
|
|
15
|
+
await page.addLocatorHandler(page.getByRole("button", { name: "Accept cookies" }), async (banner) => {
|
|
16
|
+
await page.waitForTimeout(200);
|
|
17
|
+
await banner.click();
|
|
18
|
+
});
|
|
19
|
+
await page.locator("#save").click();
|
|
20
|
+
await (0, test_1.expect)(page.locator("body")).toHaveAttribute("data-saved", "yes");
|
|
21
|
+
const [record] = (0, locator_handler_log_1.locatorHandlerRecords)(testInfo);
|
|
22
|
+
(0, test_1.expect)(record?.locator).toBe("getByRole('button', { name: 'Accept cookies' })");
|
|
23
|
+
(0, test_1.expect)(record?.runs).toHaveLength(1);
|
|
24
|
+
(0, test_1.expect)(record?.runs[0]?.durationMs).toBeGreaterThanOrEqual(200);
|
|
25
|
+
await (0, locator_handler_log_1.attachLocatorHandlerLog)(testInfo);
|
|
26
|
+
const annotation = testInfo.annotations.find((a) => a.type === locator_handler_log_1.LOCATOR_HANDLER_ANNOTATION);
|
|
27
|
+
(0, test_1.expect)(annotation?.description).toMatch(/^getByRole\('button', \{ name: 'Accept cookies' \}\): ran 1 time, \d+\.\d\ds total$/);
|
|
28
|
+
const attachment = testInfo.attachments.find((a) => a.name === locator_handler_log_1.LOCATOR_HANDLER_ATTACHMENT);
|
|
29
|
+
(0, test_1.expect)(JSON.parse(attachment.body.toString())).toHaveLength(1);
|
|
30
|
+
});
|
|
31
|
+
test("reports handlers that never ran", async ({ page }, testInfo) => {
|
|
32
|
+
await page.setContent(`<button>Save</button>`);
|
|
33
|
+
await page.addLocatorHandler(page.getByText("Rate us"), async (dialog) => {
|
|
34
|
+
await dialog.press("Escape");
|
|
35
|
+
});
|
|
36
|
+
await page.getByRole("button", { name: "Save" }).click();
|
|
37
|
+
await (0, locator_handler_log_1.attachLocatorHandlerLog)(testInfo);
|
|
38
|
+
(0, test_1.expect)(testInfo.annotations.filter((a) => a.type === locator_handler_log_1.LOCATOR_HANDLER_ANNOTATION)).toEqual([
|
|
39
|
+
{
|
|
40
|
+
type: locator_handler_log_1.LOCATOR_HANDLER_ANNOTATION,
|
|
41
|
+
description: "getByText('Rate us'): registered, never ran",
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Page, TestInfo } from "@playwright/test";
|
|
2
|
+
import { TestFn } from "./types";
|
|
3
|
+
type AddLocatorHandler = Page["addLocatorHandler"];
|
|
4
|
+
type LocatorHandlerOptions = Parameters<AddLocatorHandler>[2];
|
|
5
|
+
export type LocatorHandlerRun = {
|
|
6
|
+
startedAt: string;
|
|
7
|
+
durationMs: number;
|
|
8
|
+
error?: string;
|
|
9
|
+
};
|
|
10
|
+
export type LocatorHandlerRecord = {
|
|
11
|
+
locator: string;
|
|
12
|
+
options?: LocatorHandlerOptions;
|
|
13
|
+
registeredAt: string;
|
|
14
|
+
runs: LocatorHandlerRun[];
|
|
15
|
+
};
|
|
16
|
+
export declare const LOCATOR_HANDLER_ANNOTATION = "locator-handler";
|
|
17
|
+
export declare const LOCATOR_HANDLER_ATTACHMENT = "locator-handlers";
|
|
18
|
+
export declare function patchLocatorHandlers(page: Page, testFn: TestFn): void;
|
|
19
|
+
export declare function locatorHandlerRecords(testInfo: TestInfo): LocatorHandlerRecord[];
|
|
20
|
+
export declare function summarizeLocatorHandler(record: LocatorHandlerRecord): string;
|
|
21
|
+
export declare function attachLocatorHandlerLog(testInfo: TestInfo): Promise<void>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=locator-handler-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locator-handler-log.d.ts","sourceRoot":"","sources":["../../../src/test/scripts/locator-handler-log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,KAAK,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC;AAEnD,KAAK,qBAAqB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,iBAAiB,EAAE,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAC5D,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAkD7D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAqC9D;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,0BAEvD;AAMD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,oBAAoB,UASnE;AAED,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,iBAgB/D"}
|