[MM-55274] User account menu doesn't follow standard accessible keyboard behavior (#29173)

Этот коммит содержится в:
M-ZubairAhmed
2025-01-15 00:55:38 +05:30
коммит произвёл GitHub
родитель 3f9aa4a212
Коммит 4b6216f5a4
75 изменённых файлов: 2020 добавлений и 4305 удалений

Просмотреть файл

@@ -26,9 +26,9 @@ describe('Verify Accessibility Support in Different Images', () => {
it('MM-T1508 Accessibility support in different images', () => {
// * Verify image alt in profile image
cy.uiGetProfileHeader().
find('.Avatar').
should('have.attr', 'alt', 'user profile image');
cy.get('#userAccountMenuButton').within(() => {
cy.findByAltText('user profile image').should('be.visible');
});
// # Upload an image in the post
cy.get('#fileUploadInput').attachFile('small-image.png');

Просмотреть файл

@@ -163,9 +163,6 @@ describe('Profile > Profile Settings > Email', () => {
// # Click on the link
cy.visit(permalink);
// * Verify announcement bar
cy.get('.announcement-bar').should('be.visible').should('contain.text', 'Email verified');
// # Wait for one second for the mail to be sent out.
cy.wait(TIMEOUTS.FIVE_SEC);
@@ -199,7 +196,7 @@ describe('Profile > Profile Settings > Email', () => {
// # Close modal then logout
cy.get('body').type('{esc}');
cy.uiOpenUserMenu('Log Out');
cy.uiLogout();
// # Wait for one second for the mail to be sent out.
cy.wait(TIMEOUTS.ONE_SEC);

Просмотреть файл

@@ -116,8 +116,8 @@ describe('Settings > Sidebar > General > Edit', () => {
// # Step 3
// * Verify that we've logged in as the temp user
cy.visit(offTopicUrl);
cy.uiOpenUserMenu().findByText(`@${newTempUserName}`);
cy.uiGetSetStatusButton().click();
cy.uiOpenUserMenu().findByText(`@${newTempUserName}`).should('exist');
cy.get('body').type('{esc}');
// # Step 4
const text = `${newTempUserName} test message!`;

Просмотреть файл

@@ -124,5 +124,5 @@ function verifyUsername(username) {
cy.uiOpenUserMenu().findByText(`@${username}`);
// # Close the user menu
cy.uiGetSetStatusButton().click();
cy.get('body').type('{esc}');
}

Просмотреть файл

@@ -1,6 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {clickCategoryMenuItem} from './helpers';
// ***************************************************************
@@ -22,6 +24,8 @@ describe('Sidebar category menu', () => {
it('MM-T3171_1 Verify that the 3-dot menu on the Channels Category contains an option to Create New Category', () => {
clickCategoryMenuItem('CHANNELS', 'Create New Category');
cy.wait(TIMEOUTS.ONE_SEC);
cy.get('body').type('{esc}', {force: true});
});
@@ -41,6 +45,8 @@ describe('Sidebar category menu', () => {
// # Verify that Create New Category exists on Favorites category and click on it
clickCategoryMenuItem('FAVORITES', 'Create New Category');
cy.wait(TIMEOUTS.ONE_SEC);
cy.get('body').type('{esc}', {force: true});
});
});

Просмотреть файл

@@ -28,15 +28,23 @@ describe('Custom Status - Setting a Custom Status', () => {
it('MM-T3836_1 should open status dropdown', () => {
// # Click on the sidebar header to open status dropdown
cy.get('.MenuWrapper .status-wrapper').click();
cy.uiGetSetStatusButton().click();
// * Check if the status dropdown opens
cy.get('#statusDropdownMenu').should('exist');
cy.uiGetStatusMenuContainer();
// # Close the status dropdown
cy.get('body').type('{esc}');
});
it('MM-T3836_2 Custom status modal opens with 5 default statuses listed', () => {
// # Click on the sidebar header to open status dropdown
cy.uiGetSetStatusButton().click();
// * Check if the status dropdown opens
cy.uiGetStatusMenuContainer().findByText('Set custom status').click();
// # Open custom status modal
cy.get('#statusDropdownMenu li#status-menu-custom-status').click();
cy.get('#custom_status_modal').should('exist');
// * Check if all the default suggestions exist
@@ -111,13 +119,15 @@ describe('Custom Status - Setting a Custom Status', () => {
trigger('mouseover');
// * Custom status tooltip should be visible
cy.get('#custom-status-tooltip').should('exist');
cy.get('#custom-status-tooltip').should('exist').and('be.visible');
// * Tooltip should contain the correct custom status emoji
cy.get('#custom-status-tooltip .custom-status span.emoticon').invoke('attr', 'data-emoticon').should('contain', customStatus.emoji);
cy.get('#custom-status-tooltip').within(() => {
// * Tooltip should contain the correct custom status emoji
cy.get(`span[data-emoticon="${customStatus.emoji}"]`).should('exist');
// * Tooltip should contain the correct custom status text
cy.get('#custom-status-tooltip .custom-status span.custom-status-text').should('have.text', customStatus.text);
// * Tooltip should contain the correct custom status text
cy.findByText(customStatus.text).should('exist');
});
});
it('MM-T3836_8 should open custom status modal when emoji in LHS header is clicked', () => {

Просмотреть файл

@@ -27,7 +27,7 @@ describe('Custom Status - Setting Your Own Custom Status', () => {
it('MM-T3846_1 should change the emoji to speech balloon when typed in the input', () => {
// # Open the custom status modal
cy.uiOpenUserMenu('Set a custom status');
cy.uiOpenUserMenu('Set custom status');
// * Default emoji is currently visible in the custom status input
cy.get('#custom_status_modal .StatusModal__emoji-button span').should('have.class', 'icon--emoji');
@@ -72,20 +72,26 @@ describe('Custom Status - Setting Your Own Custom Status', () => {
cy.uiGetProfileHeader().
find('.emoticon').
should('have.attr', 'data-emoticon', customStatus.emoji);
cy.get('body').type('{esc}');
});
it('MM-T3846_5 should show custom status with emoji in the status dropdown', () => {
// # Open user menu
cy.uiOpenUserMenu();
cy.uiOpenUserMenu().within(() => {
// * Correct custom status text and emoji should be displayed in the status dropdown
cy.findByText(customStatus.text).should('exist');
cy.get(`span[data-emoticon="${customStatus.emoji}"]`).should('exist');
});
// * Correct custom status text and emoji should be displayed in the status dropdown
cy.get('.status-dropdown-menu .custom_status__container').should('have.text', customStatus.text);
cy.get('.status-dropdown-menu .custom_status__row span.emoticon').invoke('attr', 'data-emoticon').should('contain', customStatus.emoji);
cy.get('body').type('{esc}');
});
it('MM-T3846_6 should show previosly set status in the first position in Recents list', () => {
it('MM-T3846_6 should show previously set status in the first position in Recents list', () => {
// # Click on the "Set a Custom Status" option in the status dropdown
cy.get('.status-dropdown-menu li#status-menu-custom-status').click();
cy.uiOpenUserMenu().within(() => {
cy.findByText(customStatus.text).should('exist').click({force: true});
});
// * Custom status modal should open
cy.get('#custom_status_modal').should('exist');
@@ -118,9 +124,9 @@ describe('Custom Status - Setting Your Own Custom Status', () => {
cy.findByText('Clear Status').click();
// # Open user menu
cy.uiOpenUserMenu();
// * Custom status text should not be displayed in the status dropdown
cy.get('.status-dropdown-menu .custom_status__row').should('not.have.text', customStatus.text);
cy.uiOpenUserMenu().within(() => {
// * Custom status text should not be displayed in the status dropdown
cy.findByText(customStatus.text).should('not.exist');
});
});
});

Просмотреть файл

@@ -32,7 +32,7 @@ describe('Custom Status - Recent Statuses', () => {
it('MM-T3847_1 set a status', () => {
// # Open the custom status modal
cy.uiOpenUserMenu('Set a custom status');
cy.uiOpenUserMenu('Set custom status');
// # Type the custom status text in the custom status modal input
cy.get('#custom_status_modal .StatusModal__input input').typeWithForce(customStatus.text);

Просмотреть файл

@@ -27,7 +27,7 @@ describe('Custom Status - Verifying Where Custom Status Appears', () => {
});
it('MM-T3850_1 set a status', () => {
cy.uiOpenUserMenu('Set a Custom Status');
cy.uiOpenUserMenu('Set custom status');
// # Type the custom status text in the custom status modal input
cy.findByPlaceholderText('Set a status').type(customStatus.text, {force: true});

Просмотреть файл

@@ -25,6 +25,7 @@ describe('MM-T4063 Custom status expiry', () => {
const defaultCustomStatuses = ['In a meeting', 'Out for lunch', 'Out sick', 'Working from home', 'On a vacation'];
const customStatus = {
emoji: 'hamburger',
emojiAriaLabel: ':hamburger:',
text: 'Out for lunch',
duration: '30 minutes',
};
@@ -36,19 +37,25 @@ describe('MM-T4063 Custom status expiry', () => {
const expiryTimeFormat = 'h:mm A';
it('MM-T4063_1 should open status dropdown', () => {
// # Click on the sidebar header to open status dropdown
cy.get('.MenuWrapper .status-wrapper').click();
cy.uiGetSetStatusButton().click();
// * Check if the status dropdown opens
cy.get('#statusDropdownMenu').should('exist');
cy.uiGetStatusMenu();
// # Close the status dropdown
cy.get('body').click();
});
it('MM-T4063_2 Custom status modal opens with 5 default statuses listed', () => {
// # Open custom status modal
cy.get('#statusDropdownMenu li#status-menu-custom-status').click();
cy.get('#custom_status_modal').should('exist');
cy.uiOpenUserMenu('Set custom status');
// * Check if all the default suggestions exist
defaultCustomStatuses.map((statusText) => cy.get('#custom_status_modal .statusSuggestion__content').contains('span', statusText));
cy.findByRole('dialog', {name: 'Set a status'}).should('exist').within(() => {
// * Check if all the default suggestions exist
defaultCustomStatuses.forEach((statusText) => {
cy.findByText(statusText).should('exist');
});
});
});
it('MM-T4063_3 Correct custom status is selected with the correct emoji and correct duration', () => {
@@ -94,17 +101,17 @@ describe('MM-T4063 Custom status expiry', () => {
it('MM-T4063_5 should show the set custom status with expiry when status dropdown is opened', () => {
// # Click on the sidebar header to open status dropdown
cy.get('.MenuWrapper .status-wrapper').click();
cy.uiGetSetStatusButton().click();
// * Check if the status dropdown opens
cy.get('#statusDropdownMenu').should('exist');
cy.uiGetStatusMenu().within(() => {
// * Correct custom status text and emoji should be displayed in the status dropdown
cy.findByText(customStatus.text).should('exist');
cy.findByLabelText(customStatus.emojiAriaLabel).should('exist');
// * Correct custom status text and emoji should be displayed in the status dropdown
cy.get('.status-dropdown-menu .custom_status__container').should('have.text', customStatus.text);
cy.get('.status-dropdown-menu .custom_status__row span.emoticon').invoke('attr', 'data-emoticon').should('contain', customStatus.emoji);
// * Correct clear time should be displayed in the status dropdown
cy.get('.status-dropdown-menu .custom_status__expiry time').invoke('text').should('match', expiresAtRegexp);
// * Correct clear time should be displayed in the status dropdown
cy.findByText(expiresAtRegexp).should('exist');
});
});
it('MM-T4063_6 custom status should be cleared after duration of set custom status', () => {
@@ -118,8 +125,7 @@ describe('MM-T4063 Custom status expiry', () => {
it('MM-T4063_7 current custom status should display expiry time in custom status modal', () => {
// # Open custom status modal
cy.get('#statusDropdownMenu li#status-menu-custom-status').click();
cy.get('#custom_status_modal').should('exist');
cy.get('.userAccountMenu_customStatusMenuItem').should('be.visible').click();
// * Should show expiry time of status when current status is selected
cy.get('#custom_status_modal .statusSuggestion__content').contains('span', customStatus.text).click();
@@ -132,15 +138,12 @@ describe('MM-T4063 Custom status expiry', () => {
it('MM-T4063_8 previous custom status duration should be reset if custom status is expired', () => {
// # Forwarding the time by the duration of custom status
cy.clock(Date.now());
cy.tick(waitingTime * 60 * 1000);
// # Open custom status modal
cy.get('.status-dropdown-menu').click();
cy.get('#statusDropdownMenu li#status-menu-custom-status').click();
cy.get('#custom_status_modal').should('exist');
// * Should show duration of previous status when previous status is selected
cy.get('#custom_status_modal .statusSuggestion__content').contains('span', customStatus.text).click();
cy.get('#custom_status_modal .expiry-value').should('have.text', customStatus.duration);
cy.tick(waitingTime * 60 * 1000).then(() => {
// # Open custom status modal
cy.uiOpenUserMenu().within(() => {
// * Verify that there is no custom status in the dropdown
cy.findByText('Set custom status').should('exist').and('be.visible');
});
});
});
});

Просмотреть файл

@@ -21,86 +21,30 @@ describe('MM-T4064 Status expiry visibility', () => {
cy.visit(channelUrl);
});
});
const defaultCustomStatuses = ['In a meeting', 'Out for lunch', 'Out sick', 'Working from home', 'On a vacation'];
const customStatus = {
emoji: 'calendar',
text: 'In a meeting',
duration: '1 hour',
};
const waitingTime = 60; //minutes
let expiresAt = dayjs();
const expiryTimeFormat = 'h:mm A';
it('MM-T4064_1 should open status dropdown', () => {
// # Click on the sidebar header to open status dropdown
cy.get('.MenuWrapper .status-wrapper').click();
// * Check if the status dropdown opens
cy.get('#statusDropdownMenu').should('exist');
});
it('MM-T4064_6 should show expiry time in the tooltip of custom status emoji in the post header', () => {
// # Open the user account menu
cy.uiOpenUserMenu('Set custom status');
it('MM-T4064_2 Custom status modal opens with 5 default statuses listed', () => {
// # Open custom status modal
cy.get('#statusDropdownMenu li#status-menu-custom-status').click();
cy.get('#custom_status_modal').should('exist');
// * Verify that the custom status modal opens
cy.findByRole('dialog', {name: 'Set a status'}).should('exist').within(() => {
// # Select a custom status from the suggestions
cy.get('.statusSuggestion__row').first().click();
// * Check if all the default suggestions exist
defaultCustomStatuses.map((statusText) => cy.get('#custom_status_modal .statusSuggestion__content').contains('span', statusText));
});
it('MM-T4064_3 Correct custom status is selected with the correct emoji and correct duration', () => {
// * Default emoji is currently visible in the custom status input
cy.get('#custom_status_modal .StatusModal__emoji-button span').should('have.class', 'icon--emoji');
// * Input should be empty
cy.get('#custom_status_modal input.form-control').should('have.value', '');
// # Select a custom status from the suggestions
cy.get('#custom_status_modal .statusSuggestion__content').contains('span', customStatus.text).click();
// * Emoji in the custom status input should be changed
cy.get('#custom_status_modal .StatusModal__emoji-button span').invoke('attr', 'data-emoticon').should('contain', customStatus.emoji);
// * Selected custom status text should be in the input
cy.get('#custom_status_modal input.form-control').should('have.value', customStatus.text);
// * Selected custom status duration should be displayed in the Clear after section
cy.get('#custom_status_modal .expiry-wrapper .expiry-value').should('have.text', customStatus.duration);
});
it('MM-T4064_4 should set custom status when click on Set Status', () => {
// # Click on the Set Status button
cy.get('#custom_status_modal .GenericModal__button.confirm').click();
// # Click on the Set Status button
cy.findByText('Set Status').click();
});
// * Modal should be closed
cy.get('#custom_status_modal').should('not.exist');
// # Setting the time at which the custom status should be expired
// # Note that we need to be flexible around accepted values, as this calculation and the server-side one may differ slightly
expiresAt = dayjs().add(waitingTime, 'minute');
// * Status should be set and the emoji should be visible in the sidebar header
cy.uiGetProfileHeader().
find('.emoticon').
should('have.attr', 'data-emoticon', customStatus.emoji);
});
it('MM-T4064_5 should show the set custom status with expiry when status dropdown is opened', () => {
// # Click on the sidebar header to open status dropdown
cy.get('.MenuWrapper .status-wrapper').click();
// * Check if the status dropdown opens
cy.get('#statusDropdownMenu').should('exist');
// * Correct custom status text and emoji should be displayed in the status dropdown
cy.get('.status-dropdown-menu .custom_status__container').should('have.text', customStatus.text);
cy.get('.status-dropdown-menu .custom_status__row span.emoticon').invoke('attr', 'data-emoticon').should('contain', customStatus.emoji);
// * Correct clear time should be displayed in the status dropdown
cy.get('.status-dropdown-menu .custom_status__expiry time').should('have.text', expiresAt.format(expiryTimeFormat));
});
it('MM-T4064_6 should show expiry time in the tooltip of custom status emoji in the post header', () => {
// # Post a message in the channel
cy.postMessage('Hello World!');

Просмотреть файл

@@ -39,15 +39,15 @@ describe('MM-T4065 Setting manual status clear time less than 7 days away', () =
it('MM-T4065_1 should open status dropdown', () => {
// # Click on the sidebar header to open status dropdown
cy.get('.MenuWrapper .status-wrapper').click();
cy.uiGetSetStatusButton().click();
// * Check if the status dropdown opens
cy.get('#statusDropdownMenu').should('exist');
cy.get('#userAccountMenu').should('exist');
});
it('MM-T4065_2 Custom status modal opens with 5 default statuses listed', () => {
// # Open custom status modal
cy.get('#statusDropdownMenu li#status-menu-custom-status').click();
cy.get('.userAccountMenu_setCustomStatusMenuItem').click();
cy.get('#custom_status_modal').should('exist');
// * Check if all the default suggestions exist

Просмотреть файл

@@ -38,15 +38,15 @@ describe('MM-T4066 Setting manual status clear time more than 7 days away', () =
const months = dateToBeSelected.get('month') - today.get('month');
it('MM-T4066_1 should open status dropdown', () => {
// # Click on the sidebar header to open status dropdown
cy.get('.MenuWrapper .status-wrapper').click();
cy.uiGetSetStatusButton().click();
// * Check if the status dropdown opens
cy.get('#statusDropdownMenu').should('exist');
cy.get('#userAccountMenu').should('exist');
});
it('MM-T4066_2 Custom status modal opens with 5 default statuses listed', () => {
// # Open custom status modal
cy.get('#statusDropdownMenu li#status-menu-custom-status').click();
cy.get('.userAccountMenu_setCustomStatusMenuItem').click();
cy.get('#custom_status_modal').should('exist');
// * Check if all the default suggestions exist

Просмотреть файл

@@ -12,10 +12,10 @@
describe('Integrations', () => {
const testCases = [
{command: '/away', className: 'icon-clock', message: 'You are now away'},
{command: '/dnd', className: 'icon-minus-circle', message: 'Do Not Disturb is enabled. You will not receive desktop or mobile push notifications until Do Not Disturb is turned off.'},
{command: '/offline', className: 'icon-circle-outline', message: 'You are now offline'},
{command: '/online', className: 'icon-check-circle', message: 'You are now online'},
{command: '/away', className: 'userAccountMenu_awayMenuItem_icon', message: 'You are now away'},
{command: '/dnd', className: 'userAccountMenu_dndMenuItem_icon', message: 'Do Not Disturb is enabled. You will not receive desktop or mobile push notifications until Do Not Disturb is turned off.'},
{command: '/offline', className: 'userAccountMenu_offlineMenuItem_icon', message: 'You are now offline'},
{command: '/online', className: 'userAccountMenu_onlineMenuItem_icon', message: 'You are now online'},
];
let offTopicUrl;
@@ -67,7 +67,7 @@ describe('Integrations', () => {
function verifyUserStatus(testCase, isCompactMode) {
// * Verify that the user status is as indicated
cy.uiGetProfileHeader().
find('i').
find('svg').
should('be.visible').
and('have.class', testCase.className);

Просмотреть файл

@@ -26,14 +26,14 @@ describe('Integrations', () => {
it('MM-T670 /away', () => {
// # Set online status and verify it's changed as the initial status
setStatus(online.name, online.profileClassName);
setStatus(online.name);
verifyUserStatus(away);
});
it('MM-T672 /offline', () => {
// # Set online status and verify it's changed as the initial status
setStatus(online.name, online.profileClassName);
setStatus(online.name);
verifyUserStatus(offline);
@@ -60,17 +60,14 @@ describe('Integrations', () => {
it('MM-T674 /online', () => {
// # Set offline status and verify it's changed as the initial status
setStatus(offline.name, offline.className);
setStatus(offline.name);
verifyUserStatus(online);
});
});
function setStatus(status, icon) {
function setStatus(status) {
cy.apiUpdateUserStatus(status);
cy.uiGetProfileHeader().
find('i').
and('have.class', icon);
}
function verifyUserStatus(testCase) {
@@ -90,9 +87,7 @@ function verifyUserStatus(testCase) {
});
// * Verify status shown at user profile in LHS
cy.uiGetProfileHeader().
find('i').
and('have.class', testCase.profileClassName || testCase.className);
cy.get('#userAccountMenuButtonDescribedBy').should('exist').and('include.text', `Status is "${testCase.name.charAt(0).toUpperCase() + testCase.name.slice(1)}"`);
// # Post a message
cy.postMessage(testCase.name);

Просмотреть файл

@@ -33,10 +33,9 @@ describe('Main menu', () => {
cy.apiLogin(testUser);
cy.visit(`/${testTeam.name}/channels/town-square`);
cy.uiOpenUserMenu();
cy.findByRole('menu').should('exist').find('.menu-divider:visible').last().click();
cy.findByRole('menu').should('exist');
cy.uiOpenUserMenu().within(() => {
cy.findAllByRole('separator').last().click();
});
});
it('should show integrations option for system administrator', () => {

Просмотреть файл

@@ -10,15 +10,14 @@
// Stage: @prod
// Group: @channels @menu @custom_status @status_menu
import * as TIMEOUTS from '../../../fixtures/timeouts';
import theme from '../../../fixtures/theme.json';
describe('Status dropdown menu', () => {
const statusTestCases = [
{text: 'Online', className: 'icon-check-circle', profileClassName: 'icon-check-circle'},
{text: 'Away', className: 'icon-clock'},
{text: 'Do not disturb', className: 'icon-minus-circle'},
{text: 'Offline', className: 'icon-circle-outline'},
{text: 'Online', className: 'userAccountMenu_onlineMenuItem_icon'},
{text: 'Away', className: 'userAccountMenu_awayMenuItem_icon'},
{text: 'Do not disturb', className: 'userAccountMenu_dndMenuItem_icon'},
{text: 'Offline', className: 'userAccountMenu_offlineMenuItem_icon'},
];
before(() => {
@@ -40,9 +39,10 @@ describe('Status dropdown menu', () => {
// * Verify all available statuses are shown with icon and text
statusTestCases.forEach((tc) => {
cy.get('@userMenu').findByText(tc.text).
parent().
find('i').should('have.class', tc.className);
cy.uiGetStatusMenu().within(() => {
cy.findByText(tc.text).should('be.visible');
cy.get('svg').filter(`.${tc.className}`).should('have.length', 1);
});
});
});
@@ -67,7 +67,7 @@ describe('Status dropdown menu', () => {
cy.uiOpenUserMenu().as('userMenu');
// * Verify "Set a Custom Status" header is clickable
cy.get('@userMenu').findByText('Set a custom status').should('have.css', 'cursor', 'pointer');
cy.get('@userMenu').findByText('Set custom status').should('have.css', 'cursor', 'pointer');
});
it('MM-T2927_5 When custom status is disabled, status menu is displayed when status icon is clicked', () => {
@@ -81,22 +81,12 @@ describe('Status dropdown menu', () => {
cy.uiOpenUserMenu();
});
it('MM-T4420 Should stay open when dnd sub-menu header is clicked', () => {
// # Open Dnd sub menu and click on header
cy.uiOpenDndStatusSubMenu().find('#dndSubMenu-header_menuitem').click().then(() => {
cy.wait(TIMEOUTS.HALF_SEC);
// * Verify that dnd submenu is still visible
cy.get('body').find('#dndSubMenu-header_menuitem').should('be.visible');
});
});
it('MM-T4914 Profile menu header is clickable, opens Profile settings', () => {
// # Open user menu
cy.uiOpenUserMenu().as('userMenu');
// * Verify menu header is clickable
cy.get('@userMenu').get('.MenuHeader').should('have.css', 'cursor', 'pointer').click();
cy.uiOpenUserMenu().within(() => {
// * Verify menu header is clickable
cy.get('li').first().should('have.css', 'cursor', 'pointer').click();
});
// * Verify click on header opens Profile settings modal
cy.findByRole('dialog', {name: 'Profile'}).should('be.visible');
@@ -111,14 +101,14 @@ function stepThroughStatuses(statusTestCases = []) {
statusTestCases.forEach((tc) => {
// # Open user menu and click option
if (tc.text === 'Do not disturb') {
cy.uiOpenDndStatusSubMenu().find('#dndTime-thirty_minutes_menuitem').click();
cy.uiOpenDndStatusSubMenuAndClick30Mins();
} else {
cy.uiOpenUserMenu(tc.text);
}
// # Verify correct status icon is shown on user's profile picture
cy.uiGetProfileHeader().
find('i').
and('have.class', tc.profileClassName || tc.className);
cy.uiGetSetStatusButton().within(() => {
cy.get('svg').filter(`.${tc.className}`).should('have.length', 1);
});
});
}

Просмотреть файл

@@ -78,7 +78,7 @@ describe('Notifications', () => {
cy.uiOpenUserMenu().findByText(`@${firstUser.username}`);
// # Close the user menu
cy.uiGetSetStatusButton().click();
cy.get('body').type('{esc}');
// * Check that 'Town Square' is currently being selected
cy.get('.active').within(() => {

Просмотреть файл

@@ -71,7 +71,7 @@ describe('Profile Settings', () => {
fileTypes.forEach((fileType, index) => {
it(`MM-T2078_${index + 1} Profile picture: file ${fileType.extension} type accepted`, () => {
// # Save the default profile picture link so it can be compared to the new one
cy.uiGetProfileHeader().findByRole('img').invoke('attr', 'src').as('defaultProfilePictureLink');
cy.uiGetSetStatusButton().get('img').invoke('attr', 'src').as('defaultProfilePictureLink');
cy.uiOpenProfileModal('Profile Settings');
@@ -95,7 +95,7 @@ describe('Profile Settings', () => {
cy.uiClose();
// # Save the new custom profile picture link so it can be compared to the old one
cy.uiGetProfileHeader().findByRole('img').invoke('attr', 'src').as('customProfilePictureLink');
cy.uiGetSetStatusButton().get('img').invoke('attr', 'src').as('customProfilePictureLink');
cy.then(function() {
expect(this.customProfilePictureLink).to.not.equal(this.defaultProfilePictureLink);

Просмотреть файл

@@ -92,18 +92,18 @@ describe('Custom Theme - Sidebar Styles', () => {
cy.uiOpenUserMenu('Online');
// * Check Online Indicator color
cy.get('.icon-check-circle').should('have.css', 'color', rgbArrayToString(themeRgbColor.onlineIndicator));
cy.uiGetSetStatusButton().find('svg').should('have.css', 'color', rgbArrayToString(themeRgbColor.onlineIndicator));
// # Set user status to away
cy.uiOpenUserMenu('Away');
// * Check Away Indicator color
cy.get('.icon-clock').should('have.css', 'color', rgbArrayToString(themeRgbColor.awayIndicator));
cy.uiGetSetStatusButton().find('svg').should('have.css', 'color', rgbArrayToString(themeRgbColor.awayIndicator));
// # Set user status to do not disturb
cy.uiOpenDndStatusSubMenu().find('#dndTime-thirty_minutes_menuitem').click();
cy.uiOpenDndStatusSubMenuAndClick30Mins();
// * Check Do Not Disturb Indicator color
cy.get('.icon-minus-circle').should('have.css', 'color', rgbArrayToString(themeRgbColor.dndIndicator));
cy.uiGetSetStatusButton().find('svg').should('have.css', 'color', rgbArrayToString(themeRgbColor.dndIndicator));
});
});

Просмотреть файл

@@ -42,7 +42,7 @@ describe('SignIn Authentication', () => {
cy.url().should('include', '/channels/town-square');
// # Click logout via user menu
cy.uiOpenUserMenu('Log Out');
cy.uiOpenUserMenu('Log out');
// * Check that it logout successfully and it redirects into the login page
cy.url().should('include', '/login');

Просмотреть файл

@@ -186,7 +186,7 @@ describe('Login page with open server', () => {
cy.url().should('include', '/channels/town-square');
// # Click logout via user menu
cy.uiOpenUserMenu('Log Out');
cy.uiOpenUserMenu('Log out');
// * Check that it logout successfully and it redirects into the login page
cy.url().should('include', '/login');
@@ -209,7 +209,7 @@ describe('Login page with open server', () => {
cy.url().should('include', '/channels/town-square');
// # Click logout via user menu
cy.uiOpenUserMenu('Log Out');
cy.uiOpenUserMenu('Log out');
// * Check that it logout successfully and it redirects into the login page
cy.url().should('include', '/login');

Просмотреть файл

@@ -92,12 +92,12 @@ describe('Status of current user', () => {
});
function verifyStatus(status: 'online' | 'away' | 'offline' | 'dnd') {
cy.get('[aria-label="Current status: Online. Select to open profile and status menu."]').
cy.get('[aria-label="Status is \\"Online\\". Open user\'s account menu."]').
should(status === 'online' ? 'exist' : 'not.exist');
cy.get('[aria-label="Current status: Away. Select to open profile and status menu."]').
cy.get('[aria-label="Status is \\"Away\\". Open user\'s account menu."]').
should(status === 'away' ? 'exist' : 'not.exist');
cy.get('[aria-label="Current status: Offline. Select to open profile and status menu."]').
cy.get('[aria-label="Status is \\"Offline\\". Open user\'s account menu."]').
should(status === 'offline' ? 'exist' : 'not.exist');
cy.get('[aria-label="Current status: Do not disturb. Select to open profile and status menu."]').
cy.get('[aria-label="Status is \\"Do not disturb\\". Open user\'s account menu."]').
should(status === 'dnd' ? 'exist' : 'not.exist');
}

Просмотреть файл

@@ -53,7 +53,7 @@ Cypress.Commands.add('checkLeftSideBar', (settings = {}) => {
cy.uiOpenUserMenu().findByText(`@${settings.user.username}`);
// # Close status menu
cy.uiGetSetStatusButton().click();
cy.get('body').type('{esc}');
}
if (settings.user.userType === 'Admin' || settings.user.isAdmin) {

Просмотреть файл

@@ -27,7 +27,8 @@ Cypress.Commands.add('uiOpenProductMenu', (item = '') => {
});
Cypress.Commands.add('uiGetSetStatusButton', () => {
return cy.findByRole('button', {name: /Select to open profile and status menu\./i}).should('be.visible');
// # Get set status button
return cy.get('#userAccountMenuButton').should('be.visible');
});
Cypress.Commands.add('uiGetProfileHeader', () => {
@@ -36,22 +37,18 @@ Cypress.Commands.add('uiGetProfileHeader', () => {
Cypress.Commands.add('uiGetStatusMenuContainer', (options = {exist: true}) => {
if (options.exist) {
return cy.findByRole('menu').should('exist');
return cy.get('#userAccountMenu').should('exist').and('be.visible');
}
return cy.findByRole('menu').should('not.exist');
return cy.get('#userAccountMenu').should('not.exist');
});
Cypress.Commands.add('uiGetStatusMenu', (options = {visible: true}) => {
if (options.visible) {
return cy.uiGetStatusMenuContainer().
find('ul').
should('be.visible');
return cy.get('#userAccountMenu').should('exist').and('be.visible');
}
return cy.uiGetStatusMenuContainer().
find('ul').
should('not.be.visible');
return cy.get('#userAccountMenu').should('not.exist');
});
Cypress.Commands.add('uiOpenHelpMenu', (item = '') => {
@@ -147,7 +144,7 @@ Cypress.Commands.add('uiOpenSettingsModal', (section = '') => {
Cypress.Commands.add('uiLogout', () => {
// # Click logout via user menu
cy.uiOpenUserMenu('Log Out');
cy.uiOpenUserMenu('Log out');
cy.url().should('include', '/login');
cy.get('.login-body-message').should('be.visible');

Просмотреть файл

@@ -33,14 +33,8 @@ Cypress.Commands.add('uiGetSystemConsoleMainMenu', () => {
return getMenu(SYSTEM_CONSOLE_MAIN_MENU);
});
Cypress.Commands.add('uiOpenDndStatusSubMenu', () => {
cy.uiOpenUserMenu();
Cypress.Commands.add('uiOpenDndStatusSubMenuAndClick30Mins', () => {
cy.uiOpenUserMenu().findByText('Do not disturb').should('be.visible').trigger('mouseover');
// # Wait for status menu to transition in
cy.get('.MenuWrapper.status-dropdown-menu .Menu__content.dropdown-menu').should('be.visible');
// # Hover over Do Not Disturb option
cy.get('.MenuWrapper.status-dropdown-menu .Menu__content.dropdown-menu li#status-menu-dnd_menuitem').trigger('mouseover');
return cy.get('#status-menu-dnd');
cy.findByText('30 mins').should('be.visible').click({force: true});
});