@@ -10,21 +10,29 @@ describe('Test new User Registration Workflow', () => {
1010 before ( 'Register a new user' , ( ) => {
1111 cy . visit ( '/' )
1212
13- cy . get ( '[href="/login"]' ) . contains ( 'Sign In' ) . click ( )
13+ cy
14+ . get ( '[data-cy=btn-signin]' )
15+ . should ( 'have.attr' , 'href' , '/login' )
16+ . contains ( 'Sign In' )
17+ . click ( )
1418
1519 cy . url ( ) . should ( 'equal' , 'http://localhost:3000/login' )
1620
17- cy . get ( '[href="/register"]' ) . contains ( 'Create an account' ) . click ( )
21+ cy
22+ . get ( '[data-cy=link-create-account]' )
23+ . should ( 'have.attr' , 'href' , '/register' )
24+ . contains ( 'Create an account' )
25+ . click ( )
1826
1927 cy . url ( ) . should ( 'equal' , 'http://localhost:3000/register' )
2028
21- cy . get ( '[name =username]' ) . should ( 'have.attr' , 'type' , 'text' ) . type ( testUser . username )
29+ cy . get ( '[data-cy =username]' ) . should ( 'have.attr' , 'type' , 'text' ) . type ( testUser . username )
2230
23- cy . get ( '[name =email]' ) . should ( 'have.attr' , 'type' , 'text' ) . type ( testUser . email )
31+ cy . get ( '[data-cy =email]' ) . should ( 'have.attr' , 'type' , 'text' ) . type ( testUser . email )
2432
25- cy . get ( '[name =password]' ) . should ( 'have.attr' , 'type' , 'password' ) . type ( testUser . password )
33+ cy . get ( '[data-cy =password]' ) . should ( 'have.attr' , 'type' , 'password' ) . type ( testUser . password )
2634
27- cy . get ( '[name =tc]' ) . should ( 'have.attr' , 'type' , 'checkbox' ) . click ( )
35+ cy . get ( '[data-cy =tc]' ) . should ( 'have.attr' , 'type' , 'checkbox' ) . click ( )
2836
2937 cy . get ( '[data-cy=btn-register]' ) . contains ( 'Register' ) . click ( )
3038
@@ -43,17 +51,21 @@ describe('Test new User Registration Workflow', () => {
4351 } )
4452
4553 it ( 'Allows user to create new story' , ( ) => {
46- cy . get ( '[href="/newStory"]' ) . contains ( '+ New Story' ) . click ( )
54+ cy
55+ . get ( '[data-cy=btn-new-story]' )
56+ . should ( 'have.attr' , 'href' , '/newStory' )
57+ . contains ( '+ New Story' )
58+ . click ( )
4759
4860 cy . url ( ) . should ( 'equal' , 'http://localhost:3000/newStory' )
4961
50- cy . get ( '[name =title]' ) . type ( 'This is a test story' )
62+ cy . get ( '[data-cy =title]' ) . type ( 'This is a test story' )
5163
52- cy . get ( '[name =product]' ) . select ( 'EOS Icons' )
64+ cy . get ( '[data-cy =product]' ) . select ( 'EOS Icons' )
5365
54- cy . get ( '[name =category]' ) . select ( 'Documentation' )
66+ cy . get ( '[data-cy =category]' ) . select ( 'Documentation' )
5567
56- cy . get ( '[name =priority]' ) . select ( 'High' )
68+ cy . get ( '[data-cy =priority]' ) . select ( 'High' )
5769
5870 cy
5971 . get ( '[data-cy=description-editor]' )
@@ -85,16 +97,18 @@ describe('Test new User Registration Workflow', () => {
8597 } )
8698
8799 it ( 'Allows user to comment on a story' , ( ) => {
88- cy . get ( '[href="/"] ' ) . click ( )
100+ cy . get ( '[data-cy=nav-eos-logo]' ) . should ( 'have.attr' , 'href' , '/ ') . click ( )
89101
90102 cy . get ( '[data-cy=stories]' ) . contains ( 'Testing my story' ) . click ( )
91103
92- cy . get ( '[name="addComment" ]' ) . type ( 'Testing comments' )
104+ cy . get ( '[data-cy=comment-input ]' ) . type ( 'Testing comments' )
93105
94106 cy . get ( '[data-cy=btn-comment]' ) . contains ( 'Add Comment' ) . click ( )
95107
96- cy . get ( '[data-cy=comment-content] > a' ) . contains ( testUser . username )
97-
98108 cy . get ( '[data-cy=comment-content]' ) . contains ( 'Testing comments' )
109+
110+ cy . get ( '[data-cy=comment-username]' ) . contains ( testUser . username ) . click ( )
111+
112+ cy . url ( ) . should ( 'contain' , 'profile' )
99113 } )
100114} )
0 commit comments