ui5-test-runner 3.3.5 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +9 -16
  2. package/package.json +17 -18
  3. package/src/browsers.js +9 -1
  4. package/src/capabilities/index.js +6 -6
  5. package/src/capabilities/tests/screenshot/index.html +13 -3
  6. package/src/capabilities/tests/screenshot/index.js +11 -5
  7. package/src/capabilities/tests/traces/index.js +1 -1
  8. package/src/coverage.js +51 -42
  9. package/src/defaults/puppeteer.js +10 -20
  10. package/src/defaults/report/progress.js +11 -0
  11. package/src/endpoints.js +8 -0
  12. package/src/get-job-progress.js +9 -0
  13. package/src/inject/opa-iframe-coverage.js +0 -1
  14. package/src/inject/post.js +4 -4
  15. package/src/inject/qunit-hooks.js +18 -2
  16. package/src/inject/qunit-intercept.js +6 -0
  17. package/src/inject/ui5-coverage.js +6 -0
  18. package/src/job-mode.js +0 -1
  19. package/src/job.js +10 -10
  20. package/src/options.js +4 -0
  21. package/src/output.js +56 -24
  22. package/src/qunit-hooks.js +43 -29
  23. package/src/symbols.js +2 -1
  24. package/src/tests.js +6 -1
  25. package/src/add-test-pages.spec.js +0 -95
  26. package/src/browser.spec.js +0 -724
  27. package/src/cors.spec.js +0 -41
  28. package/src/coverage.spec.js +0 -120
  29. package/src/csv-reader.spec.js +0 -42
  30. package/src/csv-writer.spec.js +0 -77
  31. package/src/error.spec.js +0 -17
  32. package/src/get-job-progress.spec.js +0 -175
  33. package/src/inject/post.spec.js +0 -147
  34. package/src/job.spec.js +0 -418
  35. package/src/npm.spec.js +0 -98
  36. package/src/options.spec.js +0 -141
  37. package/src/qunit-hooks.spec.js +0 -747
  38. package/src/simulate.spec.js +0 -547
  39. package/src/timeout.spec.js +0 -39
  40. package/src/tools.spec.js +0 -90
  41. package/src/unhandled.spec.js +0 -63
@@ -1,747 +0,0 @@
1
- jest.mock('./browsers.js', () => ({
2
- screenshot: jest.fn(),
3
- stop: jest.fn()
4
- }))
5
- const { screenshot, stop } = require('./browsers')
6
-
7
- jest.mock('./coverage.js', () => ({
8
- collect: jest.fn()
9
- }))
10
- const { collect } = require('./coverage')
11
-
12
- const mockGenericError = jest.fn()
13
- const mockQunitEarlyStart = jest.fn()
14
-
15
- jest.mock('./output.js', () => ({
16
- getOutput: () => ({
17
- genericError: mockGenericError,
18
- qunitEarlyStart: mockQunitEarlyStart
19
- })
20
- }))
21
-
22
- const {
23
- get,
24
- begin,
25
- testStart,
26
- log,
27
- testDone,
28
- done
29
- } = require('./qunit-hooks.js')
30
- const { UTRError } = require('./error')
31
-
32
- describe('src/qunit-hooks', () => {
33
- const url = 'http://localhost:80/page1.html'
34
- let job
35
-
36
- beforeEach(() => {
37
- screenshot.mockReset()
38
- screenshot.mockImplementation((job, url, testId) => Promise.resolve(`whatever/${testId}.png`))
39
- stop.mockClear()
40
- mockGenericError.mockClear()
41
- job = {
42
- screenshot: true,
43
- browserCapabilities: {
44
- screenshot: false
45
- }
46
- }
47
- })
48
-
49
- const getModules = () => [{
50
- name: 'module 1',
51
- tests: [{
52
- name: 'test 1a',
53
- testId: '1a'
54
- }, {
55
- name: 'test 1b',
56
- testId: '1b'
57
- }]
58
- }, {
59
- name: 'module 2',
60
- tests: [{
61
- name: 'test 2c',
62
- testId: '2c'
63
- }, {
64
- name: 'test 2d',
65
- testId: '2d'
66
- }]
67
- }]
68
- const getBeginInfo = () => ({
69
- totalTests: 4,
70
- modules: getModules()
71
- })
72
-
73
- describe('begin', () => {
74
- it('allocates a placeholder page', async () => {
75
- await begin(job, url, getBeginInfo())
76
- const { page } = get(job, url)
77
- expect(page).not.toBeUndefined()
78
- })
79
-
80
- it('allocates an id for the page', async () => {
81
- await begin(job, url, getBeginInfo())
82
- const { page } = get(job, url)
83
- expect(page.id).not.toBeUndefined()
84
- })
85
-
86
- it('stores test information and keeps track of when it starts', async () => {
87
- await begin(job, url, getBeginInfo())
88
- const { page } = get(job, url)
89
- const { start, id, ...pageWithoutVariableInfos } = page
90
- expect(pageWithoutVariableInfos).toStrictEqual({
91
- isOpa: false,
92
- failed: 0,
93
- passed: 0,
94
- count: 4,
95
- modules: getModules()
96
- })
97
- expect(start).toBeInstanceOf(Date)
98
- expect(id).not.toBeUndefined()
99
- })
100
-
101
- it('resets the existing structure on retry', async () => {
102
- job.qunitPages = {
103
- [url]: {
104
- isOpa: true,
105
- failed: 2,
106
- passed: 1,
107
- count: 4,
108
- modules: [{
109
- name: 'module 1',
110
- tests: [{
111
- name: 'test 1a',
112
- testId: '1a',
113
- logs: []
114
- }, {
115
- name: 'test 1b',
116
- testId: '1b',
117
- anything: true
118
- }]
119
- }, {
120
- name: 'module 2',
121
- tests: [{
122
- name: 'test 2c',
123
- testId: '2c',
124
- failed: 1
125
- }, {
126
- name: 'test 2d',
127
- testId: '2d',
128
- whatever: {
129
- }
130
- }]
131
- }],
132
- start: 'Not a date',
133
- end: 'Not a date'
134
- }
135
- }
136
- await begin(job, url, {
137
- isOpa: true,
138
- ...getBeginInfo()
139
- })
140
- const { page } = get(job, url)
141
- const { start, id, ...pageWithoutVariableInfos } = page
142
- expect(pageWithoutVariableInfos).toStrictEqual({
143
- isOpa: true,
144
- failed: 0,
145
- passed: 0,
146
- count: 4,
147
- modules: getModules()
148
- })
149
- expect(start).toBeInstanceOf(Date)
150
- expect(id).not.toBeUndefined()
151
- })
152
-
153
- describe('ignoring hash variation', () => {
154
- it('starts empty, receives #any_hash', async () => {
155
- await begin(job, url, getBeginInfo())
156
- const { page } = get(job, url + '#any_hash')
157
- expect(page).not.toBeUndefined()
158
- })
159
-
160
- it('starts with #any_hash, receives #any_hash', async () => {
161
- await begin(job, url, getBeginInfo())
162
- const { page } = get(job, url + '#any_hash')
163
- expect(page).not.toBeUndefined()
164
- })
165
-
166
- it('starts with #any_hash, receives #another_hash', async () => {
167
- await begin(job, url, getBeginInfo())
168
- const { page } = get(job, url + '#another_hash')
169
- expect(page).not.toBeUndefined()
170
- })
171
-
172
- it('starts with #any_hash, receives empty', async () => {
173
- await begin(job, url, getBeginInfo())
174
- const { page } = get(job, url)
175
- expect(page).not.toBeUndefined()
176
- })
177
- })
178
-
179
- describe('validation (--qunit-strict)', () => {
180
- beforeEach(() => {
181
- job.qunitStrict = true
182
- })
183
-
184
- afterEach(() => {
185
- expect(stop).toHaveBeenCalledWith(job, url)
186
- expect(job.failed).toStrictEqual(true)
187
- })
188
-
189
- it('requires totalTests', async () => {
190
- await expect(begin(job, url, {
191
- isOpa: false,
192
- modules: getModules()
193
- })).rejects.toThrow(UTRError.QUNIT_ERROR('Invalid begin hook details'))
194
- expect(mockQunitEarlyStart).toHaveBeenCalled()
195
- })
196
-
197
- it('requires modules', async () => {
198
- await expect(begin(job, url, {
199
- isOpa: false,
200
- totalTests: 1
201
- })).rejects.toThrow(UTRError.QUNIT_ERROR('Invalid begin hook details'))
202
- expect(mockQunitEarlyStart).toHaveBeenCalled()
203
- })
204
- })
205
- })
206
-
207
- describe('testStart', () => {
208
- beforeEach(async () => {
209
- await begin(job, url, {
210
- isOpa: false,
211
- ...getBeginInfo()
212
- })
213
- })
214
-
215
- it('signals test start', async () => {
216
- await testStart(job, url, {
217
- module: 'module 1',
218
- name: 'test 1a',
219
- testId: '1a'
220
- })
221
-
222
- const { test } = get(job, url, '1a')
223
- expect(test.start).toBeInstanceOf(Date)
224
- })
225
- })
226
-
227
- describe('log', () => {
228
- const getLogFor1a = () => ({
229
- module: 'module 1',
230
- name: 'test 1a',
231
- result: true,
232
- message: 'message',
233
- actual: true,
234
- expected: true,
235
- testId: '1a',
236
- runtime: 1419
237
- })
238
-
239
- it('keeps track of logs', async () => {
240
- await begin(job, url, {
241
- isOpa: false,
242
- ...getBeginInfo()
243
- })
244
- await log(job, url, getLogFor1a())
245
- const { test } = get(job, url, '1a')
246
- expect(test.logs).toBeInstanceOf(Array)
247
- expect(test.logs.length).toStrictEqual(1)
248
- expect(test.logs[0]).toStrictEqual({
249
- result: true,
250
- actual: true,
251
- expected: true,
252
- message: 'message',
253
- runtime: 1419
254
- })
255
- })
256
-
257
- it('keeps track of logs (multiple)', async () => {
258
- await begin(job, url, {
259
- isOpa: false,
260
- ...getBeginInfo()
261
- })
262
- await log(job, url, getLogFor1a())
263
- await log(job, url, {
264
- ...getLogFor1a(),
265
- result: false,
266
- message: 'an error occurred',
267
- actual: undefined,
268
- expected: {},
269
- runtime: 1506
270
- })
271
- const { test } = get(job, url, '1a')
272
- expect(test.logs.length).toStrictEqual(2)
273
- expect(test.logs).toStrictEqual([{
274
- result: true,
275
- actual: true,
276
- expected: true,
277
- message: 'message',
278
- runtime: 1419
279
- }, {
280
- result: false,
281
- actual: undefined,
282
- expected: {},
283
- message: 'an error occurred',
284
- runtime: 1506
285
- }])
286
- })
287
-
288
- it('does not take a screenshot if not OPA', async () => {
289
- job.browserCapabilities.screenshot = '.png'
290
- await begin(job, url, {
291
- isOpa: false,
292
- ...getBeginInfo()
293
- })
294
- await log(job, url, getLogFor1a())
295
- expect(screenshot).not.toHaveBeenCalled()
296
- })
297
-
298
- it('does not take a screenshot if not available', async () => {
299
- await begin(job, url, {
300
- isOpa: true,
301
- ...getBeginInfo()
302
- })
303
- await log(job, url, getLogFor1a())
304
- expect(screenshot).not.toHaveBeenCalled()
305
- })
306
-
307
- it('does not take a screenshot if not disabled', async () => {
308
- job.browserCapabilities.screenshot = '.png'
309
- job.screenshot = false
310
- await begin(job, url, {
311
- isOpa: true,
312
- ...getBeginInfo()
313
- })
314
- await log(job, url, getLogFor1a())
315
- expect(screenshot).not.toHaveBeenCalled()
316
- })
317
-
318
- it('takes a screenshot for OPA tests', async () => {
319
- job.browserCapabilities.screenshot = '.png'
320
- await begin(job, url, {
321
- isOpa: true,
322
- ...getBeginInfo()
323
- })
324
- screenshot.mockImplementation(() => '1a-1419.png')
325
- await log(job, url, getLogFor1a())
326
- expect(screenshot).toHaveBeenCalledWith(job, url, '1a-1419')
327
- const { test } = get(job, url, '1a')
328
- expect(test.logs[0]).toStrictEqual({
329
- result: true,
330
- actual: true,
331
- expected: true,
332
- message: 'message',
333
- runtime: 1419,
334
- screenshot: '1a-1419.png'
335
- })
336
- })
337
-
338
- it('takes a screenshot for OPA tests (hash changing)', async () => {
339
- job.browserCapabilities.screenshot = '.png'
340
- await begin(job, url, {
341
- isOpa: true,
342
- ...getBeginInfo()
343
- })
344
- await log(job, url + '#any_hash', getLogFor1a())
345
- expect(screenshot).toHaveBeenCalledWith(job, url, '1a-1419')
346
- })
347
-
348
- it('does not fail if screenshot failed', async () => {
349
- job.browserCapabilities.screenshot = '.png'
350
- await begin(job, url, {
351
- isOpa: true,
352
- ...getBeginInfo()
353
- })
354
- screenshot.mockImplementation(() => Promise.reject(new Error()))
355
- await log(job, url, getLogFor1a())
356
- expect(mockGenericError).toHaveBeenCalled()
357
- expect(job.failed).not.toStrictEqual(true)
358
- const { page, test } = get(job, url, '1a')
359
- expect(page).toMatchObject({
360
- isOpa: true,
361
- failed: 0,
362
- passed: 0
363
- })
364
- expect(test.logs[0]).toStrictEqual({
365
- result: true,
366
- actual: true,
367
- expected: true,
368
- message: 'message',
369
- runtime: 1419
370
- })
371
- })
372
-
373
- it('fails on invalid test', async () => {
374
- await begin(job, url, {
375
- isOpa: true,
376
- ...getBeginInfo()
377
- })
378
- await expect(log(job, url, {
379
- module: 'module 1',
380
- name: 'unknown',
381
- result: true,
382
- message: 'message',
383
- actual: true,
384
- expected: true,
385
- testId: 'unk',
386
- runtime: 1000
387
- })).rejects.toThrow(UTRError.QUNIT_ERROR('No QUnit unit test found with id unk'))
388
- expect(stop).toHaveBeenCalledWith(job, url)
389
- expect(job.failed).toStrictEqual(true)
390
- })
391
- })
392
-
393
- describe('testDone', () => {
394
- const getTestDoneFor1a = () => ({
395
- name: 'test 1a',
396
- module: 'module 1',
397
- skipped: false,
398
- failed: 0,
399
- passed: 1,
400
- total: 1,
401
- runtime: 1515,
402
- assertions: [{
403
- result: true,
404
- message: 'message'
405
- }],
406
- testId: '1a',
407
- duration: 1515
408
- })
409
-
410
- beforeEach(async () => {
411
- await begin(job, url, {
412
- isOpa: false,
413
- ...getBeginInfo()
414
- })
415
- })
416
-
417
- describe('test success (no screenshot, page.passed += 1)', () => {
418
- afterEach(() => {
419
- expect(screenshot).not.toHaveBeenCalled()
420
- const { page, test } = get(job, url, '1a')
421
- expect(page).toMatchObject({
422
- isOpa: false,
423
- failed: 0,
424
- passed: 1
425
- })
426
- expect(test).toMatchObject({
427
- report: {
428
- skipped: false,
429
- failed: 0,
430
- runtime: 1515,
431
- duration: 1515
432
- }
433
- })
434
- expect(test.end).toBeInstanceOf(Date)
435
- })
436
-
437
- it('store reports', async () => {
438
- await testDone(job, url, getTestDoneFor1a())
439
- const { test } = get(job, url, '1a')
440
- expect(test).toMatchObject({
441
- report: {
442
- passed: 1,
443
- total: 1
444
- }
445
- })
446
- })
447
-
448
- it('supports more than one assertion in the test', async () => {
449
- await testDone(job, url, {
450
- ...getTestDoneFor1a(),
451
- passed: 2,
452
- total: 2
453
- })
454
- const { test } = get(job, url, '1a')
455
- expect(test).toMatchObject({
456
- report: {
457
- passed: 2,
458
- total: 2
459
- }
460
- })
461
- })
462
- })
463
-
464
- describe('test failure (page.failed += 1)', () => {
465
- afterEach(() => {
466
- const { page, test } = get(job, url, '1a')
467
- expect(page).toMatchObject({
468
- isOpa: false,
469
- failed: 1,
470
- passed: 0
471
- })
472
- expect(test).toMatchObject({
473
- report: {
474
- skipped: false,
475
- runtime: 1515,
476
- duration: 1515
477
- }
478
- })
479
- expect(test.end).toBeInstanceOf(Date)
480
- expect(job.failed).toStrictEqual(true)
481
- })
482
-
483
- describe('screenshot not supported', () => {
484
- it('increases failed count only', async () => {
485
- await testDone(job, url, {
486
- ...getTestDoneFor1a(),
487
- passed: 0,
488
- failed: 1,
489
- total: 1
490
- })
491
- expect(screenshot).not.toHaveBeenCalled()
492
- const { test } = get(job, url, '1a')
493
- expect(test).toMatchObject({
494
- report: {
495
- passed: 0,
496
- failed: 1,
497
- total: 1
498
- }
499
- })
500
- })
501
-
502
- it('supports more than one failed assertion in the test', async () => {
503
- await testDone(job, url, {
504
- ...getTestDoneFor1a(),
505
- passed: 0,
506
- failed: 2,
507
- total: 2
508
- })
509
- const { test } = get(job, url, '1a')
510
- expect(test).toMatchObject({
511
- report: {
512
- passed: 0,
513
- failed: 2,
514
- total: 2
515
- }
516
- })
517
- })
518
-
519
- it('supports failed and succeeded assertions in the test', async () => {
520
- await testDone(job, url, {
521
- ...getTestDoneFor1a(),
522
- passed: 1,
523
- failed: 1,
524
- total: 2
525
- })
526
- const { test } = get(job, url, '1a')
527
- expect(test).toMatchObject({
528
- report: {
529
- passed: 1,
530
- failed: 1,
531
- total: 2
532
- }
533
- })
534
- })
535
- })
536
-
537
- describe('screenshot supported', () => {
538
- beforeEach(() => {
539
- job.browserCapabilities.screenshot = '.png'
540
- })
541
-
542
- it('takes a screenshot', async () => {
543
- await testDone(job, url, {
544
- ...getTestDoneFor1a(),
545
- passed: 0,
546
- failed: 1,
547
- total: 1
548
- })
549
- expect(screenshot).toHaveBeenCalledWith(job, url, '1a')
550
- })
551
-
552
- it('takes a screenshot (even if disabled)', async () => {
553
- job.screenshot = false
554
- await testDone(job, url, {
555
- ...getTestDoneFor1a(),
556
- passed: 0,
557
- failed: 1,
558
- total: 1
559
- })
560
- expect(screenshot).toHaveBeenCalledWith(job, url, '1a')
561
- const { test } = get(job, url, '1a')
562
- expect(test.screenshot).toStrictEqual('1a.png')
563
- })
564
-
565
- it('takes a screenshot (hash changing)', async () => {
566
- await testDone(job, url + '#any_hash', {
567
- ...getTestDoneFor1a(),
568
- passed: 0,
569
- failed: 1,
570
- total: 1
571
- })
572
- expect(screenshot).toHaveBeenCalledWith(job, url, '1a')
573
- })
574
-
575
- it('does not stop if screenshot failed', async () => {
576
- screenshot.mockImplementation(() => Promise.reject(new Error()))
577
- await testDone(job, url, {
578
- ...getTestDoneFor1a(),
579
- passed: 0,
580
- failed: 1,
581
- total: 1
582
- })
583
- expect(mockGenericError).toHaveBeenCalled()
584
- expect(stop).not.toHaveBeenCalled()
585
- })
586
- })
587
- })
588
-
589
- it('fails if tests not started', async () => {
590
- delete job.qunitPages
591
- await expect(testDone(job, url, getTestDoneFor1a()))
592
- .rejects.toThrow(UTRError.QUNIT_ERROR('No QUnit page found for http://localhost:80/page1.html'))
593
- expect(stop).toHaveBeenCalledWith(job, url)
594
- expect(job.failed).toStrictEqual(true)
595
- })
596
-
597
- it('fails if URL does not exist', async () => {
598
- job.qunitPages = {}
599
- await expect(testDone(job, url, getTestDoneFor1a()))
600
- .rejects.toThrow(UTRError.QUNIT_ERROR('No QUnit page found for http://localhost:80/page1.html'))
601
- expect(stop).toHaveBeenCalledWith(job, url)
602
- expect(job.failed).toStrictEqual(true)
603
- })
604
-
605
- it('fails on invalid test id (--qunit-strict)', async () => {
606
- job.qunitStrict = true
607
- await expect(testDone(job, url, {
608
- ...getTestDoneFor1a(),
609
- testId: '1c'
610
- }))
611
- .rejects.toThrow(UTRError.QUNIT_ERROR('No QUnit unit test found with id 1c'))
612
- expect(stop).toHaveBeenCalledWith(job, url)
613
- expect(job.failed).toStrictEqual(true)
614
- })
615
-
616
- it('fails on invalid test id (--no-qunit-strict)', async () => {
617
- await expect(testDone(job, url, {
618
- ...getTestDoneFor1a(),
619
- testId: '1c'
620
- }))
621
- .rejects.toThrow(UTRError.QUNIT_ERROR('No QUnit unit test found with id 1c'))
622
- expect(stop).toHaveBeenCalledWith(job, url)
623
- expect(job.failed).toStrictEqual(true)
624
- })
625
-
626
- describe('fail OPA fast behavior', () => {
627
- beforeEach(async () => {
628
- job.failOpaFast = true
629
- await testDone(job, url, {
630
- ...getTestDoneFor1a(),
631
- passed: 0,
632
- failed: 1,
633
- total: 1
634
- })
635
- })
636
-
637
- it('fails the test immediately', () => {
638
- const { test } = get(job, url, '1a')
639
- expect(test).toMatchObject({
640
- report: {
641
- passed: 0,
642
- failed: 1,
643
- total: 1
644
- }
645
- })
646
- })
647
-
648
- it('flags the remaining tests as skipped', () => {
649
- const { page } = get(job, url)
650
- page.modules.forEach(module => {
651
- module.tests.forEach(test => {
652
- if (test.testId !== '1a') {
653
- expect(test.skip).toStrictEqual(true)
654
- }
655
- })
656
- })
657
- })
658
-
659
- it('stops the page immediately', () => {
660
- expect(stop).toHaveBeenCalledWith(job, url)
661
- })
662
- })
663
- })
664
-
665
- describe('done', () => {
666
- const getDoneInfo = () => ({
667
- failed: 0,
668
- passed: 4,
669
- total: 4,
670
- runtime: 2853
671
- })
672
-
673
- beforeEach(async () => {
674
- await begin(job, url, {
675
- isOpa: false,
676
- ...getBeginInfo()
677
- })
678
- })
679
-
680
- it('stops the browser', async () => {
681
- await done(job, url, getDoneInfo())
682
- expect(stop).toHaveBeenCalledWith(job, url)
683
- })
684
-
685
- it('takes a screenshot if enabled', async () => {
686
- job.browserCapabilities.screenshot = '.png'
687
- await done(job, url, getDoneInfo())
688
- expect(screenshot).toHaveBeenCalledWith(job, url, 'done')
689
- })
690
-
691
- it('takes a screenshot if enabled (hash changing)', async () => {
692
- job.browserCapabilities.screenshot = '.png'
693
- await done(job, url + '#any_hash', getDoneInfo())
694
- expect(screenshot).toHaveBeenCalledWith(job, url, 'done')
695
- })
696
-
697
- it('fails properly if screenshot failed', async () => {
698
- job.browserCapabilities.screenshot = '.png'
699
- screenshot.mockImplementation(() => Promise.reject(new Error()))
700
- await done(job, url, getDoneInfo())
701
- expect(mockGenericError).toHaveBeenCalled()
702
- expect(stop).toHaveBeenCalledWith(job, url)
703
- expect(job.failed).not.toStrictEqual(true)
704
- })
705
-
706
- it('takes no screenshot if disabled', async () => {
707
- await done(job, url, getDoneInfo())
708
- expect(screenshot).not.toHaveBeenCalled()
709
- })
710
-
711
- it('associates the report to the qunitPage', async () => {
712
- await done(job, url, getDoneInfo())
713
- const { page } = get(job, url)
714
- expect(page.report).toStrictEqual(getDoneInfo())
715
- })
716
-
717
- it('collects and strips coverage information', async () => {
718
- const report = getDoneInfo()
719
- const coverage = {}
720
- report.__coverage__ = coverage
721
- await done(job, url, report)
722
- expect(collect).toHaveBeenCalledWith(job, url, coverage)
723
- const { page } = get(job, url)
724
- expect(page.report).toStrictEqual(getDoneInfo())
725
- })
726
-
727
- it('documents when the page ended', async () => {
728
- await done(job, url, getDoneInfo())
729
- const { page } = get(job, url)
730
- expect(page.end).toBeInstanceOf(Date)
731
- })
732
-
733
- it('fails if tests not started', async () => {
734
- delete job.qunitPages
735
- await expect(done(job, url, getDoneInfo())).rejects.toThrow(UTRError.QUNIT_ERROR('No QUnit page found for http://localhost:80/page1.html'))
736
- expect(stop).toHaveBeenCalledWith(job, url)
737
- expect(job.failed).toStrictEqual(true)
738
- })
739
-
740
- it('fails if URL does not exist', async () => {
741
- job.qunitPages = {}
742
- await expect(done(job, url, {})).rejects.toThrow(UTRError.QUNIT_ERROR('No QUnit page found for http://localhost:80/page1.html'))
743
- expect(stop).toHaveBeenCalledWith(job, url)
744
- expect(job.failed).toStrictEqual(true)
745
- })
746
- })
747
- })