mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
docs: syntax corrections in expect.extend documentation (#27772)
Signed-off-by: Yury Semikhatsky <yurys@chromium.org> Co-authored-by: Yury Semikhatsky <yurys@chromium.org> Co-authored-by: Pavel Feldman <pavel.feldman@gmail.com>
This commit is contained in:
parent
afa5cdc53f
commit
7bab19d807
@ -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,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user