Skip to content

Commit

Permalink
E2E: fix failing tests (mattermost#3056)
Browse files Browse the repository at this point in the history
  • Loading branch information
saturninoabril authored and Bob Lubecker committed Jul 5, 2019
1 parent 2009444 commit bcab4be
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ describe('AS14318 Theme Colors - Color Picker', () => {
// * Check Sidebar Unread Text
cy.get('.sidebar-item.unread-title').should('have.css', 'color', 'rgb(129, 65, 65)');

// * Check Sidebar Text Active Color
cy.get('#displayButton').should('have.css', 'color', 'rgb(129, 65, 65)');

// * Check Mention Jewel BG color
cy.get('#unreadIndicatorBottom').should('have.css', 'background-color', 'rgb(129, 65, 65)');

Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/integration/channel/channel_settings_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Channel Settings', () => {
});

// add a direct message incase there is not one
cy.get('#directChannel button').click();
cy.get('#addDirectChannel').click();
cy.get('.more-modal__row.clickable').first().click();
cy.get('#saveItems').click();

Expand Down
4 changes: 3 additions & 1 deletion e2e/cypress/integration/channel/header_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Header', () => {
cy.updateChannelHeader('> newheader');

// * Check if channel header description has no ellipsis
cy.get('#channelHeaderDescription').should('have.text', ' newheader');
cy.get('#channelHeaderDescription').then(($header) => {
expect($header.outerWidth()).to.be.closeTo($header[0].scrollWidth, 1);
});
Expand All @@ -29,6 +30,7 @@ describe('Header', () => {
cy.updateChannelHeader('>' + ' newheader'.repeat(20));

// * Check if channel header description has ellipsis
cy.get('#channelHeaderDescription').should('have.text', ' newheader'.repeat(20));
cy.get('#channelHeaderDescription').then(($header) => {
expect($header.outerWidth()).lt($header[0].scrollWidth);
});
Expand All @@ -49,7 +51,7 @@ describe('Header', () => {
cy.changeMessageDisplaySetting('COMPACT');

// # Open a DM with user named 'user-2'
cy.get('#directChannel > .add-channel-btn').click().wait(TIMEOUTS.TINY);
cy.get('#addDirectChannel').click().wait(TIMEOUTS.TINY);
cy.focused().type('user-2', {force: true}).type('{enter}', {force: true}).wait(TIMEOUTS.TINY);
cy.get('#saveItems').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import * as TIMEOUTS from '../../fixtures/timeouts';

describe('MM-13697 Edit Post with attachment', () => {
before(() => {
// # Login and go to /
// # Login, set display preference and go to /
cy.apiLogin('user-1');
cy.apiSaveMessageDisplayPreference();
cy.visit('/ad-1/channels/town-square');
});

Expand Down
9 changes: 0 additions & 9 deletions e2e/cypress/integration/markdown/markdown_image_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,10 @@ describe('Markdown', () => {

const inlineImage1 = `<h3 class="markdown__heading">In-line Images</h3><p>Mattermost/platform build status: <a class="theme markdown__link" href="https://travis-ci.org/mattermost/platform" rel="noreferrer" target="_blank"><img alt="Build Status" class="markdown-inline-img" src="${baseUrl}/api/v4/image?url=https%3A%2F%2Ftravis-ci.org%2Fmattermost%2Fplatform.svg%3Fbranch%3Dmaster"></a></p>`;
const inlineImage2 = `<h3 class="markdown__heading">In-line Images</h3><p>GitHub favicon: <img alt="Github" class="markdown-inline-img" src="${baseUrl}/api/v4/image?url=https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico"></p>`;
const inlineImage3 = `<h3 class="markdown__heading">In-line Images</h3><p>GIF Image:
<img alt="gif" class="markdown-inline-img" src="${baseUrl}/api/v4/image?url=http%3A%2F%2Fi.giphy.com%2FxNrM4cGJ8u3ao.gif" style=""></p>`;
const inlineImage4 = `<h3 class="markdown__heading">In-line Images</h3><p>4K Wallpaper Image (11Mb):
<img alt="4K Image" class="markdown-inline-img" src="${baseUrl}/api/v4/image?url=https%3A%2F%2Fimages.wallpaperscraft.com%2Fimage%2Fstarry_sky_shine_glitter_118976_3840x2160.jpg" style=""></p>`;
const inlineImage5 = `<h3 class="markdown__heading">In-line Images</h3><p>Panorama Image:
<img alt="Pano" class="markdown-inline-img" src="${baseUrl}/api/v4/image?url=http%3A%2F%2Famardeepphotography.com%2Fwp-content%2Fuploads%2F2012%2F11%2FUntitled_Panorama6small.jpg" style=""></p>`;

const tests = [
{name: 'with in-line images 1', fileKey: 'markdown_inline_images_1', expected: inlineImage1},
{name: 'with in-line images 2', fileKey: 'markdown_inline_images_2', expected: inlineImage2},
{name: 'with in-line images 3 (Gif)', fileKey: 'markdown_inline_images_3', expected: inlineImage3},
{name: 'with in-line images 4 (4k)', fileKey: 'markdown_inline_images_4', expected: inlineImage4},
{name: 'with in-line images 5 (Panorama)', fileKey: 'markdown_inline_images_5', expected: inlineImage5},
];

tests.forEach((test) => {
Expand Down
5 changes: 5 additions & 0 deletions e2e/cypress/integration/search/date_filter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ describe('SF15699 Search Date Filter', () => {
});

describe('works without leading 0 in', () => {
before(() => {
// # Close the search side bar
cy.get('#searchResultsCloseButton').should('be.visible').click();
});

// These must match the date of the firstMessage, only altering leading zeroes
const tests = [
{name: 'day', date: '2018-06-5'},
Expand Down
2 changes: 2 additions & 0 deletions e2e/cypress/support/api_commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ Cypress.Commands.add('apiUpdateConfig', (newSettings = {}) => {
body: settings,
});
});

cy.apiLogout();
});

Cypress.Commands.add('apiGetConfig', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/support/ui_commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Cypress.Commands.add('getNthPostId', (nthPost) => {
*/
Cypress.Commands.add('postMessageFromFile', (file, target = '#post_textbox') => {
cy.fixture(file, 'utf-8').then((text) => {
cy.get(target).clear().invoke('val', text).wait(TIMEOUTS.TINY).type(' {backspace}{enter}').should('have.text', '');
cy.get(target).clear().invoke('val', text).wait(TIMEOUTS.MEDIUM).type(' {backspace}{enter}').should('have.text', '');
});
});

Expand Down

0 comments on commit bcab4be

Please sign in to comment.