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

Commit

Permalink
[MM-28140] e2e/system_console/customization: add T1029 (#6401)
Browse files Browse the repository at this point in the history
* [MM-28140] e2e/system_console/customization: add T1029

* Make each test ensure the admin is logged in and remove unnecessary reload

* Fix linter

* Remove beforeEach method that got duplicated after merge

* Update test to add a check for a default emoji
  • Loading branch information
mgdelacroix committed Sep 14, 2020
1 parent 971d49a commit 2505889
Showing 1 changed file with 92 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('Customization', () => {
it('MM-T1024 - Can change name and desc with Custom Branding set to false', () => {
// # Make sure necessary field is false
cy.apiUpdateConfig({TeamSettings: {EnableCustomBrand: false}});
cy.reload();

// * Verify that setting is visible and matches text content
cy.findByTestId('TeamSettings.SiteNamelabel').scrollIntoView().should('be.visible').and('have.text', 'Site Name:');
Expand Down Expand Up @@ -158,6 +157,98 @@ describe('Customization', () => {
cy.get('p').should('have.text', customBrandText);
});
});

it('MM-T1029 - Custom branding text can render markdown text', () => {
// # Visit emoji system console page
cy.visit('/admin_console/site_config/emoji');
cy.get('.admin-console__header').should('be.visible').and('have.text', 'Emoji');

// # Set Enable Custom Emoji to true
cy.findByTestId('ServiceSettings.EnableCustomEmojitrue').check();

// # Save setting
saveSetting();

// * Visit the add custom emoji page for ad-1
cy.visit('/ad-1/emoji/add');
cy.get('.backstage-header').should('be.visible');

// * Ensure the form is visible
cy.get('.backstage-form').should('be.visible').within(() => {
// # Fill the emoji data
cy.get('input#name').clear().type('yay');
cy.get('input#select-emoji').attachFile('mattermost-icon.png');

// # Save emoji
cy.get('.backstage-form__footer button').click();
});

// # Make sure necessary field is true
cy.apiUpdateConfig({TeamSettings: {EnableCustomBrand: true}});
cy.reload();

// # Visit customization system console page
cy.visit('/admin_console/site_config/customization');
cy.get('.admin-console__header').should('be.visible').and('have.text', 'Customization');

// eslint-disable-next-line no-irregular-whitespace
const customBrandText = `​​​​:yay:
:smile:
- This is a bullet point
- This is another bullet point
**This has been bolded**
~~This has been strikethrough~~
*This has been italicized*
[This is a link to mattermost.com](https://mattermost.com)
` + '`This is inline code`'; // eslint-disable-line no-useless-concat

// # Update custom brand text
cy.findByTestId('TeamSettings.CustomBrandTextinput').clear().type(customBrandText);

// # Save setting
saveSetting();

// # Logout
cy.apiLogout();

// * Ensure that the user was redirected to the login page after the logout
cy.url().should('include', '/login');

cy.get('.signup__markdown div div').should('be.visible').within(() => {
// * Ensure custom emoji has been rendered
// ToDo: uncomment after fixing MM-12657
//cy.get('span.emoticon').should('have.attr', 'title', ':yay:');

// * Ensure default emoji has been rendered
cy.get('span.emoticon').should('have.attr', 'title', ':smile:');

// * Ensure the list and two bullets have been rendered
cy.get('ul.markdown__list').should('be.visible').within(() => {
cy.contains('This is a bullet point');
cy.contains('This is another bullet point');
});

// * Find within the paragraph after the list
cy.get('ul+p').should('be.visible').within(() => {
// * Ensure the bold text has been rendered
cy.get('strong').should('be.visible').and('have.text', 'This has been bolded');

// * Ensure the strikethrough text has been rendered
cy.get('del').should('be.visible').and('have.text', 'This has been strikethrough');

// * Ensure the italic text has been rendered
cy.get('em').should('be.visible').and('have.text', 'This has been italicized');

// * Ensure the link has been rendered
cy.get('a.markdown__link').should('be.visible').and('have.text', 'This is a link to mattermost.com').and('have.attr', 'href', 'https://mattermost.com');

// * Ensure the inline code has been rendered
cy.get('.codespan__pre-wrap').should('be.visible').and('have.text', 'This is inline code');
});
});
});
});

function saveSetting() {
Expand Down

0 comments on commit 2505889

Please sign in to comment.