@@ -4,6 +4,9 @@ describe(`Production build tests`, () => {
4
4
5
5
cy . getTestElement ( `page2` ) . click ( ) . waitForRouteChange ( )
6
6
7
+ // add buffer time so that componentDidMount has time to be called after route change
8
+ cy . wait ( 1000 )
9
+
7
10
// we expect 2 `componentDidMount` calls - 1 for initial page and 1 for second page
8
11
cy . lifecycleCallCount ( `componentDidMount` ) . should ( `equal` , 2 )
9
12
cy . lifecycleCallCount ( `render` ) . should ( `equal` , 2 )
@@ -14,6 +17,9 @@ describe(`Production build tests`, () => {
14
17
15
18
cy . getTestElement ( `duplicated` ) . click ( ) . waitForRouteChange ( )
16
19
20
+ // add buffer time so that componentDidMount has time to be called after route change
21
+ cy . wait ( 1000 )
22
+
17
23
// we expect 2 `componentDidMount` calls - 1 for initial page and 1 for duplicated page
18
24
cy . lifecycleCallCount ( `componentDidMount` ) . should ( `equal` , 2 )
19
25
cy . lifecycleCallCount ( `render` ) . should ( `equal` , 2 )
@@ -26,6 +32,9 @@ describe(`Production build tests`, () => {
26
32
27
33
cy . getTestElement ( `/nested/foo` ) . click ( ) . waitForRouteChange ( )
28
34
35
+ // add buffer time so that componentDidMount has time to be called after route change
36
+ cy . wait ( 1000 )
37
+
29
38
// we expect just 1 `componentDidMount` call, when navigating inside matchPath
30
39
cy . lifecycleCallCount ( `componentDidMount` ) . should ( `equal` , 1 )
31
40
cy . lifecycleCallCount ( `render` ) . should ( `equal` , 3 )
0 commit comments