Mattermost Logo
We're hiring!
Edit on GitHub

Account Settings Modal

image


cy.uiOpenAccountSettingsModal(section) 

Open the account settings modal when viewing a channel.

  • section < string >
    • Possible values: 'General', 'Security', 'Notifications', 'Display', 'Sidebar' and 'Advanced'
Open the Account Settings modal 
// # Open 'Account Settings' modal and view the default 'General Settings'
cy.uiOpenAccountSettingsModal();
Open the Account Settings modal and view a specific section 
// # Open 'Advanced' section of 'Account Settings' modal
cy.uiOpenAccountSettingsModal('Advanced');
Open the Account Settings modal, view a specific section and change a setting 
// # Open 'Advanced' section of 'Account Settings' modal
cy.uiOpenAccountSettingsModal('Advanced').within(() => {
    // # Open 'Enable Join/Leave Messages' and turn it off
    cy.findByRole('heading', {name: 'Enable Join/Leave Messages'}).click();
    cy.findByRole('radio', {name: 'Off'}).click();

    // # Save and close the modal
    cy.uiSave();
    cy.uiClose();
});

cy.findByRoleExtended('button', {name}) 

Use to select section’s button within a modal.

  • name < string >
    • Possible values: 'General', 'Security', 'Notifications', 'Display', 'Sidebar' and 'Advanced'
Open a section within the Account Settings modal 
// # Open 'Advanced' section of 'Account Settings' modal
cy.uiOpenAccountSettingsModal().within(() => {
+   // # Click 'Notifications' button
+   cy.findByRoleExtended('button', {name: 'Notifications'}).should('be.visible').click();
});

cy.findByRole('heading', {name}) 

Use to select a setting of a section within a modal.

  • name < string >
    • Possible values: 'Full Name', 'Username', and others depending of a section
Open a section within the Account Settings modal 
// # Open 'Notifications' of 'Account Settings' modal
cy.uiOpenAccountSettingsModal('Notifications').within(() => {
+   // # Open 'Words That Trigger Mentions' setting
+   cy.findByRole('heading', {name: 'Words That Trigger Mentions'}).should('be.visible').click();
});

cy.findByRole(role, {name}) 

Use to select a setting of a section within a modal.

  • role < string >
    • Possible values: 'textbox', 'radio', 'checkbox' and other roles
  • name < string >
    • Possible values: 'On', 'Off', and others depending of a section’s setting
Change value of a section’s setting 
// # Open 'Notifications' of 'Account Settings' modal
cy.uiOpenAccountSettingsModal('Notifications').within(() => {
    // # Open 'Words That Trigger Mentions' setting
    cy.findByRole('heading', {name: 'Words That Trigger Mentions'}).should('be.visible').click();

+   // # Check channel-wide mentions
+   cy.findByRole('checkbox', {name: 'Channel-wide mentions "@channel", "@all", "@here"'}).click();
});

cy.uiSave and cy.uiClose 

Common commands that can be used to save settings and close the modal.

Save and Close 
// # Open 'Notifications' of 'Account Settings' modal
cy.uiOpenAccountSettingsModal('Notifications').within(() => {
    // # Open 'Words That Trigger Mentions' setting
    cy.findByRole('heading', {name: 'Words That Trigger Mentions'}).should('be.visible').click();

    // # Check channel-wide mentions
    cy.findByRole('checkbox', {name: 'Channel-wide mentions "@channel", "@all", "@here"'}).click();

+   // # Save then close the modal
+   cy.uiSave();
+   cy.uiClose();
});