diff --git a/packages/playwright/src/matchers/matchers.ts b/packages/playwright/src/matchers/matchers.ts index c04326bdf7..8a8089e91e 100644 --- a/packages/playwright/src/matchers/matchers.ts +++ b/packages/playwright/src/matchers/matchers.ts @@ -194,7 +194,7 @@ export function toHaveAccessibleName( ) { if (Array.isArray(expected)) { return toEqual.call(this, 'toHaveAccessibleName', locator, 'Locator', async (isNot, timeout) => { - const expectedText = serializeExpectedTextValues([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true }); + const expectedText = serializeExpectedTextValues(expected, { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true }); return await locator._expect('to.have.accessible.name.array', { expectedText, isNot, timeout }); }, expected, options); } else { diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 6c7b86befc..715762cffe 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -7899,7 +7899,7 @@ interface LocatorAssertions { * @param name Expected accessible name. * @param options */ - toHaveAccessibleName(name: string|RegExp|ReadonlyArray|ReadonlyArray, options?: { + toHaveAccessibleName(name: string|RegExp|ReadonlyArray, options?: { /** * Whether to perform case-insensitive match. * [`ignoreCase`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-accessible-name-option-ignore-case) diff --git a/tests/page/expect-misc.spec.ts b/tests/page/expect-misc.spec.ts index ae7db019bc..e5d2528b9e 100644 --- a/tests/page/expect-misc.spec.ts +++ b/tests/page/expect-misc.spec.ts @@ -461,9 +461,6 @@ test('toHaveAccessibleName should accept array of names for multiple elements', 'Cell A2 Cell B2 Cell C2', 'Cell A3 Cell B3 Cell C3', ]); - await expect(page.getByRole('row')).toHaveAccessibleName(['Cell A1 Cell B1 Cell C1', - 'Cell A2 Cell B2 Cell C2', - 'Cell A3 Cell B3',]); await expect(page.getByRole('row')).toHaveAccessibleName(['cell a1 cell b1 cell C1', 'cell A2 Cell b2 Cell c2', 'Cell a3 Cell b3 cell C3',], { ignoreCase: true });