@one2x/playwright 1.57.0-alpha.6 → 1.57.0-alpha.8
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.
|
@@ -35,6 +35,7 @@ var import_bundle = require("../../sdk/bundle");
|
|
|
35
35
|
var import_tool = require("./tool");
|
|
36
36
|
var codegen = __toESM(require("../codegen"));
|
|
37
37
|
var import_actionRetry = require("./actionRetry");
|
|
38
|
+
var import_utils = require("./utils");
|
|
38
39
|
const fillForm = (0, import_tool.defineTabTool)({
|
|
39
40
|
capability: "core",
|
|
40
41
|
schema: {
|
|
@@ -65,12 +66,8 @@ const fillForm = (0, import_tool.defineTabTool)({
|
|
|
65
66
|
async (opts) => await locator.setChecked(field.value === "true", opts),
|
|
66
67
|
{}
|
|
67
68
|
);
|
|
68
|
-
if (result.usedAllowIntercept)
|
|
69
|
-
response.
|
|
70
|
-
if (result.interceptorInfo)
|
|
71
|
-
response.addResult(` Intercepting element: ${result.interceptorInfo}`);
|
|
72
|
-
response.addResult("\u2713 Retried with allowIntercept: true and succeeded");
|
|
73
|
-
}
|
|
69
|
+
if (result.usedAllowIntercept)
|
|
70
|
+
(0, import_utils.addInterceptorWarning)(response, resolved, ".setChecked(value, { allowIntercept: true })", result.interceptorInfo);
|
|
74
71
|
const optionsAttr = result.usedAllowIntercept ? ", { allowIntercept: true }" : "";
|
|
75
72
|
response.addCode(`${locatorSource}.setChecked(${field.value}${optionsAttr});`);
|
|
76
73
|
} else if (field.type === "combobox") {
|
|
@@ -92,10 +92,8 @@ const click = (0, import_tool.defineTabTool)({
|
|
|
92
92
|
interceptorInfo = result.interceptorInfo;
|
|
93
93
|
});
|
|
94
94
|
if (usedAllowIntercept) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
response.addResult(` Intercepting element: ${interceptorInfo}`);
|
|
98
|
-
response.addResult("\u2713 Retried with allowIntercept: true and succeeded");
|
|
95
|
+
const actionName = params.doubleClick ? ".dblclick({ allowIntercept: true })" : ".click({ allowIntercept: true })";
|
|
96
|
+
(0, import_utils.addInterceptorWarning)(response, resolved, actionName, interceptorInfo);
|
|
99
97
|
}
|
|
100
98
|
const finalOptions = usedAllowIntercept ? { ...options, allowIntercept: true } : options;
|
|
101
99
|
const formatted = javascript.formatObject(finalOptions, " ", "oneline");
|
|
@@ -137,12 +135,8 @@ const drag = (0, import_tool.defineTabTool)({
|
|
|
137
135
|
usedAllowIntercept = result.usedAllowIntercept;
|
|
138
136
|
interceptorInfo = result.interceptorInfo;
|
|
139
137
|
});
|
|
140
|
-
if (usedAllowIntercept)
|
|
141
|
-
response.
|
|
142
|
-
if (interceptorInfo)
|
|
143
|
-
response.addResult(` Intercepting element: ${interceptorInfo}`);
|
|
144
|
-
response.addResult("\u2713 Retried with allowIntercept: true and succeeded");
|
|
145
|
-
}
|
|
138
|
+
if (usedAllowIntercept)
|
|
139
|
+
(0, import_utils.addInterceptorWarning)(response, start.resolved, ".dragTo(target, { allowIntercept: true })", interceptorInfo);
|
|
146
140
|
const optionsAttr = usedAllowIntercept ? ", { allowIntercept: true }" : "";
|
|
147
141
|
response.addCode(`await page.${start.resolved}.dragTo(page.${end.resolved}${optionsAttr});`);
|
|
148
142
|
response.setIncludeAutoScreenshot();
|
|
@@ -170,12 +164,8 @@ const hover = (0, import_tool.defineTabTool)({
|
|
|
170
164
|
usedAllowIntercept = result.usedAllowIntercept;
|
|
171
165
|
interceptorInfo = result.interceptorInfo;
|
|
172
166
|
});
|
|
173
|
-
if (usedAllowIntercept)
|
|
174
|
-
response.
|
|
175
|
-
if (interceptorInfo)
|
|
176
|
-
response.addResult(` Intercepting element: ${interceptorInfo}`);
|
|
177
|
-
response.addResult("\u2713 Retried with allowIntercept: true and succeeded");
|
|
178
|
-
}
|
|
167
|
+
if (usedAllowIntercept)
|
|
168
|
+
(0, import_utils.addInterceptorWarning)(response, resolved, ".hover({ allowIntercept: true })", interceptorInfo);
|
|
179
169
|
const optionsAttr = usedAllowIntercept ? "{ allowIntercept: true }" : "";
|
|
180
170
|
response.addCode(`await page.${resolved}.hover(${optionsAttr});`);
|
|
181
171
|
response.setIncludeAutoScreenshot();
|
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var utils_exports = {};
|
|
20
20
|
__export(utils_exports, {
|
|
21
|
+
addInterceptorWarning: () => addInterceptorWarning,
|
|
21
22
|
callOnPageNoTrace: () => callOnPageNoTrace,
|
|
22
23
|
dateAsFileName: () => dateAsFileName,
|
|
23
24
|
generateLocators: () => generateLocators,
|
|
@@ -83,8 +84,15 @@ async function generateLocators(locator) {
|
|
|
83
84
|
const selectors = await locator.evaluate((el) => window.__injectedScript.generateSelector(el, { multiple: true, testIdAttributeName: "data-testid" }).selectors);
|
|
84
85
|
return selectors.map((s) => (0, import_utils.asLocator)("javascript", s));
|
|
85
86
|
}
|
|
87
|
+
function addInterceptorWarning(response, targetSelector, actionName, interceptorInfo) {
|
|
88
|
+
response.addResult(`\u26A0\uFE0F Warning: An intercepting element appears above target element \`page.${targetSelector}\``);
|
|
89
|
+
if (interceptorInfo)
|
|
90
|
+
response.addResult(` Intercepting element: ${interceptorInfo}`);
|
|
91
|
+
response.addResult(`\u2713 Retried action \`${actionName}\` and succeeded. The \`allowIntercept\` option is CRUCIAL`);
|
|
92
|
+
}
|
|
86
93
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
94
|
0 && (module.exports = {
|
|
95
|
+
addInterceptorWarning,
|
|
88
96
|
callOnPageNoTrace,
|
|
89
97
|
dateAsFileName,
|
|
90
98
|
generateLocators,
|
package/lib/mcp/sdk/http.js
CHANGED
|
@@ -235,7 +235,8 @@ function configFromInitRequest(body) {
|
|
|
235
235
|
"storage_state": "storageState",
|
|
236
236
|
"user_agent": "userAgent",
|
|
237
237
|
"user_data_dir": "userDataDir",
|
|
238
|
-
"viewport_size": "viewportSize"
|
|
238
|
+
"viewport_size": "viewportSize",
|
|
239
|
+
"auto_screenshot": "autoScreenshot"
|
|
239
240
|
};
|
|
240
241
|
for (const [snakeKey, camelKey] of Object.entries(keyMap)) {
|
|
241
242
|
if (playwrightConfig[snakeKey] !== void 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@one2x/playwright",
|
|
3
|
-
"version": "1.57.0-alpha.
|
|
3
|
+
"version": "1.57.0-alpha.8",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"license": "Apache-2.0",
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"content-type": "^1.0.5",
|
|
68
|
-
"playwright-core": "npm:@one2x/playwright-core@1.57.0-alpha.
|
|
68
|
+
"playwright-core": "npm:@one2x/playwright-core@1.57.0-alpha.8",
|
|
69
69
|
"raw-body": "^2.5.2"
|
|
70
70
|
},
|
|
71
71
|
"optionalDependencies": {
|