# Instructions
- Following Playwright test failed.
- Explain why, be concise, respect Playwright best practices.
- Provide a snippet of code with the fix, if possible.
# Test info
- Name: src/manager/tests/e2e/invoice/invoice-create.spec.ts >> creates a bacs auto-charged invoice
- Location: src/manager/tests/e2e/invoice/invoice-create.spec.ts:29:7
# Error details
```
Error: expect(locator).toHaveText(expected) failed
Locator: getByTestId('app-page').getByTestId('app-page-content').locator('[data-test-id=app-details-card]:has([data-test-id=title]:has-text("Payments"))').locator('.ui-data-grid').locator('[data-test-id=ui-data-grid-table]:not(.disabled):not(.loading):not(.fetching)').getByTestId('ui-data-grid-table-with-data').locator('tr').getByTestId('ui-data-grid-cell-status').first().locator('.ui-chip-content').first()
Expected pattern: /Succeeded/
Received string: "Pending"
Timeout: 30000ms
Call log:
- Expect "toHaveText" with timeout 30000ms
- waiting for getByTestId('app-page').getByTestId('app-page-content').locator('[data-test-id=app-details-card]:has([data-test-id=title]:has-text("Payments"))').locator('.ui-data-grid').locator('[data-test-id=ui-data-grid-table]:not(.disabled):not(.loading):not(.fetching)').getByTestId('ui-data-grid-table-with-data').locator('tr').getByTestId('ui-data-grid-cell-status').first().locator('.ui-chip-content').first()
64 × locator resolved to Pending
- unexpected value "Pending"
```
```yaml
- text: Pending
```
# Test source
```ts
1 | import { escapeRegExp } from '@/shared/utils/regex-utils';
2 | import { expect, Locator } from '@playwright/test';
3 |
4 | export async function expectMultiLocatorToHaveText(locator: Locator, text: string[] | undefined): Promise {
5 | if (!text) {
6 | await expectLocatorToBeEmpty(locator);
7 | return;
8 | }
9 |
10 | const expectedValue = RegExp(text.map(escapeRegExp).join('|'));
11 |
12 | for (const element of await locator.all()) {
13 | await expectSingleLocatorToHaveText(element, expectedValue);
14 | }
15 | }
16 |
17 | export async function expectSingleLocatorToHaveText(
18 | locator: Locator,
19 | text: string | RegExp | undefined
20 | ): Promise {
21 | text
> 22 | ? await expect(locator).toHaveText(text, { ignoreCase: true, useInnerText: true })
| ^ Error: expect(locator).toHaveText(expected) failed
23 | : await expectLocatorToBeEmpty(locator);
24 | }
25 |
26 | export async function expectLocatorToBeEmpty(locator: Locator): Promise {
27 | await expect(locator).toHaveText(/^(\s*-?\s*)$/);
28 | }
29 |
```