Skip to content

Commit 0f371b5

Browse files
committed
Test wit timeout
1 parent b06d54c commit 0f371b5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cypress/integration/user_story.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('Test new User Registration Workflow', () => {
100100
})
101101

102102
it('Allows user to edit the story created by them', () => {
103-
cy.get('[data-cy=btn-edit]').contains('Edit').click()
103+
cy.get('[data-cy=btn-edit]', { timeout: 1000 }).contains('Edit').click()
104104

105105
cy.get('[data-cy=edit-description]').type(editedDescription)
106106

@@ -114,9 +114,9 @@ describe('Test new User Registration Workflow', () => {
114114

115115
cy.get('[data-cy=stories]').contains(testStory.title).click()
116116

117-
cy.get('[data-cy=comment-input]').type(testComment)
117+
cy.get('[data-cy=comment-input-2]').type(testComment)
118118

119-
cy.get('[data-cy=btn-comment]').contains('Add Comment').click()
119+
cy.get('[data-cy=btn-comment-2]').contains('Add Comment').click()
120120

121121
cy.get('[data-cy=comment-content]').contains(testComment)
122122

src/components/CommentForm.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const CommentForm = (props) => {
3939
cols='25'
4040
name='Comments'
4141
value={comment}
42+
data-cy={`comment-input-${id}`}
4243
ref={register({ required: true })}
4344
onChange={(e) => setComment(e.target.value)}
4445
></textarea>
@@ -57,7 +58,9 @@ const CommentForm = (props) => {
5758
</div>
5859
{errors.Comments && <FormError message='Reply cannot be empty' />}
5960
<MediaPreview attachments={attachments} setAttachments={setAttachments} />
60-
<Button className='btn btn-default'>{cta}</Button>
61+
<Button className='btn btn-default' data-cy={`btn-comment-${id}`}>
62+
{cta}
63+
</Button>
6164
</form>
6265
)
6366
}

0 commit comments

Comments
 (0)