Skip to content

Commit 5d3bb53

Browse files
authored
test(gatsby): Add buffer time to failing react 18 e2e tests (#35673)
* Skip failing react 18 tests * Instead of skipping, add buffer time after route change * Add to third test
1 parent 7732447 commit 5d3bb53

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

e2e-tests/production-runtime/cypress/integration/lifecycle-methods.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ describe(`Production build tests`, () => {
44

55
cy.getTestElement(`page2`).click().waitForRouteChange()
66

7+
// add buffer time so that componentDidMount has time to be called after route change
8+
cy.wait(1000)
9+
710
// we expect 2 `componentDidMount` calls - 1 for initial page and 1 for second page
811
cy.lifecycleCallCount(`componentDidMount`).should(`equal`, 2)
912
cy.lifecycleCallCount(`render`).should(`equal`, 2)
@@ -14,6 +17,9 @@ describe(`Production build tests`, () => {
1417

1518
cy.getTestElement(`duplicated`).click().waitForRouteChange()
1619

20+
// add buffer time so that componentDidMount has time to be called after route change
21+
cy.wait(1000)
22+
1723
// we expect 2 `componentDidMount` calls - 1 for initial page and 1 for duplicated page
1824
cy.lifecycleCallCount(`componentDidMount`).should(`equal`, 2)
1925
cy.lifecycleCallCount(`render`).should(`equal`, 2)
@@ -26,6 +32,9 @@ describe(`Production build tests`, () => {
2632

2733
cy.getTestElement(`/nested/foo`).click().waitForRouteChange()
2834

35+
// add buffer time so that componentDidMount has time to be called after route change
36+
cy.wait(1000)
37+
2938
// we expect just 1 `componentDidMount` call, when navigating inside matchPath
3039
cy.lifecycleCallCount(`componentDidMount`).should(`equal`, 1)
3140
cy.lifecycleCallCount(`render`).should(`equal`, 3)

0 commit comments

Comments
 (0)