Skip to content

Commit

Permalink
fix flaky test on markdown and teams spec (mattermost#3099)
Browse files Browse the repository at this point in the history
  • Loading branch information
saturninoabril committed Jul 12, 2019
1 parent 302e776 commit 76b532f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
9 changes: 7 additions & 2 deletions e2e/cypress/integration/markdown/markdown_image_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import * as TIMEOUTS from '../../fixtures/timeouts';

describe('Markdown', () => {
before(() => {
cy.apiLogin('user-1');
cy.visit('/');
// # Login as new user
cy.loginAsNewUser().then(() => {
// # Create new team and visit its URL
cy.apiCreateTeam('test-team', 'Test Team').then((response) => {
cy.visit(`/${response.body.name}`);
});
});
});

const baseUrl = Cypress.config('baseUrl');
Expand Down
22 changes: 7 additions & 15 deletions e2e/cypress/integration/markdown/markdown_text_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ const testCases = [

describe('Markdown message', () => {
before(() => {
// # Disable fetch so requests fall back to XHR so we can listen to routes
cy.on('window:before:load', (win) => {
win.fetch = null;
});

// # Enable local image proxy so our expected URLs match
const newSettings = {
ImageProxySettings: {
Expand All @@ -42,16 +37,13 @@ describe('Markdown message', () => {
};
cy.apiUpdateConfig(newSettings);

// # Login as "user-1"
cy.apiLogin('user-1');

// # Start cypress server, and listen for request to get posts
cy.server();
cy.route('GET', 'api/v4/channels/**/posts*').as('getPosts');

// # Navigate to app and wait for posts request to finish
cy.visit('/');
cy.wait('@getPosts', {timeout: TIMEOUTS.HUGE}).should('have.property', 'status', 200);
// # Login as new user
cy.loginAsNewUser().then(() => {
// # Create new team and visit its URL
cy.apiCreateTeam('test-team', 'Test Team').then((response) => {
cy.visit(`/${response.body.name}`);
});
});
});

testCases.forEach((testCase) => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/integration/team/teams_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function removeTeamMember(teamURL, username) {
cy.apiLogout();
cy.apiLogin('sysadmin');
cy.visit(`/${teamURL}`);
cy.get('#sidebarHeaderDropdownButton').click();
cy.get('#sidebarHeaderDropdownButton').should('be.visible').click();
cy.get('#manageMembers').click();
cy.get(`#teamMembersDropdown_${username}`).should('be.visible').click();
cy.get('#removeFromTeam').should('be.visible').click();
Expand Down

0 comments on commit 76b532f

Please sign in to comment.