@playwright/test 1.31.2 → 1.32.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.
- package/lib/cli.js +12 -34
- package/lib/common/compilationCache.js +4 -2
- package/lib/common/configLoader.js +4 -1
- package/lib/common/fixtures.js +31 -2
- package/lib/common/globals.js +9 -0
- package/lib/common/process.js +15 -3
- package/lib/common/testType.js +2 -1
- package/lib/common/transform.js +0 -1
- package/lib/index.js +95 -56
- package/lib/isomorphic/folders.js +25 -0
- package/lib/isomorphic/teleReceiver.js +368 -0
- package/lib/matchers/expect.js +35 -16
- package/lib/matchers/matchers.js +48 -48
- package/lib/matchers/toBeTruthy.js +1 -1
- package/lib/matchers/toEqual.js +1 -4
- package/lib/matchers/toMatchSnapshot.js +3 -4
- package/lib/matchers/toMatchText.js +1 -1
- package/lib/plugins/vitePlugin.js +3 -2
- package/lib/reporters/base.js +6 -9
- package/lib/reporters/html.js +7 -2
- package/lib/reporters/json.js +2 -2
- package/lib/reporters/junit.js +2 -2
- package/lib/reporters/teleEmitter.js +209 -0
- package/lib/runner/dispatcher.js +15 -2
- package/lib/runner/loadUtils.js +168 -96
- package/lib/runner/loaderHost.js +2 -2
- package/lib/runner/processHost.js +16 -4
- package/lib/runner/reporters.js +3 -2
- package/lib/runner/runner.js +9 -1
- package/lib/runner/taskRunner.js +6 -8
- package/lib/runner/tasks.js +55 -46
- package/lib/runner/testGroups.js +15 -10
- package/lib/runner/uiMode.js +279 -0
- package/lib/runner/workerHost.js +7 -6
- package/lib/store.js +99 -0
- package/lib/util.js +23 -39
- package/lib/worker/fixtureRunner.js +3 -3
- package/lib/worker/testInfo.js +8 -3
- package/lib/worker/timeoutManager.js +11 -5
- package/lib/worker/workerMain.js +6 -3
- package/package.json +2 -2
- package/types/component.d.ts +1 -1
- package/types/reporterPrivate.ts +22 -0
- package/types/test.d.ts +18 -22
- package/types/testReporter.d.ts +5 -1
- package/lib/common/profiler.js +0 -53
package/lib/matchers/matchers.js
CHANGED
|
@@ -50,76 +50,76 @@ var _utils = require("playwright-core/lib/utils");
|
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
52
|
function toBeChecked(locator, options) {
|
|
53
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeChecked', locator, 'Locator', async (isNot, timeout
|
|
53
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeChecked', locator, 'Locator', async (isNot, timeout) => {
|
|
54
54
|
const checked = !options || options.checked === undefined || options.checked === true;
|
|
55
|
-
return await locator._expect(
|
|
55
|
+
return await locator._expect(checked ? 'to.be.checked' : 'to.be.unchecked', {
|
|
56
56
|
isNot,
|
|
57
57
|
timeout
|
|
58
58
|
});
|
|
59
59
|
}, options);
|
|
60
60
|
}
|
|
61
61
|
function toBeDisabled(locator, options) {
|
|
62
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeDisabled', locator, 'Locator', async (isNot, timeout
|
|
63
|
-
return await locator._expect(
|
|
62
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeDisabled', locator, 'Locator', async (isNot, timeout) => {
|
|
63
|
+
return await locator._expect('to.be.disabled', {
|
|
64
64
|
isNot,
|
|
65
65
|
timeout
|
|
66
66
|
});
|
|
67
67
|
}, options);
|
|
68
68
|
}
|
|
69
69
|
function toBeEditable(locator, options) {
|
|
70
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeEditable', locator, 'Locator', async (isNot, timeout
|
|
70
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeEditable', locator, 'Locator', async (isNot, timeout) => {
|
|
71
71
|
const editable = !options || options.editable === undefined || options.editable === true;
|
|
72
|
-
return await locator._expect(
|
|
72
|
+
return await locator._expect(editable ? 'to.be.editable' : 'to.be.readonly', {
|
|
73
73
|
isNot,
|
|
74
74
|
timeout
|
|
75
75
|
});
|
|
76
76
|
}, options);
|
|
77
77
|
}
|
|
78
78
|
function toBeEmpty(locator, options) {
|
|
79
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeEmpty', locator, 'Locator', async (isNot, timeout
|
|
80
|
-
return await locator._expect(
|
|
79
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeEmpty', locator, 'Locator', async (isNot, timeout) => {
|
|
80
|
+
return await locator._expect('to.be.empty', {
|
|
81
81
|
isNot,
|
|
82
82
|
timeout
|
|
83
83
|
});
|
|
84
84
|
}, options);
|
|
85
85
|
}
|
|
86
86
|
function toBeEnabled(locator, options) {
|
|
87
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeEnabled', locator, 'Locator', async (isNot, timeout
|
|
87
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeEnabled', locator, 'Locator', async (isNot, timeout) => {
|
|
88
88
|
const enabled = !options || options.enabled === undefined || options.enabled === true;
|
|
89
|
-
return await locator._expect(
|
|
89
|
+
return await locator._expect(enabled ? 'to.be.enabled' : 'to.be.disabled', {
|
|
90
90
|
isNot,
|
|
91
91
|
timeout
|
|
92
92
|
});
|
|
93
93
|
}, options);
|
|
94
94
|
}
|
|
95
95
|
function toBeFocused(locator, options) {
|
|
96
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeFocused', locator, 'Locator', async (isNot, timeout
|
|
97
|
-
return await locator._expect(
|
|
96
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeFocused', locator, 'Locator', async (isNot, timeout) => {
|
|
97
|
+
return await locator._expect('to.be.focused', {
|
|
98
98
|
isNot,
|
|
99
99
|
timeout
|
|
100
100
|
});
|
|
101
101
|
}, options);
|
|
102
102
|
}
|
|
103
103
|
function toBeHidden(locator, options) {
|
|
104
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeHidden', locator, 'Locator', async (isNot, timeout
|
|
105
|
-
return await locator._expect(
|
|
104
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeHidden', locator, 'Locator', async (isNot, timeout) => {
|
|
105
|
+
return await locator._expect('to.be.hidden', {
|
|
106
106
|
isNot,
|
|
107
107
|
timeout
|
|
108
108
|
});
|
|
109
109
|
}, options);
|
|
110
110
|
}
|
|
111
111
|
function toBeVisible(locator, options) {
|
|
112
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeVisible', locator, 'Locator', async (isNot, timeout
|
|
112
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeVisible', locator, 'Locator', async (isNot, timeout) => {
|
|
113
113
|
const visible = !options || options.visible === undefined || options.visible === true;
|
|
114
|
-
return await locator._expect(
|
|
114
|
+
return await locator._expect(visible ? 'to.be.visible' : 'to.be.hidden', {
|
|
115
115
|
isNot,
|
|
116
116
|
timeout
|
|
117
117
|
});
|
|
118
118
|
}, options);
|
|
119
119
|
}
|
|
120
120
|
function toBeInViewport(locator, options) {
|
|
121
|
-
return _toBeTruthy.toBeTruthy.call(this, 'toBeInViewport', locator, 'Locator', async (isNot, timeout
|
|
122
|
-
return await locator._expect(
|
|
121
|
+
return _toBeTruthy.toBeTruthy.call(this, 'toBeInViewport', locator, 'Locator', async (isNot, timeout) => {
|
|
122
|
+
return await locator._expect('to.be.in.viewport', {
|
|
123
123
|
isNot,
|
|
124
124
|
expectedNumber: options === null || options === void 0 ? void 0 : options.ratio,
|
|
125
125
|
timeout
|
|
@@ -128,13 +128,13 @@ function toBeInViewport(locator, options) {
|
|
|
128
128
|
}
|
|
129
129
|
function toContainText(locator, expected, options = {}) {
|
|
130
130
|
if (Array.isArray(expected)) {
|
|
131
|
-
return _toEqual.toEqual.call(this, 'toContainText', locator, 'Locator', async (isNot, timeout
|
|
131
|
+
return _toEqual.toEqual.call(this, 'toContainText', locator, 'Locator', async (isNot, timeout) => {
|
|
132
132
|
const expectedText = (0, _toMatchText.toExpectedTextValues)(expected, {
|
|
133
133
|
matchSubstring: true,
|
|
134
134
|
normalizeWhiteSpace: true,
|
|
135
135
|
ignoreCase: options.ignoreCase
|
|
136
136
|
});
|
|
137
|
-
return await locator._expect(
|
|
137
|
+
return await locator._expect('to.contain.text.array', {
|
|
138
138
|
expectedText,
|
|
139
139
|
isNot,
|
|
140
140
|
useInnerText: options.useInnerText,
|
|
@@ -145,13 +145,13 @@ function toContainText(locator, expected, options = {}) {
|
|
|
145
145
|
contains: true
|
|
146
146
|
});
|
|
147
147
|
} else {
|
|
148
|
-
return _toMatchText.toMatchText.call(this, 'toContainText', locator, 'Locator', async (isNot, timeout
|
|
148
|
+
return _toMatchText.toMatchText.call(this, 'toContainText', locator, 'Locator', async (isNot, timeout) => {
|
|
149
149
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected], {
|
|
150
150
|
matchSubstring: true,
|
|
151
151
|
normalizeWhiteSpace: true,
|
|
152
152
|
ignoreCase: options.ignoreCase
|
|
153
153
|
});
|
|
154
|
-
return await locator._expect(
|
|
154
|
+
return await locator._expect('to.have.text', {
|
|
155
155
|
expectedText,
|
|
156
156
|
isNot,
|
|
157
157
|
useInnerText: options.useInnerText,
|
|
@@ -161,9 +161,9 @@ function toContainText(locator, expected, options = {}) {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
function toHaveAttribute(locator, name, expected, options) {
|
|
164
|
-
return _toMatchText.toMatchText.call(this, 'toHaveAttribute', locator, 'Locator', async (isNot, timeout
|
|
164
|
+
return _toMatchText.toMatchText.call(this, 'toHaveAttribute', locator, 'Locator', async (isNot, timeout) => {
|
|
165
165
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected]);
|
|
166
|
-
return await locator._expect(
|
|
166
|
+
return await locator._expect('to.have.attribute', {
|
|
167
167
|
expressionArg: name,
|
|
168
168
|
expectedText,
|
|
169
169
|
isNot,
|
|
@@ -173,18 +173,18 @@ function toHaveAttribute(locator, name, expected, options) {
|
|
|
173
173
|
}
|
|
174
174
|
function toHaveClass(locator, expected, options) {
|
|
175
175
|
if (Array.isArray(expected)) {
|
|
176
|
-
return _toEqual.toEqual.call(this, 'toHaveClass', locator, 'Locator', async (isNot, timeout
|
|
176
|
+
return _toEqual.toEqual.call(this, 'toHaveClass', locator, 'Locator', async (isNot, timeout) => {
|
|
177
177
|
const expectedText = (0, _toMatchText.toExpectedTextValues)(expected);
|
|
178
|
-
return await locator._expect(
|
|
178
|
+
return await locator._expect('to.have.class.array', {
|
|
179
179
|
expectedText,
|
|
180
180
|
isNot,
|
|
181
181
|
timeout
|
|
182
182
|
});
|
|
183
183
|
}, expected, options);
|
|
184
184
|
} else {
|
|
185
|
-
return _toMatchText.toMatchText.call(this, 'toHaveClass', locator, 'Locator', async (isNot, timeout
|
|
185
|
+
return _toMatchText.toMatchText.call(this, 'toHaveClass', locator, 'Locator', async (isNot, timeout) => {
|
|
186
186
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected]);
|
|
187
|
-
return await locator._expect(
|
|
187
|
+
return await locator._expect('to.have.class', {
|
|
188
188
|
expectedText,
|
|
189
189
|
isNot,
|
|
190
190
|
timeout
|
|
@@ -193,8 +193,8 @@ function toHaveClass(locator, expected, options) {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
function toHaveCount(locator, expected, options) {
|
|
196
|
-
return _toEqual.toEqual.call(this, 'toHaveCount', locator, 'Locator', async (isNot, timeout
|
|
197
|
-
return await locator._expect(
|
|
196
|
+
return _toEqual.toEqual.call(this, 'toHaveCount', locator, 'Locator', async (isNot, timeout) => {
|
|
197
|
+
return await locator._expect('to.have.count', {
|
|
198
198
|
expectedNumber: expected,
|
|
199
199
|
isNot,
|
|
200
200
|
timeout
|
|
@@ -202,9 +202,9 @@ function toHaveCount(locator, expected, options) {
|
|
|
202
202
|
}, expected, options);
|
|
203
203
|
}
|
|
204
204
|
function toHaveCSS(locator, name, expected, options) {
|
|
205
|
-
return _toMatchText.toMatchText.call(this, 'toHaveCSS', locator, 'Locator', async (isNot, timeout
|
|
205
|
+
return _toMatchText.toMatchText.call(this, 'toHaveCSS', locator, 'Locator', async (isNot, timeout) => {
|
|
206
206
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected]);
|
|
207
|
-
return await locator._expect(
|
|
207
|
+
return await locator._expect('to.have.css', {
|
|
208
208
|
expressionArg: name,
|
|
209
209
|
expectedText,
|
|
210
210
|
isNot,
|
|
@@ -213,9 +213,9 @@ function toHaveCSS(locator, name, expected, options) {
|
|
|
213
213
|
}, expected, options);
|
|
214
214
|
}
|
|
215
215
|
function toHaveId(locator, expected, options) {
|
|
216
|
-
return _toMatchText.toMatchText.call(this, 'toHaveId', locator, 'Locator', async (isNot, timeout
|
|
216
|
+
return _toMatchText.toMatchText.call(this, 'toHaveId', locator, 'Locator', async (isNot, timeout) => {
|
|
217
217
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected]);
|
|
218
|
-
return await locator._expect(
|
|
218
|
+
return await locator._expect('to.have.id', {
|
|
219
219
|
expectedText,
|
|
220
220
|
isNot,
|
|
221
221
|
timeout
|
|
@@ -223,8 +223,8 @@ function toHaveId(locator, expected, options) {
|
|
|
223
223
|
}, expected, options);
|
|
224
224
|
}
|
|
225
225
|
function toHaveJSProperty(locator, name, expected, options) {
|
|
226
|
-
return _toEqual.toEqual.call(this, 'toHaveJSProperty', locator, 'Locator', async (isNot, timeout
|
|
227
|
-
return await locator._expect(
|
|
226
|
+
return _toEqual.toEqual.call(this, 'toHaveJSProperty', locator, 'Locator', async (isNot, timeout) => {
|
|
227
|
+
return await locator._expect('to.have.property', {
|
|
228
228
|
expressionArg: name,
|
|
229
229
|
expectedValue: expected,
|
|
230
230
|
isNot,
|
|
@@ -234,12 +234,12 @@ function toHaveJSProperty(locator, name, expected, options) {
|
|
|
234
234
|
}
|
|
235
235
|
function toHaveText(locator, expected, options = {}) {
|
|
236
236
|
if (Array.isArray(expected)) {
|
|
237
|
-
return _toEqual.toEqual.call(this, 'toHaveText', locator, 'Locator', async (isNot, timeout
|
|
237
|
+
return _toEqual.toEqual.call(this, 'toHaveText', locator, 'Locator', async (isNot, timeout) => {
|
|
238
238
|
const expectedText = (0, _toMatchText.toExpectedTextValues)(expected, {
|
|
239
239
|
normalizeWhiteSpace: true,
|
|
240
240
|
ignoreCase: options.ignoreCase
|
|
241
241
|
});
|
|
242
|
-
return await locator._expect(
|
|
242
|
+
return await locator._expect('to.have.text.array', {
|
|
243
243
|
expectedText,
|
|
244
244
|
isNot,
|
|
245
245
|
useInnerText: options === null || options === void 0 ? void 0 : options.useInnerText,
|
|
@@ -247,12 +247,12 @@ function toHaveText(locator, expected, options = {}) {
|
|
|
247
247
|
});
|
|
248
248
|
}, expected, options);
|
|
249
249
|
} else {
|
|
250
|
-
return _toMatchText.toMatchText.call(this, 'toHaveText', locator, 'Locator', async (isNot, timeout
|
|
250
|
+
return _toMatchText.toMatchText.call(this, 'toHaveText', locator, 'Locator', async (isNot, timeout) => {
|
|
251
251
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected], {
|
|
252
252
|
normalizeWhiteSpace: true,
|
|
253
253
|
ignoreCase: options.ignoreCase
|
|
254
254
|
});
|
|
255
|
-
return await locator._expect(
|
|
255
|
+
return await locator._expect('to.have.text', {
|
|
256
256
|
expectedText,
|
|
257
257
|
isNot,
|
|
258
258
|
useInnerText: options === null || options === void 0 ? void 0 : options.useInnerText,
|
|
@@ -262,9 +262,9 @@ function toHaveText(locator, expected, options = {}) {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
function toHaveValue(locator, expected, options) {
|
|
265
|
-
return _toMatchText.toMatchText.call(this, 'toHaveValue', locator, 'Locator', async (isNot, timeout
|
|
265
|
+
return _toMatchText.toMatchText.call(this, 'toHaveValue', locator, 'Locator', async (isNot, timeout) => {
|
|
266
266
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected]);
|
|
267
|
-
return await locator._expect(
|
|
267
|
+
return await locator._expect('to.have.value', {
|
|
268
268
|
expectedText,
|
|
269
269
|
isNot,
|
|
270
270
|
timeout
|
|
@@ -272,9 +272,9 @@ function toHaveValue(locator, expected, options) {
|
|
|
272
272
|
}, expected, options);
|
|
273
273
|
}
|
|
274
274
|
function toHaveValues(locator, expected, options) {
|
|
275
|
-
return _toEqual.toEqual.call(this, 'toHaveValues', locator, 'Locator', async (isNot, timeout
|
|
275
|
+
return _toEqual.toEqual.call(this, 'toHaveValues', locator, 'Locator', async (isNot, timeout) => {
|
|
276
276
|
const expectedText = (0, _toMatchText.toExpectedTextValues)(expected);
|
|
277
|
-
return await locator._expect(
|
|
277
|
+
return await locator._expect('to.have.values', {
|
|
278
278
|
expectedText,
|
|
279
279
|
isNot,
|
|
280
280
|
timeout
|
|
@@ -283,11 +283,11 @@ function toHaveValues(locator, expected, options) {
|
|
|
283
283
|
}
|
|
284
284
|
function toHaveTitle(page, expected, options = {}) {
|
|
285
285
|
const locator = page.locator(':root');
|
|
286
|
-
return _toMatchText.toMatchText.call(this, 'toHaveTitle', locator, 'Locator', async (isNot, timeout
|
|
286
|
+
return _toMatchText.toMatchText.call(this, 'toHaveTitle', locator, 'Locator', async (isNot, timeout) => {
|
|
287
287
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected], {
|
|
288
288
|
normalizeWhiteSpace: true
|
|
289
289
|
});
|
|
290
|
-
return await locator._expect(
|
|
290
|
+
return await locator._expect('to.have.title', {
|
|
291
291
|
expectedText,
|
|
292
292
|
isNot,
|
|
293
293
|
timeout
|
|
@@ -298,9 +298,9 @@ function toHaveURL(page, expected, options) {
|
|
|
298
298
|
const baseURL = page.context()._options.baseURL;
|
|
299
299
|
expected = typeof expected === 'string' ? (0, _utils.constructURLBasedOnBaseURL)(baseURL, expected) : expected;
|
|
300
300
|
const locator = page.locator(':root');
|
|
301
|
-
return _toMatchText.toMatchText.call(this, 'toHaveURL', locator, 'Locator', async (isNot, timeout
|
|
301
|
+
return _toMatchText.toMatchText.call(this, 'toHaveURL', locator, 'Locator', async (isNot, timeout) => {
|
|
302
302
|
const expectedText = (0, _toMatchText.toExpectedTextValues)([expected]);
|
|
303
|
-
return await locator._expect(
|
|
303
|
+
return await locator._expect('to.have.url', {
|
|
304
304
|
expectedText,
|
|
305
305
|
isNot,
|
|
306
306
|
timeout
|
|
@@ -34,7 +34,7 @@ async function toBeTruthy(matcherName, receiver, receiverType, query, options =
|
|
|
34
34
|
matches,
|
|
35
35
|
log,
|
|
36
36
|
timedOut
|
|
37
|
-
} = await query(this.isNot, timeout
|
|
37
|
+
} = await query(this.isNot, timeout);
|
|
38
38
|
const message = () => {
|
|
39
39
|
return (0, _matcherHint.matcherHint)(this, matcherName, undefined, '', matcherOptions, timedOut ? timeout : undefined) + (0, _util.callLogText)(log);
|
|
40
40
|
};
|
package/lib/matchers/toEqual.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.toEqual = toEqual;
|
|
7
7
|
var _util = require("../util");
|
|
8
|
-
var _utils = require("playwright-core/lib/utils");
|
|
9
8
|
var _matcherHint = require("./matcherHint");
|
|
10
9
|
var _globals = require("../common/globals");
|
|
11
10
|
/**
|
|
@@ -38,14 +37,12 @@ async function toEqual(matcherName, receiver, receiverType, query, expected, opt
|
|
|
38
37
|
promise: this.promise
|
|
39
38
|
};
|
|
40
39
|
const timeout = (0, _globals.currentExpectTimeout)(options);
|
|
41
|
-
const customStackTrace = (0, _utils.captureStackTrace)();
|
|
42
|
-
customStackTrace.apiName = 'expect.' + matcherName;
|
|
43
40
|
const {
|
|
44
41
|
matches: pass,
|
|
45
42
|
received,
|
|
46
43
|
log,
|
|
47
44
|
timedOut
|
|
48
|
-
} = await query(this.isNot, timeout
|
|
45
|
+
} = await query(this.isNot, timeout);
|
|
49
46
|
const message = pass ? () => (0, _matcherHint.matcherHint)(this, matcherName, undefined, undefined, matcherOptions, timedOut ? timeout : undefined) + '\n\n' + `Expected: not ${this.utils.printExpected(expected)}\n` + (this.utils.stringify(expected) !== this.utils.stringify(received) ? `Received: ${this.utils.printReceived(received)}` : '') + (0, _util.callLogText)(log) : () => (0, _matcherHint.matcherHint)(this, matcherName, undefined, undefined, matcherOptions, timedOut ? timeout : undefined) + '\n\n' + this.utils.printDiffOrStringify(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(this.expand)) + (0, _util.callLogText)(log);
|
|
50
47
|
|
|
51
48
|
// Passing the actual and expected objects so that a custom reporter
|
|
@@ -283,7 +283,6 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
|
|
283
283
|
maxDiffPixels: undefined,
|
|
284
284
|
maxDiffPixelRatio: undefined
|
|
285
285
|
};
|
|
286
|
-
const customStackTrace = (0, _util.captureStackTrace)(`expect.${this.isNot ? 'not.' : ''}toHaveScreenshot`);
|
|
287
286
|
const hasSnapshot = _fs.default.existsSync(helper.snapshotPath);
|
|
288
287
|
if (this.isNot) {
|
|
289
288
|
if (!hasSnapshot) return helper.handleMissingNegated();
|
|
@@ -291,7 +290,7 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
|
|
291
290
|
// Having `errorMessage` means we timed out while waiting
|
|
292
291
|
// for screenshots not to match, so screenshots
|
|
293
292
|
// are actually the same in the end.
|
|
294
|
-
const isDifferent = !(await page._expectScreenshot(
|
|
293
|
+
const isDifferent = !(await page._expectScreenshot({
|
|
295
294
|
expected: await _fs.default.promises.readFile(helper.snapshotPath),
|
|
296
295
|
isNot: true,
|
|
297
296
|
locator,
|
|
@@ -319,7 +318,7 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
|
|
319
318
|
diff,
|
|
320
319
|
errorMessage,
|
|
321
320
|
log
|
|
322
|
-
} = await page._expectScreenshot(
|
|
321
|
+
} = await page._expectScreenshot({
|
|
323
322
|
expected: undefined,
|
|
324
323
|
isNot: false,
|
|
325
324
|
locator,
|
|
@@ -348,7 +347,7 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
|
|
348
347
|
diff,
|
|
349
348
|
errorMessage,
|
|
350
349
|
log
|
|
351
|
-
} = await page._expectScreenshot(
|
|
350
|
+
} = await page._expectScreenshot({
|
|
352
351
|
expected,
|
|
353
352
|
isNot: false,
|
|
354
353
|
locator,
|
|
@@ -41,7 +41,7 @@ async function toMatchText(matcherName, receiver, receiverType, query, expected,
|
|
|
41
41
|
received,
|
|
42
42
|
log,
|
|
43
43
|
timedOut
|
|
44
|
-
} = await query(this.isNot, timeout
|
|
44
|
+
} = await query(this.isNot, timeout);
|
|
45
45
|
const stringSubstring = options.matchSubstring ? 'substring' : 'string';
|
|
46
46
|
const receivedString = received || '';
|
|
47
47
|
const message = pass ? () => typeof expected === 'string' ? (0, _matcherHint.matcherHint)(this, matcherName, undefined, undefined, matcherOptions, timedOut ? timeout : undefined) + '\n\n' + `Expected ${stringSubstring}: not ${this.utils.printExpected(expected)}\n` + `Received string: ${(0, _expect.printReceivedStringContainExpectedSubstring)(receivedString, receivedString.indexOf(expected), expected.length)}` + (0, _util.callLogText)(log) : (0, _matcherHint.matcherHint)(this, matcherName, undefined, undefined, matcherOptions, timedOut ? timeout : undefined) + '\n\n' + `Expected pattern: not ${this.utils.printExpected(expected)}\n` + `Received string: ${(0, _expect.printReceivedStringContainExpectedResult)(receivedString, typeof expected.exec === 'function' ? expected.exec(receivedString) : null)}` + (0, _util.callLogText)(log) : () => {
|
|
@@ -259,8 +259,9 @@ function vitePlugin(registerSource, relativeTemplateDir, buildInfo, componentReg
|
|
|
259
259
|
const indexTs = _path.default.join(relativeTemplateDir, 'index.ts');
|
|
260
260
|
const indexTsx = _path.default.join(relativeTemplateDir, 'index.tsx');
|
|
261
261
|
const indexJs = _path.default.join(relativeTemplateDir, 'index.js');
|
|
262
|
+
const indexJsx = _path.default.join(relativeTemplateDir, 'index.jsx');
|
|
262
263
|
const idResolved = _path.default.resolve(id);
|
|
263
|
-
if (!idResolved.endsWith(indexTs) && !idResolved.endsWith(indexTsx) && !idResolved.endsWith(indexJs)) return;
|
|
264
|
+
if (!idResolved.endsWith(indexTs) && !idResolved.endsWith(indexTsx) && !idResolved.endsWith(indexJs) && !idResolved.endsWith(indexJsx)) return;
|
|
264
265
|
const folder = _path.default.dirname(id);
|
|
265
266
|
const lines = [content, ''];
|
|
266
267
|
lines.push(registerSource);
|
|
@@ -268,7 +269,7 @@ function vitePlugin(registerSource, relativeTemplateDir, buildInfo, componentReg
|
|
|
268
269
|
const importPath = value.isModuleOrAlias ? value.importPath : './' + _path.default.relative(folder, value.importPath).replace(/\\/g, '/');
|
|
269
270
|
if (value.importedName) lines.push(`import { ${value.importedName} as ${alias} } from '${importPath}';`);else lines.push(`import ${alias} from '${importPath}';`);
|
|
270
271
|
}
|
|
271
|
-
lines.push(`
|
|
272
|
+
lines.push(`pwRegister({ ${[...componentRegistry.keys()].join(',\n ')} });`);
|
|
272
273
|
return {
|
|
273
274
|
code: lines.join('\n'),
|
|
274
275
|
map: {
|
package/lib/reporters/base.js
CHANGED
|
@@ -397,16 +397,13 @@ function prepareErrorStack(stack) {
|
|
|
397
397
|
const stackLines = lines.slice(firstStackLine);
|
|
398
398
|
let location;
|
|
399
399
|
for (const line of stackLines) {
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
} = (0, _utilsBundle.parseStackTraceLine)(line);
|
|
404
|
-
if (!parsed || !resolvedFile) continue;
|
|
405
|
-
if (belongsToNodeModules(resolvedFile)) continue;
|
|
400
|
+
const frame = (0, _utilsBundle.parseStackTraceLine)(line);
|
|
401
|
+
if (!frame || !frame.file) continue;
|
|
402
|
+
if (belongsToNodeModules(frame.file)) continue;
|
|
406
403
|
location = {
|
|
407
|
-
file:
|
|
408
|
-
column:
|
|
409
|
-
line:
|
|
404
|
+
file: frame.file,
|
|
405
|
+
column: frame.column || 0,
|
|
406
|
+
line: frame.line || 0
|
|
410
407
|
};
|
|
411
408
|
break;
|
|
412
409
|
}
|
package/lib/reporters/html.js
CHANGED
|
@@ -271,13 +271,18 @@ class HtmlBuilder {
|
|
|
271
271
|
if (this._hasTraces) {
|
|
272
272
|
const traceViewerFolder = _path.default.join(require.resolve('playwright-core'), '..', 'lib', 'webpack', 'traceViewer');
|
|
273
273
|
const traceViewerTargetFolder = _path.default.join(this._reportFolder, 'trace');
|
|
274
|
-
|
|
274
|
+
const traceViewerAssetsTargetFolder = _path.default.join(traceViewerTargetFolder, 'assets');
|
|
275
|
+
_fs.default.mkdirSync(traceViewerAssetsTargetFolder, {
|
|
275
276
|
recursive: true
|
|
276
277
|
});
|
|
277
278
|
for (const file of _fs.default.readdirSync(traceViewerFolder)) {
|
|
278
|
-
if (file.endsWith('.map')) continue;
|
|
279
|
+
if (file.endsWith('.map') || file.includes('watch') || file.includes('assets')) continue;
|
|
279
280
|
await (0, _utils.copyFileAndMakeWritable)(_path.default.join(traceViewerFolder, file), _path.default.join(traceViewerTargetFolder, file));
|
|
280
281
|
}
|
|
282
|
+
for (const file of _fs.default.readdirSync(_path.default.join(traceViewerFolder, 'assets'))) {
|
|
283
|
+
if (file.endsWith('.map') || file.includes('xtermModule')) continue;
|
|
284
|
+
await (0, _utils.copyFileAndMakeWritable)(_path.default.join(traceViewerFolder, 'assets', file), _path.default.join(traceViewerAssetsTargetFolder, file));
|
|
285
|
+
}
|
|
281
286
|
}
|
|
282
287
|
|
|
283
288
|
// Inline report data.
|
package/lib/reporters/json.js
CHANGED
|
@@ -62,7 +62,7 @@ class JSONReporter {
|
|
|
62
62
|
repeatEach: project.repeatEach,
|
|
63
63
|
retries: project.retries,
|
|
64
64
|
metadata: project.metadata,
|
|
65
|
-
id: project.
|
|
65
|
+
id: project._internal.id,
|
|
66
66
|
name: project.name,
|
|
67
67
|
testDir: toPosixPath(project.testDir),
|
|
68
68
|
testIgnore: serializePatterns(project.testIgnore),
|
|
@@ -78,7 +78,7 @@ class JSONReporter {
|
|
|
78
78
|
_mergeSuites(suites) {
|
|
79
79
|
const fileSuites = new _utils.MultiMap();
|
|
80
80
|
for (const projectSuite of suites) {
|
|
81
|
-
const projectId = projectSuite.project().
|
|
81
|
+
const projectId = projectSuite.project()._internal.id;
|
|
82
82
|
const projectName = projectSuite.project().name;
|
|
83
83
|
for (const fileSuite of projectSuite.suites) {
|
|
84
84
|
const file = fileSuite.location.file;
|
package/lib/reporters/junit.js
CHANGED
|
@@ -51,7 +51,7 @@ class JUnitReporter {
|
|
|
51
51
|
onBegin(config, suite) {
|
|
52
52
|
this.config = config;
|
|
53
53
|
this.suite = suite;
|
|
54
|
-
this.timestamp = Date
|
|
54
|
+
this.timestamp = new Date();
|
|
55
55
|
this.startTime = (0, _utils.monotonicTime)();
|
|
56
56
|
}
|
|
57
57
|
async onEnd(result) {
|
|
@@ -108,7 +108,7 @@ class JUnitReporter {
|
|
|
108
108
|
name: 'testsuite',
|
|
109
109
|
attributes: {
|
|
110
110
|
name: suite.title,
|
|
111
|
-
timestamp: this.timestamp,
|
|
111
|
+
timestamp: this.timestamp.toISOString(),
|
|
112
112
|
hostname: projectName,
|
|
113
113
|
tests,
|
|
114
114
|
failures,
|