@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,28 @@
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 util_exports = {};
20
+ __export(util_exports, {
21
+ kTopLevelAttachmentPrefix: () => kTopLevelAttachmentPrefix
22
+ });
23
+ module.exports = __toCommonJS(util_exports);
24
+ const kTopLevelAttachmentPrefix = "_attach";
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ kTopLevelAttachmentPrefix
28
+ });
@@ -0,0 +1,59 @@
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 loaderMain_exports = {};
20
+ __export(loaderMain_exports, {
21
+ LoaderMain: () => LoaderMain,
22
+ create: () => create
23
+ });
24
+ module.exports = __toCommonJS(loaderMain_exports);
25
+ var import_configLoader = require("../common/configLoader");
26
+ var import_esmLoaderHost = require("../common/esmLoaderHost");
27
+ var import_poolBuilder = require("../common/poolBuilder");
28
+ var import_process = require("../common/process");
29
+ var import_testLoader = require("../common/testLoader");
30
+ var import_compilationCache = require("../transform/compilationCache");
31
+ class LoaderMain extends import_process.ProcessRunner {
32
+ constructor(serializedConfig) {
33
+ super();
34
+ this._poolBuilder = import_poolBuilder.PoolBuilder.createForLoader();
35
+ this._serializedConfig = serializedConfig;
36
+ }
37
+ _config() {
38
+ if (!this._configPromise)
39
+ this._configPromise = (0, import_configLoader.deserializeConfig)(this._serializedConfig);
40
+ return this._configPromise;
41
+ }
42
+ async loadTestFile(params) {
43
+ const testErrors = [];
44
+ const config = await this._config();
45
+ const fileSuite = await (0, import_testLoader.loadTestFile)(params.file, config.config.rootDir, testErrors);
46
+ this._poolBuilder.buildPools(fileSuite);
47
+ return { fileSuite: fileSuite._deepSerialize(), testErrors };
48
+ }
49
+ async getCompilationCacheFromLoader() {
50
+ await (0, import_esmLoaderHost.incorporateCompilationCache)();
51
+ return (0, import_compilationCache.serializeCompilationCache)();
52
+ }
53
+ }
54
+ const create = (config) => new LoaderMain(config);
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ LoaderMain,
58
+ create
59
+ });
@@ -0,0 +1,322 @@
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 expect_exports = {};
20
+ __export(expect_exports, {
21
+ expect: () => expect,
22
+ mergeExpects: () => mergeExpects,
23
+ printReceivedStringContainExpectedResult: () => printReceivedStringContainExpectedResult,
24
+ printReceivedStringContainExpectedSubstring: () => printReceivedStringContainExpectedSubstring
25
+ });
26
+ module.exports = __toCommonJS(expect_exports);
27
+ var import_utils = require("@ohos-ports/playwright-core/lib/utils");
28
+ var import_matcherHint = require("./matcherHint");
29
+ var import_matchers = require("./matchers");
30
+ var import_toMatchAriaSnapshot = require("./toMatchAriaSnapshot");
31
+ var import_toMatchSnapshot = require("./toMatchSnapshot");
32
+ var import_expectBundle = require("../common/expectBundle");
33
+ var import_globals = require("../common/globals");
34
+ var import_util = require("../util");
35
+ var import_testInfo = require("../worker/testInfo");
36
+ const printSubstring = (val) => val.replace(/"|\\/g, "\\$&");
37
+ const printReceivedStringContainExpectedSubstring = (received, start, length) => (0, import_expectBundle.RECEIVED_COLOR)(
38
+ '"' + printSubstring(received.slice(0, start)) + (0, import_expectBundle.INVERTED_COLOR)(printSubstring(received.slice(start, start + length))) + printSubstring(received.slice(start + length)) + '"'
39
+ );
40
+ const printReceivedStringContainExpectedResult = (received, result) => result === null ? (0, import_expectBundle.printReceived)(received) : printReceivedStringContainExpectedSubstring(
41
+ received,
42
+ result.index,
43
+ result[0].length
44
+ );
45
+ function createMatchers(actual, info, prefix) {
46
+ return new Proxy((0, import_expectBundle.expect)(actual), new ExpectMetaInfoProxyHandler(info, prefix));
47
+ }
48
+ const userMatchersSymbol = Symbol("userMatchers");
49
+ function qualifiedMatcherName(qualifier, matcherName) {
50
+ return qualifier.join(":") + "$" + matcherName;
51
+ }
52
+ function createExpect(info, prefix, userMatchers) {
53
+ const expectInstance = new Proxy(import_expectBundle.expect, {
54
+ apply: function(target, thisArg, argumentsList) {
55
+ const [actual, messageOrOptions] = argumentsList;
56
+ const message = (0, import_utils.isString)(messageOrOptions) ? messageOrOptions : messageOrOptions?.message || info.message;
57
+ const newInfo = { ...info, message };
58
+ if (newInfo.poll) {
59
+ if (typeof actual !== "function")
60
+ throw new Error("`expect.poll()` accepts only function as a first argument");
61
+ newInfo.poll.generator = actual;
62
+ }
63
+ return createMatchers(actual, newInfo, prefix);
64
+ },
65
+ get: function(target, property) {
66
+ if (property === "configure")
67
+ return configure;
68
+ if (property === "extend") {
69
+ return (matchers) => {
70
+ const qualifier = [...prefix, (0, import_utils.createGuid)()];
71
+ const wrappedMatchers = {};
72
+ for (const [name, matcher] of Object.entries(matchers)) {
73
+ wrappedMatchers[name] = wrapPlaywrightMatcherToPassNiceThis(matcher);
74
+ const key = qualifiedMatcherName(qualifier, name);
75
+ wrappedMatchers[key] = wrappedMatchers[name];
76
+ Object.defineProperty(wrappedMatchers[key], "name", { value: name });
77
+ }
78
+ import_expectBundle.expect.extend(wrappedMatchers);
79
+ return createExpect(info, qualifier, { ...userMatchers, ...matchers });
80
+ };
81
+ }
82
+ if (property === "soft") {
83
+ return (actual, messageOrOptions) => {
84
+ return configure({ soft: true })(actual, messageOrOptions);
85
+ };
86
+ }
87
+ if (property === userMatchersSymbol)
88
+ return userMatchers;
89
+ if (property === "poll") {
90
+ return (actual, messageOrOptions) => {
91
+ const poll = (0, import_utils.isString)(messageOrOptions) ? {} : messageOrOptions || {};
92
+ return configure({ _poll: poll })(actual, messageOrOptions);
93
+ };
94
+ }
95
+ return import_expectBundle.expect[property];
96
+ }
97
+ });
98
+ const configure = (configuration) => {
99
+ const newInfo = { ...info };
100
+ if ("message" in configuration)
101
+ newInfo.message = configuration.message;
102
+ if ("timeout" in configuration)
103
+ newInfo.timeout = configuration.timeout;
104
+ if ("soft" in configuration)
105
+ newInfo.isSoft = configuration.soft;
106
+ if ("_poll" in configuration) {
107
+ newInfo.poll = configuration._poll ? { ...info.poll, generator: () => {
108
+ } } : void 0;
109
+ if (typeof configuration._poll === "object") {
110
+ newInfo.poll.timeout = configuration._poll.timeout ?? newInfo.poll.timeout;
111
+ newInfo.poll.intervals = configuration._poll.intervals ?? newInfo.poll.intervals;
112
+ }
113
+ }
114
+ return createExpect(newInfo, prefix, userMatchers);
115
+ };
116
+ return expectInstance;
117
+ }
118
+ let matcherCallContext;
119
+ function setMatcherCallContext(context) {
120
+ matcherCallContext = context;
121
+ }
122
+ function takeMatcherCallContext() {
123
+ try {
124
+ return matcherCallContext;
125
+ } finally {
126
+ matcherCallContext = void 0;
127
+ }
128
+ }
129
+ const defaultExpectTimeout = 5e3;
130
+ function wrapPlaywrightMatcherToPassNiceThis(matcher) {
131
+ return function(...args) {
132
+ const { isNot, promise, utils } = this;
133
+ const context = takeMatcherCallContext();
134
+ const timeout = context?.expectInfo.timeout ?? context?.testInfo?._projectInternal?.expect?.timeout ?? defaultExpectTimeout;
135
+ const newThis = {
136
+ isNot,
137
+ promise,
138
+ utils,
139
+ timeout,
140
+ _stepInfo: context?.step
141
+ };
142
+ newThis.equals = throwUnsupportedExpectMatcherError;
143
+ return matcher.call(newThis, ...args);
144
+ };
145
+ }
146
+ function throwUnsupportedExpectMatcherError() {
147
+ throw new Error("It looks like you are using custom expect matchers that are not compatible with Playwright. See https://aka.ms/playwright/expect-compatibility");
148
+ }
149
+ import_expectBundle.expect.setState({ expand: false });
150
+ const customAsyncMatchers = {
151
+ toBeAttached: import_matchers.toBeAttached,
152
+ toBeChecked: import_matchers.toBeChecked,
153
+ toBeDisabled: import_matchers.toBeDisabled,
154
+ toBeEditable: import_matchers.toBeEditable,
155
+ toBeEmpty: import_matchers.toBeEmpty,
156
+ toBeEnabled: import_matchers.toBeEnabled,
157
+ toBeFocused: import_matchers.toBeFocused,
158
+ toBeHidden: import_matchers.toBeHidden,
159
+ toBeInViewport: import_matchers.toBeInViewport,
160
+ toBeOK: import_matchers.toBeOK,
161
+ toBeVisible: import_matchers.toBeVisible,
162
+ toContainText: import_matchers.toContainText,
163
+ toContainClass: import_matchers.toContainClass,
164
+ toHaveAccessibleDescription: import_matchers.toHaveAccessibleDescription,
165
+ toHaveAccessibleName: import_matchers.toHaveAccessibleName,
166
+ toHaveAccessibleErrorMessage: import_matchers.toHaveAccessibleErrorMessage,
167
+ toHaveAttribute: import_matchers.toHaveAttribute,
168
+ toHaveClass: import_matchers.toHaveClass,
169
+ toHaveCount: import_matchers.toHaveCount,
170
+ toHaveCSS: import_matchers.toHaveCSS,
171
+ toHaveId: import_matchers.toHaveId,
172
+ toHaveJSProperty: import_matchers.toHaveJSProperty,
173
+ toHaveRole: import_matchers.toHaveRole,
174
+ toHaveText: import_matchers.toHaveText,
175
+ toHaveTitle: import_matchers.toHaveTitle,
176
+ toHaveURL: import_matchers.toHaveURL,
177
+ toHaveValue: import_matchers.toHaveValue,
178
+ toHaveValues: import_matchers.toHaveValues,
179
+ toHaveScreenshot: import_toMatchSnapshot.toHaveScreenshot,
180
+ toMatchAriaSnapshot: import_toMatchAriaSnapshot.toMatchAriaSnapshot,
181
+ toPass: import_matchers.toPass
182
+ };
183
+ const customMatchers = {
184
+ ...customAsyncMatchers,
185
+ toMatchSnapshot: import_toMatchSnapshot.toMatchSnapshot
186
+ };
187
+ class ExpectMetaInfoProxyHandler {
188
+ constructor(info, prefix) {
189
+ this._info = { ...info };
190
+ this._prefix = prefix;
191
+ }
192
+ get(target, matcherName, receiver) {
193
+ let matcher = Reflect.get(target, matcherName, receiver);
194
+ if (typeof matcherName !== "string")
195
+ return matcher;
196
+ let resolvedMatcherName = matcherName;
197
+ for (let i = this._prefix.length; i > 0; i--) {
198
+ const qualifiedName = qualifiedMatcherName(this._prefix.slice(0, i), matcherName);
199
+ if (Reflect.has(target, qualifiedName)) {
200
+ matcher = Reflect.get(target, qualifiedName, receiver);
201
+ resolvedMatcherName = qualifiedName;
202
+ break;
203
+ }
204
+ }
205
+ if (matcher === void 0)
206
+ throw new Error(`expect: Property '${matcherName}' not found.`);
207
+ if (typeof matcher !== "function") {
208
+ if (matcherName === "not")
209
+ this._info.isNot = !this._info.isNot;
210
+ return new Proxy(matcher, this);
211
+ }
212
+ if (this._info.poll) {
213
+ if (customAsyncMatchers[matcherName] || matcherName === "resolves" || matcherName === "rejects")
214
+ throw new Error(`\`expect.poll()\` does not support "${matcherName}" matcher.`);
215
+ matcher = (...args) => pollMatcher(resolvedMatcherName, this._info, this._prefix, ...args);
216
+ }
217
+ return (...args) => {
218
+ const testInfo = (0, import_globals.currentTestInfo)();
219
+ setMatcherCallContext({ expectInfo: this._info, testInfo });
220
+ if (!testInfo)
221
+ return matcher.call(target, ...args);
222
+ const customMessage = this._info.message || "";
223
+ const argsSuffix = computeArgsSuffix(matcherName, args);
224
+ const defaultTitle = `expect${this._info.poll ? ".poll" : ""}${this._info.isSoft ? ".soft" : ""}${this._info.isNot ? ".not" : ""}.${matcherName}${argsSuffix}`;
225
+ const title = customMessage || defaultTitle;
226
+ const stackFrames = (0, import_util.filteredStackTrace)((0, import_utils.captureRawStack)());
227
+ const stepInfo = {
228
+ category: matcherName === "toPass" || this._info.poll ? "step" : "expect",
229
+ title: (0, import_util.trimLongString)(title, 1024),
230
+ params: args[0] ? { expected: args[0] } : void 0,
231
+ infectParentStepsWithError: this._info.isSoft
232
+ };
233
+ const step = testInfo._addStep(stepInfo);
234
+ const reportStepError = (e) => {
235
+ const jestError = (0, import_matcherHint.isJestError)(e) ? e : null;
236
+ const error = jestError ? new import_matcherHint.ExpectError(jestError, customMessage, stackFrames) : e;
237
+ if (jestError?.matcherResult.suggestedRebaseline) {
238
+ step.complete({ suggestedRebaseline: jestError?.matcherResult.suggestedRebaseline });
239
+ return;
240
+ }
241
+ step.complete({ error });
242
+ if (this._info.isSoft)
243
+ testInfo._failWithError(error);
244
+ else
245
+ throw error;
246
+ };
247
+ const finalizer = () => {
248
+ step.complete({});
249
+ };
250
+ try {
251
+ setMatcherCallContext({ expectInfo: this._info, testInfo, step: step.info });
252
+ const callback = () => matcher.call(target, ...args);
253
+ const result = (0, import_utils.currentZone)().with("stepZone", step).run(callback);
254
+ if (result instanceof Promise)
255
+ return result.then(finalizer).catch(reportStepError);
256
+ finalizer();
257
+ return result;
258
+ } catch (e) {
259
+ reportStepError(e);
260
+ }
261
+ };
262
+ }
263
+ }
264
+ async function pollMatcher(qualifiedMatcherName2, info, prefix, ...args) {
265
+ const testInfo = (0, import_globals.currentTestInfo)();
266
+ const poll = info.poll;
267
+ const timeout = poll.timeout ?? info.timeout ?? testInfo?._projectInternal?.expect?.timeout ?? defaultExpectTimeout;
268
+ const { deadline, timeoutMessage } = testInfo ? testInfo._deadlineForMatcher(timeout) : import_testInfo.TestInfoImpl._defaultDeadlineForMatcher(timeout);
269
+ const result = await (0, import_utils.pollAgainstDeadline)(async () => {
270
+ if (testInfo && (0, import_globals.currentTestInfo)() !== testInfo)
271
+ return { continuePolling: false, result: void 0 };
272
+ const innerInfo = {
273
+ ...info,
274
+ isSoft: false,
275
+ // soft is outside of poll, not inside
276
+ poll: void 0
277
+ };
278
+ const value = await poll.generator();
279
+ try {
280
+ let matchers = createMatchers(value, innerInfo, prefix);
281
+ if (info.isNot)
282
+ matchers = matchers.not;
283
+ matchers[qualifiedMatcherName2](...args);
284
+ return { continuePolling: false, result: void 0 };
285
+ } catch (error) {
286
+ return { continuePolling: true, result: error };
287
+ }
288
+ }, deadline, poll.intervals ?? [100, 250, 500, 1e3]);
289
+ if (result.timedOut) {
290
+ const message = result.result ? [
291
+ result.result.message,
292
+ "",
293
+ `Call Log:`,
294
+ `- ${timeoutMessage}`
295
+ ].join("\n") : timeoutMessage;
296
+ throw new Error(message);
297
+ }
298
+ }
299
+ function computeArgsSuffix(matcherName, args) {
300
+ let value = "";
301
+ if (matcherName === "toHaveScreenshot")
302
+ value = (0, import_toMatchSnapshot.toHaveScreenshotStepTitle)(...args);
303
+ return value ? `(${value})` : "";
304
+ }
305
+ const expect = createExpect({}, [], {}).extend(customMatchers);
306
+ function mergeExpects(...expects) {
307
+ let merged = expect;
308
+ for (const e of expects) {
309
+ const internals = e[userMatchersSymbol];
310
+ if (!internals)
311
+ continue;
312
+ merged = merged.extend(internals);
313
+ }
314
+ return merged;
315
+ }
316
+ // Annotate the CommonJS export names for ESM import in node:
317
+ 0 && (module.exports = {
318
+ expect,
319
+ mergeExpects,
320
+ printReceivedStringContainExpectedResult,
321
+ printReceivedStringContainExpectedSubstring
322
+ });
@@ -0,0 +1,59 @@
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 matcherHint_exports = {};
20
+ __export(matcherHint_exports, {
21
+ ExpectError: () => ExpectError,
22
+ isJestError: () => isJestError,
23
+ kNoElementsFoundError: () => kNoElementsFoundError,
24
+ matcherHint: () => matcherHint
25
+ });
26
+ module.exports = __toCommonJS(matcherHint_exports);
27
+ var import_utils = require("@ohos-ports/playwright-core/lib/utils");
28
+ var import_utils2 = require("@ohos-ports/playwright-core/lib/utils");
29
+ const kNoElementsFoundError = "<element(s) not found>";
30
+ function matcherHint(state, locator, matcherName, expression, actual, matcherOptions, timeout) {
31
+ let header = state.utils.matcherHint(matcherName, expression, actual, matcherOptions).replace(/ \/\/ deep equality/, "") + "\n\n";
32
+ if (timeout)
33
+ header = import_utils2.colors.red(`Timed out ${timeout}ms waiting for `) + header;
34
+ if (locator)
35
+ header += `Locator: ${String(locator)}
36
+ `;
37
+ return header;
38
+ }
39
+ class ExpectError extends Error {
40
+ constructor(jestError, customMessage, stackFrames) {
41
+ super("");
42
+ this.name = jestError.name;
43
+ this.message = jestError.message;
44
+ this.matcherResult = jestError.matcherResult;
45
+ if (customMessage)
46
+ this.message = customMessage + "\n\n" + this.message;
47
+ this.stack = this.name + ": " + this.message + "\n" + (0, import_utils.stringifyStackFrames)(stackFrames).join("\n");
48
+ }
49
+ }
50
+ function isJestError(e) {
51
+ return e instanceof Error && "matcherResult" in e;
52
+ }
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ ExpectError,
56
+ isJestError,
57
+ kNoElementsFoundError,
58
+ matcherHint
59
+ });