Skip to content

Commit 853785f

Browse files
committed
test: stabilize navigation e2e links
Wait on nav containers, target links by selector and text, and scroll links into view before clicking so the mobile secondary navigation test is less sensitive to route-transition and sticky-nav timing.
1 parent 92bdda5 commit 853785f

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

apps/docs/e2e/Navigation.cy.res

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ let waitForHydration = () => {
1515
// re-query from the DOM root on each retry.
1616

1717
let clickNavLink = (~testId, ~text) => {
18-
get(`[data-testid="${testId}"] a:visible`)
19-
->containsChainable(text)
18+
getByTestId(testId)
19+
->should("be.visible")
20+
->containsSelectorChainable("a", text)
21+
->scrollIntoView
22+
->should("be.visible")
2023
->click
2124
->ignore
2225
}
2326

2427
let clickMobileNavLink = text => {
25-
get(`[data-testid="mobile-nav"] a:visible`)
26-
->containsChainable(text)
28+
getByTestId("mobile-nav")
29+
->should("be.visible")
30+
->containsSelectorChainable("a", text)
31+
->scrollIntoView
32+
->should("be.visible")
2733
->click
2834
->ignore
2935
}

0 commit comments

Comments
 (0)