-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-23346 MM-T123 Add e2e pinned parent post test #6102
MM-23346 MM-T123 Add e2e pinned parent post test #6102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @josephk96! Please see comments.
}); | ||
}); | ||
|
||
it('M23346 - Pinned parent post: reply count remains in center channel and is correct', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('M23346 - Pinned parent post: reply count remains in center channel and is correct', () => { | |
it('MM-T123 - Pinned parent post: reply count remains in center channel and is correct', () => { |
// # Assign lastPostId variable to the id of the last post | ||
cy.getLastPostId().then((postId) => { | ||
lastPostId = postId; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to move this into the test block itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it to the test block as you suggested. However, after I moved it to test block, the lastPostId = postId;
variable assignment expression did not work as intended, so I had to wrap all the commands that use postId
within the cy.getLastPostId
function.
I'm not sure why the variable reassignment did not work, have you encountered this issue by any chance? I tried creating a test variable a
in the global scope, reassigned that variable in the test block and console.log it and it was working as intended, but reassigning a variable to the value of the postId returned from the promise doesn't work in the test block, but it does in thebefore
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the assignment happened first on the test block before going into the before hook. That's why the value it's getting is the initial value of undefined. But it's just my assumption as I'm getting similar issue in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the one you implemented is the one I'm thinking actually. Wrapping everything inside the cy.getLastPostId
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for the explanation Saturn!
Co-authored-by: Saturnino Abril <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @josephk96, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution @josephk96! Looks perfect!
🎉
Summary
Ticket Link
Jira: https://mattermost.atlassian.net/browse/MM-23346
Test case: https://automation-test-cases.vercel.app/test/MM-T123