@@ -40,9 +40,11 @@ function loadErrorSpec (options: Options): VerifyFunc {
40
40
cy . get ( '.runnable-header' , { log : false } ) . should ( 'be.visible' )
41
41
// Extended timeout needed due to lengthy Angular bootstrap on Windows
42
42
cy . contains ( 'Your tests are loading...' , { timeout : 60000 , log : false } ) . should ( 'not.exist' )
43
+ // Then ensure the tests have finished
44
+ cy . get ( '[aria-label="Rerun all tests"]' , { timeout : 30000 } )
43
45
cy . findByLabelText ( 'Stats' ) . within ( ( ) => {
44
- cy . get ( '.passed .num' , { timeout : 30000 } ) . should ( 'have.text' , `${ passCount } ` )
45
- cy . get ( '.failed .num' , { timeout : 30000 } ) . should ( 'have.text' , `${ failCount } ` )
46
+ cy . get ( '.passed .num' ) . should ( 'have.text' , `${ passCount } ` )
47
+ cy . get ( '.failed .num' ) . should ( 'have.text' , `${ failCount } ` )
46
48
} )
47
49
48
50
// Return scoped verify function with spec options baked in
@@ -285,19 +287,36 @@ describe('Nuxt', {
285
287
projectName : 'nuxtjs-vue2-configured' ,
286
288
configFile : 'cypress.config.js' ,
287
289
filePath : 'components/Errors.cy.js' ,
288
- failCount : 3 ,
290
+ failCount : 4 ,
289
291
} )
290
292
291
293
verify ( 'error on mount' , {
292
294
fileName : 'Errors.vue' ,
293
295
line : 19 ,
296
+ uncaught : true ,
297
+ uncaughtMessage : 'mount error' ,
294
298
message : [
295
299
'mount error' ,
296
300
] ,
297
301
stackRegex : / E r r o r s \. v u e : 1 9 / ,
298
302
codeFrameText : 'Errors.vue' ,
299
303
} )
300
304
305
+ verify ( 'sync error' , {
306
+ fileName : 'Errors.vue' ,
307
+ line : 24 ,
308
+ uncaught : true ,
309
+ uncaughtMessage : 'sync error' ,
310
+ message : [
311
+ 'The following error originated from your application code' ,
312
+ 'sync error' ,
313
+ ] ,
314
+ stackRegex : / E r r o r s \. v u e : 2 4 / ,
315
+ codeFrameText : 'Errors.vue' ,
316
+ } ) . then ( ( ) => {
317
+ verifyErrorOnlyCapturedOnce ( 'Error: sync error' )
318
+ } )
319
+
301
320
verify ( 'async error' , {
302
321
fileName : 'Errors.vue' ,
303
322
line : 28 ,
@@ -413,12 +432,37 @@ angularVersions.forEach((angularVersion) => {
413
432
projectName : `angular-${ angularVersion } ` ,
414
433
configFile : 'cypress.config.ts' ,
415
434
filePath : 'src/app/errors.cy.ts' ,
416
- failCount : 1 ,
435
+ failCount : 3 ,
436
+ passCount : 1 ,
437
+ } )
438
+
439
+ verify ( 'sync error' , {
440
+ fileName : 'errors.ts' ,
441
+ line : 14 ,
442
+ column : 11 ,
443
+ uncaught : true ,
444
+ uncaughtMessage : 'sync error' ,
445
+ message : [
446
+ 'The following error originated from your application code' ,
447
+ 'sync error' ,
448
+ ] ,
449
+ } ) . then ( ( ) => {
450
+ verifyErrorOnlyCapturedOnce ( 'Error: sync error' )
417
451
} )
418
452
419
- // Angular uses ZoneJS which encapsulates errors thrown by components
420
- // Thus, the mount, sync, and async error case errors will not propagate to Cypress
421
- // and thus won't fail the tests
453
+ verify ( 'async error' , {
454
+ fileName : 'errors.ts' ,
455
+ line : 19 ,
456
+ column : 13 ,
457
+ uncaught : true ,
458
+ uncaughtMessage : 'async error' ,
459
+ message : [
460
+ 'The following error originated from your application code' ,
461
+ 'async error' ,
462
+ ] ,
463
+ } ) . then ( ( ) => {
464
+ verifyErrorOnlyCapturedOnce ( 'Error: async error' )
465
+ } )
422
466
423
467
verify ( 'command failure' , {
424
468
line : 21 ,
0 commit comments