@smoothdeploy/playwright 1.58.4 → 1.60.0-beta-1780662356000

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 (182) hide show
  1. package/ThirdPartyNotices.txt +8 -5036
  2. package/lib/agents/agentParser.js +2 -2
  3. package/lib/agents/generateAgents.js +21 -22
  4. package/lib/agents/playwright-test-healer.agent.md +1 -0
  5. package/lib/agents/playwright-test-planner.agent.md +2 -1
  6. package/lib/cli/reportActions.js +78 -0
  7. package/lib/cli/testActions.js +211 -0
  8. package/lib/common/index.js +2898 -0
  9. package/lib/common/index.js.txt +35 -0
  10. package/lib/errorContext.js +130 -0
  11. package/lib/index.js +258 -206
  12. package/lib/{isomorphic/testServerConnection.js → isomorphic.js} +70 -35
  13. package/lib/isomorphic.js.txt +9 -0
  14. package/lib/loader/loaderProcessEntry.js +34 -0
  15. package/lib/loader/loaderProcessEntry.js.txt +9 -0
  16. package/lib/matchers/expect.js +12988 -249
  17. package/lib/matchers/expect.js.LICENSE +693 -0
  18. package/lib/matchers/expect.js.txt +72 -0
  19. package/lib/mcp/test/browserBackend.js +49 -22
  20. package/lib/mcp/test/generatorTools.js +16 -16
  21. package/lib/mcp/test/plannerTools.js +25 -20
  22. package/lib/mcp/test/seed.js +7 -7
  23. package/lib/mcp/test/testBackend.js +30 -30
  24. package/lib/mcp/test/testContext.js +50 -33
  25. package/lib/mcp/test/testTools.js +15 -25
  26. package/lib/{internalsForTest.js → package.js} +13 -8
  27. package/lib/program.js +63 -263
  28. package/lib/runner/index.js +8339 -0
  29. package/lib/runner/index.js.txt +60 -0
  30. package/lib/transform/babelBundle.js +71002 -18
  31. package/lib/transform/babelBundle.js.LICENSE +2359 -0
  32. package/lib/transform/babelBundle.js.txt +325 -0
  33. package/lib/transform/esmLoader.js +5884 -30
  34. package/lib/transform/esmLoader.js.LICENSE +335 -0
  35. package/lib/transform/esmLoader.js.txt +55 -0
  36. package/lib/util.js +37 -34
  37. package/lib/worker/workerProcessEntry.js +3251 -0
  38. package/lib/worker/workerProcessEntry.js.txt +24 -0
  39. package/package.json +5 -16
  40. package/test.mjs +1 -0
  41. package/types/test.d.ts +172 -12
  42. package/types/testReporter.d.ts +7 -5
  43. package/lib/common/config.js +0 -282
  44. package/lib/common/configLoader.js +0 -344
  45. package/lib/common/esmLoaderHost.js +0 -104
  46. package/lib/common/expectBundle.js +0 -28
  47. package/lib/common/expectBundleImpl.js +0 -407
  48. package/lib/common/fixtures.js +0 -302
  49. package/lib/common/ipc.js +0 -60
  50. package/lib/common/poolBuilder.js +0 -85
  51. package/lib/common/process.js +0 -132
  52. package/lib/common/suiteUtils.js +0 -140
  53. package/lib/common/test.js +0 -321
  54. package/lib/common/testLoader.js +0 -101
  55. package/lib/common/testType.js +0 -298
  56. package/lib/common/validators.js +0 -68
  57. package/lib/fsWatcher.js +0 -67
  58. package/lib/isomorphic/events.js +0 -77
  59. package/lib/isomorphic/folders.js +0 -30
  60. package/lib/isomorphic/stringInternPool.js +0 -69
  61. package/lib/isomorphic/teleReceiver.js +0 -521
  62. package/lib/isomorphic/teleSuiteUpdater.js +0 -157
  63. package/lib/isomorphic/testServerInterface.js +0 -16
  64. package/lib/isomorphic/testTree.js +0 -329
  65. package/lib/isomorphic/types.d.js +0 -16
  66. package/lib/loader/loaderMain.js +0 -59
  67. package/lib/matchers/matcherHint.js +0 -44
  68. package/lib/matchers/matchers.js +0 -383
  69. package/lib/matchers/toBeTruthy.js +0 -75
  70. package/lib/matchers/toEqual.js +0 -100
  71. package/lib/matchers/toHaveURL.js +0 -101
  72. package/lib/matchers/toMatchAriaSnapshot.js +0 -159
  73. package/lib/matchers/toMatchSnapshot.js +0 -342
  74. package/lib/matchers/toMatchText.js +0 -99
  75. package/lib/mcp/browser/browserContextFactory.js +0 -329
  76. package/lib/mcp/browser/browserServerBackend.js +0 -84
  77. package/lib/mcp/browser/config.js +0 -421
  78. package/lib/mcp/browser/context.js +0 -244
  79. package/lib/mcp/browser/response.js +0 -278
  80. package/lib/mcp/browser/sessionLog.js +0 -75
  81. package/lib/mcp/browser/tab.js +0 -343
  82. package/lib/mcp/browser/tools/common.js +0 -65
  83. package/lib/mcp/browser/tools/console.js +0 -46
  84. package/lib/mcp/browser/tools/dialogs.js +0 -60
  85. package/lib/mcp/browser/tools/evaluate.js +0 -61
  86. package/lib/mcp/browser/tools/files.js +0 -58
  87. package/lib/mcp/browser/tools/form.js +0 -63
  88. package/lib/mcp/browser/tools/install.js +0 -72
  89. package/lib/mcp/browser/tools/keyboard.js +0 -107
  90. package/lib/mcp/browser/tools/mouse.js +0 -107
  91. package/lib/mcp/browser/tools/navigate.js +0 -71
  92. package/lib/mcp/browser/tools/network.js +0 -63
  93. package/lib/mcp/browser/tools/open.js +0 -57
  94. package/lib/mcp/browser/tools/pdf.js +0 -49
  95. package/lib/mcp/browser/tools/runCode.js +0 -78
  96. package/lib/mcp/browser/tools/screenshot.js +0 -93
  97. package/lib/mcp/browser/tools/snapshot.js +0 -173
  98. package/lib/mcp/browser/tools/tabs.js +0 -67
  99. package/lib/mcp/browser/tools/tool.js +0 -47
  100. package/lib/mcp/browser/tools/tracing.js +0 -74
  101. package/lib/mcp/browser/tools/utils.js +0 -94
  102. package/lib/mcp/browser/tools/verify.js +0 -143
  103. package/lib/mcp/browser/tools/wait.js +0 -63
  104. package/lib/mcp/browser/tools.js +0 -84
  105. package/lib/mcp/browser/watchdog.js +0 -44
  106. package/lib/mcp/config.d.js +0 -16
  107. package/lib/mcp/extension/cdpRelay.js +0 -351
  108. package/lib/mcp/extension/extensionContextFactory.js +0 -76
  109. package/lib/mcp/extension/protocol.js +0 -28
  110. package/lib/mcp/index.js +0 -61
  111. package/lib/mcp/log.js +0 -35
  112. package/lib/mcp/program.js +0 -111
  113. package/lib/mcp/sdk/exports.js +0 -28
  114. package/lib/mcp/sdk/http.js +0 -152
  115. package/lib/mcp/sdk/inProcessTransport.js +0 -71
  116. package/lib/mcp/sdk/server.js +0 -223
  117. package/lib/mcp/sdk/tool.js +0 -47
  118. package/lib/mcp/terminal/cli.js +0 -296
  119. package/lib/mcp/terminal/command.js +0 -56
  120. package/lib/mcp/terminal/commands.js +0 -333
  121. package/lib/mcp/terminal/daemon.js +0 -129
  122. package/lib/mcp/terminal/help.json +0 -32
  123. package/lib/mcp/terminal/helpGenerator.js +0 -88
  124. package/lib/mcp/terminal/socketConnection.js +0 -80
  125. package/lib/plugins/gitCommitInfoPlugin.js +0 -198
  126. package/lib/plugins/index.js +0 -28
  127. package/lib/plugins/webServerPlugin.js +0 -237
  128. package/lib/reporters/base.js +0 -634
  129. package/lib/reporters/blob.js +0 -138
  130. package/lib/reporters/dot.js +0 -99
  131. package/lib/reporters/empty.js +0 -32
  132. package/lib/reporters/github.js +0 -128
  133. package/lib/reporters/html.js +0 -633
  134. package/lib/reporters/internalReporter.js +0 -138
  135. package/lib/reporters/json.js +0 -254
  136. package/lib/reporters/junit.js +0 -232
  137. package/lib/reporters/line.js +0 -131
  138. package/lib/reporters/list.js +0 -253
  139. package/lib/reporters/listModeReporter.js +0 -69
  140. package/lib/reporters/markdown.js +0 -144
  141. package/lib/reporters/merge.js +0 -558
  142. package/lib/reporters/multiplexer.js +0 -112
  143. package/lib/reporters/reporterV2.js +0 -102
  144. package/lib/reporters/smoothdeploy.js +0 -333
  145. package/lib/reporters/teleEmitter.js +0 -317
  146. package/lib/reporters/versions/blobV1.js +0 -16
  147. package/lib/runner/dispatcher.js +0 -531
  148. package/lib/runner/failureTracker.js +0 -72
  149. package/lib/runner/lastRun.js +0 -77
  150. package/lib/runner/loadUtils.js +0 -334
  151. package/lib/runner/loaderHost.js +0 -89
  152. package/lib/runner/processHost.js +0 -180
  153. package/lib/runner/projectUtils.js +0 -241
  154. package/lib/runner/rebase.js +0 -189
  155. package/lib/runner/reporters.js +0 -140
  156. package/lib/runner/sigIntWatcher.js +0 -96
  157. package/lib/runner/storage.js +0 -91
  158. package/lib/runner/taskRunner.js +0 -127
  159. package/lib/runner/tasks.js +0 -410
  160. package/lib/runner/testGroups.js +0 -125
  161. package/lib/runner/testRunner.js +0 -398
  162. package/lib/runner/testServer.js +0 -269
  163. package/lib/runner/uiModeReporter.js +0 -30
  164. package/lib/runner/vcs.js +0 -72
  165. package/lib/runner/watchMode.js +0 -396
  166. package/lib/runner/workerHost.js +0 -104
  167. package/lib/third_party/pirates.js +0 -62
  168. package/lib/third_party/tsconfig-loader.js +0 -103
  169. package/lib/transform/babelBundleImpl.js +0 -461
  170. package/lib/transform/compilationCache.js +0 -274
  171. package/lib/transform/md.js +0 -221
  172. package/lib/transform/portTransport.js +0 -67
  173. package/lib/transform/transform.js +0 -303
  174. package/lib/utilsBundle.js +0 -50
  175. package/lib/utilsBundleImpl.js +0 -103
  176. package/lib/worker/fixtureRunner.js +0 -262
  177. package/lib/worker/testInfo.js +0 -536
  178. package/lib/worker/testTracing.js +0 -345
  179. package/lib/worker/timeoutManager.js +0 -174
  180. package/lib/worker/util.js +0 -31
  181. package/lib/worker/workerMain.js +0 -530
  182. /package/lib/{common/globals.js → globals.js} +0 -0
@@ -1,383 +0,0 @@
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 matchers_exports = {};
20
- __export(matchers_exports, {
21
- computeMatcherTitleSuffix: () => computeMatcherTitleSuffix,
22
- toBeAttached: () => toBeAttached,
23
- toBeChecked: () => toBeChecked,
24
- toBeDisabled: () => toBeDisabled,
25
- toBeEditable: () => toBeEditable,
26
- toBeEmpty: () => toBeEmpty,
27
- toBeEnabled: () => toBeEnabled,
28
- toBeFocused: () => toBeFocused,
29
- toBeHidden: () => toBeHidden,
30
- toBeInViewport: () => toBeInViewport,
31
- toBeOK: () => toBeOK,
32
- toBeVisible: () => toBeVisible,
33
- toContainClass: () => toContainClass,
34
- toContainText: () => toContainText,
35
- toHaveAccessibleDescription: () => toHaveAccessibleDescription,
36
- toHaveAccessibleErrorMessage: () => toHaveAccessibleErrorMessage,
37
- toHaveAccessibleName: () => toHaveAccessibleName,
38
- toHaveAttribute: () => toHaveAttribute,
39
- toHaveCSS: () => toHaveCSS,
40
- toHaveClass: () => toHaveClass,
41
- toHaveCount: () => toHaveCount,
42
- toHaveId: () => toHaveId,
43
- toHaveJSProperty: () => toHaveJSProperty,
44
- toHaveRole: () => toHaveRole,
45
- toHaveText: () => toHaveText,
46
- toHaveTitle: () => toHaveTitle,
47
- toHaveURL: () => toHaveURL,
48
- toHaveValue: () => toHaveValue,
49
- toHaveValues: () => toHaveValues,
50
- toPass: () => toPass
51
- });
52
- module.exports = __toCommonJS(matchers_exports);
53
- var import_utils = require("playwright-core/lib/utils");
54
- var import_utils2 = require("playwright-core/lib/utils");
55
- var import_util = require("../util");
56
- var import_toBeTruthy = require("./toBeTruthy");
57
- var import_toEqual = require("./toEqual");
58
- var import_toHaveURL = require("./toHaveURL");
59
- var import_toMatchText = require("./toMatchText");
60
- var import_toMatchSnapshot = require("./toMatchSnapshot");
61
- var import_config = require("../common/config");
62
- var import_globals = require("../common/globals");
63
- var import_testInfo = require("../worker/testInfo");
64
- function toBeAttached(locator, options) {
65
- const attached = !options || options.attached === void 0 || options.attached;
66
- const expected = attached ? "attached" : "detached";
67
- const arg = attached ? "" : "{ attached: false }";
68
- return import_toBeTruthy.toBeTruthy.call(this, "toBeAttached", locator, "Locator", expected, arg, async (isNot, timeout) => {
69
- return await locator._expect(attached ? "to.be.attached" : "to.be.detached", { isNot, timeout });
70
- }, options);
71
- }
72
- function toBeChecked(locator, options) {
73
- const checked = options?.checked;
74
- const indeterminate = options?.indeterminate;
75
- const expectedValue = {
76
- checked,
77
- indeterminate
78
- };
79
- let expected;
80
- let arg;
81
- if (options?.indeterminate) {
82
- expected = "indeterminate";
83
- arg = `{ indeterminate: true }`;
84
- } else {
85
- expected = options?.checked === false ? "unchecked" : "checked";
86
- arg = options?.checked === false ? `{ checked: false }` : "";
87
- }
88
- return import_toBeTruthy.toBeTruthy.call(this, "toBeChecked", locator, "Locator", expected, arg, async (isNot, timeout) => {
89
- return await locator._expect("to.be.checked", { isNot, timeout, expectedValue });
90
- }, options);
91
- }
92
- function toBeDisabled(locator, options) {
93
- return import_toBeTruthy.toBeTruthy.call(this, "toBeDisabled", locator, "Locator", "disabled", "", async (isNot, timeout) => {
94
- return await locator._expect("to.be.disabled", { isNot, timeout });
95
- }, options);
96
- }
97
- function toBeEditable(locator, options) {
98
- const editable = !options || options.editable === void 0 || options.editable;
99
- const expected = editable ? "editable" : "readOnly";
100
- const arg = editable ? "" : "{ editable: false }";
101
- return import_toBeTruthy.toBeTruthy.call(this, "toBeEditable", locator, "Locator", expected, arg, async (isNot, timeout) => {
102
- return await locator._expect(editable ? "to.be.editable" : "to.be.readonly", { isNot, timeout });
103
- }, options);
104
- }
105
- function toBeEmpty(locator, options) {
106
- return import_toBeTruthy.toBeTruthy.call(this, "toBeEmpty", locator, "Locator", "empty", "", async (isNot, timeout) => {
107
- return await locator._expect("to.be.empty", { isNot, timeout });
108
- }, options);
109
- }
110
- function toBeEnabled(locator, options) {
111
- const enabled = !options || options.enabled === void 0 || options.enabled;
112
- const expected = enabled ? "enabled" : "disabled";
113
- const arg = enabled ? "" : "{ enabled: false }";
114
- return import_toBeTruthy.toBeTruthy.call(this, "toBeEnabled", locator, "Locator", expected, arg, async (isNot, timeout) => {
115
- return await locator._expect(enabled ? "to.be.enabled" : "to.be.disabled", { isNot, timeout });
116
- }, options);
117
- }
118
- function toBeFocused(locator, options) {
119
- return import_toBeTruthy.toBeTruthy.call(this, "toBeFocused", locator, "Locator", "focused", "", async (isNot, timeout) => {
120
- return await locator._expect("to.be.focused", { isNot, timeout });
121
- }, options);
122
- }
123
- function toBeHidden(locator, options) {
124
- return import_toBeTruthy.toBeTruthy.call(this, "toBeHidden", locator, "Locator", "hidden", "", async (isNot, timeout) => {
125
- return await locator._expect("to.be.hidden", { isNot, timeout });
126
- }, options);
127
- }
128
- function toBeVisible(locator, options) {
129
- const visible = !options || options.visible === void 0 || options.visible;
130
- const expected = visible ? "visible" : "hidden";
131
- const arg = visible ? "" : "{ visible: false }";
132
- return import_toBeTruthy.toBeTruthy.call(this, "toBeVisible", locator, "Locator", expected, arg, async (isNot, timeout) => {
133
- return await locator._expect(visible ? "to.be.visible" : "to.be.hidden", { isNot, timeout });
134
- }, options);
135
- }
136
- function toBeInViewport(locator, options) {
137
- return import_toBeTruthy.toBeTruthy.call(this, "toBeInViewport", locator, "Locator", "in viewport", "", async (isNot, timeout) => {
138
- return await locator._expect("to.be.in.viewport", { isNot, expectedNumber: options?.ratio, timeout });
139
- }, options);
140
- }
141
- function toContainText(locator, expected, options = {}) {
142
- if (Array.isArray(expected)) {
143
- return import_toEqual.toEqual.call(this, "toContainText", locator, "Locator", async (isNot, timeout) => {
144
- const expectedText = (0, import_utils.serializeExpectedTextValues)(expected, { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
145
- return await locator._expect("to.contain.text.array", { expectedText, isNot, useInnerText: options.useInnerText, timeout });
146
- }, expected, { ...options, contains: true });
147
- } else {
148
- return import_toMatchText.toMatchText.call(this, "toContainText", locator, "Locator", async (isNot, timeout) => {
149
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
150
- return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options.useInnerText, timeout });
151
- }, expected, { ...options, matchSubstring: true });
152
- }
153
- }
154
- function toHaveAccessibleDescription(locator, expected, options) {
155
- return import_toMatchText.toMatchText.call(this, "toHaveAccessibleDescription", locator, "Locator", async (isNot, timeout) => {
156
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
157
- return await locator._expect("to.have.accessible.description", { expectedText, isNot, timeout });
158
- }, expected, options);
159
- }
160
- function toHaveAccessibleName(locator, expected, options) {
161
- return import_toMatchText.toMatchText.call(this, "toHaveAccessibleName", locator, "Locator", async (isNot, timeout) => {
162
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
163
- return await locator._expect("to.have.accessible.name", { expectedText, isNot, timeout });
164
- }, expected, options);
165
- }
166
- function toHaveAccessibleErrorMessage(locator, expected, options) {
167
- return import_toMatchText.toMatchText.call(this, "toHaveAccessibleErrorMessage", locator, "Locator", async (isNot, timeout) => {
168
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
169
- return await locator._expect("to.have.accessible.error.message", { expectedText, isNot, timeout });
170
- }, expected, options);
171
- }
172
- function toHaveAttribute(locator, name, expected, options) {
173
- if (!options) {
174
- if (typeof expected === "object" && !(0, import_utils.isRegExp)(expected)) {
175
- options = expected;
176
- expected = void 0;
177
- }
178
- }
179
- if (expected === void 0) {
180
- return import_toBeTruthy.toBeTruthy.call(this, "toHaveAttribute", locator, "Locator", "have attribute", "", async (isNot, timeout) => {
181
- return await locator._expect("to.have.attribute", { expressionArg: name, isNot, timeout });
182
- }, options);
183
- }
184
- return import_toMatchText.toMatchText.call(this, "toHaveAttribute", locator, "Locator", async (isNot, timeout) => {
185
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase });
186
- return await locator._expect("to.have.attribute.value", { expressionArg: name, expectedText, isNot, timeout });
187
- }, expected, options);
188
- }
189
- function toHaveClass(locator, expected, options) {
190
- if (Array.isArray(expected)) {
191
- return import_toEqual.toEqual.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout) => {
192
- const expectedText = (0, import_utils.serializeExpectedTextValues)(expected);
193
- return await locator._expect("to.have.class.array", { expectedText, isNot, timeout });
194
- }, expected, options);
195
- } else {
196
- return import_toMatchText.toMatchText.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout) => {
197
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
198
- return await locator._expect("to.have.class", { expectedText, isNot, timeout });
199
- }, expected, options);
200
- }
201
- }
202
- function toContainClass(locator, expected, options) {
203
- if (Array.isArray(expected)) {
204
- if (expected.some((e) => (0, import_utils.isRegExp)(e)))
205
- throw new Error(`"expected" argument in toContainClass cannot contain RegExp values`);
206
- return import_toEqual.toEqual.call(this, "toContainClass", locator, "Locator", async (isNot, timeout) => {
207
- const expectedText = (0, import_utils.serializeExpectedTextValues)(expected);
208
- return await locator._expect("to.contain.class.array", { expectedText, isNot, timeout });
209
- }, expected, options);
210
- } else {
211
- if ((0, import_utils.isRegExp)(expected))
212
- throw new Error(`"expected" argument in toContainClass cannot be a RegExp value`);
213
- return import_toMatchText.toMatchText.call(this, "toContainClass", locator, "Locator", async (isNot, timeout) => {
214
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
215
- return await locator._expect("to.contain.class", { expectedText, isNot, timeout });
216
- }, expected, options);
217
- }
218
- }
219
- function toHaveCount(locator, expected, options) {
220
- return import_toEqual.toEqual.call(this, "toHaveCount", locator, "Locator", async (isNot, timeout) => {
221
- return await locator._expect("to.have.count", { expectedNumber: expected, isNot, timeout });
222
- }, expected, options);
223
- }
224
- function toHaveCSS(locator, name, expected, options) {
225
- return import_toMatchText.toMatchText.call(this, "toHaveCSS", locator, "Locator", async (isNot, timeout) => {
226
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
227
- return await locator._expect("to.have.css", { expressionArg: name, expectedText, isNot, timeout });
228
- }, expected, options);
229
- }
230
- function toHaveId(locator, expected, options) {
231
- return import_toMatchText.toMatchText.call(this, "toHaveId", locator, "Locator", async (isNot, timeout) => {
232
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
233
- return await locator._expect("to.have.id", { expectedText, isNot, timeout });
234
- }, expected, options);
235
- }
236
- function toHaveJSProperty(locator, name, expected, options) {
237
- return import_toEqual.toEqual.call(this, "toHaveJSProperty", locator, "Locator", async (isNot, timeout) => {
238
- return await locator._expect("to.have.property", { expressionArg: name, expectedValue: expected, isNot, timeout });
239
- }, expected, options);
240
- }
241
- function toHaveRole(locator, expected, options) {
242
- if (!(0, import_utils.isString)(expected))
243
- throw new Error(`"role" argument in toHaveRole must be a string`);
244
- return import_toMatchText.toMatchText.call(this, "toHaveRole", locator, "Locator", async (isNot, timeout) => {
245
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
246
- return await locator._expect("to.have.role", { expectedText, isNot, timeout });
247
- }, expected, options);
248
- }
249
- function toHaveText(locator, expected, options = {}) {
250
- if (Array.isArray(expected)) {
251
- return import_toEqual.toEqual.call(this, "toHaveText", locator, "Locator", async (isNot, timeout) => {
252
- const expectedText = (0, import_utils.serializeExpectedTextValues)(expected, { normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
253
- return await locator._expect("to.have.text.array", { expectedText, isNot, useInnerText: options?.useInnerText, timeout });
254
- }, expected, options);
255
- } else {
256
- return import_toMatchText.toMatchText.call(this, "toHaveText", locator, "Locator", async (isNot, timeout) => {
257
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
258
- return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options?.useInnerText, timeout });
259
- }, expected, options);
260
- }
261
- }
262
- function toHaveValue(locator, expected, options) {
263
- return import_toMatchText.toMatchText.call(this, "toHaveValue", locator, "Locator", async (isNot, timeout) => {
264
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
265
- return await locator._expect("to.have.value", { expectedText, isNot, timeout });
266
- }, expected, options);
267
- }
268
- function toHaveValues(locator, expected, options) {
269
- return import_toEqual.toEqual.call(this, "toHaveValues", locator, "Locator", async (isNot, timeout) => {
270
- const expectedText = (0, import_utils.serializeExpectedTextValues)(expected);
271
- return await locator._expect("to.have.values", { expectedText, isNot, timeout });
272
- }, expected, options);
273
- }
274
- function toHaveTitle(page, expected, options = {}) {
275
- return import_toMatchText.toMatchText.call(this, "toHaveTitle", page, "Page", async (isNot, timeout) => {
276
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { normalizeWhiteSpace: true });
277
- return await page.mainFrame()._expect("to.have.title", { expectedText, isNot, timeout });
278
- }, expected, options);
279
- }
280
- function toHaveURL(page, expected, options) {
281
- if (typeof expected === "function")
282
- return import_toHaveURL.toHaveURLWithPredicate.call(this, page, expected, options);
283
- const baseURL = page.context()._options.baseURL;
284
- expected = typeof expected === "string" ? (0, import_utils.constructURLBasedOnBaseURL)(baseURL, expected) : expected;
285
- return import_toMatchText.toMatchText.call(this, "toHaveURL", page, "Page", async (isNot, timeout) => {
286
- const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase });
287
- return await page.mainFrame()._expect("to.have.url", { expectedText, isNot, timeout });
288
- }, expected, options);
289
- }
290
- async function toBeOK(response) {
291
- const matcherName = "toBeOK";
292
- (0, import_util.expectTypes)(response, ["APIResponse"], matcherName);
293
- const contentType = response.headers()["content-type"];
294
- const isTextEncoding = contentType && (0, import_utils.isTextualMimeType)(contentType);
295
- const [log, text] = this.isNot === response.ok() ? await Promise.all([
296
- response._fetchLog(),
297
- isTextEncoding ? response.text() : null
298
- ]) : [];
299
- const message = () => (0, import_utils.formatMatcherMessage)(this.utils, {
300
- isNot: this.isNot,
301
- promise: this.promise,
302
- matcherName,
303
- receiver: "response",
304
- expectation: "",
305
- log
306
- }) + (text === null ? "" : `
307
- Response text:
308
- ${import_utils2.colors.dim(text?.substring(0, 1e3) || "")}`);
309
- const pass = response.ok();
310
- return { message, pass };
311
- }
312
- async function toPass(callback, options = {}) {
313
- const testInfo = (0, import_globals.currentTestInfo)();
314
- const timeout = (0, import_config.takeFirst)(options.timeout, testInfo?._projectInternal.expect?.toPass?.timeout, 0);
315
- const intervals = (0, import_config.takeFirst)(options.intervals, testInfo?._projectInternal.expect?.toPass?.intervals, [100, 250, 500, 1e3]);
316
- const { deadline, timeoutMessage } = testInfo ? testInfo._deadlineForMatcher(timeout) : import_testInfo.TestInfoImpl._defaultDeadlineForMatcher(timeout);
317
- const result = await (0, import_utils.pollAgainstDeadline)(async () => {
318
- if (testInfo && (0, import_globals.currentTestInfo)() !== testInfo)
319
- return { continuePolling: false, result: void 0 };
320
- try {
321
- await callback();
322
- return { continuePolling: !!this.isNot, result: void 0 };
323
- } catch (e) {
324
- return { continuePolling: !this.isNot, result: e };
325
- }
326
- }, deadline, intervals);
327
- if (result.timedOut) {
328
- const message = result.result ? [
329
- result.result.message,
330
- "",
331
- `Call Log:`,
332
- `- ${timeoutMessage}`
333
- ].join("\n") : timeoutMessage;
334
- return { message: () => message, pass: !!this.isNot };
335
- }
336
- return { pass: !this.isNot, message: () => "" };
337
- }
338
- function computeMatcherTitleSuffix(matcherName, receiver, args) {
339
- if (matcherName === "toHaveScreenshot") {
340
- const title = (0, import_toMatchSnapshot.toHaveScreenshotStepTitle)(...args);
341
- return { short: title ? `(${title})` : "" };
342
- }
343
- if (receiver && typeof receiver === "object" && receiver.constructor?.name === "Locator") {
344
- try {
345
- return { long: " " + (0, import_utils.asLocatorDescription)("javascript", receiver._selector) };
346
- } catch {
347
- }
348
- }
349
- return {};
350
- }
351
- // Annotate the CommonJS export names for ESM import in node:
352
- 0 && (module.exports = {
353
- computeMatcherTitleSuffix,
354
- toBeAttached,
355
- toBeChecked,
356
- toBeDisabled,
357
- toBeEditable,
358
- toBeEmpty,
359
- toBeEnabled,
360
- toBeFocused,
361
- toBeHidden,
362
- toBeInViewport,
363
- toBeOK,
364
- toBeVisible,
365
- toContainClass,
366
- toContainText,
367
- toHaveAccessibleDescription,
368
- toHaveAccessibleErrorMessage,
369
- toHaveAccessibleName,
370
- toHaveAttribute,
371
- toHaveCSS,
372
- toHaveClass,
373
- toHaveCount,
374
- toHaveId,
375
- toHaveJSProperty,
376
- toHaveRole,
377
- toHaveText,
378
- toHaveTitle,
379
- toHaveURL,
380
- toHaveValue,
381
- toHaveValues,
382
- toPass
383
- });
@@ -1,75 +0,0 @@
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 toBeTruthy_exports = {};
20
- __export(toBeTruthy_exports, {
21
- toBeTruthy: () => toBeTruthy
22
- });
23
- module.exports = __toCommonJS(toBeTruthy_exports);
24
- var import_utils = require("playwright-core/lib/utils");
25
- var import_util = require("../util");
26
- async function toBeTruthy(matcherName, locator, receiverType, expected, arg, query, options = {}) {
27
- (0, import_util.expectTypes)(locator, [receiverType], matcherName);
28
- const timeout = options.timeout ?? this.timeout;
29
- const { matches: pass, log, timedOut, received, errorMessage } = await query(!!this.isNot, timeout);
30
- if (pass === !this.isNot) {
31
- return {
32
- name: matcherName,
33
- message: () => "",
34
- pass,
35
- expected
36
- };
37
- }
38
- let printedReceived;
39
- let printedExpected;
40
- if (pass) {
41
- printedExpected = `Expected: not ${expected}`;
42
- printedReceived = errorMessage ? "" : `Received: ${expected}`;
43
- } else {
44
- printedExpected = `Expected: ${expected}`;
45
- printedReceived = errorMessage ? "" : `Received: ${received}`;
46
- }
47
- const message = () => {
48
- return (0, import_utils.formatMatcherMessage)(this.utils, {
49
- isNot: this.isNot,
50
- promise: this.promise,
51
- matcherName,
52
- expectation: arg,
53
- locator: locator.toString(),
54
- timeout,
55
- timedOut,
56
- printedExpected,
57
- printedReceived,
58
- errorMessage,
59
- log
60
- });
61
- };
62
- return {
63
- message,
64
- pass,
65
- actual: received,
66
- name: matcherName,
67
- expected,
68
- log,
69
- timeout: timedOut ? timeout : void 0
70
- };
71
- }
72
- // Annotate the CommonJS export names for ESM import in node:
73
- 0 && (module.exports = {
74
- toBeTruthy
75
- });
@@ -1,100 +0,0 @@
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 toEqual_exports = {};
20
- __export(toEqual_exports, {
21
- toEqual: () => toEqual
22
- });
23
- module.exports = __toCommonJS(toEqual_exports);
24
- var import_utils = require("playwright-core/lib/utils");
25
- var import_util = require("../util");
26
- const EXPECTED_LABEL = "Expected";
27
- const RECEIVED_LABEL = "Received";
28
- async function toEqual(matcherName, locator, receiverType, query, expected, options = {}) {
29
- (0, import_util.expectTypes)(locator, [receiverType], matcherName);
30
- const timeout = options.timeout ?? this.timeout;
31
- const { matches: pass, received, log, timedOut, errorMessage } = await query(!!this.isNot, timeout);
32
- if (pass === !this.isNot) {
33
- return {
34
- name: matcherName,
35
- message: () => "",
36
- pass,
37
- expected
38
- };
39
- }
40
- let printedReceived;
41
- let printedExpected;
42
- let printedDiff;
43
- if (pass) {
44
- printedExpected = `Expected: not ${this.utils.printExpected(expected)}`;
45
- printedReceived = errorMessage ? "" : `Received: ${this.utils.printReceived(received)}`;
46
- } else if (errorMessage) {
47
- printedExpected = `Expected: ${this.utils.printExpected(expected)}`;
48
- } else if (Array.isArray(expected) && Array.isArray(received)) {
49
- const normalizedExpected = expected.map((exp, index) => {
50
- const rec = received[index];
51
- if ((0, import_utils.isRegExp)(exp))
52
- return exp.test(rec) ? rec : exp;
53
- return exp;
54
- });
55
- printedDiff = this.utils.printDiffOrStringify(
56
- normalizedExpected,
57
- received,
58
- EXPECTED_LABEL,
59
- RECEIVED_LABEL,
60
- false
61
- );
62
- } else {
63
- printedDiff = this.utils.printDiffOrStringify(
64
- expected,
65
- received,
66
- EXPECTED_LABEL,
67
- RECEIVED_LABEL,
68
- false
69
- );
70
- }
71
- const message = () => {
72
- return (0, import_utils.formatMatcherMessage)(this.utils, {
73
- isNot: this.isNot,
74
- promise: this.promise,
75
- matcherName,
76
- expectation: "expected",
77
- locator: locator.toString(),
78
- timeout,
79
- timedOut,
80
- printedExpected,
81
- printedReceived,
82
- printedDiff,
83
- errorMessage,
84
- log
85
- });
86
- };
87
- return {
88
- actual: received,
89
- expected,
90
- message,
91
- name: matcherName,
92
- pass,
93
- log,
94
- timeout: timedOut ? timeout : void 0
95
- };
96
- }
97
- // Annotate the CommonJS export names for ESM import in node:
98
- 0 && (module.exports = {
99
- toEqual
100
- });
@@ -1,101 +0,0 @@
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 toHaveURL_exports = {};
20
- __export(toHaveURL_exports, {
21
- toHaveURLWithPredicate: () => toHaveURLWithPredicate
22
- });
23
- module.exports = __toCommonJS(toHaveURL_exports);
24
- var import_utils = require("playwright-core/lib/utils");
25
- async function toHaveURLWithPredicate(page, expected, options) {
26
- const matcherName = "toHaveURL";
27
- const timeout = options?.timeout ?? this.timeout;
28
- const baseURL = page.context()._options.baseURL;
29
- let conditionSucceeded = false;
30
- let lastCheckedURLString = void 0;
31
- try {
32
- await page.mainFrame().waitForURL(
33
- (url) => {
34
- lastCheckedURLString = url.toString();
35
- if (options?.ignoreCase) {
36
- return !this.isNot === (0, import_utils.urlMatches)(
37
- baseURL?.toLocaleLowerCase(),
38
- lastCheckedURLString.toLocaleLowerCase(),
39
- expected
40
- );
41
- }
42
- return !this.isNot === (0, import_utils.urlMatches)(baseURL, lastCheckedURLString, expected);
43
- },
44
- { timeout }
45
- );
46
- conditionSucceeded = true;
47
- } catch (e) {
48
- conditionSucceeded = false;
49
- }
50
- if (conditionSucceeded)
51
- return { name: matcherName, pass: !this.isNot, message: () => "" };
52
- return {
53
- name: matcherName,
54
- pass: this.isNot,
55
- message: () => toHaveURLMessage(
56
- this,
57
- matcherName,
58
- expected,
59
- lastCheckedURLString,
60
- this.isNot,
61
- true,
62
- timeout
63
- ),
64
- actual: lastCheckedURLString,
65
- timeout
66
- };
67
- }
68
- function toHaveURLMessage(state, matcherName, expected, received, pass, timedOut, timeout) {
69
- const receivedString = received || "";
70
- let printedReceived;
71
- let printedExpected;
72
- let printedDiff;
73
- if (typeof expected === "function") {
74
- printedExpected = `Expected: predicate to ${!state.isNot ? "succeed" : "fail"}`;
75
- printedReceived = `Received: ${state.utils.printReceived(receivedString)}`;
76
- } else {
77
- if (pass) {
78
- printedExpected = `Expected pattern: not ${state.utils.printExpected(expected)}`;
79
- const formattedReceived = (0, import_utils.printReceivedStringContainExpectedResult)(state.utils, receivedString, null);
80
- printedReceived = `Received string: ${formattedReceived}`;
81
- } else {
82
- const labelExpected = `Expected ${typeof expected === "string" ? "string" : "pattern"}`;
83
- printedDiff = state.utils.printDiffOrStringify(expected, receivedString, labelExpected, "Received string", false);
84
- }
85
- }
86
- return (0, import_utils.formatMatcherMessage)(state.utils, {
87
- isNot: state.isNot,
88
- promise: state.promise,
89
- matcherName,
90
- expectation: "expected",
91
- timeout,
92
- timedOut,
93
- printedExpected,
94
- printedReceived,
95
- printedDiff
96
- });
97
- }
98
- // Annotate the CommonJS export names for ESM import in node:
99
- 0 && (module.exports = {
100
- toHaveURLWithPredicate
101
- });