@@ -32,7 +32,12 @@ describe(`DISPLAYS CORRECT TUTORIALS ON HOMEPAGE AND TUTORIALS PAGE`, function (
32
32
cy . get ( '[data-cy=tutorial-card-title]' ) . should ( 'have.length' , courses . all . length ) // displaying # of tutorials in all array in courses.json
33
33
. and ( 'have.length' , Object . keys ( tutorials ) . length ) // displaying # of tutorials in tutorials.json
34
34
for ( let i = 0 ; i < courses . all . length ; i ++ ) {
35
- cy . get ( '[data-cy=tutorial-card-title]' ) . eq ( i ) . should ( 'contain' , tutorials [ courses . all [ i ] ] . title )
35
+ const tutorial = tutorials [ courses . all [ i ] ]
36
+
37
+ cy . get ( '[data-cy=tutorial-card-title]' ) . eq ( i ) . should ( 'contain' , tutorial . title )
38
+ cy . get ( `.tutorial a[href="/${ tutorial . url } "]` ) . click ( )
39
+ cy . location ( 'pathname' ) . should ( 'eq' , `/${ tutorial . url } ` )
40
+ cy . visit ( `/tutorials` )
36
41
}
37
42
}
38
43
@@ -50,7 +55,12 @@ describe(`DISPLAYS CORRECT TUTORIALS ON HOMEPAGE AND TUTORIALS PAGE`, function (
50
55
cy . visit ( `/` )
51
56
cy . get ( '[data-cy=tutorial-card-title]' ) . should ( 'have.length' , courses . featured . length )
52
57
for ( let i = 0 ; i < courses . featured . length ; i ++ ) {
53
- cy . get ( '[data-cy=tutorial-card-title]' ) . eq ( i ) . should ( 'contain' , tutorials [ courses . featured [ i ] ] . title )
58
+ const tutorial = tutorials [ courses . featured [ i ] ]
59
+
60
+ cy . get ( '[data-cy=tutorial-card-title]' ) . eq ( i ) . should ( 'contain' , tutorial . title )
61
+ cy . get ( `.tutorial a[href="/${ tutorial . url } "]` ) . click ( )
62
+ cy . location ( 'pathname' ) . should ( 'eq' , `/${ tutorial . url } ` )
63
+ cy . visit ( `/` )
54
64
}
55
65
} )
56
66
@@ -440,7 +450,7 @@ function advanceThroughLessons (tutorialId) {
440
450
}
441
451
442
452
function advanceToNextLesson ( ) {
443
- // ADVANCE TO NEXT LESSON AS ABLE OR BY CHEATING, DEPENDING ON LESSON TYPE
453
+ // ADVANCE TO NEXT LESSON DEPENDING ON ITS TYPE
444
454
let advance = { }
445
455
446
456
switch ( lessonType ) {
@@ -467,13 +477,8 @@ function advanceThroughLessons (tutorialId) {
467
477
}
468
478
469
479
it ( `${ advance . msg } ` , function ( ) {
470
- if ( advance . method === 'cheat' ) {
471
- cy . log ( `cannot fully test tutorial ${ tutorialId } , lesson ${ lessonNr } because it is of type ${ lessonType } ` )
472
- cy . visit ( `/${ tutorialName } /${ nextLessonNr } ` )
473
- } else if ( advance . method === 'click' ) {
474
- cy . get ( `[data-cy=${ advance . buttonData } ]` ) . should ( 'be.visible' ) . and ( 'not.be.disabled' )
475
- cy . get ( `[data-cy=${ advance . buttonData } ]` ) . click ( )
476
- }
480
+ cy . get ( `[data-cy=${ advance . buttonData } ]` ) . should ( 'be.visible' ) . and ( 'not.be.disabled' )
481
+ cy . get ( `[data-cy=${ advance . buttonData } ]` ) . click ( )
477
482
cy . url ( ) . should ( 'include' , `/${ tutorialName } /${ nextLessonNr } ` )
478
483
cy . contains ( 'h1' , lessons [ index + 1 ] . title )
479
484
} )
0 commit comments