@ohos-ports/playwright 1.52.0-beta.0

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.
Files changed (110) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +168 -0
  4. package/ThirdPartyNotices.txt +4011 -0
  5. package/cli.js +19 -0
  6. package/index.d.ts +17 -0
  7. package/index.js +17 -0
  8. package/index.mjs +18 -0
  9. package/jsx-runtime.js +42 -0
  10. package/jsx-runtime.mjs +21 -0
  11. package/lib/common/config.js +272 -0
  12. package/lib/common/configLoader.js +373 -0
  13. package/lib/common/esmLoaderHost.js +100 -0
  14. package/lib/common/expectBundle.js +49 -0
  15. package/lib/common/expectBundleImpl.js +389 -0
  16. package/lib/common/fixtures.js +302 -0
  17. package/lib/common/globals.js +58 -0
  18. package/lib/common/ipc.js +60 -0
  19. package/lib/common/poolBuilder.js +85 -0
  20. package/lib/common/process.js +109 -0
  21. package/lib/common/suiteUtils.js +149 -0
  22. package/lib/common/test.js +313 -0
  23. package/lib/common/testLoader.js +100 -0
  24. package/lib/common/testType.js +306 -0
  25. package/lib/errorContext.js +149 -0
  26. package/lib/fsWatcher.js +67 -0
  27. package/lib/index.js +692 -0
  28. package/lib/internalsForTest.js +42 -0
  29. package/lib/isomorphic/events.js +77 -0
  30. package/lib/isomorphic/folders.js +30 -0
  31. package/lib/isomorphic/stringInternPool.js +69 -0
  32. package/lib/isomorphic/teleReceiver.js +484 -0
  33. package/lib/isomorphic/teleSuiteUpdater.js +137 -0
  34. package/lib/isomorphic/testServerConnection.js +211 -0
  35. package/lib/isomorphic/testServerInterface.js +16 -0
  36. package/lib/isomorphic/testTree.js +307 -0
  37. package/lib/isomorphic/types.d.js +16 -0
  38. package/lib/isomorphic/util.js +28 -0
  39. package/lib/loader/loaderMain.js +59 -0
  40. package/lib/matchers/expect.js +322 -0
  41. package/lib/matchers/matcherHint.js +59 -0
  42. package/lib/matchers/matchers.js +362 -0
  43. package/lib/matchers/toBeTruthy.js +71 -0
  44. package/lib/matchers/toEqual.js +94 -0
  45. package/lib/matchers/toHaveURL.js +117 -0
  46. package/lib/matchers/toMatchAriaSnapshot.js +180 -0
  47. package/lib/matchers/toMatchSnapshot.js +365 -0
  48. package/lib/matchers/toMatchText.js +105 -0
  49. package/lib/plugins/gitCommitInfoPlugin.js +198 -0
  50. package/lib/plugins/index.js +28 -0
  51. package/lib/plugins/webServerPlugin.js +207 -0
  52. package/lib/program.js +407 -0
  53. package/lib/reporters/base.js +540 -0
  54. package/lib/reporters/blob.js +135 -0
  55. package/lib/reporters/dot.js +82 -0
  56. package/lib/reporters/empty.js +32 -0
  57. package/lib/reporters/github.js +127 -0
  58. package/lib/reporters/html.js +579 -0
  59. package/lib/reporters/internalReporter.js +129 -0
  60. package/lib/reporters/json.js +254 -0
  61. package/lib/reporters/junit.js +230 -0
  62. package/lib/reporters/line.js +113 -0
  63. package/lib/reporters/list.js +228 -0
  64. package/lib/reporters/merge.js +511 -0
  65. package/lib/reporters/multiplexer.js +104 -0
  66. package/lib/reporters/reporterV2.js +102 -0
  67. package/lib/reporters/teleEmitter.js +269 -0
  68. package/lib/reporters/versions/blobV1.js +16 -0
  69. package/lib/runner/dispatcher.js +484 -0
  70. package/lib/runner/failureTracker.js +62 -0
  71. package/lib/runner/lastRun.js +74 -0
  72. package/lib/runner/loadUtils.js +299 -0
  73. package/lib/runner/loaderHost.js +89 -0
  74. package/lib/runner/processHost.js +165 -0
  75. package/lib/runner/projectUtils.js +235 -0
  76. package/lib/runner/rebase.js +189 -0
  77. package/lib/runner/reporters.js +162 -0
  78. package/lib/runner/runner.js +110 -0
  79. package/lib/runner/sigIntWatcher.js +96 -0
  80. package/lib/runner/taskRunner.js +127 -0
  81. package/lib/runner/tasks.js +400 -0
  82. package/lib/runner/testGroups.js +117 -0
  83. package/lib/runner/testServer.js +477 -0
  84. package/lib/runner/uiModeReporter.js +30 -0
  85. package/lib/runner/vcs.js +72 -0
  86. package/lib/runner/watchMode.js +394 -0
  87. package/lib/runner/workerHost.js +93 -0
  88. package/lib/third_party/tsconfig-loader.js +103 -0
  89. package/lib/transform/babelBundle.js +43 -0
  90. package/lib/transform/babelBundleImpl.js +477 -0
  91. package/lib/transform/compilationCache.js +255 -0
  92. package/lib/transform/esmLoader.js +104 -0
  93. package/lib/transform/esmUtils.js +53 -0
  94. package/lib/transform/portTransport.js +66 -0
  95. package/lib/transform/transform.js +291 -0
  96. package/lib/util.js +407 -0
  97. package/lib/utilsBundle.js +46 -0
  98. package/lib/utilsBundleImpl.js +102 -0
  99. package/lib/worker/fixtureRunner.js +253 -0
  100. package/lib/worker/testInfo.js +422 -0
  101. package/lib/worker/testTracing.js +351 -0
  102. package/lib/worker/timeoutManager.js +174 -0
  103. package/lib/worker/util.js +31 -0
  104. package/lib/worker/workerMain.js +511 -0
  105. package/package.json +64 -0
  106. package/test.d.ts +18 -0
  107. package/test.js +24 -0
  108. package/test.mjs +33 -0
  109. package/types/test.d.ts +10061 -0
  110. package/types/testReporter.d.ts +799 -0
@@ -0,0 +1,82 @@
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 dot_exports = {};
20
+ __export(dot_exports, {
21
+ default: () => dot_default
22
+ });
23
+ module.exports = __toCommonJS(dot_exports);
24
+ var import_base = require("./base");
25
+ class DotReporter extends import_base.TerminalReporter {
26
+ constructor() {
27
+ super(...arguments);
28
+ this._counter = 0;
29
+ }
30
+ onBegin(suite) {
31
+ super.onBegin(suite);
32
+ console.log(this.generateStartingMessage());
33
+ }
34
+ onStdOut(chunk, test, result) {
35
+ super.onStdOut(chunk, test, result);
36
+ if (!this.config.quiet)
37
+ process.stdout.write(chunk);
38
+ }
39
+ onStdErr(chunk, test, result) {
40
+ super.onStdErr(chunk, test, result);
41
+ if (!this.config.quiet)
42
+ process.stderr.write(chunk);
43
+ }
44
+ onTestEnd(test, result) {
45
+ super.onTestEnd(test, result);
46
+ if (this._counter === 80) {
47
+ process.stdout.write("\n");
48
+ this._counter = 0;
49
+ }
50
+ ++this._counter;
51
+ if (result.status === "skipped") {
52
+ process.stdout.write(this.screen.colors.yellow("\xB0"));
53
+ return;
54
+ }
55
+ if (this.willRetry(test)) {
56
+ process.stdout.write(this.screen.colors.gray("\xD7"));
57
+ return;
58
+ }
59
+ switch (test.outcome()) {
60
+ case "expected":
61
+ process.stdout.write(this.screen.colors.green("\xB7"));
62
+ break;
63
+ case "unexpected":
64
+ process.stdout.write(this.screen.colors.red(result.status === "timedOut" ? "T" : "F"));
65
+ break;
66
+ case "flaky":
67
+ process.stdout.write(this.screen.colors.yellow("\xB1"));
68
+ break;
69
+ }
70
+ }
71
+ onError(error) {
72
+ super.onError(error);
73
+ console.log("\n" + this.formatError(error).message);
74
+ this._counter = 0;
75
+ }
76
+ async onEnd(result) {
77
+ await super.onEnd(result);
78
+ process.stdout.write("\n");
79
+ this.epilogue(true);
80
+ }
81
+ }
82
+ var dot_default = DotReporter;
@@ -0,0 +1,32 @@
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 empty_exports = {};
20
+ __export(empty_exports, {
21
+ default: () => empty_default
22
+ });
23
+ module.exports = __toCommonJS(empty_exports);
24
+ class EmptyReporter {
25
+ version() {
26
+ return "v2";
27
+ }
28
+ printsToStdio() {
29
+ return false;
30
+ }
31
+ }
32
+ var empty_default = EmptyReporter;
@@ -0,0 +1,127 @@
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 github_exports = {};
30
+ __export(github_exports, {
31
+ GitHubReporter: () => GitHubReporter,
32
+ default: () => github_default
33
+ });
34
+ module.exports = __toCommonJS(github_exports);
35
+ var import_path = __toESM(require("path"));
36
+ var import_utils = require("@ohos-ports/playwright-core/lib/utils");
37
+ var import_utilsBundle = require("@ohos-ports/playwright-core/lib/utilsBundle");
38
+ var import_base = require("./base");
39
+ var import_util = require("../util");
40
+ class GitHubLogger {
41
+ _log(message, type = "notice", options = {}) {
42
+ message = message.replace(/\n/g, "%0A");
43
+ const configs = Object.entries(options).map(([key, option]) => `${key}=${option}`).join(",");
44
+ console.log((0, import_util.stripAnsiEscapes)(`::${type} ${configs}::${message}`));
45
+ }
46
+ debug(message, options) {
47
+ this._log(message, "debug", options);
48
+ }
49
+ error(message, options) {
50
+ this._log(message, "error", options);
51
+ }
52
+ notice(message, options) {
53
+ this._log(message, "notice", options);
54
+ }
55
+ warning(message, options) {
56
+ this._log(message, "warning", options);
57
+ }
58
+ }
59
+ class GitHubReporter extends import_base.TerminalReporter {
60
+ constructor(options = {}) {
61
+ super(options);
62
+ this.githubLogger = new GitHubLogger();
63
+ this.screen = { ...this.screen, colors: import_utils.noColors };
64
+ }
65
+ printsToStdio() {
66
+ return false;
67
+ }
68
+ async onEnd(result) {
69
+ await super.onEnd(result);
70
+ this._printAnnotations();
71
+ }
72
+ onError(error) {
73
+ const errorMessage = this.formatError(error).message;
74
+ this.githubLogger.error(errorMessage);
75
+ }
76
+ _printAnnotations() {
77
+ const summary = this.generateSummary();
78
+ const summaryMessage = this.generateSummaryMessage(summary);
79
+ if (summary.failuresToPrint.length)
80
+ this._printFailureAnnotations(summary.failuresToPrint);
81
+ this._printSlowTestAnnotations();
82
+ this._printSummaryAnnotation(summaryMessage);
83
+ }
84
+ _printSlowTestAnnotations() {
85
+ this.getSlowTests().forEach(([file, duration]) => {
86
+ const filePath = workspaceRelativePath(import_path.default.join(process.cwd(), file));
87
+ this.githubLogger.warning(`${filePath} took ${(0, import_utilsBundle.ms)(duration)}`, {
88
+ title: "Slow Test",
89
+ file: filePath
90
+ });
91
+ });
92
+ }
93
+ _printSummaryAnnotation(summary) {
94
+ this.githubLogger.notice(summary, {
95
+ title: "\u{1F3AD} Playwright Run Summary"
96
+ });
97
+ }
98
+ _printFailureAnnotations(failures) {
99
+ failures.forEach((test, index) => {
100
+ const title = this.formatTestTitle(test);
101
+ const header = this.formatTestHeader(test, { indent: " ", index: index + 1, mode: "error" });
102
+ for (const result of test.results) {
103
+ const errors = (0, import_base.formatResultFailure)(this.screen, test, result, " ");
104
+ for (const error of errors) {
105
+ const options = {
106
+ file: workspaceRelativePath(error.location?.file || test.location.file),
107
+ title
108
+ };
109
+ if (error.location) {
110
+ options.line = error.location.line;
111
+ options.col = error.location.column;
112
+ }
113
+ const message = [header, ...(0, import_base.formatRetry)(this.screen, result), error.message].join("\n");
114
+ this.githubLogger.error(message, options);
115
+ }
116
+ }
117
+ });
118
+ }
119
+ }
120
+ function workspaceRelativePath(filePath) {
121
+ return import_path.default.relative(process.env["GITHUB_WORKSPACE"] ?? "", filePath);
122
+ }
123
+ var github_default = GitHubReporter;
124
+ // Annotate the CommonJS export names for ESM import in node:
125
+ 0 && (module.exports = {
126
+ GitHubReporter
127
+ });