@@ -43,9 +43,13 @@ describe("Guest comment", { testIsolation: false }, () => {
4343 const loggedInEditText = generateRandomCopy ( )
4444 cy . intercept ( "PUT" , ".netlify/functions/comment/*" ) . as ( "putComment" )
4545 cy . get ( ".overflow-menu-button" ) . first ( ) . click ( )
46- cy . get ( ".comment-edit-button" ) . first ( ) . click ( )
47- cy . get ( "form.comment-form .comment-field" ) . clear ( ) . type ( loggedInEditText )
48- cy . get ( "form.comment-form .comment-update-button" ) . click ( )
46+ cy . get ( ".comment-edit-button" ) . click ( )
47+ cy . get ( "li.comment.is-open form.comment-form .comment-field" )
48+ . clear ( )
49+ . type ( loggedInEditText )
50+ cy . get (
51+ "li.comment.is-open form.comment-form .comment-update-button"
52+ ) . click ( )
4953 cy . wait ( "@putComment" ) . its ( "response.statusCode" ) . should ( "eq" , 204 ) // 204
5054 cy . contains ( "article.comment-body p" , loggedInEditText ) . should ( "exist" )
5155 } )
@@ -65,13 +69,19 @@ describe("Guest comment", { testIsolation: false }, () => {
6569 } else req . reply ( )
6670 } ) . as ( "putComment" )
6771 cy . get ( ".overflow-menu-button" ) . first ( ) . click ( )
68- cy . get ( ".comment-edit-button" ) . first ( ) . click ( )
72+ cy . get ( ".comment-edit-button" ) . click ( )
73+ cy . get ( "li.comment.is-open form.comment-form .comment-field" )
74+ . clear ( )
75+ . type ( errorText )
76+ cy . get (
77+ "li.comment.is-open form.comment-form .comment-update-button"
78+ ) . click ( )
6979
70- cy . get ( "form.comment-form .comment-field" ) . clear ( ) . type ( errorText )
71- cy . get ( "form.comment-form .comment-update-button" ) . click ( )
7280 cy . wait ( "@putComment" )
7381
74- cy . get ( "form.comment-form .comment-update-button" ) . click ( )
82+ cy . get (
83+ "li.comment.is-open form.comment-form .comment-update-button"
84+ ) . click ( )
7585
7686 cy . wait ( "@putComment" ) . then ( interception => {
7787 expect ( interception . response . statusCode ) . to . equal ( 204 )
@@ -102,10 +112,12 @@ describe("Guest comment", { testIsolation: false }, () => {
102112 } )
103113
104114 it ( "Reply to a comment as a logged-in guest" , ( ) => {
105- cy . get ( "button.comment-reply-button" ) . first ( ) . as ( "replyButton" )
106- cy . get ( "@replyButton" ) . closest ( "article.comment-body" ) . as ( "commentBody" )
107- cy . get ( "@replyButton" ) . click ( )
108- cy . get ( "form.guest-login-form" ) . should ( "not.exist" )
115+ const commentText = generateRandomCopy ( )
116+ cy . get ( "button.comment-reply-button" ) . first ( ) . click ( )
117+ // cy.wait(500)
118+ cy . get ( "textarea.comment-field" ) . should ( "have.length" , 1 ) . type ( commentText )
119+ cy . get ( "button.comment-submit-button" ) . click ( )
120+ cy . get ( "article.comment-body p" ) . contains ( commentText ) . should ( "exist" )
109121 } )
110122
111123 it ( "Can log out" , ( ) => {
0 commit comments