[MM-56695] Consolidate desktop and mobile Notifications to one and a new desktop notification sound settings (#26198)

Этот коммит содержится в:
M-ZubairAhmed
2024-04-08 18:59:05 +00:00
коммит произвёл GitHub
родитель a81ee87832
Коммит 9698cfcc19
42 изменённых файлов: 2395 добавлений и 2780 удалений

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

@@ -31,12 +31,12 @@ describe('Verify Accessibility Support in different sections in Settings and Pro
const settings = {
notifications: [
{key: 'desktop', label: 'Desktop Notifications', type: 'radio'},
{key: 'email', label: 'Email Notifications', type: 'radio'},
{key: 'push', label: 'Mobile Push Notifications', type: 'radio'},
{key: 'keysWithNotification', label: 'Keywords That Trigger Notifications', type: 'checkbox'},
{key: 'keysWithHighlight', label: 'Keywords That Get Highlighted (Without Notifications)', type: 'checkbox'},
{key: 'comments', label: 'Reply Notifications', type: 'radio'},
{key: 'desktopAndMobile', label: 'Desktop and mobile notifications', type: 'radio'},
{key: 'desktopNotificationSound', label: 'Desktop notification sounds', type: 'radio'},
{key: 'email', label: 'Email notifications', type: 'radio'},
{key: 'keywordsAndMentions', label: 'Keywords that trigger notifications', type: 'checkbox'},
{key: 'keywordsAndHighlight', label: 'Keywords that get highlighted (without notifications)', type: 'checkbox'},
{key: 'replyNotifications', label: 'Reply notifications', type: 'radio'},
],
display: [
{key: 'theme', label: 'Theme', type: 'radio'},
@@ -147,18 +147,6 @@ describe('Verify Accessibility Support in different sections in Settings and Pro
verifySettings(settings.advanced);
});
it('MM-T1481 Verify Correct Radio button behavior in Settings and Profile', () => {
cy.visit(url);
cy.postMessage('hello');
cy.uiOpenSettingsModal();
cy.get('#notificationsButton').click();
cy.get('#desktopEdit').click();
cy.get('#desktopNotificationAllActivity').check().should('be.checked').tab().check();
cy.get('#desktopNotificationMentions').should('be.checked').tab().check();
cy.get('#desktopNotificationNever').should('be.checked');
});
it('MM-T1482 Input fields in Settings and Profile should read labels', () => {
cy.visit(url);
cy.postMessage('hello');

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

@@ -48,7 +48,7 @@ describe('Auto Response In DMs', () => {
// # Open 'Settings' modal and view 'Notifications'
cy.uiOpenSettingsModal().within(() => {
// # Click on 'Edit' for 'Automatic Direct Message Replies
cy.get('#auto-responderEdit').should('exist').scrollIntoView().and('be.visible').click();
cy.get('#autoResponderEdit').should('exist').scrollIntoView().and('be.visible').click();
// # Click on 'Enabled' checkbox
cy.get('#autoResponderActive').should('be.visible').click();

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

@@ -23,8 +23,8 @@ describe('Notifications', () => {
// # Open 'Settings' modal
cy.uiOpenSettingsModal().within(() => {
// # Open 'Keywords That Trigger Notifications' setting and uncheck all the checkboxes
cy.findByRole('heading', {name: 'Keywords That Trigger Notifications'}).should('be.visible').click();
// # Open 'Keywords that trigger notifications' setting and uncheck all the checkboxes
cy.findByRole('heading', {name: 'Keywords that trigger notifications'}).should('be.visible').click();
cy.findByRole('checkbox', {name: `Your case-sensitive first name "${otherUser.first_name}"`}).should('not.be.checked');
cy.findByRole('checkbox', {name: `Your non case-sensitive username "${otherUser.username}"`}).should('not.be.checked');
cy.findByRole('checkbox', {name: 'Channel-wide mentions "@channel", "@all", "@here"'}).click().should('not.be.checked');

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

@@ -252,7 +252,7 @@ function setNotificationSettings(desiredSettings = {first: true, username: true,
cy.findAllByText('Notifications').should('be.visible');
// Open up 'Words that trigger mentions' sub-section
cy.findByText('Keywords That Trigger Notifications').
cy.findByText('Keywords that trigger notifications').
scrollIntoView().
click();

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

@@ -50,8 +50,8 @@ describe('Notifications', () => {
// # Open 'Notifications' of 'Settings' modal
cy.uiOpenSettingsModal().within(() => {
// # Open 'Email Notifications' setting and set to 'Immediately'
cy.findByRole('heading', {name: 'Email Notifications'}).should('be.visible').click();
// # Open 'Email notifications' setting and set to 'Immediately'
cy.findByRole('heading', {name: 'Email notifications'}).should('be.visible').click();
cy.findByRole('radio', {name: 'Immediately'}).click().should('be.checked');
// # Save then close the modal

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

@@ -29,8 +29,8 @@ describe('Notifications', () => {
// # Open 'Settings' modal
cy.uiOpenSettingsModal().within(() => {
// # Open 'Keywords That Trigger Notifications' setting
cy.findByRole('heading', {name: 'Keywords That Trigger Notifications'}).should('be.visible').click();
// # Open 'Keywords that trigger notifications' setting
cy.findByRole('heading', {name: 'Keywords that trigger notifications'}).should('be.visible').click();
// * As otherUser, ensure that 'Your non-case sensitive username' is not checked
cy.findByRole('checkbox', {name: `Your non case-sensitive username "${otherUser.username}"`}).should('not.be.checked');

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

@@ -48,7 +48,7 @@ describe('Desktop notifications', () => {
spyNotificationAs('withoutNotification', 'granted');
// # Ensure notifications are set up to fire a desktop notification if are mentioned.
changeDesktopNotificationAs('#desktopNotificationMentions');
changeDesktopNotificationAs('mentions');
cy.apiGetChannelByName(testTeam.name, 'Off-Topic').then(({channel}) => {
// # Logout the user
@@ -100,7 +100,7 @@ describe('Desktop notifications', () => {
const expected = '@' + otherUser.username + ': I\'m hungry :taco: Mattermost';
// # Ensure notifications are set up to fire a desktop notification if are mentioned.
changeDesktopNotificationAs('#desktopNotificationAllActivity');
changeDesktopNotificationAs('all');
cy.apiGetChannelByName(testTeam.name, 'Off-Topic').then(({channel}) => {
// # Have another user send a post.
@@ -147,7 +147,7 @@ describe('Desktop notifications', () => {
const expected = '@' + otherUser.username + ' did something new';
// # Ensure notifications are set up to fire a desktop notification for all activity.
changeDesktopNotificationAs('#desktopNotificationAllActivity');
changeDesktopNotificationAs('all');
cy.apiGetChannelByName(testTeam.name, 'Off-Topic').then(({channel}) => {
// # Have another user send a post.
@@ -169,7 +169,7 @@ describe('Desktop notifications', () => {
spyNotificationAs('withNotification', 'granted');
// # Ensure notifications are set up to fire a desktop notification if are mentioned
changeDesktopNotificationAs('#desktopNotificationMentions');
changeDesktopNotificationAs('mentions');
// # Ensure display settings are set to "Show username"
changeTeammateNameDisplayAs('#name_formatFormatA');
@@ -194,7 +194,7 @@ describe('Desktop notifications', () => {
spyNotificationAs('withNotification', 'granted');
// # Ensure notifications are set up to fire a desktop notification if are mentioned
changeDesktopNotificationAs('#desktopNotificationMentions');
changeDesktopNotificationAs('mentions');
// # Ensure display settings are set to "Show first and last name"
changeTeammateNameDisplayAs('#name_formatFormatC');
@@ -235,7 +235,7 @@ describe('Desktop notifications', () => {
spyNotificationAs('withNotification', 'granted');
// # Ensure notifications are set up to fire a desktop notification
changeDesktopNotificationAs('#desktopNotificationMentions');
changeDesktopNotificationAs('mentions');
cy.apiGetChannelByName(testTeam.name, 'Off-Topic').then(({channel}) => {
const messageWithoutNotification = 'message without notification';
@@ -271,7 +271,7 @@ describe('Desktop notifications', () => {
spyNotificationAs('withNotification', 'granted');
// # Ensure notifications are set up to never fire a desktop notification
changeDesktopNotificationAs('#desktopNotificationNever');
changeDesktopNotificationAs('nothing');
cy.apiGetChannelByName(testTeam.name, 'Off-Topic').then(({channel}) => {
const messageWithNotification = `random message with mention @${testUser.username}`;
@@ -297,14 +297,11 @@ describe('Desktop notifications', () => {
// # Open settings modal
cy.uiOpenSettingsModal().within(() => {
// # Click "Desktop"
cy.findByText('Desktop Notifications').should('be.visible').click();
// # Click "Desktop sound notifications"
cy.findByText('Desktop notification sounds').should('be.visible').click();
// # Select sound off.
cy.get('#soundOff').check();
// # Ensure sound dropdown is not visible
cy.get('#displaySoundNotification').should('not.exist');
cy.findByText('Message notification sound').click({force: true});
// # Click "Save" and close the modal
cy.uiSaveAndClose();

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

@@ -43,7 +43,7 @@ describe('Desktop notifications', () => {
it('MM-T885 Channel notifications: Desktop notifications mentions only', () => {
// # Ensure notifications are set up to fire a desktop notification
changeDesktopNotificationAs('#desktopNotificationAllActivity');
changeDesktopNotificationAs('all');
const messageWithNotification = `random message with mention @${testUser.username}`;
const expected = `@${otherUser.username}: ${messageWithNotification}`;

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

@@ -48,7 +48,7 @@ describe('Desktop notifications', () => {
spyNotificationAs('withNotification', 'granted');
// # Ensure notifications are set up to fire a desktop notification if are mentioned
changeDesktopNotificationAs('#desktopNotificationMentions');
changeDesktopNotificationAs('mentions');
// # Ensure display settings are set to "Show nickname if one exists, otherwise show first and last name"
changeTeammateNameDisplayAs('#name_formatFormatB');
@@ -76,7 +76,7 @@ describe('Desktop notifications', () => {
spyNotificationAs('withNotification', 'granted');
// # Ensure notifications are set up to fire a desktop notification if are mentioned
changeDesktopNotificationAs('#desktopNotificationMentions');
changeDesktopNotificationAs('mentions');
// # Ensure display settings are set to "Show nickname if one exists, otherwise show first and last name"
changeTeammateNameDisplayAs('#name_formatFormatB');

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

@@ -4,11 +4,21 @@
export function changeDesktopNotificationAs(category) {
// # Open settings modal
cy.uiOpenSettingsModal().within(() => {
// # Click "Desktop Notifications"
cy.findByText('Desktop Notifications').should('be.visible').click();
// # Click "Desktop and mobile notifications"
cy.findByText('Desktop and mobile notifications').should('be.visible').click();
// # Select category.
cy.get(category).check();
cy.get('#sendDesktopNotificationsSection').should('exist').within(() => {
if (category === 'all') {
// # Click "For all All new messages"
cy.findByText('All new messages').should('be.visible').click({force: true});
} else if (category === 'mentions') {
// # Click "For mentions"
cy.findByText('Mentions, direct messages, and group messages').should('be.visible').click({force: true});
} else if (category === 'nothing') {
// # Click "For nothing"
cy.findByText('Nothing').should('be.visible').click({force: true});
}
});
// # Click "Save" and close the modal
cy.uiSaveAndClose();

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

@@ -31,17 +31,17 @@ describe('Notifications', () => {
});
it('MM-T555 Notification Preferences do not save when modal is closed without saving', () => {
// # Call function that clicks on Settings -> Notifications -> Email Notifications -> Send Email Notifications -> Never without saving
// # Call function that clicks on Settings -> Notifications -> Email notifications -> Send Email notifications -> Never without saving
openSettingsAndClickEmailEdit(true);
// # Call function that checks Settings -> Notifications -> Email Notifications -> Send Email Notifications -> Never is not saved
// # Call function that checks Settings -> Notifications -> Email notifications -> Send Email notifications -> Never is not saved
openSettingsAndClickEmailEdit(false);
});
function openSettingsAndClickEmailEdit(shouldBeClicked = false) {
// # Open 'Settings' modal
cy.uiOpenSettingsModal().within(() => {
// # Click on the 'Edit' button next to Email Notifications
// # Click on the 'Edit' button next to Email notifications
cy.get('#emailEdit').click();
if (shouldBeClicked) {

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

@@ -239,9 +239,7 @@ function setReplyNotificationsSetting(idToToggle) {
and('contain', 'Notifications');
// Open up 'Reply Notifications' sub-section
cy.get('#commentsTitle').
scrollIntoView().
click();
cy.findByText('Reply notifications').should('be.visible').scrollIntoView().click();
cy.get(idToToggle).check().should('be.checked');

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

@@ -20,47 +20,27 @@ describe('Notifications', () => {
});
it('MM-T5458 Notification sound modal selection should reset when settings canceled', () => {
// # Call function that clicks on Settings -> Notifications -> Desktop Notifications -> Notification sound -> Change sound -> Cancel -> Desktop Notifications
openSettingsAndChangeNotification();
});
function openSettingsAndChangeNotification() {
// # Open 'Settings' modal
cy.uiOpenSettingsModal().within(() => {
// # Navigate to Desktop Notification Settings
navigateToDesktopNotificationSettings();
cy.uiOpenSettingsModal();
// # Change Notification selection
setNotificationSound();
// # Navigate to Desktop Notification Settings
cy.get('#desktopNotificationSoundEdit').should('be.visible').click();
// # Click Cancel button
cy.uiCancelButton().click();
// # Change Notification selection
cy.get('#messageNotificationSoundSelect').click();
// # Navigate to Desktop Notification Settings
navigateToDesktopNotificationSettings();
cy.uiClose();
});
}
function setNotificationSound() {
// # Change Notification sound selection value is set to Down
cy.get('#displaySoundNotification').click();
// # Select 'Bing' sound
cy.findByText('Down').click();
// * Verify Notification display changed to Down
verifyNotificationSelectionValue('Down');
}
// # Click Cancel button to close the settings
cy.uiCancelButton().click();
function navigateToDesktopNotificationSettings() {
// # Click on the 'Edit' button next to Desktop Notifications
cy.get('#desktopEdit').should('be.visible').click();
// # Click on the 'Edit' button next to Desktop sound notification again
cy.get('#desktopNotificationSoundEdit').should('be.visible').click();
// * Verify that the Notification sound is set to Bing
verifyNotificationSelectionValue('Bing');
}
// * Verify that the Notification sound is set to Bing as we canceled the settings
cy.findByText('Bing').should('be.visible');
function verifyNotificationSelectionValue(value) {
// * Verify that the Notification sound is set to certain value
cy.get('#displaySoundNotification').findByTestId('displaySoundNotificationValue').should('contain', value);
}
cy.uiClose();
});
});

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

@@ -34,7 +34,7 @@ describe('Authentication', () => {
// # Open settings modal
cy.uiOpenSettingsModal().within(() => {
// Click "Desktop"
cy.findByText('Desktop Notifications').should('be.visible').click();
cy.findByText('Desktop and mobile notifications').should('be.visible').click();
// # Set your desktop notifications to Never
cy.get('#desktopNotificationNever').check();