Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit a5d283f

Browse files
committed
Refactor comment WaitForLoadState test
1 parent b5d61b6 commit a5d283f

File tree

1 file changed

+17
-43
lines changed

1 file changed

+17
-43
lines changed

tests/lifecycle_wait_test.go

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ import (
3636
func TestLifecycleWaitForLoadState(t *testing.T) {
3737
t.Parallel()
3838

39+
// Test description
40+
//
41+
// 1. goto /home and wait for the specified lifecycle event.
42+
// 2. use WaitForLoadState with the same specified lifecycle event.
43+
//
44+
// Success criteria: We want to ensure that the specified event is persisted in
45+
// memory, and we don't block on WaitForLoadState.
46+
3947
tests := []struct {
4048
name string
4149
pingSlowness time.Duration
@@ -46,13 +54,6 @@ func TestLifecycleWaitForLoadState(t *testing.T) {
4654
assertFunc func(p api.Page)
4755
}{
4856
{
49-
// Test description
50-
//
51-
// 1. goto /home and wait for the load lifecycle event.
52-
// 2. use WaitForLoadState with load.
53-
//
54-
// Success criteria: We want to ensure that the load event is persisted in
55-
// memory, and we don't block on WaitForLoadState.
5657
name: "load",
5758
pingSlowness: time.Millisecond * 100,
5859
pingJSSlow: false,
@@ -65,13 +66,6 @@ func TestLifecycleWaitForLoadState(t *testing.T) {
6566
},
6667
},
6768
{
68-
// Test description
69-
//
70-
// 1. goto /home and wait for the domcontentloaded lifecycle event.
71-
// 2. use WaitForLoadState with domcontentloaded.
72-
//
73-
// Success criteria: We want to ensure that the domcontentloaded event is
74-
// persisted in memory, and we don't block on WaitForLoadState.
7569
name: "domcontentloaded",
7670
pingSlowness: time.Millisecond * 100,
7771
pingJSSlow: true,
@@ -84,13 +78,6 @@ func TestLifecycleWaitForLoadState(t *testing.T) {
8478
},
8579
},
8680
{
87-
// Test description
88-
//
89-
// 1. goto /home and wait for the networkidle lifecycle event.
90-
// 2. use WaitForLoadState with networkidle.
91-
//
92-
// Success criteria: We want to ensure that the networkidle event is
93-
// persisted in memory, and we don't block on WaitForLoadState.
9481
name: "networkidle",
9582
pingSlowness: 0,
9683
pingJSSlow: false,
@@ -110,7 +97,7 @@ func TestLifecycleWaitForLoadState(t *testing.T) {
11097
//
11198
// Success criteria: We want to quickly move to calling WaitForLoadState
11299
// so that we wait until networkidle is received from
113-
// the browser. So not relying on the persisted state in memory.
100+
// the browser -- not relying on the persisted state in memory.
114101
name: "domcontentloaded then networkidle",
115102
pingSlowness: time.Millisecond * 100,
116103
pingJSSlow: false,
@@ -160,6 +147,14 @@ func TestLifecycleWaitForLoadState(t *testing.T) {
160147
func TestLifecycleReload(t *testing.T) {
161148
t.Parallel()
162149

150+
// Test description
151+
//
152+
// 1. goto /home and wait for the specified lifecycle event.
153+
// 2. reload the page and wait for the specified lifecycle event.
154+
//
155+
// Success criteria: The resulting page after reload is the same as
156+
// the initial navigation with goto.
157+
163158
tests := []struct {
164159
name string
165160
pingSlowness time.Duration
@@ -169,13 +164,6 @@ func TestLifecycleReload(t *testing.T) {
169164
pingJSTextAssert func(result string)
170165
}{
171166
{
172-
// Test description
173-
//
174-
// 1. goto /home and wait for the load lifecycle event.
175-
// 2. reload the page and wait with for the load lifecycle event.
176-
//
177-
// Success criteria: The resulting page after reload is the same as
178-
// the initial navigation with goto.
179167
name: "load",
180168
pingSlowness: time.Millisecond * 100,
181169
pingJSSlow: false,
@@ -188,13 +176,6 @@ func TestLifecycleReload(t *testing.T) {
188176
},
189177
},
190178
{
191-
// Test description
192-
//
193-
// 1. goto /home and wait for the domcontentloaded lifecycle event.
194-
// 2. reload the page and wait with for the domcontentloaded lifecycle event.
195-
//
196-
// Success criteria: The resulting page after reload is the same as
197-
// the initial navigation with goto.
198179
name: "domcontentloaded",
199180
pingSlowness: time.Millisecond * 100,
200181
pingJSSlow: true,
@@ -207,13 +188,6 @@ func TestLifecycleReload(t *testing.T) {
207188
},
208189
},
209190
{
210-
// Test description
211-
//
212-
// 1. goto /home and wait for the networkidle lifecycle event.
213-
// 2. reload the page and wait with for the networkidle lifecycle event.
214-
//
215-
// Success criteria: The resulting page after reload is the same as
216-
// the initial navigation with goto.
217191
name: "networkidle",
218192
pingSlowness: 0,
219193
pingJSSlow: false,

0 commit comments

Comments
 (0)