Skip to content

Commit

Permalink
test(commerce): fix flaky commerce query summary tests (#4235)
Browse files Browse the repository at this point in the history
https://coveord.atlassian.net/browse/KIT-3369

fixes this strict selector error : 

Retry #1
───────────────────────────────────────────────────────────────────────────────────────
Error: expect.toBeVisible: Error: strict mode violation:
getByText(/^Product 1 of 1 for kayak$/) resolved to 2 elements:
1) <div role="status" aria-live="polite"
id="aria-live-eypty-query-summary">Product 1 of 1 for kayak</div> aka
locator('#aria-live-eypty-query-summary')
2) <div part="container" class="text-on-background">…</div> aka
locator('#code-root').getByText('Product 1 of 1 for kayak')
  • Loading branch information
alexprudhomme authored Jul 30, 2024
1 parent c474a8d commit 9f795cc
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export class QuerySummaryPageObject extends BasePageObject<'atomic-commerce-quer
}

text(summaryRegex: RegExp) {
return this.page.getByText(summaryRegex);
return this.page
.locator(':not([role="status"])')
.filter({hasText: summaryRegex});
}

get container() {
Expand Down

0 comments on commit 9f795cc

Please sign in to comment.