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

GH 12301 - Adding mobile view profile popover test #3787

Merged

Conversation

avasconcelos114
Copy link
Contributor

Summary

This adds a new E2E cypress test that checks whether the profile popover gets rendered to the page on mobile view

Ticket Link

Fixes mattermost/mattermost#12301

Jira ticket: MM-18715

@avasconcelos114 avasconcelos114 changed the title Adding mobile view profile popover test GH 12301 - Adding mobile view profile popover test Sep 27, 2019
@hanzei hanzei added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Sep 29, 2019
cy.wait(TIMEOUTS.TINY);

// # Click on user profile image
cy.get(`#post_${postId}`).find('.profile-icon > img').click();
Copy link
Member

Choose a reason for hiding this comment

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

This fails when message display setting is set to compact mode. Please explicitly set it to standard after user-1 has logged in.
Bonus: Not required but would be nice if you can add case to open profile popover on compact mode (that is by clicking on username)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that's a good idea, will definitely add those in :)

cy.get('#user-profile-popover').should('be.visible');
});
});
});
Copy link
Member

Choose a reason for hiding this comment

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

Please move this file into /cypress/integration/messaging.

@@ -18,6 +18,11 @@ Cypress.Commands.add('toMainChannelView', (username, password) => {
cy.get('#post_textbox').should('be.visible');
});

Cypress.Commands.add('toTopPublicChannelView', () => {
cy.visit('/');
cy.get('#publicChannelList > li').eq('2').click();
Copy link
Contributor

Choose a reason for hiding this comment

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

.eq(2) with get the third li under #publicChannelList. Did you mean eq(1)?

Alternatively, this selector and code should more directly get just those that are with the class of sidebar item:

cy.get('#publicChannelList .sidebar-item').first().click()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue with this is that the publicChannelList element's first child is the PUBLIC CHANNELS + row, which then means we have to retrieve the second child of that (which would mean that both your suggestions wouldn't really work)

Would there be any recommended ways to retrieve the second child of an element aside from what I used over there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, given your other feedback with regards to adding a new post to make sure there will always be a post in the channel, I figured it would be unnecessary to keep this method, as its purpose was to navigate to a channel that already had posts in it.

Should be a cleaner way to resolve this

});

it('M18715 Profile popover should render', () => {
cy.getLastPostId().then((postId) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This code assumes that the top channel has posts in it. Generally, it should, but can you send a post to guarantee that there will be a post for you to look up?

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 yep, definitely can do

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 Andre, LGTM, except for last minor request.


it('M18715 Profile popover should render (standard mode)', () => {
// # Setting posts to standard mode
cy.changeMessageDisplaySetting('STANDARD');
Copy link
Member

Choose a reason for hiding this comment

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

nit: please use API command - cy.apiSaveMessageDisplayPreference since we're not particularly testing that UI flow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that actually makes more sense, wasn't fully aware that this was also accessible through the API commands haha

will be sure to change that right away


afterEach(() => {
// Set viewport back to desktop view to make sure changeMessageDisplaySetting works between tests
cy.viewport('macbook-13');
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use the API command (which you should) to change the message display preference, this afterEach can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, you're right, will be sure to remove that as I use the API commands instead of the UI ones

@thekiiingbob thekiiingbob added QA Review Done and removed 3: QA Review Requires review by a QA tester labels Oct 3, 2019
@thekiiingbob thekiiingbob merged commit 3081ced into mattermost:master Oct 3, 2019
@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 Hacktoberfest labels Oct 3, 2019
brewsterbhg pushed a commit to brewsterbhg/mattermost-webapp that referenced this pull request Nov 11, 2019
* Adding mobile view profile popover test

* Removed UI Commands changes, added standard/compact view mode tests separately

* Using API Commands to change display preferences
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 Docs/Not Needed Does not require documentation QA Review Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI Automation: Write an automated test using Cypress for "Mobile view: View profile popover from profile pic"
5 participants