@smoothdeploy/playwright 1.62.1 → 1.63.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/testActions.js +1 -0
- package/lib/common/index.js +44 -75
- package/lib/common/index.js.txt +10 -10
- package/lib/index.js +36 -25
- package/lib/matchers/expect.js +50 -44
- package/lib/matchers/expect.js.txt +3 -3
- package/lib/mcp/test/browserBackend.js +12 -2
- package/lib/program.js +2 -3
- package/lib/runner/index.js +767 -321
- package/lib/runner/index.js.txt +23 -21
- package/lib/transform/babelBundle.js +4 -5
- package/lib/transform/babelBundle.js.txt +2 -2
- package/lib/transform/esmLoader.js +9 -30
- package/lib/transform/esmLoader.js.txt +3 -3
- package/lib/worker/workerProcessEntry.js +26 -13
- package/lib/worker/workerProcessEntry.js.txt +3 -3
- package/package.json +2 -5
- package/types/test.d.ts +237 -11
- package/types/testReporter.d.ts +52 -1
package/lib/matchers/expect.js
CHANGED
|
@@ -12612,6 +12612,7 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
|
|
12612
12612
|
isNot: !!this.isNot,
|
|
12613
12613
|
timeout,
|
|
12614
12614
|
signal: helper.options.signal,
|
|
12615
|
+
title: this.title,
|
|
12615
12616
|
type: screenshotType,
|
|
12616
12617
|
comparator: helper.options.comparator,
|
|
12617
12618
|
maxDiffPixels: helper.options.maxDiffPixels,
|
|
@@ -12725,7 +12726,7 @@ function toBeAttached(locator, options) {
|
|
|
12725
12726
|
const expected = attached ? "attached" : "detached";
|
|
12726
12727
|
const arg = attached ? "" : "{ attached: false }";
|
|
12727
12728
|
return toBeTruthy.call(this, "toBeAttached", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
|
|
12728
|
-
return await locator._expect(attached ? "to.be.attached" : "to.be.detached", { isNot, timeout, signal });
|
|
12729
|
+
return await locator._expect(attached ? "to.be.attached" : "to.be.detached", { isNot, timeout, signal, title: this.title });
|
|
12729
12730
|
}, options);
|
|
12730
12731
|
}
|
|
12731
12732
|
function toBeChecked(locator, options) {
|
|
@@ -12745,12 +12746,12 @@ function toBeChecked(locator, options) {
|
|
|
12745
12746
|
arg = options?.checked === false ? `{ checked: false }` : "";
|
|
12746
12747
|
}
|
|
12747
12748
|
return toBeTruthy.call(this, "toBeChecked", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
|
|
12748
|
-
return await locator._expect("to.be.checked", { isNot, timeout, expectedValue, signal });
|
|
12749
|
+
return await locator._expect("to.be.checked", { isNot, timeout, expectedValue, signal, title: this.title });
|
|
12749
12750
|
}, options);
|
|
12750
12751
|
}
|
|
12751
12752
|
function toBeDisabled(locator, options) {
|
|
12752
12753
|
return toBeTruthy.call(this, "toBeDisabled", locator, "Locator", "disabled", "", async (isNot, timeout, signal) => {
|
|
12753
|
-
return await locator._expect("to.be.disabled", { isNot, timeout, signal });
|
|
12754
|
+
return await locator._expect("to.be.disabled", { isNot, timeout, signal, title: this.title });
|
|
12754
12755
|
}, options);
|
|
12755
12756
|
}
|
|
12756
12757
|
function toBeEditable(locator, options) {
|
|
@@ -12758,12 +12759,12 @@ function toBeEditable(locator, options) {
|
|
|
12758
12759
|
const expected = editable ? "editable" : "readOnly";
|
|
12759
12760
|
const arg = editable ? "" : "{ editable: false }";
|
|
12760
12761
|
return toBeTruthy.call(this, "toBeEditable", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
|
|
12761
|
-
return await locator._expect(editable ? "to.be.editable" : "to.be.readonly", { isNot, timeout, signal });
|
|
12762
|
+
return await locator._expect(editable ? "to.be.editable" : "to.be.readonly", { isNot, timeout, signal, title: this.title });
|
|
12762
12763
|
}, options);
|
|
12763
12764
|
}
|
|
12764
12765
|
function toBeEmpty(locator, options) {
|
|
12765
12766
|
return toBeTruthy.call(this, "toBeEmpty", locator, "Locator", "empty", "", async (isNot, timeout, signal) => {
|
|
12766
|
-
return await locator._expect("to.be.empty", { isNot, timeout, signal });
|
|
12767
|
+
return await locator._expect("to.be.empty", { isNot, timeout, signal, title: this.title });
|
|
12767
12768
|
}, options);
|
|
12768
12769
|
}
|
|
12769
12770
|
function toBeEnabled(locator, options) {
|
|
@@ -12771,17 +12772,17 @@ function toBeEnabled(locator, options) {
|
|
|
12771
12772
|
const expected = enabled ? "enabled" : "disabled";
|
|
12772
12773
|
const arg = enabled ? "" : "{ enabled: false }";
|
|
12773
12774
|
return toBeTruthy.call(this, "toBeEnabled", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
|
|
12774
|
-
return await locator._expect(enabled ? "to.be.enabled" : "to.be.disabled", { isNot, timeout, signal });
|
|
12775
|
+
return await locator._expect(enabled ? "to.be.enabled" : "to.be.disabled", { isNot, timeout, signal, title: this.title });
|
|
12775
12776
|
}, options);
|
|
12776
12777
|
}
|
|
12777
12778
|
function toBeFocused(locator, options) {
|
|
12778
12779
|
return toBeTruthy.call(this, "toBeFocused", locator, "Locator", "focused", "", async (isNot, timeout, signal) => {
|
|
12779
|
-
return await locator._expect("to.be.focused", { isNot, timeout, signal });
|
|
12780
|
+
return await locator._expect("to.be.focused", { isNot, timeout, signal, title: this.title });
|
|
12780
12781
|
}, options);
|
|
12781
12782
|
}
|
|
12782
12783
|
function toBeHidden(locator, options) {
|
|
12783
12784
|
return toBeTruthy.call(this, "toBeHidden", locator, "Locator", "hidden", "", async (isNot, timeout, signal) => {
|
|
12784
|
-
return await locator._expect("to.be.hidden", { isNot, timeout, signal });
|
|
12785
|
+
return await locator._expect("to.be.hidden", { isNot, timeout, signal, title: this.title });
|
|
12785
12786
|
}, options);
|
|
12786
12787
|
}
|
|
12787
12788
|
function toBeVisible(locator, options) {
|
|
@@ -12789,43 +12790,43 @@ function toBeVisible(locator, options) {
|
|
|
12789
12790
|
const expected = visible ? "visible" : "hidden";
|
|
12790
12791
|
const arg = visible ? "" : "{ visible: false }";
|
|
12791
12792
|
return toBeTruthy.call(this, "toBeVisible", locator, "Locator", expected, arg, async (isNot, timeout, signal) => {
|
|
12792
|
-
return await locator._expect(visible ? "to.be.visible" : "to.be.hidden", { isNot, timeout, signal });
|
|
12793
|
+
return await locator._expect(visible ? "to.be.visible" : "to.be.hidden", { isNot, timeout, signal, title: this.title });
|
|
12793
12794
|
}, options);
|
|
12794
12795
|
}
|
|
12795
12796
|
function toBeInViewport(locator, options) {
|
|
12796
12797
|
return toBeTruthy.call(this, "toBeInViewport", locator, "Locator", "in viewport", "", async (isNot, timeout, signal) => {
|
|
12797
|
-
return await locator._expect("to.be.in.viewport", { isNot, expectedNumber: options?.ratio, timeout, signal });
|
|
12798
|
+
return await locator._expect("to.be.in.viewport", { isNot, expectedNumber: options?.ratio, timeout, signal, title: this.title });
|
|
12798
12799
|
}, options);
|
|
12799
12800
|
}
|
|
12800
12801
|
function toContainText(locator, expected, options = {}) {
|
|
12801
12802
|
if (Array.isArray(expected)) {
|
|
12802
12803
|
return toEqual.call(this, "toContainText", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12803
12804
|
const expectedText = serializeExpectedTextValues(expected, { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
|
|
12804
|
-
return await locator._expect("to.contain.text.array", { expectedText, isNot, useInnerText: options.useInnerText, timeout, signal });
|
|
12805
|
+
return await locator._expect("to.contain.text.array", { expectedText, isNot, useInnerText: options.useInnerText, timeout, signal, title: this.title });
|
|
12805
12806
|
}, expected, { ...options, contains: true });
|
|
12806
12807
|
} else {
|
|
12807
12808
|
return toMatchText.call(this, "toContainText", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12808
12809
|
const expectedText = serializeExpectedTextValues([expected], { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
|
|
12809
|
-
return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options.useInnerText, timeout, signal });
|
|
12810
|
+
return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options.useInnerText, timeout, signal, title: this.title });
|
|
12810
12811
|
}, expected, { ...options, matchSubstring: true });
|
|
12811
12812
|
}
|
|
12812
12813
|
}
|
|
12813
12814
|
function toHaveAccessibleDescription(locator, expected, options) {
|
|
12814
12815
|
return toMatchText.call(this, "toHaveAccessibleDescription", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12815
12816
|
const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
|
|
12816
|
-
return await locator._expect("to.have.accessible.description", { expectedText, isNot, timeout, signal });
|
|
12817
|
+
return await locator._expect("to.have.accessible.description", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12817
12818
|
}, expected, options);
|
|
12818
12819
|
}
|
|
12819
12820
|
function toHaveAccessibleName(locator, expected, options) {
|
|
12820
12821
|
return toMatchText.call(this, "toHaveAccessibleName", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12821
12822
|
const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
|
|
12822
|
-
return await locator._expect("to.have.accessible.name", { expectedText, isNot, timeout, signal });
|
|
12823
|
+
return await locator._expect("to.have.accessible.name", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12823
12824
|
}, expected, options);
|
|
12824
12825
|
}
|
|
12825
12826
|
function toHaveAccessibleErrorMessage(locator, expected, options) {
|
|
12826
12827
|
return toMatchText.call(this, "toHaveAccessibleErrorMessage", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12827
12828
|
const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
|
|
12828
|
-
return await locator._expect("to.have.accessible.error.message", { expectedText, isNot, timeout, signal });
|
|
12829
|
+
return await locator._expect("to.have.accessible.error.message", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12829
12830
|
}, expected, options);
|
|
12830
12831
|
}
|
|
12831
12832
|
function toHaveAttribute(locator, name, expected, options) {
|
|
@@ -12837,24 +12838,24 @@ function toHaveAttribute(locator, name, expected, options) {
|
|
|
12837
12838
|
}
|
|
12838
12839
|
if (expected === void 0) {
|
|
12839
12840
|
return toBeTruthy.call(this, "toHaveAttribute", locator, "Locator", "have attribute", "", async (isNot, timeout, signal) => {
|
|
12840
|
-
return await locator._expect("to.have.attribute", { expressionArg: name, isNot, timeout, signal });
|
|
12841
|
+
return await locator._expect("to.have.attribute", { expressionArg: name, isNot, timeout, signal, title: this.title });
|
|
12841
12842
|
}, options);
|
|
12842
12843
|
}
|
|
12843
12844
|
return toMatchText.call(this, "toHaveAttribute", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12844
12845
|
const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase });
|
|
12845
|
-
return await locator._expect("to.have.attribute.value", { expressionArg: name, expectedText, isNot, timeout, signal });
|
|
12846
|
+
return await locator._expect("to.have.attribute.value", { expressionArg: name, expectedText, isNot, timeout, signal, title: this.title });
|
|
12846
12847
|
}, expected, options);
|
|
12847
12848
|
}
|
|
12848
12849
|
function toHaveClass(locator, expected, options) {
|
|
12849
12850
|
if (Array.isArray(expected)) {
|
|
12850
12851
|
return toEqual.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12851
12852
|
const expectedText = serializeExpectedTextValues(expected);
|
|
12852
|
-
return await locator._expect("to.have.class.array", { expectedText, isNot, timeout, signal });
|
|
12853
|
+
return await locator._expect("to.have.class.array", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12853
12854
|
}, expected, options);
|
|
12854
12855
|
} else {
|
|
12855
12856
|
return toMatchText.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12856
12857
|
const expectedText = serializeExpectedTextValues([expected]);
|
|
12857
|
-
return await locator._expect("to.have.class", { expectedText, isNot, timeout, signal });
|
|
12858
|
+
return await locator._expect("to.have.class", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12858
12859
|
}, expected, options);
|
|
12859
12860
|
}
|
|
12860
12861
|
}
|
|
@@ -12864,37 +12865,37 @@ function toContainClass(locator, expected, options) {
|
|
|
12864
12865
|
throw new Error(`"expected" argument in toContainClass cannot contain RegExp values`);
|
|
12865
12866
|
return toEqual.call(this, "toContainClass", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12866
12867
|
const expectedText = serializeExpectedTextValues(expected);
|
|
12867
|
-
return await locator._expect("to.contain.class.array", { expectedText, isNot, timeout, signal });
|
|
12868
|
+
return await locator._expect("to.contain.class.array", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12868
12869
|
}, expected, options);
|
|
12869
12870
|
} else {
|
|
12870
12871
|
if (isRegExp2(expected))
|
|
12871
12872
|
throw new Error(`"expected" argument in toContainClass cannot be a RegExp value`);
|
|
12872
12873
|
return toMatchText.call(this, "toContainClass", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12873
12874
|
const expectedText = serializeExpectedTextValues([expected]);
|
|
12874
|
-
return await locator._expect("to.contain.class", { expectedText, isNot, timeout, signal });
|
|
12875
|
+
return await locator._expect("to.contain.class", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12875
12876
|
}, expected, options);
|
|
12876
12877
|
}
|
|
12877
12878
|
}
|
|
12878
12879
|
function toHaveCount(locator, expected, options) {
|
|
12879
12880
|
return toEqual.call(this, "toHaveCount", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12880
|
-
return await locator._expect("to.have.count", { expectedNumber: expected, isNot, timeout, signal });
|
|
12881
|
+
return await locator._expect("to.have.count", { expectedNumber: expected, isNot, timeout, signal, title: this.title });
|
|
12881
12882
|
}, expected, options);
|
|
12882
12883
|
}
|
|
12883
12884
|
function toHaveCSS(locator, name, expected, options) {
|
|
12884
12885
|
return toMatchText.call(this, "toHaveCSS", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12885
12886
|
const expectedText = serializeExpectedTextValues([expected]);
|
|
12886
|
-
return await locator._expect("to.have.css", { expressionArg: name, expectedText, isNot, pseudo: options?.pseudo, timeout, signal });
|
|
12887
|
+
return await locator._expect("to.have.css", { expressionArg: name, expectedText, isNot, pseudo: options?.pseudo, timeout, signal, title: this.title });
|
|
12887
12888
|
}, expected, options);
|
|
12888
12889
|
}
|
|
12889
12890
|
function toHaveId(locator, expected, options) {
|
|
12890
12891
|
return toMatchText.call(this, "toHaveId", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12891
12892
|
const expectedText = serializeExpectedTextValues([expected]);
|
|
12892
|
-
return await locator._expect("to.have.id", { expectedText, isNot, timeout, signal });
|
|
12893
|
+
return await locator._expect("to.have.id", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12893
12894
|
}, expected, options);
|
|
12894
12895
|
}
|
|
12895
12896
|
function toHaveJSProperty(locator, name, expected, options) {
|
|
12896
12897
|
return toEqual.call(this, "toHaveJSProperty", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12897
|
-
return await locator._expect("to.have.property", { expressionArg: name, expectedValue: expected, isNot, timeout, signal });
|
|
12898
|
+
return await locator._expect("to.have.property", { expressionArg: name, expectedValue: expected, isNot, timeout, signal, title: this.title });
|
|
12898
12899
|
}, expected, options);
|
|
12899
12900
|
}
|
|
12900
12901
|
function toHaveRole(locator, expected, options) {
|
|
@@ -12902,38 +12903,38 @@ function toHaveRole(locator, expected, options) {
|
|
|
12902
12903
|
throw new Error(`"role" argument in toHaveRole must be a string`);
|
|
12903
12904
|
return toMatchText.call(this, "toHaveRole", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12904
12905
|
const expectedText = serializeExpectedTextValues([expected]);
|
|
12905
|
-
return await locator._expect("to.have.role", { expectedText, isNot, timeout, signal });
|
|
12906
|
+
return await locator._expect("to.have.role", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12906
12907
|
}, expected, options);
|
|
12907
12908
|
}
|
|
12908
12909
|
function toHaveText(locator, expected, options = {}) {
|
|
12909
12910
|
if (Array.isArray(expected)) {
|
|
12910
12911
|
return toEqual.call(this, "toHaveText", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12911
12912
|
const expectedText = serializeExpectedTextValues(expected, { normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
|
|
12912
|
-
return await locator._expect("to.have.text.array", { expectedText, isNot, useInnerText: options?.useInnerText, timeout, signal });
|
|
12913
|
+
return await locator._expect("to.have.text.array", { expectedText, isNot, useInnerText: options?.useInnerText, timeout, signal, title: this.title });
|
|
12913
12914
|
}, expected, options);
|
|
12914
12915
|
} else {
|
|
12915
12916
|
return toMatchText.call(this, "toHaveText", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12916
12917
|
const expectedText = serializeExpectedTextValues([expected], { normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
|
|
12917
|
-
return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options?.useInnerText, timeout, signal });
|
|
12918
|
+
return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options?.useInnerText, timeout, signal, title: this.title });
|
|
12918
12919
|
}, expected, options);
|
|
12919
12920
|
}
|
|
12920
12921
|
}
|
|
12921
12922
|
function toHaveValue(locator, expected, options) {
|
|
12922
12923
|
return toMatchText.call(this, "toHaveValue", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12923
12924
|
const expectedText = serializeExpectedTextValues([expected]);
|
|
12924
|
-
return await locator._expect("to.have.value", { expectedText, isNot, timeout, signal });
|
|
12925
|
+
return await locator._expect("to.have.value", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12925
12926
|
}, expected, options);
|
|
12926
12927
|
}
|
|
12927
12928
|
function toHaveValues(locator, expected, options) {
|
|
12928
12929
|
return toEqual.call(this, "toHaveValues", locator, "Locator", async (isNot, timeout, signal) => {
|
|
12929
12930
|
const expectedText = serializeExpectedTextValues(expected);
|
|
12930
|
-
return await locator._expect("to.have.values", { expectedText, isNot, timeout, signal });
|
|
12931
|
+
return await locator._expect("to.have.values", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12931
12932
|
}, expected, options);
|
|
12932
12933
|
}
|
|
12933
12934
|
function toHaveTitle(page, expected, options = {}) {
|
|
12934
12935
|
return toMatchText.call(this, "toHaveTitle", page, "Page", async (isNot, timeout, signal) => {
|
|
12935
12936
|
const expectedText = serializeExpectedTextValues([expected], { normalizeWhiteSpace: true });
|
|
12936
|
-
return await page.mainFrame()._expect("to.have.title", { expectedText, isNot, timeout, signal });
|
|
12937
|
+
return await page.mainFrame()._expect("to.have.title", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12937
12938
|
}, expected, options);
|
|
12938
12939
|
}
|
|
12939
12940
|
function toHaveURL(page, expected, options) {
|
|
@@ -12945,7 +12946,7 @@ function toHaveURL(page, expected, options) {
|
|
|
12945
12946
|
expected = typeof expected === "string" ? constructURLBasedOnBaseURL(baseURL, expected) : expected;
|
|
12946
12947
|
return toMatchText.call(this, "toHaveURL", page, "Page", async (isNot, timeout, signal) => {
|
|
12947
12948
|
const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase });
|
|
12948
|
-
return await page.mainFrame()._expect("to.have.url", { expectedText, isNot, timeout, signal });
|
|
12949
|
+
return await page.mainFrame()._expect("to.have.url", { expectedText, isNot, timeout, signal, title: this.title });
|
|
12949
12950
|
}, expected, options);
|
|
12950
12951
|
}
|
|
12951
12952
|
async function toBeOK(response) {
|
|
@@ -12999,11 +13000,12 @@ async function toPass(callback, options = {}) {
|
|
|
12999
13000
|
function computeMatcherTitleSuffix(matcherName, receiver, args) {
|
|
13000
13001
|
if (matcherName === "toHaveScreenshot") {
|
|
13001
13002
|
const title = toHaveScreenshotStepTitle(...args);
|
|
13002
|
-
return {
|
|
13003
|
+
return { titleSuffix: title ? `(${title})` : "" };
|
|
13003
13004
|
}
|
|
13004
13005
|
if (receiver && typeof receiver === "object" && receiver._apiName === "Locator") {
|
|
13005
13006
|
try {
|
|
13006
|
-
|
|
13007
|
+
const locator = asLocatorDescription("javascript", receiver._selector);
|
|
13008
|
+
return { subtitle: locator, params: { locator } };
|
|
13007
13009
|
} catch {
|
|
13008
13010
|
}
|
|
13009
13011
|
}
|
|
@@ -13067,7 +13069,7 @@ async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
|
|
|
13067
13069
|
if (globalChildren && !expected.match(/^- \/children:/m))
|
|
13068
13070
|
expected = `- /children: ${globalChildren}
|
|
13069
13071
|
` + expected;
|
|
13070
|
-
const expectParams = { expectedValue: expected, isNot: this.isNot, timeout, signal: options.signal };
|
|
13072
|
+
const expectParams = { expectedValue: expected, isNot: this.isNot, timeout, signal: options.signal, title: this.title };
|
|
13071
13073
|
const { matches: pass, received, log, timedOut, errorMessage } = locator ? await locator._expect("to.match.aria", expectParams) : await receiver.mainFrame()._expect("to.match.aria", expectParams);
|
|
13072
13074
|
const typedReceived = received?.value;
|
|
13073
13075
|
const message = () => {
|
|
@@ -13303,17 +13305,20 @@ function callMatcherAsStep(matcherName, info, actual, matcher, args, promise) {
|
|
|
13303
13305
|
const testInfo = expectConfig().testInfo;
|
|
13304
13306
|
const customMessage = info.message || "";
|
|
13305
13307
|
const suffixes = computeMatcherTitleSuffix(matcherName, actual, args);
|
|
13306
|
-
const defaultTitle = `${info.poll ? "poll " : ""}${info.isSoft ? "soft " : ""}${info.isNot ? "not " : ""}${matcherName}${suffixes.
|
|
13307
|
-
const
|
|
13308
|
-
const longTitle = shortTitle + (suffixes.long || "");
|
|
13309
|
-
const apiName = `expect${info.poll ? ".poll " : ""}${info.isSoft ? ".soft " : ""}${info.isNot ? ".not" : ""}.${matcherName}${suffixes.short || ""}`;
|
|
13308
|
+
const defaultTitle = `${info.poll ? "poll " : ""}${info.isSoft ? "soft " : ""}${info.isNot ? "not " : ""}${matcherName}${suffixes.titleSuffix || ""}`;
|
|
13309
|
+
const title = customMessage || `Expect ${escapeWithQuotes(defaultTitle, '"')}`;
|
|
13310
13310
|
const stackFrames = expectConfig().filteredStackTrace(captureRawStack());
|
|
13311
|
+
const params = { ...suffixes.params };
|
|
13312
|
+
if (args[0])
|
|
13313
|
+
params.expected = args[0];
|
|
13314
|
+
const apiName = `expect${info.poll ? ".poll " : ""}${info.isSoft ? ".soft " : ""}${info.isNot ? ".not" : ""}.${matcherName}${suffixes.titleSuffix || ""}`;
|
|
13311
13315
|
const stepData = {
|
|
13312
13316
|
category: "expect",
|
|
13313
13317
|
apiName,
|
|
13314
|
-
title
|
|
13315
|
-
|
|
13316
|
-
|
|
13318
|
+
title,
|
|
13319
|
+
subtitle: suffixes.subtitle,
|
|
13320
|
+
location: stackFrames[0],
|
|
13321
|
+
params: Object.keys(params).length ? params : void 0
|
|
13317
13322
|
};
|
|
13318
13323
|
const step = testInfo?._addStep(stepData);
|
|
13319
13324
|
const handleError = (error, result) => {
|
|
@@ -13334,7 +13339,7 @@ function callMatcherAsStep(matcherName, info, actual, matcher, args, promise) {
|
|
|
13334
13339
|
}
|
|
13335
13340
|
};
|
|
13336
13341
|
try {
|
|
13337
|
-
const invoke = () => info.poll ? invokePollMatcher(matcherName, info, matcher, actual, args, promise) : invokeMatcher(matcherName, info, matcher, actual, args, promise);
|
|
13342
|
+
const invoke = () => info.poll ? invokePollMatcher(matcherName, info, matcher, actual, args, promise) : invokeMatcher(matcherName, info, matcher, actual, args, promise, title);
|
|
13338
13343
|
const result = step ? currentZone().with("stepZone", step).run(invoke) : invoke();
|
|
13339
13344
|
if (result instanceof Promise)
|
|
13340
13345
|
return result.then(finalizer, handleError);
|
|
@@ -13343,7 +13348,7 @@ function callMatcherAsStep(matcherName, info, actual, matcher, args, promise) {
|
|
|
13343
13348
|
handleError(error);
|
|
13344
13349
|
}
|
|
13345
13350
|
}
|
|
13346
|
-
function invokeMatcher(matcherName, info, matcher, actual, args, promise) {
|
|
13351
|
+
function invokeMatcher(matcherName, info, matcher, actual, args, promise, title) {
|
|
13347
13352
|
const isNot = !!info.isNot;
|
|
13348
13353
|
const timeout = info.timeout ?? expectConfig().timeout ?? defaultExpectTimeout;
|
|
13349
13354
|
const matcherContext = {
|
|
@@ -13352,6 +13357,7 @@ function invokeMatcher(matcherName, info, matcher, actual, args, promise) {
|
|
|
13352
13357
|
promise: promise ?? "",
|
|
13353
13358
|
utils,
|
|
13354
13359
|
timeout,
|
|
13360
|
+
title,
|
|
13355
13361
|
equals: throwUnsupportedExpectMatcherError
|
|
13356
13362
|
};
|
|
13357
13363
|
if (!promise)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# packages/playwright/lib/matchers/expect.js
|
|
2
|
-
# total:
|
|
2
|
+
# total: 534.2 KB
|
|
3
3
|
|
|
4
4
|
## Inlined (59)
|
|
5
5
|
7.9 KB node_modules/@babel/code-frame/lib/index.js
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
7.6 KB node_modules/stack-utils/index.js
|
|
52
52
|
0.4 KB node_modules/stack-utils/node_modules/escape-string-regexp/index.js
|
|
53
53
|
3.1 KB node_modules/supports-color/index.js
|
|
54
|
-
10.
|
|
54
|
+
10.4 KB packages/playwright/src/matchers/expect.ts
|
|
55
55
|
45.2 KB packages/playwright/src/matchers/expectLibrary.ts
|
|
56
56
|
3.3 KB packages/playwright/src/matchers/matcherHint.ts
|
|
57
|
-
|
|
57
|
+
17.4 KB packages/playwright/src/matchers/matchers.ts
|
|
58
58
|
1.3 KB packages/playwright/src/matchers/toBeTruthy.ts
|
|
59
59
|
2.1 KB packages/playwright/src/matchers/toEqual.ts
|
|
60
60
|
2.9 KB packages/playwright/src/matchers/toHaveURL.ts
|
|
@@ -104,11 +104,21 @@ async function generatePausedMessage(tools, testInfo, context) {
|
|
|
104
104
|
lines.push(`### Task`, `Try recovering from the error prior to continuing`);
|
|
105
105
|
return lines.join("\n");
|
|
106
106
|
}
|
|
107
|
+
const kDaemonSymbol = /* @__PURE__ */ Symbol("daemon");
|
|
108
|
+
const kSessionNameSymbol = /* @__PURE__ */ Symbol("sessionName");
|
|
107
109
|
async function runDaemonForContext(testInfo, context) {
|
|
108
110
|
if (testInfo._configInternal.configCLIOverrides.debug !== "cli")
|
|
109
111
|
return false;
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
+
const browser = context.browser();
|
|
113
|
+
let sessionName = browser[kSessionNameSymbol];
|
|
114
|
+
if (!sessionName) {
|
|
115
|
+
sessionName = `tw-${import_crypto.default.randomBytes(3).toString("hex")}`;
|
|
116
|
+
await browser.bind(sessionName, { workspaceDir: testInfo.project.testDir });
|
|
117
|
+
browser[kSessionNameSymbol] = sessionName;
|
|
118
|
+
}
|
|
119
|
+
if (testInfo[kDaemonSymbol])
|
|
120
|
+
return false;
|
|
121
|
+
testInfo[kDaemonSymbol] = true;
|
|
112
122
|
console.log([
|
|
113
123
|
`### The test is currently paused at the start`,
|
|
114
124
|
``,
|
package/lib/program.js
CHANGED
|
@@ -138,9 +138,7 @@ function addTestMCPServerCommand(program2) {
|
|
|
138
138
|
nameInConfig: "playwright-test-runner",
|
|
139
139
|
version: import_package.packageJSON.version,
|
|
140
140
|
toolSchemas: import_testBackend.testServerBackendTools.map((tool) => tool.schema),
|
|
141
|
-
create: async () => new import_testBackend.TestServerBackend(options.config, { muteConsole: options.port === void 0, headless: options.headless })
|
|
142
|
-
disposed: async () => {
|
|
143
|
-
}
|
|
141
|
+
create: async () => new import_testBackend.TestServerBackend(options.config, { muteConsole: options.port === void 0, headless: options.headless })
|
|
144
142
|
};
|
|
145
143
|
await import_coreBundle.tools.start(factory, { port: options.port === void 0 ? void 0 : +options.port, host: options.host });
|
|
146
144
|
});
|
|
@@ -188,6 +186,7 @@ function addInitSkillsCommand(program2) {
|
|
|
188
186
|
}
|
|
189
187
|
const kTraceModes = ["on", "off", "on-first-retry", "on-all-retries", "retain-on-failure", "retain-on-first-failure", "retain-on-failure-and-retries"];
|
|
190
188
|
const testOptions = [
|
|
189
|
+
["--add-reporter <reporter>", { description: `Reporter to add on top of the configured reporters, comma-separated, can be ${import_common.builtInReporters.map((name) => `"${name}"`).join(", ")} or a path to a reporter module` }],
|
|
191
190
|
/* deprecated */
|
|
192
191
|
["--browser <browser>", { description: `Browser to use for tests, one of "all", "chromium", "firefox" or "webkit" (default: "chromium")` }],
|
|
193
192
|
["-c, --config <file>", { description: `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"` }],
|