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

Fix E2E flaky tests #2996

Merged
merged 2 commits into from
Jun 21, 2019
Merged

Fix E2E flaky tests #2996

merged 2 commits into from
Jun 21, 2019

Conversation

saturninoabril
Copy link
Member

Summary

Fix E2E flaky tests

Ticket Link

none

@saturninoabril saturninoabril added the 2: Dev Review Requires review by a core commiter label Jun 21, 2019
@@ -17,7 +17,7 @@ describe('Account Settings > Display > Channel Display Mode', () => {

// Post a message to a channel
cy.visit('/');
cy.postMessage('Test for channel display mode {enter}');
cy.postMessage('Test for channel display mode');
Copy link
Member Author

Choose a reason for hiding this comment

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

nit: update the correct usage of cy.postMessage where the text param don't need to add {enter} since the command itself is doing it already.

cy.get('#manageMembers').should('be.visible');
cy.get('#manageMembers').click();
cy.get('#viewMembers').should('be.visible');
cy.get('#viewMembers').click();
Copy link
Member Author

Choose a reason for hiding this comment

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

user-1 by default don't have a permission to manage members on sample team/channel and so just use viewMembers

@@ -230,6 +230,8 @@ describe('at-mention', () => {
cy.get('@postMessageText').
find(`[data-mention=${receiver.username}]`).
should('not.exist');

cy.get('#sidebarItem_saepe-5').scrollIntoView().click({force: true});
Copy link
Member Author

Choose a reason for hiding this comment

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

nit: Added missing step

Copy link
Contributor

Choose a reason for hiding this comment

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

Another nit, no need to scroll into view if we are forcing the click.

@@ -311,7 +312,7 @@ Cypress.Commands.add('minDisplaySettings', () => {
cy.get('#collapseTitle').should('be.visible', 'contain', 'Default appearance of image previews');
cy.get('#collapseEdit').should('be.visible', 'contain', 'Edit');

cy.get('#message_displayTitle').should('be.visible', 'contain', 'Message Display');
cy.get('#message_displayTitle').scrollIntoView().should('be.visible', 'contain', 'Message Display');
Copy link
Member Author

Choose a reason for hiding this comment

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

Message display is out of the window, and so it needs to scroll into view.


return Client4.createPost(options);
return {status: response.status, data: response.data, error: response.error};
Copy link
Member Author

@saturninoabril saturninoabril Jun 21, 2019

Choose a reason for hiding this comment

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

Not totally sure why postMessageAs is not working as expected. I just removed the use of Client4; let's observe if it will pass on daily test.

Copy link
Contributor

Choose a reason for hiding this comment

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

mattermost-redux changes perhaps? I haven't looked at recent commits, but I think it's totally fine for us to use the API directly, ultimately that's what the client is doing. This way we have more control over the requests as well. 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so as the current mattermost-redux is working locally but let's eliminate potential issue by going thru API call directly.

cy.get('#help_link').should('contain', 'Help');
cy.get('#help_link').should('have.attr', 'href', 'https://about.mattermost.com/default-help/');
cy.get('#help_link').should('have.attr', 'href', config.SupportSettings.HelpLink);
Copy link
Member Author

@saturninoabril saturninoabril Jun 21, 2019

Choose a reason for hiding this comment

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

This is failing since cypress server has different config for SiteName and so, it's safe to use data from config instead of hard-coded values.

cypress/integration/login/signup_spec.js Outdated Show resolved Hide resolved
cypress/support/api_commands.js Outdated Show resolved Hide resolved
cy.apiCreateTeam('test-team', 'Test Team').then((response) => {
testTeam = response.body;
cy.visit(`/${testTeam.name}`);
cy.loginAsNewUser().then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think having to use .then() should be necessary, but maybe I'm missing something.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not totally sure about this but let's try and observe.

@@ -230,6 +230,8 @@ describe('at-mention', () => {
cy.get('@postMessageText').
find(`[data-mention=${receiver.username}]`).
should('not.exist');

cy.get('#sidebarItem_saepe-5').scrollIntoView().click({force: true});
Copy link
Contributor

Choose a reason for hiding this comment

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

Another nit, no need to scroll into view if we are forcing the click.


return Client4.createPost(options);
return {status: response.status, data: response.data, error: response.error};
Copy link
Contributor

Choose a reason for hiding this comment

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

mattermost-redux changes perhaps? I haven't looked at recent commits, but I think it's totally fine for us to use the API directly, ultimately that's what the client is doing. This way we have more control over the requests as well. 👍

@thekiiingbob thekiiingbob merged commit d283e88 into mattermost:master Jun 21, 2019
@saturninoabril saturninoabril deleted the e2e-flaky branch June 21, 2019 14:20
@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 labels Jun 21, 2019
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
Projects
None yet
4 participants