@ohos-ports/playwright 1.62.1-2-beta.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +318 -0
- package/ThirdPartyNotices.txt +14 -0
- package/cli.js +19 -0
- package/index.d.ts +17 -0
- package/index.js +17 -0
- package/index.mjs +18 -0
- package/jsx-runtime.js +42 -0
- package/jsx-runtime.mjs +21 -0
- package/lib/agents/agentParser.js +89 -0
- package/lib/agents/copilot-setup-steps.yml +34 -0
- package/lib/agents/generateAgents.js +395 -0
- package/lib/agents/playwright-test-coverage.prompt.md +31 -0
- package/lib/agents/playwright-test-generate.prompt.md +8 -0
- package/lib/agents/playwright-test-generator.agent.md +88 -0
- package/lib/agents/playwright-test-heal.prompt.md +6 -0
- package/lib/agents/playwright-test-healer.agent.md +56 -0
- package/lib/agents/playwright-test-plan.prompt.md +9 -0
- package/lib/agents/playwright-test-planner.agent.md +74 -0
- package/lib/cli/reportActions.js +78 -0
- package/lib/cli/testActions.js +213 -0
- package/lib/common/index.js +2954 -0
- package/lib/common/index.js.txt +34 -0
- package/lib/errorContext.js +129 -0
- package/lib/globals.js +58 -0
- package/lib/index.js +806 -0
- package/lib/isomorphic.js +260 -0
- package/lib/isomorphic.js.txt +9 -0
- package/lib/loader/loaderProcessEntry.js +34 -0
- package/lib/loader/loaderProcessEntry.js.txt +9 -0
- package/lib/matchers/expect.js +13486 -0
- package/lib/matchers/expect.js.LICENSE +640 -0
- package/lib/matchers/expect.js.txt +67 -0
- package/lib/mcp/test/browserBackend.js +125 -0
- package/lib/mcp/test/generatorTools.js +122 -0
- package/lib/mcp/test/plannerTools.js +150 -0
- package/lib/mcp/test/seed.js +82 -0
- package/lib/mcp/test/streams.js +44 -0
- package/lib/mcp/test/testBackend.js +99 -0
- package/lib/mcp/test/testContext.js +306 -0
- package/lib/mcp/test/testTool.js +30 -0
- package/lib/mcp/test/testTools.js +98 -0
- package/lib/package.js +47 -0
- package/lib/program.js +242 -0
- package/lib/runner/index.js +8241 -0
- package/lib/runner/index.js.txt +60 -0
- package/lib/transform/babelBundle.js +72275 -0
- package/lib/transform/babelBundle.js.LICENSE +2384 -0
- package/lib/transform/babelBundle.js.txt +325 -0
- package/lib/transform/esmLoader.js +8075 -0
- package/lib/transform/esmLoader.js.LICENSE +355 -0
- package/lib/transform/esmLoader.js.txt +60 -0
- package/lib/util.js +373 -0
- package/lib/worker/workerProcessEntry.js +1850 -0
- package/lib/worker/workerProcessEntry.js.txt +19 -0
- package/package.json +59 -0
- package/test.d.ts +18 -0
- package/test.js +24 -0
- package/test.mjs +35 -0
- package/types/test.d.ts +10848 -0
- package/types/testReporter.d.ts +899 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# packages/playwright/lib/common/index.js
|
|
2
|
+
# total: 114.2 KB
|
|
3
|
+
|
|
4
|
+
## Inlined (20)
|
|
5
|
+
12.0 KB packages/playwright/src/common/config.ts
|
|
6
|
+
13.7 KB packages/playwright/src/common/configLoader.ts
|
|
7
|
+
11.5 KB packages/playwright/src/common/fixtures.ts
|
|
8
|
+
0.8 KB packages/playwright/src/common/index.ts
|
|
9
|
+
1.3 KB packages/playwright/src/common/ipc.ts
|
|
10
|
+
2.1 KB packages/playwright/src/common/poolBuilder.ts
|
|
11
|
+
3.9 KB packages/playwright/src/common/process.ts
|
|
12
|
+
4.7 KB packages/playwright/src/common/suiteUtils.ts
|
|
13
|
+
8.5 KB packages/playwright/src/common/test.ts
|
|
14
|
+
2.0 KB packages/playwright/src/common/testLoader.ts
|
|
15
|
+
12.6 KB packages/playwright/src/common/testType.ts
|
|
16
|
+
1.2 KB packages/playwright/src/common/validators.ts
|
|
17
|
+
1.3 KB packages/playwright/src/isomorphic/teleReceiver.ts
|
|
18
|
+
9.7 KB packages/playwright/src/transform/compilationCache.ts
|
|
19
|
+
1.7 KB packages/playwright/src/transform/esmLoaderSync.ts
|
|
20
|
+
1.1 KB packages/playwright/src/transform/pirates.ts
|
|
21
|
+
1.1 KB packages/playwright/src/transform/portTransport.ts
|
|
22
|
+
12.3 KB packages/playwright/src/transform/transform.ts
|
|
23
|
+
2.9 KB packages/playwright/src/transform/tsconfig-loader.ts
|
|
24
|
+
7.0 KB packages/playwright/src/util.ts
|
|
25
|
+
|
|
26
|
+
## External (8)
|
|
27
|
+
../globals
|
|
28
|
+
../matchers/expect
|
|
29
|
+
../package
|
|
30
|
+
../transform/esmLoader.js
|
|
31
|
+
playwright
|
|
32
|
+
playwright-core/lib/bootstrap
|
|
33
|
+
playwright-core/lib/coreBundle
|
|
34
|
+
playwright-core/lib/utilsBundle
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var errorContext_exports = {};
|
|
30
|
+
__export(errorContext_exports, {
|
|
31
|
+
buildErrorContext: () => buildErrorContext
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(errorContext_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_util = require("./util");
|
|
36
|
+
const { parseErrorStack } = require("playwright-core/lib/coreBundle").utils;
|
|
37
|
+
const { stripAnsiEscapes } = require("playwright-core/lib/coreBundle").iso;
|
|
38
|
+
const fixTestInstructions = `# Instructions
|
|
39
|
+
|
|
40
|
+
- Following Playwright test failed.
|
|
41
|
+
- Explain why, be concise, respect Playwright best practices.
|
|
42
|
+
- Provide a snippet of code with the fix, if possible.
|
|
43
|
+
`;
|
|
44
|
+
function buildErrorContext(options) {
|
|
45
|
+
const { titlePath, location, errors, pageSnapshot } = options;
|
|
46
|
+
const meaningfulErrors = errors.filter((e) => !!e.message);
|
|
47
|
+
if (!meaningfulErrors.length && !pageSnapshot)
|
|
48
|
+
return void 0;
|
|
49
|
+
const lines = [
|
|
50
|
+
fixTestInstructions,
|
|
51
|
+
"# Test info",
|
|
52
|
+
"",
|
|
53
|
+
`- Name: ${titlePath.join(" >> ")}`,
|
|
54
|
+
`- Location: ${(0, import_util.relativeFilePath)(location.file)}:${location.line}:${location.column}`
|
|
55
|
+
];
|
|
56
|
+
if (meaningfulErrors.length) {
|
|
57
|
+
lines.push("", "# Error details");
|
|
58
|
+
for (const error of meaningfulErrors) {
|
|
59
|
+
lines.push(
|
|
60
|
+
"",
|
|
61
|
+
"```",
|
|
62
|
+
stripAnsiEscapes(error.message || ""),
|
|
63
|
+
"```"
|
|
64
|
+
);
|
|
65
|
+
if (error.errorContext) {
|
|
66
|
+
lines.push(
|
|
67
|
+
"",
|
|
68
|
+
"```yaml",
|
|
69
|
+
error.errorContext,
|
|
70
|
+
"```"
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (pageSnapshot) {
|
|
76
|
+
lines.push(
|
|
77
|
+
"",
|
|
78
|
+
"# Page snapshot",
|
|
79
|
+
"",
|
|
80
|
+
"```yaml",
|
|
81
|
+
pageSnapshot,
|
|
82
|
+
"```"
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
const lastError = meaningfulErrors[meaningfulErrors.length - 1];
|
|
86
|
+
const codeFrame = lastError ? buildCodeFrame(lastError, location) : void 0;
|
|
87
|
+
if (codeFrame) {
|
|
88
|
+
lines.push(
|
|
89
|
+
"",
|
|
90
|
+
"# Test source",
|
|
91
|
+
"",
|
|
92
|
+
"```ts",
|
|
93
|
+
codeFrame,
|
|
94
|
+
"```"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return lines.join("\n");
|
|
98
|
+
}
|
|
99
|
+
function buildCodeFrame(error, testLocation) {
|
|
100
|
+
const stack = error.stack;
|
|
101
|
+
if (!stack)
|
|
102
|
+
return void 0;
|
|
103
|
+
const parsed = parseErrorStack(stack);
|
|
104
|
+
const errorLocation = parsed.location;
|
|
105
|
+
if (!errorLocation)
|
|
106
|
+
return void 0;
|
|
107
|
+
let source;
|
|
108
|
+
try {
|
|
109
|
+
source = import_fs.default.readFileSync(errorLocation.file, "utf8");
|
|
110
|
+
} catch {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
const sourceLines = source.split("\n");
|
|
114
|
+
const linesAbove = 100;
|
|
115
|
+
const linesBelow = 100;
|
|
116
|
+
const start = Math.max(0, errorLocation.line - linesAbove - 1);
|
|
117
|
+
const end = Math.min(sourceLines.length, errorLocation.line + linesBelow);
|
|
118
|
+
const scope = sourceLines.slice(start, end);
|
|
119
|
+
const lineNumberWidth = String(end).length;
|
|
120
|
+
const message = stripAnsiEscapes(error.message || "").split("\n")[0] || void 0;
|
|
121
|
+
const frame = scope.map((line, index) => `${start + index + 1 === errorLocation.line ? "> " : " "}${(start + index + 1).toString().padEnd(lineNumberWidth, " ")} | ${line}`);
|
|
122
|
+
if (message)
|
|
123
|
+
frame.splice(errorLocation.line - start, 0, `${" ".repeat(lineNumberWidth + 2)} | ${" ".repeat(Math.max(0, errorLocation.column - 2))} ^ ${message}`);
|
|
124
|
+
return frame.join("\n");
|
|
125
|
+
}
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
buildErrorContext
|
|
129
|
+
});
|
package/lib/globals.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var globals_exports = {};
|
|
20
|
+
__export(globals_exports, {
|
|
21
|
+
currentTestInfo: () => currentTestInfo,
|
|
22
|
+
currentlyLoadingFileSuite: () => currentlyLoadingFileSuite,
|
|
23
|
+
isWorkerProcess: () => isWorkerProcess,
|
|
24
|
+
setCurrentTestInfo: () => setCurrentTestInfo,
|
|
25
|
+
setCurrentlyLoadingFileSuite: () => setCurrentlyLoadingFileSuite,
|
|
26
|
+
setIsWorkerProcess: () => setIsWorkerProcess
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(globals_exports);
|
|
29
|
+
let currentTestInfoValue = null;
|
|
30
|
+
function setCurrentTestInfo(testInfo) {
|
|
31
|
+
currentTestInfoValue = testInfo;
|
|
32
|
+
}
|
|
33
|
+
function currentTestInfo() {
|
|
34
|
+
return currentTestInfoValue;
|
|
35
|
+
}
|
|
36
|
+
let currentFileSuite;
|
|
37
|
+
function setCurrentlyLoadingFileSuite(suite) {
|
|
38
|
+
currentFileSuite = suite;
|
|
39
|
+
}
|
|
40
|
+
function currentlyLoadingFileSuite() {
|
|
41
|
+
return currentFileSuite;
|
|
42
|
+
}
|
|
43
|
+
let _isWorkerProcess = false;
|
|
44
|
+
function setIsWorkerProcess() {
|
|
45
|
+
_isWorkerProcess = true;
|
|
46
|
+
}
|
|
47
|
+
function isWorkerProcess() {
|
|
48
|
+
return _isWorkerProcess;
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
currentTestInfo,
|
|
53
|
+
currentlyLoadingFileSuite,
|
|
54
|
+
isWorkerProcess,
|
|
55
|
+
setCurrentTestInfo,
|
|
56
|
+
setCurrentlyLoadingFileSuite,
|
|
57
|
+
setIsWorkerProcess
|
|
58
|
+
});
|