@empiricalrun/playwright-utils 0.20.9 → 0.20.11
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 +16 -0
- package/dist/overlay-tests/click.spec.js +11 -0
- package/dist/test/scripts/locator-highlights.js +1 -1
- package/dist/test/scripts/pw-locator-patch/highlight/click.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/highlight/click.js +0 -11
- package/dist/test/scripts/pw-locator-patch/highlight/expect.d.ts +1 -2
- package/dist/test/scripts/pw-locator-patch/highlight/expect.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/highlight/expect.js +7 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.20.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 089977f: test: added test for no overlay scenarios
|
|
8
|
+
- 3ffd03c: feat: enable key moments feature flag
|
|
9
|
+
|
|
10
|
+
## 0.20.10
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- ae65525: fix: remove the runtime planner before master agent call
|
|
15
|
+
- Updated dependencies [698ad31]
|
|
16
|
+
- Updated dependencies [23f875f]
|
|
17
|
+
- @empiricalrun/test-gen@0.45.0
|
|
18
|
+
|
|
3
19
|
## 0.20.9
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -102,3 +102,14 @@ test_1.test.beforeEach(async ({ page }) => {
|
|
|
102
102
|
(0, test_1.expect)(firstLineThatStartsWithAt).toBeDefined();
|
|
103
103
|
(0, test_1.expect)(firstLineThatStartsWithAt).toContain("overlay-tests/click.spec.ts:106");
|
|
104
104
|
});
|
|
105
|
+
(0, test_1.test)("should return from master agent planner", async ({ page }) => {
|
|
106
|
+
await page.goto(`http://localhost:${PORT}/no-overlay.html`);
|
|
107
|
+
try {
|
|
108
|
+
// Deliberately click on a button that doesn't exist
|
|
109
|
+
await page.getByRole("button", { name: "Login" }).click();
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
(0, test_1.expect)(e.message).toContain("locator.apply: Timeout 5000ms exceeded");
|
|
113
|
+
(0, test_1.expect)(e.message).toContain("waiting for getByRole('button', { name: 'Login' })");
|
|
114
|
+
}
|
|
115
|
+
});
|
|
@@ -19,7 +19,7 @@ exports.addLocatorHighlights = addLocatorHighlights;
|
|
|
19
19
|
function applyHighlights(page, testFn) {
|
|
20
20
|
const LocatorClass = page.locator("").constructor;
|
|
21
21
|
(0, hover_1.patchHover)(LocatorClass, testFn);
|
|
22
|
-
(0, expect_1.patchExpect)(LocatorClass
|
|
22
|
+
(0, expect_1.patchExpect)(LocatorClass);
|
|
23
23
|
(0, input_value_1.patchInputValue)(LocatorClass, testFn);
|
|
24
24
|
(0, is_checked_1.patchIsChecked)(LocatorClass, testFn);
|
|
25
25
|
(0, is_editable_1.patchIsEditable)(LocatorClass, testFn);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/click.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/click.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA8BrC,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B;AA4FD,wBAAgB,UAAU,CACxB,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,EAC/C,MAAM,EAAE,MAAM,QA+Df"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.patchClick = exports.extractInterceptingElement = void 0;
|
|
4
|
-
const planner_1 = require("@empiricalrun/test-gen/agent/master/planner");
|
|
5
4
|
const run_1 = require("@empiricalrun/test-gen/agent/master/run");
|
|
6
5
|
const utils_1 = require("../utils");
|
|
7
6
|
// Static flag to track if click has been patched
|
|
@@ -125,16 +124,6 @@ async function runAgentOnOverlay(pageRef, element) {
|
|
|
125
124
|
The popup can be identified with its text content:
|
|
126
125
|
${content}`
|
|
127
126
|
: ``;
|
|
128
|
-
const plannerResp = await (0, planner_1.runtimePlannerWithScreenshot)({
|
|
129
|
-
task: `
|
|
130
|
-
Find a way to dismiss the popup. If the popup is non dismissible or there is no popup then return immediately.
|
|
131
|
-
Also note that you just need to dismiss popup and do nothing else.`,
|
|
132
|
-
conversation: [],
|
|
133
|
-
page: pageRef,
|
|
134
|
-
});
|
|
135
|
-
if (plannerResp.isDone) {
|
|
136
|
-
throw new Error("No active popup found");
|
|
137
|
-
}
|
|
138
127
|
await (0, run_1.createTestUsingMasterAgent)({
|
|
139
128
|
task: `
|
|
140
129
|
Find a way to dismiss the popup. If the popup is non dismissible or there is no popup then return immediately.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/expect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/expect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAMhD,wBAAgB,WAAW,CAAC,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAoB1E"}
|
|
@@ -3,30 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.patchExpect = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const isExpectPatched = new WeakMap();
|
|
6
|
-
function patchExpect(LocatorClass
|
|
6
|
+
function patchExpect(LocatorClass) {
|
|
7
7
|
if (isExpectPatched.get(LocatorClass)) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
const originalExpect = LocatorClass.prototype._expect;
|
|
11
|
+
// No need to add test.step in this patch as its already an internal method and is not part of stack trace
|
|
12
|
+
// if added then its tracked as a separate step in playwright trace
|
|
11
13
|
// @ts-ignore _expect is a private method in playwright
|
|
12
14
|
// https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L352
|
|
13
15
|
LocatorClass.prototype._expect = async function (expression, options) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
result = await originalExpect.apply(this, [expression, options]);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
if (error instanceof Error) {
|
|
22
|
-
Error.captureStackTrace(error, LocatorClass.prototype._expect);
|
|
23
|
-
}
|
|
24
|
-
throw error;
|
|
25
|
-
}
|
|
26
|
-
if (result.matches) {
|
|
27
|
-
await (0, utils_1.scrollAndHighlight)(this);
|
|
28
|
-
}
|
|
29
|
-
}, { box: true });
|
|
16
|
+
const result = await originalExpect.apply(this, [expression, options]);
|
|
17
|
+
if (result.matches) {
|
|
18
|
+
await (0, utils_1.scrollAndHighlight)(this);
|
|
19
|
+
}
|
|
30
20
|
return result;
|
|
31
21
|
};
|
|
32
22
|
isExpectPatched.set(LocatorClass, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
45
|
"@empiricalrun/llm": "^0.9.35",
|
|
46
|
-
"@empiricalrun/test-gen": "^0.
|
|
46
|
+
"@empiricalrun/test-gen": "^0.45.0",
|
|
47
47
|
"@empiricalrun/r2-uploader": "^0.3.8"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|