-
Notifications
You must be signed in to change notification settings - Fork 2.7k
GH 12301 - Adding mobile view profile popover test #3787
GH 12301 - Adding mobile view profile popover test #3787
Conversation
cy.wait(TIMEOUTS.TINY); | ||
|
||
// # Click on user profile image | ||
cy.get(`#post_${postId}`).find('.profile-icon > img').click(); |
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.
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)
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.
Oh that's a good idea, will definitely add those in :)
cy.get('#user-profile-popover').should('be.visible'); | ||
}); | ||
}); | ||
}); |
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.
Please move this file into /cypress/integration/messaging
.
e2e/cypress/support/ui_commands.js
Outdated
@@ -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(); |
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.
.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()
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.
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?
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.
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) => { |
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.
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?
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 yep, definitely can do
e6f2ed7
to
d4a7736
Compare
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 Andre, LGTM, except for last minor request.
|
||
it('M18715 Profile popover should render (standard mode)', () => { | ||
// # Setting posts to standard mode | ||
cy.changeMessageDisplaySetting('STANDARD'); |
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.
nit: please use API command - cy.apiSaveMessageDisplayPreference
since we're not particularly testing that UI flow.
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.
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'); |
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.
If you use the API command (which you should) to change the message display preference, this afterEach can be removed.
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.
Yup, you're right, will be sure to remove that as I use the API commands instead of the UI ones
* Adding mobile view profile popover test * Removed UI Commands changes, added standard/compact view mode tests separately * Using API Commands to change display preferences
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