Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-23346 MM-T123 Add e2e pinned parent post test #6102

Merged
merged 4 commits into from
Aug 11, 2020

Conversation

josephk96
Copy link
Contributor

@josephk96 josephk96 commented Aug 8, 2020

Summary

  • Created a test that replies to a parent post, pins the parent post and verifies that the reply count exists and is correct

Ticket Link
Jira: https://mattermost.atlassian.net/browse/MM-23346
Test case: https://automation-test-cases.vercel.app/test/MM-T123

@hanzei hanzei added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester Hackfest labels Aug 9, 2020
Copy link
Member

@saturninoabril saturninoabril left a 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', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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', () => {

Comment on lines 41 to 44
// # Assign lastPostId variable to the id of the last post
cy.getLastPostId().then((postId) => {
lastPostId = postId;
});
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@saturninoabril saturninoabril Aug 10, 2020

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.

Copy link
Member

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.

Copy link
Contributor Author

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!

@saturninoabril saturninoabril changed the title MM-23346 Add e2e pinned parent post test MM-23346 MM-T123 Add e2e pinned parent post test Aug 10, 2020
Copy link
Member

@saturninoabril saturninoabril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @josephk96, LGTM!

@saturninoabril saturninoabril removed the 2: Dev Review Requires review by a core commiter label Aug 10, 2020
Copy link
Contributor

@prapti prapti left a 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!
🎉

@prapti prapti added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels Aug 11, 2020
@prapti prapti merged commit ccd5fab into mattermost:master Aug 11, 2020
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Aug 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation Hackfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants