Skip to content

More generous alert check. #1113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/e2e/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,22 @@ export class App {
*/
async findAlertText(title: string, description?: string): Promise<void> {
const document = await this.document();
const alert = await document.findByRole("alert", {
name: title,
});
if (description) {
await alert.findByText(description);
}
await waitFor(async () => {
const alerts = await document.findAllByRole("alert", {
name: title,
});
if (description) {
const matchingDescriptions = await Promise.all(
alerts.map(async (alert) => {
const matches = await alert.queryAllByText(description);
return matches.length > 0;
})
);
if (!matchingDescriptions.some((x) => x)) {
throw new Error("No description match in matching alerts");
}
}
}, defaultWaitForOptions);
}

/**
Expand Down