Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: syntax corrections in expect.extend documentation (#27772)

Renan Greca7bab19d807e1
diff --git a/docs/src/test-configuration-js.md b/docs/src/test-configuration-js.md
index 99117a16bb..6ebd29db08 100644
--- a/docs/src/test-configuration-js.md
+++ b/docs/src/test-configuration-js.md
@@ -165,6 +165,7 @@ export { test } from '@playwright/test';
export const expect = baseExpect.extend({
async toHaveAmount(locator: Locator, expected: number, options?: { timeout?: number }) {
+ const assertionName = 'toHaveAmount';
let pass: boolean;
let matcherResult: any;
try {
@@ -176,21 +177,21 @@ export const expect = baseExpect.extend({
}
const message = pass
- ? () => this.utils.matcherHint('toHaveAmount', undefined, undefined, { isNot: this.isNot }) +
+ ? () => this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
'\n\n' +
- `Locator: ${locator}\n`,
+ `Locator: ${locator}\n` +
`Expected: ${this.isNot ? 'not' : ''}${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : '')
- : () => this.utils.matcherHint('toHaveAmount', undefined, undefined, expectOptions) +
+ : () => this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
'\n\n' +
- `Locator: ${locator}\n`,
+ `Locator: ${locator}\n` +
`Expected: ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : '');
return {
message,
pass,
- name: 'toHaveAmount',
+ name: assertionName,
expected,
actual: matcherResult?.actual,
};