diff --git a/e2e-tests/cypress/tests/integration/channels/accessibility/accessibility_account_settings_spec.js b/e2e-tests/cypress/tests/integration/channels/accessibility/accessibility_account_settings_spec.js index 438c25b569..a1b44c5856 100644 --- a/e2e-tests/cypress/tests/integration/channels/accessibility/accessibility_account_settings_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/accessibility/accessibility_account_settings_spec.js @@ -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'); diff --git a/e2e-tests/cypress/tests/integration/channels/messaging/message_auto_response_spec.js b/e2e-tests/cypress/tests/integration/channels/messaging/message_auto_response_spec.js index 007b04dc74..af840df56e 100644 --- a/e2e-tests/cypress/tests/integration/channels/messaging/message_auto_response_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/messaging/message_auto_response_spec.js @@ -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(); diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/at_icon_still_shows_mentions_list_with_deactivated_triggers_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/at_icon_still_shows_mentions_list_with_deactivated_triggers_spec.js index 521d3f9133..0c17a7bfa2 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/at_icon_still_shows_mentions_list_with_deactivated_triggers_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/at_icon_still_shows_mentions_list_with_deactivated_triggers_spec.js @@ -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'); diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/at_mentions_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/at_mentions_spec.js index 4982846810..c38d3d93fa 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/at_mentions_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/at_mentions_spec.js @@ -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(); diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/channel_links_show_as_links_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/channel_links_show_as_links_spec.js index 8751f3e8ff..5a30952ba2 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/channel_links_show_as_links_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/channel_links_show_as_links_spec.js @@ -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 diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/deselect_username_mention_trigger_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/deselect_username_mention_trigger_spec.js index 10bb5465fc..3d920b1e12 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/deselect_username_mention_trigger_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/deselect_username_mention_trigger_spec.js @@ -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'); diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_1_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_1_spec.js index 248849a1f0..e823387c89 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_1_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_1_spec.js @@ -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(); diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_2_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_2_spec.js index 12d9e3a4d3..5b081ecd2c 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_2_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_2_spec.js @@ -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}`; diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_3_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_3_spec.js index 0a5942b6d5..a91ce32bda 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_3_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/desktop_notifications_3_spec.js @@ -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'); diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/helper.js b/e2e-tests/cypress/tests/integration/channels/notifications/helper.js index c9e20cd8e6..1648bd9038 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/helper.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/helper.js @@ -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(); diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/notification_preferences_do_not_save_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/notification_preferences_do_not_save_spec.js index 9daf4ebea0..165030ea7d 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/notification_preferences_do_not_save_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/notification_preferences_do_not_save_spec.js @@ -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) { diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/reply_notifications_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/reply_notifications_spec.js index 0e9c2bdcc9..e52cdc5d30 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/reply_notifications_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/reply_notifications_spec.js @@ -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'); diff --git a/e2e-tests/cypress/tests/integration/channels/notifications/reset_notification_when_settings_canceled_spec.js b/e2e-tests/cypress/tests/integration/channels/notifications/reset_notification_when_settings_canceled_spec.js index e14f97bee8..1db44c9d3d 100644 --- a/e2e-tests/cypress/tests/integration/channels/notifications/reset_notification_when_settings_canceled_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/notifications/reset_notification_when_settings_canceled_spec.js @@ -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(); + }); }); diff --git a/e2e-tests/cypress/tests/integration/channels/signin_authentication/desktop_session_expire_spec.js b/e2e-tests/cypress/tests/integration/channels/signin_authentication/desktop_session_expire_spec.js index 28d1a34854..6235fcff18 100644 --- a/e2e-tests/cypress/tests/integration/channels/signin_authentication/desktop_session_expire_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/signin_authentication/desktop_session_expire_spec.js @@ -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(); diff --git a/webapp/channels/src/actions/notification_actions.jsx b/webapp/channels/src/actions/notification_actions.jsx index 9110966d63..18718e6316 100644 --- a/webapp/channels/src/actions/notification_actions.jsx +++ b/webapp/channels/src/actions/notification_actions.jsx @@ -102,13 +102,13 @@ export function sendDesktopNotification(post, msgProps) { notifyLevel = user?.notify_props?.desktop || NotificationLevels.ALL; } - if (channel.type === 'G' && channelNotifyProp === NotificationLevels.DEFAULT && user?.notify_props?.desktop === NotificationLevels.MENTION) { + if (channel?.type === 'G' && channelNotifyProp === NotificationLevels.DEFAULT && user?.notify_props?.desktop === NotificationLevels.MENTION) { notifyLevel = NotificationLevels.ALL; } if (notifyLevel === NotificationLevels.NONE) { return; - } else if (channel.type === 'G' && notifyLevel === NotificationLevels.MENTION) { + } else if (channel?.type === 'G' && notifyLevel === NotificationLevels.MENTION) { // Compose the whole text in the message, including interactive messages. let text = post.message; diff --git a/webapp/channels/src/components/__snapshots__/setting_item_max.test.tsx.snap b/webapp/channels/src/components/__snapshots__/setting_item_max.test.tsx.snap index 13701dc3a9..86050df07e 100644 --- a/webapp/channels/src/components/__snapshots__/setting_item_max.test.tsx.snap +++ b/webapp/channels/src/components/__snapshots__/setting_item_max.test.tsx.snap @@ -11,7 +11,7 @@ exports[`components/SettingItemMax should match snapshot 1`] = ` title