playwright 1.57.0-alpha-2025-11-16 → 1.57.0-alpha-2025-11-18
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/index.js +2 -2
- package/lib/matchers/expect.js +10 -13
- package/lib/matchers/matchers.js +16 -0
- package/lib/worker/testInfo.js +1 -1
- package/package.json +2 -2
- package/types/test.d.ts +3 -1
package/lib/index.js
CHANGED
|
@@ -242,8 +242,8 @@ const playwrightFixtures = {
|
|
|
242
242
|
if (zone && zone.category === "expect" && isExpectCall) {
|
|
243
243
|
if (zone.apiName)
|
|
244
244
|
data.apiName = zone.apiName;
|
|
245
|
-
if (zone.title)
|
|
246
|
-
data.title = zone.title;
|
|
245
|
+
if (zone.shortTitle || zone.title)
|
|
246
|
+
data.title = zone.shortTitle ?? zone.title;
|
|
247
247
|
data.stepId = zone.stepId;
|
|
248
248
|
return;
|
|
249
249
|
}
|
package/lib/matchers/expect.js
CHANGED
|
@@ -43,7 +43,7 @@ const printReceivedStringContainExpectedResult = (received, result) => result ==
|
|
|
43
43
|
result[0].length
|
|
44
44
|
);
|
|
45
45
|
function createMatchers(actual, info, prefix) {
|
|
46
|
-
return new Proxy((0, import_expectBundle.expect)(actual), new ExpectMetaInfoProxyHandler(info, prefix));
|
|
46
|
+
return new Proxy((0, import_expectBundle.expect)(actual), new ExpectMetaInfoProxyHandler(actual, info, prefix));
|
|
47
47
|
}
|
|
48
48
|
const userMatchersSymbol = Symbol("userMatchers");
|
|
49
49
|
function qualifiedMatcherName(qualifier, matcherName) {
|
|
@@ -185,7 +185,8 @@ const customMatchers = {
|
|
|
185
185
|
toMatchSnapshot: import_toMatchSnapshot.toMatchSnapshot
|
|
186
186
|
};
|
|
187
187
|
class ExpectMetaInfoProxyHandler {
|
|
188
|
-
constructor(info, prefix) {
|
|
188
|
+
constructor(actual, info, prefix) {
|
|
189
|
+
this._actual = actual;
|
|
189
190
|
this._info = { ...info };
|
|
190
191
|
this._prefix = prefix;
|
|
191
192
|
}
|
|
@@ -222,15 +223,17 @@ class ExpectMetaInfoProxyHandler {
|
|
|
222
223
|
if (!testInfo)
|
|
223
224
|
return matcher.call(target, ...args);
|
|
224
225
|
const customMessage = this._info.message || "";
|
|
225
|
-
const
|
|
226
|
-
const defaultTitle = `${this._info.poll ? "poll " : ""}${this._info.isSoft ? "soft " : ""}${this._info.isNot ? "not " : ""}${matcherName}${
|
|
227
|
-
const
|
|
228
|
-
const
|
|
226
|
+
const suffixes = (0, import_matchers.computeMatcherTitleSuffix)(matcherName, this._actual, args);
|
|
227
|
+
const defaultTitle = `${this._info.poll ? "poll " : ""}${this._info.isSoft ? "soft " : ""}${this._info.isNot ? "not " : ""}${matcherName}${suffixes.short || ""}`;
|
|
228
|
+
const shortTitle = customMessage || `Expect ${(0, import_utils.escapeWithQuotes)(defaultTitle, '"')}`;
|
|
229
|
+
const longTitle = shortTitle + (suffixes.long || "");
|
|
230
|
+
const apiName = `expect${this._info.poll ? ".poll " : ""}${this._info.isSoft ? ".soft " : ""}${this._info.isNot ? ".not" : ""}.${matcherName}${suffixes.short || ""}`;
|
|
229
231
|
const stackFrames = (0, import_util.filteredStackTrace)((0, import_utils.captureRawStack)());
|
|
230
232
|
const stepInfo = {
|
|
231
233
|
category: "expect",
|
|
232
234
|
apiName,
|
|
233
|
-
title,
|
|
235
|
+
title: longTitle,
|
|
236
|
+
shortTitle,
|
|
234
237
|
params: args[0] ? { expected: args[0] } : void 0,
|
|
235
238
|
infectParentStepsWithError: this._info.isSoft
|
|
236
239
|
};
|
|
@@ -301,12 +304,6 @@ async function pollMatcher(qualifiedMatcherName2, info, prefix, ...args) {
|
|
|
301
304
|
throw new Error(message);
|
|
302
305
|
}
|
|
303
306
|
}
|
|
304
|
-
function computeArgsSuffix(matcherName, args) {
|
|
305
|
-
let value = "";
|
|
306
|
-
if (matcherName === "toHaveScreenshot")
|
|
307
|
-
value = (0, import_toMatchSnapshot.toHaveScreenshotStepTitle)(...args);
|
|
308
|
-
return value ? `(${value})` : "";
|
|
309
|
-
}
|
|
310
307
|
const expect = createExpect({}, [], {}).extend(customMatchers);
|
|
311
308
|
function mergeExpects(...expects) {
|
|
312
309
|
let merged = expect;
|
package/lib/matchers/matchers.js
CHANGED
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var matchers_exports = {};
|
|
20
20
|
__export(matchers_exports, {
|
|
21
|
+
computeMatcherTitleSuffix: () => computeMatcherTitleSuffix,
|
|
21
22
|
toBeAttached: () => toBeAttached,
|
|
22
23
|
toBeChecked: () => toBeChecked,
|
|
23
24
|
toBeDisabled: () => toBeDisabled,
|
|
@@ -56,6 +57,7 @@ var import_toBeTruthy = require("./toBeTruthy");
|
|
|
56
57
|
var import_toEqual = require("./toEqual");
|
|
57
58
|
var import_toHaveURL = require("./toHaveURL");
|
|
58
59
|
var import_toMatchText = require("./toMatchText");
|
|
60
|
+
var import_toMatchSnapshot = require("./toMatchSnapshot");
|
|
59
61
|
var import_config = require("../common/config");
|
|
60
62
|
var import_globals = require("../common/globals");
|
|
61
63
|
var import_testInfo = require("../worker/testInfo");
|
|
@@ -332,8 +334,22 @@ async function toPass(callback, options = {}) {
|
|
|
332
334
|
}
|
|
333
335
|
return { pass: !this.isNot, message: () => "" };
|
|
334
336
|
}
|
|
337
|
+
function computeMatcherTitleSuffix(matcherName, receiver, args) {
|
|
338
|
+
if (matcherName === "toHaveScreenshot") {
|
|
339
|
+
const title = (0, import_toMatchSnapshot.toHaveScreenshotStepTitle)(...args);
|
|
340
|
+
return { short: title ? `(${title})` : "" };
|
|
341
|
+
}
|
|
342
|
+
if (receiver && typeof receiver === "object" && receiver.constructor?.name === "Locator") {
|
|
343
|
+
try {
|
|
344
|
+
return { long: " " + (0, import_utils.asLocatorDescription)("javascript", receiver._selector) };
|
|
345
|
+
} catch {
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return {};
|
|
349
|
+
}
|
|
335
350
|
// Annotate the CommonJS export names for ESM import in node:
|
|
336
351
|
0 && (module.exports = {
|
|
352
|
+
computeMatcherTitleSuffix,
|
|
337
353
|
toBeAttached,
|
|
338
354
|
toBeChecked,
|
|
339
355
|
toBeDisabled,
|
package/lib/worker/testInfo.js
CHANGED
|
@@ -268,7 +268,7 @@ ${(0, import_utils.stringifyStackFrames)(step.boxedStack).join("\n")}`;
|
|
|
268
268
|
this._tracing.appendBeforeActionForStep({
|
|
269
269
|
stepId,
|
|
270
270
|
parentId: parentStep?.stepId,
|
|
271
|
-
title: step.title,
|
|
271
|
+
title: step.shortTitle ?? step.title,
|
|
272
272
|
category: step.category,
|
|
273
273
|
params: step.params,
|
|
274
274
|
stack: step.location ? [step.location] : [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright",
|
|
3
|
-
"version": "1.57.0-alpha-2025-11-
|
|
3
|
+
"version": "1.57.0-alpha-2025-11-18",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"license": "Apache-2.0",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"playwright-core": "1.57.0-alpha-2025-11-
|
|
67
|
+
"playwright-core": "1.57.0-alpha-2025-11-18"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"fsevents": "2.3.2"
|
package/types/test.d.ts
CHANGED
|
@@ -873,7 +873,9 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
873
873
|
* - A module name like `'my-awesome-reporter'`.
|
|
874
874
|
* - A relative path to the reporter like `'./reporters/my-awesome-reporter.js'`.
|
|
875
875
|
*
|
|
876
|
-
* You can pass options to the reporter in a tuple like `['json', { outputFile: './report.json' }]`.
|
|
876
|
+
* You can pass options to the reporter in a tuple like `['json', { outputFile: './report.json' }]`. If the property
|
|
877
|
+
* is not specified, Playwright uses the `'dot'` reporter when the CI environment variable is set, and the `'list'`
|
|
878
|
+
* reporter otherwise.
|
|
877
879
|
*
|
|
878
880
|
* Learn more in the [reporters guide](https://playwright.dev/docs/test-reporters).
|
|
879
881
|
*
|