@@ -23,31 +23,27 @@ describe('Test new User Registration Workflow', () => {
2323
2424 cy
2525 . get ( '[data-cy=btn-signin]' )
26- . should ( 'have.attr' , 'href' , '/login' )
27- . contains ( 'Sign In' )
2826 . click ( )
2927
30- cy . url ( ) . should ( 'equal' , 'http://localhost:3000/ login' )
28+ cy . url ( ) . should ( 'equal' , ` ${ Cypress . config ( ) . baseUrl } / login` )
3129
3230 cy
3331 . get ( '[data-cy=link-create-account]' )
34- . should ( 'have.attr' , 'href' , '/register' )
35- . contains ( 'Create an account' )
3632 . click ( )
3733
38- cy . url ( ) . should ( 'equal' , 'http://localhost:3000/ register' )
34+ cy . url ( ) . should ( 'equal' , ` ${ Cypress . config ( ) . baseUrl } / register` )
3935
40- cy . get ( '[data-cy=username]' ) . should ( 'have.attr' , 'type' , 'text' ) . type ( testUser . username )
36+ cy . get ( '[data-cy=username]' ) . type ( testUser . username )
4137
42- cy . get ( '[data-cy=email]' ) . should ( 'have.attr' , 'type' , 'text' ) . type ( testUser . email )
38+ cy . get ( '[data-cy=email]' ) . type ( testUser . email )
4339
4440 cy . get ( '[data-cy=password]' ) . should ( 'have.attr' , 'type' , 'password' ) . type ( testUser . password )
4541
46- cy . get ( '[data-cy=tc]' ) . should ( 'have.attr' , 'type' , 'checkbox' ) . click ( )
42+ cy . get ( '[data-cy=tc]' ) . click ( )
4743
48- cy . get ( '[data-cy=btn-register]' ) . contains ( 'Register' ) . click ( )
44+ cy . get ( '[data-cy=btn-register]' ) . click ( )
4945
50- cy . url ( ) . should ( 'equal' , 'http://localhost:3000/' )
46+ cy . url ( ) . should ( 'equal' , ` ${ Cypress . config ( ) . baseUrl } /` )
5147
5248 cy . saveLocalStorage ( )
5349 } )
@@ -64,11 +60,9 @@ describe('Test new User Registration Workflow', () => {
6460 it ( 'Allows user to create new story' , ( ) => {
6561 cy
6662 . get ( '[data-cy=btn-new-story]' )
67- . should ( 'have.attr' , 'href' , '/newStory' )
68- . contains ( '+ New Story' )
6963 . click ( )
7064
71- cy . url ( ) . should ( 'equal' , 'http://localhost:3000/ newStory' )
65+ cy . url ( ) . should ( 'equal' , ` ${ Cypress . config ( ) . baseUrl } / newStory` )
7266
7367 cy . get ( '[data-cy=title]' ) . type ( testStory . title )
7468
@@ -82,9 +76,9 @@ describe('Test new User Registration Workflow', () => {
8276 . get ( '[data-cy=description-editor]' )
8377 . type ( testStory . description )
8478
85- cy . get ( '[data-cy=btn-submit]' ) . contains ( 'Submit' ) . click ( )
79+ cy . get ( '[data-cy=btn-submit]' ) . click ( )
8680
87- cy . url ( ) . should ( 'equal' , 'http://localhost:3000/' )
81+ cy . url ( ) . should ( 'equal' , ` ${ Cypress . config ( ) . baseUrl } /` )
8882 } )
8983
9084 it ( 'Displays story in home page, once created' , ( ) => {
@@ -98,23 +92,25 @@ describe('Test new User Registration Workflow', () => {
9892 } )
9993
10094 it ( 'Allows user to edit the story created by them' , ( ) => {
101- cy . get ( '[data-cy=btn-edit]' ) . contains ( 'Edit' ) . click ( )
95+ cy . wait ( 1500 )
96+
97+ cy . get ( '[data-cy=btn-edit]' ) . click ( )
10298
10399 cy . get ( '[data-cy=edit-description]' ) . type ( editedDescription )
104100
105- cy . get ( '[data-cy=story-buttons]' ) . contains ( 'Save ') . click ( )
101+ cy . get ( '[data-cy=btn-save] ' ) . click ( )
106102
107103 cy . get ( '[data-cy=story-description]' ) . contains ( editedDescription )
108104 } )
109105
110106 it ( 'Allows user to comment on a story' , ( ) => {
111- cy . get ( '[data-cy=nav-eos-logo]' ) . should ( 'have.attr' , 'href' , '/' ) . click ( )
107+ cy . get ( '[data-cy=nav-eos-logo]' ) . click ( )
112108
113109 cy . get ( '[data-cy=stories]' ) . contains ( testStory . title ) . click ( )
114110
115- cy . get ( '[data-cy=comment-input]' ) . type ( testComment )
111+ cy . get ( '[data-cy=comment-input-2 ]' ) . type ( testComment )
116112
117- cy . get ( '[data-cy=btn-comment]' ) . contains ( 'Add Comment ') . click ( )
113+ cy . get ( '[data-cy=btn-comment-2] ' ) . click ( )
118114
119115 cy . get ( '[data-cy=comment-content]' ) . contains ( testComment )
120116
0 commit comments