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

[MM-23937] Add e2e tests for group mentions #5530

Merged
merged 12 commits into from
May 21, 2020

Conversation

fmunshi
Copy link
Contributor

@fmunshi fmunshi commented May 18, 2020

Summary

  • Adds e2e tests for group mentions.

  • The following two assertions run for two different tests, once to enable and disable the allow reference switch and once to enable and disable the group mentions permission on a regular user while keeping the group allow reference enabled

To test whether a group mention is enabled the tests assert the following:

  • the suggestion list shows the given group
  • posting the message as a user not in the group shows it as a blue link
  • viewing the message as a user in the group shows it as highlighted

To test that a group mention is disabled the tests assert the following:

  • the suggestion list does not show the given group
  • posting the message containing the group does not apply any custom link styling on it
  • viewing the message as a user in the group shows it as regular text since the mention did not trigger notifications

Ticket Link

fm2munsh added 3 commits May 17, 2020 01:20
@fmunshi fmunshi added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels May 18, 2020
@@ -44,8 +44,7 @@ export default class GroupProfile extends React.PureComponent {
</div>
<input
type='text'
id={customID}
className='form-control group_at_mention_input'
className='form-control group-at-mention-input'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change is unrelated to the test but it just made sense to change the class to not be snake case since we always use hyphen case for class names

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.

@fmunshi Overall looks good, except for some comments to prevent flakiness. Thanks for adding E2E!

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 for updating. Tested and passed.

Copy link
Contributor

@srkgupta srkgupta left a comment

Choose a reason for hiding this comment

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

Thanks @fmunshi. Overall the test looks great. Just a small observation.

Comment on lines +269 to +276
// # Login as sysadmin and navigate to system scheme page
cy.apiLogin('sysadmin');
cy.visit('/admin_console/user_management/permissions/system_scheme');

// # Click reset to defaults confirm and save
cy.findByTestId('resetPermissionsToDefault').click();
cy.get('#confirmModalButton').click();
saveConfig();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add this in the after block (or) afterEach block instead of adding it at the end of the test. This is because the specified steps to reset the System permissions may get skipped if the test fails in between. However if its included in the after block, the steps will definitely be executed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@fmunshi fmunshi requested review from srkgupta and removed request for catalintomai May 20, 2020 18:22
@amyblais amyblais added this to the v5.24.0 milestone May 20, 2020
Copy link
Contributor

@srkgupta srkgupta left a comment

Choose a reason for hiding this comment

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

Retested and the changes LGTM. Approving the PR. @fmunshi please resolve the merge conflicts and merge the PR. Thanks.

@fmunshi fmunshi added the CherryPick/Approved Meant for the quality or patch release tracked in the milestone label May 21, 2020
@fmunshi fmunshi merged commit 86fa2de into mattermost:master May 21, 2020
@mattermod
Copy link
Contributor

@fmunshi
Error trying doing the automated Cherry picking. Please do this manually

+++ Updating remotes...
Fetching upstream
Fetching origin
+++ Updating remotes done...
+++ Creating local branch automated-cherry-pick-of-#5530-upstream-release-5.24-1590080264
Branch 'automated-cherry-pick-of-#5530-upstream-release-5.24-1590080264' set up to track remote branch 'release-5.24' from 'upstream'.
+++ Downloading patch to /tmp/5530.patch (in case you need to do this again)

+++ About to attempt cherry pick of PR. To reattempt:
  $ git am -3 /tmp/5530.patch

Applying: Add e2e tests for group mentions
Applying: Test from recieving user perspective too
Applying: Update last snapshot
Applying: Fixes from review
Applying: Last review changes
Applying: camelCase instead of snake
Applying: Reset permissions before and after group mentions test
Applying: Fix linting
Patch failed at 0008 Fix linting
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

+++ Conflicts detected:

!!! None. Did you git am --continue?

+++ Aborting in-progress git am.

+++ Returning you to the master branch and cleaning up.

@fmunshi fmunshi deleted the MM-23937-group-mentions-e2e branch May 21, 2020 16:57
@fmunshi fmunshi self-assigned this May 21, 2020
fmunshi added a commit that referenced this pull request May 21, 2020
* Add e2e tests for group mentions

Modify IDs and use snake_case instead of PascalCase for ids

* Test from recieving user perspective too

* Update last snapshot

* Fixes from review

* Last review changes

* camelCase instead of snake

* Reset permissions before and after group mentions test

* Fix linting
fmunshi added a commit that referenced this pull request May 21, 2020
* Add e2e tests for group mentions

Modify IDs and use snake_case instead of PascalCase for ids

* Test from recieving user perspective too

* Update last snapshot

* Fixes from review

* Last review changes

* camelCase instead of snake

* Reset permissions before and after group mentions test

* Fix linting
@fmunshi fmunshi added CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone and removed CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels May 21, 2020
fmunshi added a commit that referenced this pull request May 21, 2020
* Add e2e tests for group mentions

Modify IDs and use snake_case instead of PascalCase for ids

* Test from recieving user perspective too

* Update last snapshot

* Fixes from review

* Last review changes

* camelCase instead of snake

* Reset permissions before and after group mentions test

* Fix linting
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation and removed 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog/Not Needed Does not require a changelog entry CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone Docs/Not Needed Does not require documentation
Projects
None yet
5 participants