This repository was archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathlifecycle_wait_test.go
746 lines (644 loc) · 20.2 KB
/
lifecycle_wait_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
package tests
import (
"context"
"fmt"
"net/http"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/xk6-browser/common"
)
// TODO
// Remove the promises. We don't need them anymore.
// General guidelines on lifecycle events:
//
// load
//
// The load event is fired when the initial HTML document has been completely
// loaded. It does not wait for the other network requests to complete.
//
// Emitted by the browser once:
// 1. The HTML is loaded.
// 2. The async scripts have loaded.
//
// domcontentloaded
//
// The DOMContentLoaded event is fired when the initial HTML document has been
// completely loaded and parsed. It does not wait for the async scripts or the
// other network requests to complete.
//
// Emitted by the browser once:
// 1. The HTML is loaded.
//
// networkidle
//
// The networkidle event is fired when there are no network connections for at
// least 500ms.
//
// Emitted by the browser once:
// 1. The HTML is loaded.
// 2. The async scripts have loaded.
// 3. All other network requests have completed.
func TestLifecycleWaitForNavigation(t *testing.T) {
// Test description
//
// Steps:
// 1. goto /home and wait for the specified lifecycle event.
// 2. click on a link that navigates to a page, and wait on
// the specified lifecycle event.
//
// Success criteria:
// The click will perform a navigation away from the current page,
// it should wait for the specified lifecycle event and the result
// of the page should match the original nav.
t.Parallel()
tests := []struct {
name string
pingSlowness time.Duration
pingJSSlow bool
waitUntil common.LifecycleEvent
pingRequestTextAssert func(result string, pingCount int)
pingJSTextAssert func(result string)
assertFunc func(tb *testBrowser, p *common.Page) error
wantError string
}{
{
name: "load",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: false,
waitUntil: common.LifecycleEventLoad,
pingRequestTextAssert: func(result string, pingCount int) {
assert.NotEqualValues(t, fmt.Sprintf("Waiting... pong %d - for loop complete", pingCount), result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
{
name: "domcontentloaded",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: true,
waitUntil: common.LifecycleEventDOMContentLoad,
pingRequestTextAssert: func(result string, pingCount int) {
assert.NotEqualValues(t, fmt.Sprintf("Waiting... pong %d - for loop complete", pingCount), result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "Waiting...", result)
},
},
{
name: "networkidle",
pingSlowness: 0,
pingJSSlow: false,
waitUntil: common.LifecycleEventNetworkIdle,
pingRequestTextAssert: func(result string, pingCount int) {
assert.EqualValues(t, fmt.Sprintf("Waiting... pong %d - for loop complete", pingCount), result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
{
// Test description
//
// Steps:
// 1. goto /home and wait for the specified lifecycle event.
// 2. call WaitForNavigation without clicking on the link.
// the specified lifecycle event.
//
// Success criteria:
// We want this test to timeout since the navigation has
// completed, a new one hasn't started but we "accidentally"
// call WaitForNavigation.
name: "timeout",
pingSlowness: 0,
pingJSSlow: false,
waitUntil: common.LifecycleEventNetworkIdle,
assertFunc: func(tb *testBrowser, p *common.Page) error {
result := p.TextContent("#pingRequestText", nil)
assert.EqualValues(t, "Waiting... pong 10 - for loop complete", result)
opts := tb.toGojaValue(&common.FrameWaitForNavigationOptions{
Timeout: 1000,
WaitUntil: common.LifecycleEventNetworkIdle,
})
_, err := p.WaitForNavigation(opts)
return err
},
wantError: "waiting for navigation: timed out after 1s",
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
tb := newTestBrowser(t, withFileServer())
p := tb.NewPage(nil)
withHomeHandler(t, tb, "lifecycle.html?pingCount=10")
withPingHandler(t, tb, tt.pingSlowness, nil)
withPingJSHandler(t, tb, tt.pingJSSlow, nil, false)
if tt.assertFunc != nil {
assertHome(t, tb, p, tt.waitUntil, func() error {
return tt.assertFunc(tb, p)
}, nil, tt.wantError)
return
}
assertHome(t, tb, p, tt.waitUntil, func() error {
result := p.TextContent("#pingRequestText", nil)
tt.pingRequestTextAssert(result, 10)
result = p.TextContent("#pingJSText", nil)
tt.pingJSTextAssert(result)
waitForNav := func() error {
opts := tb.toGojaValue(&common.FrameWaitForNavigationOptions{
Timeout: 30000,
WaitUntil: tt.waitUntil,
})
_, err := p.WaitForNavigation(opts)
return err
}
click := func() error {
return p.Click(`a`, common.NewFrameClickOptions(p.Timeout()))
}
ctx, cancel := context.WithTimeout(tb.ctx, 5*time.Second)
defer cancel()
return tb.run(ctx, waitForNav, click)
}, func() {
result := p.TextContent("#pingRequestText", nil)
tt.pingRequestTextAssert(result, 20)
result = p.TextContent("#pingJSText", nil)
tt.pingJSTextAssert(result)
}, "")
})
}
}
func TestLifecycleWaitForLoadState(t *testing.T) {
t.Parallel()
// Test description
//
// Steps:
// 1. goto /home and wait for the specified lifecycle event.
// 2. use WaitForLoadState with the same specified lifecycle event.
//
// Success criteria:
// We want to ensure that the specified event is persisted in
// memory, and we don't block on WaitForLoadState.
tests := []struct {
name string
pingSlowness time.Duration
pingJSSlow bool
waitUntil common.LifecycleEvent
pingRequestTextAssert func(result string)
pingJSTextAssert func(result string)
assertFunc func(p *common.Page)
}{
{
name: "load",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: false,
waitUntil: common.LifecycleEventLoad,
pingRequestTextAssert: func(result string) {
assert.NotEqualValues(t, "Waiting... pong 10 - for loop complete", result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
{
name: "domcontentloaded",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: true,
waitUntil: common.LifecycleEventDOMContentLoad,
pingRequestTextAssert: func(result string) {
assert.NotEqualValues(t, "Waiting... pong 10 - for loop complete", result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "Waiting...", result)
},
},
{
name: "networkidle",
pingSlowness: 0,
pingJSSlow: false,
waitUntil: common.LifecycleEventNetworkIdle,
pingRequestTextAssert: func(result string) {
assert.EqualValues(t, "Waiting... pong 10 - for loop complete", result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
{
// Test description
//
// Steps:
// 1. goto /home and wait for the domcontentloaded lifecycle event.
// 2. use WaitForLoadState with networkidle.
//
// Success criteria:
// We want to quickly move to calling WaitForLoadState
// so that we wait until networkidle is received from
// the browser -- not relying on the persisted state in memory.
name: "domcontentloaded then networkidle",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: false,
waitUntil: common.LifecycleEventDOMContentLoad,
assertFunc: func(p *common.Page) {
p.WaitForLoadState(common.LifecycleEventNetworkIdle.String(), nil)
result := p.TextContent("#pingRequestText", nil)
assert.EqualValues(t, "Waiting... pong 10 - for loop complete", result)
result = p.TextContent("#pingJSText", nil)
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
tb := newTestBrowser(t, withFileServer())
p := tb.NewPage(nil)
withHomeHandler(t, tb, "lifecycle.html?pingCount=10")
withPingHandler(t, tb, tt.pingSlowness, nil)
withPingJSHandler(t, tb, tt.pingJSSlow, nil, false)
if tt.assertFunc != nil {
assertHome(t, tb, p, tt.waitUntil, func() error {
tt.assertFunc(p)
return nil
}, nil, "")
return
}
assertHome(t, tb, p, tt.waitUntil, func() error {
result := p.TextContent("#pingRequestText", nil)
tt.pingRequestTextAssert(result)
result = p.TextContent("#pingJSText", nil)
tt.pingJSTextAssert(result)
// This shouldn't block and return after calling hasLifecycleEventFired.
p.WaitForLoadState(tt.waitUntil.String(), nil)
return nil
}, nil, "")
})
}
}
func TestLifecycleReload(t *testing.T) {
t.Parallel()
// Test description
//
// Steps:
// 1. goto /home and wait for the specified lifecycle event.
// 2. reload the page and wait for the specified lifecycle event.
//
// Success criteria:
// The resulting page after reload is the same as
// the initial navigation with goto.
tests := []struct {
name string
pingSlowness time.Duration
pingJSSlow bool
waitUntil common.LifecycleEvent
pingRequestTextAssert func(result string, pingCount int)
pingJSTextAssert func(result string)
}{
{
name: "load",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: false,
waitUntil: common.LifecycleEventLoad,
pingRequestTextAssert: func(result string, pingCount int) {
assert.NotEqualValues(t, fmt.Sprintf("Waiting... pong %d - for loop complete", pingCount), result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
{
name: "domcontentloaded",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: true,
waitUntil: common.LifecycleEventDOMContentLoad,
pingRequestTextAssert: func(result string, pingCount int) {
assert.NotEqualValues(t, fmt.Sprintf("Waiting... pong %d - for loop complete", pingCount), result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "Waiting...", result)
},
},
{
name: "networkidle",
pingSlowness: 0,
pingJSSlow: false,
waitUntil: common.LifecycleEventNetworkIdle,
pingRequestTextAssert: func(result string, pingCount int) {
assert.EqualValues(t, fmt.Sprintf("Waiting... pong %d - for loop complete", pingCount), result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
tb := newTestBrowser(t, withFileServer())
p := tb.NewPage(nil)
withHomeHandler(t, tb, "lifecycle.html?pingCount=10")
withPingHandler(t, tb, tt.pingSlowness, nil)
withPingJSHandler(t, tb, tt.pingJSSlow, nil, false)
assertHome(t, tb, p, tt.waitUntil, func() error {
result := p.TextContent("#pingRequestText", nil)
tt.pingRequestTextAssert(result, 10)
result = p.TextContent("#pingJSText", nil)
tt.pingJSTextAssert(result)
opts := tb.toGojaValue(common.PageReloadOptions{
WaitUntil: tt.waitUntil,
Timeout: 30 * time.Second,
})
p.Reload(opts)
result = p.TextContent("#pingRequestText", nil)
tt.pingRequestTextAssert(result, 20)
result = p.TextContent("#pingJSText", nil)
tt.pingJSTextAssert(result)
return nil
}, nil, "")
})
}
}
func TestLifecycleGotoWithSubFrame(t *testing.T) {
t.Parallel()
// Test description
//
// Steps:
// 1. goto /home (with iframe to /sub) and wait for the specified lifecycle event.
//
// Success criteria:
// The web page (all frames) is in the expected state
// once we receive the specified lifecycle event from
// the browser.
tests := []struct {
name string
pingSlowness time.Duration
pingJSSlow bool
waitUntil common.LifecycleEvent
pingRequestTextAssert func(result string)
pingJSTextAssert func(result string)
}{
{
name: "load",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: false,
waitUntil: common.LifecycleEventLoad,
pingRequestTextAssert: func(result string) {
assert.NotEqualValues(t, "Waiting... pong 10 - for loop complete", result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
{
name: "domcontentloaded",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: true,
waitUntil: common.LifecycleEventDOMContentLoad,
pingRequestTextAssert: func(result string) {
assert.NotEqualValues(t, "Waiting... pong 10 - for loop complete", result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "Waiting...", result)
},
},
{
name: "networkidle",
pingSlowness: 0,
pingJSSlow: false,
waitUntil: common.LifecycleEventNetworkIdle,
pingRequestTextAssert: func(result string) {
assert.EqualValues(t, "Waiting... pong 10 - for loop complete", result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
tb := newTestBrowser(t, withFileServer())
p := tb.NewPage(nil)
withHomeHandler(t, tb, "lifecycle_main_frame.html")
withSubHandler(t, tb, "lifecycle.html?pingCount=10")
withPingHandler(t, tb, tt.pingSlowness, nil)
withPingJSHandler(t, tb, tt.pingJSSlow, nil, true)
assertHome(t, tb, p, tt.waitUntil, func() error {
result := p.TextContent("#subFramePingRequestText", nil)
tt.pingRequestTextAssert(result)
result = p.TextContent("#subFramePingJSText", nil)
tt.pingJSTextAssert(result)
return nil
}, nil, "")
})
}
}
func TestLifecycleGoto(t *testing.T) {
t.Parallel()
// Test description
//
// Steps:
// 1. goto /home and wait for the specified lifecycle event.
//
// Success criteria:
// The web page is in the expected state once we receive
// the specified lifecycle event from the browser.
tests := []struct {
name string
pingSlowness time.Duration
pingJSSlow bool
waitUntil common.LifecycleEvent
pingRequestTextAssert func(result string)
pingJSTextAssert func(result string)
}{
{
name: "load",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: false,
waitUntil: common.LifecycleEventLoad,
pingRequestTextAssert: func(result string) {
assert.NotEqualValues(t, "Waiting... pong 10 - for loop complete", result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "ping.js loaded from server", result)
},
},
{
name: "domcontentloaded",
pingSlowness: 100 * time.Millisecond,
pingJSSlow: true,
waitUntil: common.LifecycleEventDOMContentLoad,
pingRequestTextAssert: func(result string) {
assert.NotEqualValues(t, "Waiting... pong 10 - for loop complete", result)
},
pingJSTextAssert: func(result string) {
assert.EqualValues(t, "Waiting...", result)
},
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
tb := newTestBrowser(t, withFileServer())
p := tb.NewPage(nil)
withHomeHandler(t, tb, "lifecycle.html?pingCount=10")
withPingHandler(t, tb, tt.pingSlowness, nil)
withPingJSHandler(t, tb, tt.pingJSSlow, nil, false)
assertHome(t, tb, p, tt.waitUntil, func() error {
result := p.TextContent("#pingRequestText", nil)
tt.pingRequestTextAssert(result)
result = p.TextContent("#pingJSText", nil)
tt.pingJSTextAssert(result)
return nil
}, nil, "")
})
}
}
func TestLifecycleGotoNetworkIdle(t *testing.T) {
t.Parallel()
t.Run("doesn't timeout waiting for networkIdle", func(t *testing.T) {
t.Parallel()
tb := newTestBrowser(t, withHTTPServer())
p := tb.NewPage(nil)
tb.withHandler("/home", func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprintf(w, `
<html>
<head></head>
<body>
<div id="pingJSText">Waiting...</div>
<script src="/ping.js" async></script>
</body>
</html>
`)
})
withPingJSHandler(t, tb, false, nil, false)
assertHome(t, tb, p, common.LifecycleEventNetworkIdle, func() error {
result := p.TextContent("#pingJSText", nil)
assert.EqualValues(t, "ping.js loaded from server", result)
return nil
}, nil, "")
})
t.Run("doesn't unblock wait for networkIdle too early", func(t *testing.T) {
t.Parallel()
tb := newTestBrowser(t, withFileServer())
p := tb.NewPage(nil)
withHomeHandler(t, tb, "lifecycle.html?pingCount=4")
ch := make(chan bool)
withPingHandler(t, tb, 50*time.Millisecond, ch)
withPingJSHandler(t, tb, false, ch, false)
assertHome(t, tb, p, common.LifecycleEventNetworkIdle, func() error {
result := p.TextContent("#pingRequestText", nil)
assert.EqualValues(t, "Waiting... pong 4 - for loop complete", result)
result = p.TextContent("#pingJSText", nil)
assert.EqualValues(t, "ping.js loaded from server", result)
return nil
}, nil, "")
})
t.Run("doesn't unblock wait on networkIdle early when load and domcontentloaded complete at once", func(t *testing.T) {
t.Parallel()
tb := newTestBrowser(t, withFileServer())
p := tb.NewPage(nil)
withHomeHandler(t, tb, "lifecycle_no_ping_js.html")
withPingHandler(t, tb, 50*time.Millisecond, nil)
assertHome(t, tb, p, common.LifecycleEventNetworkIdle, func() error {
result := p.TextContent("#pingRequestText", nil)
assert.EqualValues(t, "Waiting... pong 10 - for loop complete", result)
return nil
}, nil, "")
})
}
func withHomeHandler(t *testing.T, tb *testBrowser, htmlFile string) {
t.Helper()
tb.withHandler("/home", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, tb.staticURL(htmlFile), http.StatusMovedPermanently)
})
}
func withSubHandler(t *testing.T, tb *testBrowser, htmlFile string) {
t.Helper()
tb.withHandler("/sub", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, tb.staticURL(htmlFile), http.StatusMovedPermanently)
})
}
func withPingHandler(t *testing.T, tb *testBrowser, slow time.Duration, ch chan bool) {
t.Helper()
var counter int64
var counterMu sync.Mutex
tb.withHandler("/ping", func(w http.ResponseWriter, _ *http.Request) {
if ch != nil {
<-ch
}
counterMu.Lock()
defer counterMu.Unlock()
time.Sleep(slow)
counter++
fmt.Fprintf(w, "pong %d", counter)
})
}
func withPingJSHandler(t *testing.T, tb *testBrowser, slow bool, ch chan bool, withSubFrame bool) {
t.Helper()
tb.withHandler("/ping.js", func(w http.ResponseWriter, _ *http.Request) {
script := `
var pingJSTextOutput = document.getElementById("pingJSText");
pingJSTextOutput.innerText = "ping.js loaded from server";
`
if withSubFrame {
script += `
var parentOutputServerMsg = window.parent.document.getElementById('subFramePingJSText');
parentOutputServerMsg.innerText = pingJSTextOutput.innerText;
`
}
if slow {
script = `
await new Promise(resolve => setTimeout(resolve, 1000));
` + script
}
fmt.Fprint(w, script)
if ch != nil {
close(ch)
}
})
}
func assertHome(
t *testing.T,
tb *testBrowser, p *common.Page,
waitUntil common.LifecycleEvent,
check func() error, secondCheck func(), wantError string,
) {
t.Helper()
var resolved, rejected bool
err := func() error {
opts := tb.toGojaValue(common.FrameGotoOptions{
WaitUntil: waitUntil,
Timeout: 30 * time.Second,
})
_, err := p.Goto(tb.url("/home"), opts)
if err == nil {
resolved = true
} else {
rejected = true
}
err = check()
if err != nil {
return err
}
if secondCheck != nil {
secondCheck()
}
return nil
}()
if wantError != "" {
require.EqualError(t, err, wantError)
return
}
require.NoError(t, err)
assert.True(t, resolved)
assert.False(t, rejected)
}