diff --git a/tests/screenobjects/UplinkMainScreen.ts b/tests/screenobjects/UplinkMainScreen.ts index 43429cfc4e..a402089b22 100644 --- a/tests/screenobjects/UplinkMainScreen.ts +++ b/tests/screenobjects/UplinkMainScreen.ts @@ -332,15 +332,39 @@ export default class UplinkMainScreen extends AppScreen { async getToggleState(element: WebdriverIO.Element) { const currentDriver = await this.getCurrentDriver(); - let toggleState; + let toggleState: string; + let attributeToValidate: string; if (currentDriver === MACOS_DRIVER) { - toggleState = await element.getAttribute("value"); - } else if (currentDriver === WINDOWS_DRIVER) { - toggleState = await element.getAttribute("Toggle.ToggleState"); + attributeToValidate = "value"; + } else { + attributeToValidate = "Toggle.ToggleState"; } + toggleState = await element.getAttribute(attributeToValidate); return toggleState; } + async validateToggleIsEnabled(element: WebdriverIO.Element) { + const currentDriver = await this.getCurrentDriver(); + let attributeToValidate: string; + if (currentDriver === MACOS_DRIVER) { + attributeToValidate = "value"; + } else { + attributeToValidate = "Toggle.ToggleState"; + } + await expect(element).toHaveAttribute(attributeToValidate, "1"); + } + + async validateToggleIsDisabled(element: WebdriverIO.Element) { + const currentDriver = await this.getCurrentDriver(); + let attributeToValidate: string; + if (currentDriver === MACOS_DRIVER) { + attributeToValidate = "value"; + } else { + attributeToValidate = "Toggle.ToggleState"; + } + await expect(element).toHaveAttribute(attributeToValidate, "0"); + } + async validateNoModalIsOpen() { await this.modal.waitForExist({ reverse: true, diff --git a/tests/screenobjects/settings/SettingsAccessibilityScreen.ts b/tests/screenobjects/settings/SettingsAccessibilityScreen.ts index d06e42eccf..e55664c68d 100644 --- a/tests/screenobjects/settings/SettingsAccessibilityScreen.ts +++ b/tests/screenobjects/settings/SettingsAccessibilityScreen.ts @@ -5,9 +5,7 @@ import SettingsBaseScreen from "@screenobjects/settings/SettingsBaseScreen"; let SELECTORS = {}; -const SELECTORS_COMMON = { - SETTINGS_ACCESSIBILITY: "~settings-general", -}; +const SELECTORS_COMMON = {}; const SELECTORS_WINDOWS = { OPEN_DYSLEXIC_SECTION: '[name="open-dyslexic-section"]', @@ -36,31 +34,35 @@ process.env.DRIVER === WINDOWS_DRIVER export default class SettingsAccessibilityScreen extends SettingsBaseScreen { constructor() { - super(SELECTORS.SETTINGS_AUDIO); + super(SELECTORS.OPEN_DYSLEXIC_SECTION); } get openDyslexicCheckbox() { - return $(SELECTORS.SETTINGS_CONTROL).$(SELECTORS.SWITCH_SLIDER); + return this.openDyslexicSection + .$(SELECTORS.SETTINGS_CONTROL) + .$(SELECTORS.SWITCH_SLIDER); } get openDyslexicControllerValue() { - return $(SELECTORS.SETTINGS_CONTROL).$(SELECTORS.SETTINGS_CONTROL_CHECKBOX); + return this.openDyslexicSection + .$(SELECTORS.SETTINGS_CONTROL) + .$(SELECTORS.SETTINGS_CONTROL_CHECKBOX); } get openDyslexicDescription() { - return $(SELECTORS.OPEN_DYSLEXIC_SECTION) + return this.openDyslexicSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get openDyslexicHeader() { - return $(SELECTORS.OPEN_DYSLEXIC_SECTION) + return this.openDyslexicSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } - get settingsAccessibility() { - return $(SELECTORS.SETTINGS_ACCESSIBILITY); + get openDyslexicSection() { + return $(SELECTORS.OPEN_DYSLEXIC_SECTION); } async clickOnOpenDyslexic() { @@ -72,4 +74,14 @@ export default class SettingsAccessibilityScreen extends SettingsBaseScreen { await clickOnSwitchMacOS(openDyslexicCheckbox); } } + + async validateOpenDyslexicIsEnabled() { + const openDyslexicControllerValue = await this.openDyslexicControllerValue; + await this.validateToggleIsEnabled(openDyslexicControllerValue); + } + + async validateOpenDyslexicIsDisabled() { + const openDyslexicControllerValue = await this.openDyslexicControllerValue; + await this.validateToggleIsDisabled(openDyslexicControllerValue); + } } diff --git a/tests/screenobjects/settings/SettingsAudioScreen.ts b/tests/screenobjects/settings/SettingsAudioScreen.ts index ba7f18aef6..51faae204a 100644 --- a/tests/screenobjects/settings/SettingsAudioScreen.ts +++ b/tests/screenobjects/settings/SettingsAudioScreen.ts @@ -327,4 +327,62 @@ export default class SettingsAudioScreen extends SettingsBaseScreen { await outputDeviceDropdown.addValue(device + "\uE007"); } } + + // Validate toggle methods enabled + async validateEchoCancellationIsEnabled() { + const echoCancellationControllerValue = + await this.echoCancellationControllerValue; + await this.validateToggleIsEnabled(echoCancellationControllerValue); + } + + async validateInterfaceSoundsIsEnabled() { + const interfaceSoundsControllerValue = + await this.interfaceSoundsControllerValue; + await this.validateToggleIsEnabled(interfaceSoundsControllerValue); + } + + async validateMediaSoundsIsEnabled() { + const mediaSoundsControllerValue = await this.mediaSoundsControllerValue; + await this.validateToggleIsEnabled(mediaSoundsControllerValue); + } + + async validateMessageSoundsIsEnabled() { + const messageSoundsControllerValue = + await this.messageSoundsControllerValue; + await this.validateToggleIsEnabled(messageSoundsControllerValue); + } + + async validateCallTimerIsEnabled() { + const callTimerControllerValue = await this.callTimerControllerValue; + await this.validateToggleIsEnabled(callTimerControllerValue); + } + + // Validate toggle methods disabled + async validateEchoCancellationIsDisabled() { + const echoCancellationControllerValue = + await this.echoCancellationControllerValue; + await this.validateToggleIsDisabled(echoCancellationControllerValue); + } + + async validateInterfaceSoundsIsDisabled() { + const interfaceSoundsControllerValue = + await this.interfaceSoundsControllerValue; + await this.validateToggleIsDisabled(interfaceSoundsControllerValue); + } + + async validateMediaSoundsIsDisabled() { + const mediaSoundsControllerValue = await this.mediaSoundsControllerValue; + await this.validateToggleIsDisabled(mediaSoundsControllerValue); + } + + async validateMessageSoundsIsDisabled() { + const messageSoundsControllerValue = + await this.messageSoundsControllerValue; + await this.validateToggleIsDisabled(messageSoundsControllerValue); + } + + async validateCallTimerIsDisabled() { + const callTimerControllerValue = await this.callTimerControllerValue; + await this.validateToggleIsDisabled(callTimerControllerValue); + } } diff --git a/tests/screenobjects/settings/SettingsDeveloperScreen.ts b/tests/screenobjects/settings/SettingsDeveloperScreen.ts index e603e876d2..86455fdf39 100644 --- a/tests/screenobjects/settings/SettingsDeveloperScreen.ts +++ b/tests/screenobjects/settings/SettingsDeveloperScreen.ts @@ -278,4 +278,40 @@ export default class SettingsDeveloperScreen extends SettingsBaseScreen { await driver.switchToWindow(uplinkWindow); } } + + // Toggle Enabled Methods + + async validateDeveloperModeIsEnabled() { + const developerModeToggle = await this.developerModeControllerValue; + await this.validateToggleIsEnabled(developerModeToggle); + } + + async validateExperimentalFeaturesIsEnabled() { + const experimentalFeaturesToggle = + await this.experimentalFeaturesControllerValue; + await this.validateToggleIsEnabled(experimentalFeaturesToggle); + } + + async validateSaveLogsIsEnabled() { + const saveLogsToggle = await this.saveLogsControllerValue; + await this.validateToggleIsEnabled(saveLogsToggle); + } + + // Toggle Disabled Methods + + async validateDeveloperModeIsDisabled() { + const developerModeToggle = await this.developerModeControllerValue; + await this.validateToggleIsDisabled(developerModeToggle); + } + + async validateExperimentalFeaturesIsDisabled() { + const experimentalFeaturesToggle = + await this.experimentalFeaturesControllerValue; + await this.validateToggleIsDisabled(experimentalFeaturesToggle); + } + + async validateSaveLogsIsDisabled() { + const saveLogsToggle = await this.saveLogsControllerValue; + await this.validateToggleIsDisabled(saveLogsToggle); + } } diff --git a/tests/screenobjects/settings/SettingsExtensionsScreen.ts b/tests/screenobjects/settings/SettingsExtensionsScreen.ts index 5b503b4793..5ab720c2a3 100644 --- a/tests/screenobjects/settings/SettingsExtensionsScreen.ts +++ b/tests/screenobjects/settings/SettingsExtensionsScreen.ts @@ -243,4 +243,26 @@ export default class SettingsExtensionsScreen extends SettingsBaseScreen { } return result.toString(); } + + async validateEmojiSelectorIsEnabled() { + const emojiSelectorCheckboxValue = await this.emojiSelectorCheckboxValue; + await this.validateToggleIsEnabled(emojiSelectorCheckboxValue); + } + + async validateEnableAutomaticallyIsEnabled() { + const enableAutomaticallyControllerValue = + await this.enableAutomaticallyControllerValue; + await this.validateToggleIsEnabled(enableAutomaticallyControllerValue); + } + + async validateEmojiSelectorIsDisabled() { + const emojiSelectorCheckboxValue = await this.emojiSelectorCheckboxValue; + await this.validateToggleIsDisabled(emojiSelectorCheckboxValue); + } + + async validateEnableAutomaticallyIsDisabled() { + const enableAutomaticallyControllerValue = + await this.enableAutomaticallyControllerValue; + await this.validateToggleIsDisabled(enableAutomaticallyControllerValue); + } } diff --git a/tests/screenobjects/settings/SettingsMessagesScreen.ts b/tests/screenobjects/settings/SettingsMessagesScreen.ts index 103d0876cb..9f417fdac8 100644 --- a/tests/screenobjects/settings/SettingsMessagesScreen.ts +++ b/tests/screenobjects/settings/SettingsMessagesScreen.ts @@ -115,4 +115,26 @@ export default class SettingsMessagesScreen extends SettingsBaseScreen { const settingsMessages = await this.settingsMessages; await settingsMessages.waitForExist(); } + + // Validate toggle enabled methods + async validateConvertEmojiIsEnabled() { + const convertEmojiToggle = await this.convertEmojiControllerValue; + await this.validateToggleIsEnabled(convertEmojiToggle); + } + + async validateMarkdownSupportIsEnabled() { + const markdownSupportToggle = await this.markdownSupportControllerValue; + await this.validateToggleIsEnabled(markdownSupportToggle); + } + + // Validate toggle disabled methods + async validateConvertEmojiIsDisabled() { + const convertEmojiToggle = await this.convertEmojiControllerValue; + await this.validateToggleIsDisabled(convertEmojiToggle); + } + + async validateMarkdownSupportIsDisabled() { + const markdownSupportToggle = await this.markdownSupportControllerValue; + await this.validateToggleIsDisabled(markdownSupportToggle); + } } diff --git a/tests/screenobjects/settings/SettingsNotificationsScreen.ts b/tests/screenobjects/settings/SettingsNotificationsScreen.ts index 95e5095935..8e08d98604 100644 --- a/tests/screenobjects/settings/SettingsNotificationsScreen.ts +++ b/tests/screenobjects/settings/SettingsNotificationsScreen.ts @@ -46,101 +46,117 @@ export default class SettingsNotificationsScreen extends SettingsBaseScreen { } get enabledNotificationsCheckbox() { - return $(SELECTORS.ENABLED_NOTIFICATIONS_SECTION).$( - SELECTORS.SWITCH_SLIDER, - ); + return this.enabledNotificationsSection.$(SELECTORS.SWITCH_SLIDER); } get enabledNotificationsControllerValue() { - return $(SELECTORS.ENABLED_NOTIFICATIONS_SECTION).$( + return this.enabledNotificationsSection.$( SELECTORS.SETTINGS_CONTROL_CHECKBOX, ); } get enabledNotificationsDescription() { - return $(SELECTORS.ENABLED_NOTIFICATIONS_SECTION) + return this.enabledNotificationsSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get enabledNotificationsHeader() { - return $(SELECTORS.ENABLED_NOTIFICATIONS_SECTION) + return this.enabledNotificationsSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } - get friendsNotificationsCheckbox() { - return $(SELECTORS.FRIENDS_NOTIFICATIONS_SECTION).$( - SELECTORS.SWITCH_SLIDER, + get enabledNotificationsSection() { + return this.settingsNotifications.$( + SELECTORS.ENABLED_NOTIFICATIONS_SECTION, ); } + get friendsNotificationsCheckbox() { + return this.friendsNotificationsSection.$(SELECTORS.SWITCH_SLIDER); + } + get friendsNotificationsControllerValue() { - return $(SELECTORS.FRIENDS_NOTIFICATIONS_SECTION).$( + return this.friendsNotificationsSection.$( SELECTORS.SETTINGS_CONTROL_CHECKBOX, ); } get friendsNotificationsDescription() { - return $(SELECTORS.FRIENDS_NOTIFICATIONS_SECTION) + return this.friendsNotificationsSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get friendsNotificationsHeader() { - return $(SELECTORS.FRIENDS_NOTIFICATIONS_SECTION) + return this.friendsNotificationsSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } - get messagesNotificationsCheckbox() { - return $(SELECTORS.MESSAGES_NOTIFICATIONS_SECTION).$( - SELECTORS.SWITCH_SLIDER, + get friendsNotificationsSection() { + return this.settingsNotifications.$( + SELECTORS.FRIENDS_NOTIFICATIONS_SECTION, ); } + get messagesNotificationsCheckbox() { + return this.messagesNotificationsSection.$(SELECTORS.SWITCH_SLIDER); + } + get messagesNotificationsControllerValue() { - return $(SELECTORS.MESSAGES_NOTIFICATIONS_SECTION).$( + return this.messagesNotificationsSection.$( SELECTORS.SETTINGS_CONTROL_CHECKBOX, ); } get messagesNotificationsDescription() { - return $(SELECTORS.MESSAGES_NOTIFICATIONS_SECTION) + return this.messagesNotificationsSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get messagesNotificationsHeader() { - return $(SELECTORS.MESSAGES_NOTIFICATIONS_SECTION) + return this.messagesNotificationsSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } - get settingsNotificationsCheckbox() { - return $(SELECTORS.SETTINGS_NOTIFICATIONS_SECTION).$( - SELECTORS.SWITCH_SLIDER, + get messagesNotificationsSection() { + return this.settingsNotifications.$( + SELECTORS.MESSAGES_NOTIFICATIONS_SECTION, ); } + get settingsNotificationsCheckbox() { + return this.settingsNotificationsSection.$(SELECTORS.SWITCH_SLIDER); + } + get settingsNotificationsControllerValue() { - return $(SELECTORS.SETTINGS_NOTIFICATIONS_SECTION).$( + return this.settingsNotificationsSection.$( SELECTORS.SETTINGS_CONTROL_CHECKBOX, ); } get settingsNotificationsDescription() { - return $(SELECTORS.SETTINGS_NOTIFICATIONS_SECTION) + return this.settingsNotificationsSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get settingsNotificationsHeader() { - return $(SELECTORS.SETTINGS_NOTIFICATIONS_SECTION) + return this.settingsNotificationsSection .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } + get settingsNotificationsSection() { + return this.settingsNotifications.$( + SELECTORS.SETTINGS_NOTIFICATIONS_SECTION, + ); + } + get settingsNotifications() { return $(SELECTORS.SETTINGS_NOTIFICATIONS); } @@ -196,4 +212,56 @@ export default class SettingsNotificationsScreen extends SettingsBaseScreen { const settingsNotifications = await this.settingsNotifications; await settingsNotifications.waitForExist(); } + + // Toggle Enable Methods + + async validateEnabledNotificationsIsEnabled() { + const enabledNotificationsControllerValue = + await this.enabledNotificationsControllerValue; + await this.validateToggleIsEnabled(enabledNotificationsControllerValue); + } + + async validateFriendsNotificationsIsEnabled() { + const friendsNotificationsControllerValue = + await this.friendsNotificationsControllerValue; + await this.validateToggleIsEnabled(friendsNotificationsControllerValue); + } + + async validateMessagesNotificationsIsEnabled() { + const messagesNotificationsControllerValue = + await this.messagesNotificationsControllerValue; + await this.validateToggleIsEnabled(messagesNotificationsControllerValue); + } + + async validateSettingsNotificationsIsEnabled() { + const settingsNotificationsControllerValue = + await this.settingsNotificationsControllerValue; + await this.validateToggleIsEnabled(settingsNotificationsControllerValue); + } + + // Toggle Disabled Methods + + async validateEnabledNotificationsIsDisabled() { + const enabledNotificationsControllerValue = + await this.enabledNotificationsControllerValue; + await this.validateToggleIsDisabled(enabledNotificationsControllerValue); + } + + async validateFriendsNotificationsIsDisabled() { + const friendsNotificationsControllerValue = + await this.friendsNotificationsControllerValue; + await this.validateToggleIsDisabled(friendsNotificationsControllerValue); + } + + async validateMessagesNotificationsIsDisabled() { + const messagesNotificationsControllerValue = + await this.messagesNotificationsControllerValue; + await this.validateToggleIsDisabled(messagesNotificationsControllerValue); + } + + async validateSettingsNotificationsIsDisabled() { + const settingsNotificationsControllerValue = + await this.settingsNotificationsControllerValue; + await this.validateToggleIsDisabled(settingsNotificationsControllerValue); + } } diff --git a/tests/specs/07-settings-audio.spec.ts b/tests/specs/07-settings-audio.spec.ts index 44783a1732..d8f5668ec9 100644 --- a/tests/specs/07-settings-audio.spec.ts +++ b/tests/specs/07-settings-audio.spec.ts @@ -86,80 +86,46 @@ export default async function settingsAudioTests() { }); it("Settings Audio - Click on slider switches to enable the options", async () => { - // Click on the five switch sliders from the Settings Sounds & Audio Screen + // Click on the switch slider from Settings Sounds & Audio Screen - Echo Cancellation await settingsAudio.clickOnEchoCancellation(); - await settingsAudio.clickOnInterfaceSounds(); - await settingsAudio.clickOnMediaSounds(); - await settingsAudio.clickOnMessageSounds(); - await settingsAudio.clickOnCallTimer(); - - // Validate that all toggles have now value = "1" (enabled) - const toggleElementEcho = await settingsAudio.messageSoundsControllerValue; - const echoCancellationStatus = - await settingsAudio.getToggleState(toggleElementEcho); + await settingsAudio.validateEchoCancellationIsEnabled(); - const toggleElementInterface = - await settingsAudio.interfaceSoundsControllerValue; - const interfaceSoundsStatus = await settingsAudio.getToggleState( - toggleElementInterface, - ); - - const toggleElementMedia = await settingsAudio.mediaSoundsControllerValue; - const mediaSoundsStatus = - await settingsAudio.getToggleState(toggleElementMedia); + // Click on the switch slider from Settings Sounds & Audio Screen - Interface Sounds + await settingsAudio.clickOnInterfaceSounds(); + await settingsAudio.validateInterfaceSoundsIsEnabled(); - const toggleElementMessage = - await settingsAudio.messageSoundsControllerValue; - const messageSoundsStatus = - await settingsAudio.getToggleState(toggleElementMessage); + // Click on the switch slider from Settings Sounds & Audio Screen - Media Sounds + await settingsAudio.clickOnMediaSounds(); + await settingsAudio.validateMediaSoundsIsEnabled(); - const toggleElementTimer = await settingsAudio.messageSoundsControllerValue; - const callTimerStatus = - await settingsAudio.getToggleState(toggleElementTimer); + // Click on the switch slider from Settings Sounds & Audio Screen - Message Sounds + await settingsAudio.clickOnMessageSounds(); + await settingsAudio.validateMessageSoundsIsEnabled(); - await expect(echoCancellationStatus).toEqual("1"); - await expect(interfaceSoundsStatus).toEqual("1"); - await expect(mediaSoundsStatus).toEqual("1"); - await expect(messageSoundsStatus).toEqual("1"); - await expect(callTimerStatus).toEqual("1"); + // Click on the switch slider from Settings Sounds & Audio Screen - Call Timer + await settingsAudio.clickOnCallTimer(); + await settingsAudio.validateCallTimerIsEnabled(); }); it("Settings Audio - Click on slider switches to disable the options", async () => { - // Click again on the four switch sliders from the Settings Sounds & Audio Screen + // Click on the switch slider from Settings Sounds & Audio Screen - Echo Cancellation await settingsAudio.clickOnEchoCancellation(); - await settingsAudio.clickOnInterfaceSounds(); - await settingsAudio.clickOnMediaSounds(); - await settingsAudio.clickOnMessageSounds(); - await settingsAudio.clickOnCallTimer(); - - // Validate that all toggles have now value = "0" (disabled) - const toggleElementEcho = await settingsAudio.messageSoundsControllerValue; - const echoCancellationStatus = - await settingsAudio.getToggleState(toggleElementEcho); + await settingsAudio.validateEchoCancellationIsDisabled(); - const toggleElementInterface = - await settingsAudio.interfaceSoundsControllerValue; - const interfaceSoundsStatus = await settingsAudio.getToggleState( - toggleElementInterface, - ); - - const toggleElementMedia = await settingsAudio.mediaSoundsControllerValue; - const mediaSoundsStatus = - await settingsAudio.getToggleState(toggleElementMedia); + // Click on the switch slider from Settings Sounds & Audio Screen - Interface Sounds + await settingsAudio.clickOnInterfaceSounds(); + await settingsAudio.validateInterfaceSoundsIsDisabled(); - const toggleElementMessage = - await settingsAudio.messageSoundsControllerValue; - const messageSoundsStatus = - await settingsAudio.getToggleState(toggleElementMessage); + // Click on the switch slider from Settings Sounds & Audio Screen - Media Sounds + await settingsAudio.clickOnMediaSounds(); + await settingsAudio.validateMediaSoundsIsDisabled(); - const toggleElementTimer = await settingsAudio.messageSoundsControllerValue; - const callTimerStatus = - await settingsAudio.getToggleState(toggleElementTimer); + // Click on the switch slider from Settings Sounds & Audio Screen - Message Sounds + await settingsAudio.clickOnMessageSounds(); + await settingsAudio.validateMessageSoundsIsDisabled(); - await expect(echoCancellationStatus).toEqual("0"); - await expect(interfaceSoundsStatus).toEqual("0"); - await expect(mediaSoundsStatus).toEqual("0"); - await expect(messageSoundsStatus).toEqual("0"); - await expect(callTimerStatus).toEqual("0"); + // Click on the switch slider from Settings Sounds & Audio Screen - Call Timer + await settingsAudio.clickOnCallTimer(); + await settingsAudio.validateCallTimerIsDisabled(); }); } diff --git a/tests/specs/08-settings-extensions.spec.ts b/tests/specs/08-settings-extensions.spec.ts index 1a123d0686..241bf406ca 100644 --- a/tests/specs/08-settings-extensions.spec.ts +++ b/tests/specs/08-settings-extensions.spec.ts @@ -23,11 +23,11 @@ export default async function settingsExtensionsTests() { const emojiSelectorDescription = await settingsExtensions.emojiSelectorDescription; - await expect(emojiSelectorTitle).toHaveTextContaining("Emoji Selector"); - await expect(emojiSelectorDeveloper).toHaveTextContaining( + await expect(emojiSelectorTitle).toHaveText("Emoji Selector"); + await expect(emojiSelectorDeveloper).toHaveText( "SATELLITE ", ); - await expect(emojiSelectorDescription).toHaveTextContaining( + await expect(emojiSelectorDescription).toHaveText( "Browse the standard unicode library of emoji's and send them to friends.", ); }); @@ -37,10 +37,7 @@ export default async function settingsExtensionsTests() { await settingsExtensions.clickOnEmojiSelectorCheckbox(); // Validate that switch from Emoji Selector now has value = '0' (disabled) - const toggleElement = await settingsExtensions.emojiSelectorCheckboxValue; - const emojiSelectorState = - await settingsExtensions.getToggleState(toggleElement); - await expect(emojiSelectorState).toEqual("0"); + await settingsExtensions.validateEmojiSelectorIsDisabled(); }); it("Settings Extensions - Enable Emoji Selector extension", async () => { @@ -48,10 +45,7 @@ export default async function settingsExtensionsTests() { await settingsExtensions.clickOnEmojiSelectorCheckbox(); // Validate that switch from Emoji Selector now has value = '1' (active) - const toggleElement = await settingsExtensions.emojiSelectorCheckboxValue; - const emojiSelectorState = - await settingsExtensions.getToggleState(toggleElement); - await expect(emojiSelectorState).toEqual("1"); + await settingsExtensions.validateEmojiSelectorIsEnabled(); }); it("Settings Extensions - Go to Explore panel and assert contents", async () => { @@ -60,15 +54,13 @@ export default async function settingsExtensionsTests() { // Validate warning message, search extensions header and input are displayed const installedAlertText = await settingsExtensions.installedAlertText; - await expect(installedAlertText).toHaveTextContaining( + await expect(installedAlertText).toHaveText( "Extensions are pre-compiled on external hardware. For added security you can compile extensions from source and place in the `extensions` folder.", ); const extensionsSearchHeader = await settingsExtensions.extensionsSearchHeader; - await expect(extensionsSearchHeader).toHaveTextContaining( - "SEARCH EXTENSIONS", - ); + await expect(extensionsSearchHeader).toHaveText("SEARCH EXTENSIONS"); await settingsExtensions.extensionsSearchInput.waitForExist(); const placeholder = @@ -83,25 +75,21 @@ export default async function settingsExtensionsTests() { // Assert contents from screen const openExtensionsHeader = await settingsExtensions.openExtensionsHeaderText; - await expect(openExtensionsHeader).toHaveTextContaining( - "OPEN EXTENSIONS FOLDER", - ); + await expect(openExtensionsHeader).toHaveText("OPEN EXTENSIONS FOLDER"); const openExtensionsDescription = await settingsExtensions.openExtensionsDescriptionText; - await expect(openExtensionsDescription).toHaveTextContaining( + await expect(openExtensionsDescription).toHaveText( "Open the local directory containing your installed extensions.", ); const enableAutomaticallyHeader = await settingsExtensions.enableAutomaticallyHeader; - await expect(enableAutomaticallyHeader).toHaveTextContaining( - "ENABLE AUTOMATICALLY", - ); + await expect(enableAutomaticallyHeader).toHaveText("ENABLE AUTOMATICALLY"); const enableAutomaticallyDescription = await settingsExtensions.enableAutomaticallyDescription; - await expect(enableAutomaticallyDescription).toHaveTextContaining( + await expect(enableAutomaticallyDescription).toHaveText( "When turned on, new extensions will automatically be enabled by default.", ); }); @@ -111,12 +99,7 @@ export default async function settingsExtensionsTests() { await settingsExtensions.clickOnEnableAutomatically(); // Validate that switch from Enable Automatically now has value = '1' (active) - const toggleElement = - await settingsExtensions.enableAutomaticallyControllerValue; - const enableAutomaticallyState = - await settingsExtensions.getToggleState(toggleElement); - - await expect(enableAutomaticallyState).toEqual("1"); + await settingsExtensions.validateEnableAutomaticallyIsEnabled(); }); it("Settings Extensions - Deactivate the switch slider for Enable Automatically", async () => { @@ -124,12 +107,7 @@ export default async function settingsExtensionsTests() { await settingsExtensions.clickOnEnableAutomatically(); // Validate that switch from Enable Automatically now has value = '0' (disabled) - const toggleElement = - await settingsExtensions.enableAutomaticallyControllerValue; - const enableAutomaticallyState = - await settingsExtensions.getToggleState(toggleElement); - - await expect(enableAutomaticallyState).toEqual("0"); + await settingsExtensions.validateEnableAutomaticallyIsDisabled(); }); // Skipped since it needs research on how to close external window from Explorer before proceeding with next tests diff --git a/tests/specs/09-settings-notifications.spec.ts b/tests/specs/09-settings-notifications.spec.ts index 36bc6e6e8c..73d359ac99 100644 --- a/tests/specs/09-settings-notifications.spec.ts +++ b/tests/specs/09-settings-notifications.spec.ts @@ -53,63 +53,31 @@ export default async function settingsNotificationsTests() { it("Settings Notifications - Disable all notifications by switching ENABLED toggle to off", async () => { // Click on ENABLED switch slider to activate toggles and then validate that toggle has now value = "0" (disabled) await settingsNotifications.clickOnEnabledNotifications(); - const enabledToggle = - await settingsNotifications.enabledNotificationsControllerValue; - const enabledState = - await settingsNotifications.getToggleState(enabledToggle); - await expect(enabledState).toEqual("0"); + await settingsNotifications.validateEnabledNotificationsIsDisabled(); // Validate that toggle switch for FRIENDS has now value = "0" (disabled) - const friendsToggle = - await settingsNotifications.friendsNotificationsControllerValue; - const friendsState = - await settingsNotifications.getToggleState(friendsToggle); - await expect(friendsState).toEqual("0"); + await settingsNotifications.validateFriendsNotificationsIsDisabled(); // Validate that toggle switch for MESSAGES has now value = "0" (disabled) - const messagesToggle = - await settingsNotifications.messagesNotificationsControllerValue; - const messagesState = - await settingsNotifications.getToggleState(messagesToggle); - await expect(messagesState).toEqual("0"); + await settingsNotifications.validateMessagesNotificationsIsDisabled(); // Validate that toggle switch for SETTINGS has now value = "0" (disabled) - const settingsToggle = - await settingsNotifications.settingsNotificationsControllerValue; - const settingsState = - await settingsNotifications.getToggleState(settingsToggle); - await expect(settingsState).toEqual("0"); + await settingsNotifications.validateSettingsNotificationsIsDisabled(); }); it("Settings Notifications - Enable again all notifications by switching ENABLED toggle to on", async () => { // Click on ENABLED switch slider to activate toggles and then validate that toggle has now value = "1" (enabled) await settingsNotifications.clickOnEnabledNotifications(); - const enabledToggle = - await settingsNotifications.enabledNotificationsControllerValue; - const enabledState = - await settingsNotifications.getToggleState(enabledToggle); - await expect(enabledState).toEqual("1"); + await settingsNotifications.validateEnabledNotificationsIsEnabled(); // Validate that toggle switch for FRIENDS has now value = "1" (enabled) - const friendsToggle = - await settingsNotifications.friendsNotificationsControllerValue; - const friendsState = - await settingsNotifications.getToggleState(friendsToggle); - await expect(friendsState).toEqual("1"); + await settingsNotifications.validateFriendsNotificationsIsEnabled(); // Validate that toggle switch for MESSAGES has now value = "1" (enabled) - const messagesToggle = - await settingsNotifications.messagesNotificationsControllerValue; - const messagesState = - await settingsNotifications.getToggleState(messagesToggle); - await expect(messagesState).toEqual("1"); - - // Validate that toggle switch for SETTINGS has now value = "1" (enabled) - const settingsToggle = - await settingsNotifications.settingsNotificationsControllerValue; - const settingsState = - await settingsNotifications.getToggleState(settingsToggle); - await expect(settingsState).toEqual("0"); + await settingsNotifications.validateMessagesNotificationsIsEnabled(); + + // Validate that toggle switch for SETTINGS has now value = "0" (disabled) + await settingsNotifications.validateSettingsNotificationsIsDisabled(); }); it("Settings Notifications - Enable only FRIENDS notifications", async () => { @@ -121,32 +89,16 @@ export default async function settingsNotificationsTests() { await settingsNotifications.clickOnFriendsNotifications(); // Validate that toggle switch for ENABLED has now value = "1" (enabled) - const enabledToggle = - await settingsNotifications.enabledNotificationsControllerValue; - const enabledState = - await settingsNotifications.getToggleState(enabledToggle); - await expect(enabledState).toEqual("1"); + await settingsNotifications.validateEnabledNotificationsIsEnabled(); // Validate that toggle switch for FRIENDS has now value = 1" (enabled) - const friendsToggle = - await settingsNotifications.friendsNotificationsControllerValue; - const friendsState = - await settingsNotifications.getToggleState(friendsToggle); - await expect(friendsState).toEqual("1"); + await settingsNotifications.validateFriendsNotificationsIsEnabled(); // Validate that toggle switch for MESSAGES still has value = "0" (disabled) - const messagesToggle = - await settingsNotifications.messagesNotificationsControllerValue; - const messagesState = - await settingsNotifications.getToggleState(messagesToggle); - await expect(messagesState).toEqual("0"); + await settingsNotifications.validateMessagesNotificationsIsDisabled(); // Validate that toggle switch for SETTINGS still has value = "0" (disabled) - const settingsToggle = - await settingsNotifications.settingsNotificationsControllerValue; - const settingsState = - await settingsNotifications.getToggleState(settingsToggle); - await expect(settingsState).toEqual("0"); + await settingsNotifications.validateSettingsNotificationsIsDisabled(); }); it("Settings Notifications - Enable only MESSAGES notifications", async () => { @@ -157,32 +109,16 @@ export default async function settingsNotificationsTests() { await settingsNotifications.clickOnMessagesNotifications(); // Validate that toggle switch for ENABLED still has value = "1" (enabled) - const enabledToggle = - await settingsNotifications.enabledNotificationsControllerValue; - const enabledState = - await settingsNotifications.getToggleState(enabledToggle); - await expect(enabledState).toEqual("1"); + await settingsNotifications.validateEnabledNotificationsIsEnabled(); // Validate that toggle switch for FRIENDS now has value = "0" (disabled) - const friendsToggle = - await settingsNotifications.friendsNotificationsControllerValue; - const friendsState = - await settingsNotifications.getToggleState(friendsToggle); - await expect(friendsState).toEqual("0"); + await settingsNotifications.validateFriendsNotificationsIsDisabled(); // Validate that toggle switch for MESSAGES has now value = 1" (enabled) - const messagesToggle = - await settingsNotifications.messagesNotificationsControllerValue; - const messagesState = - await settingsNotifications.getToggleState(messagesToggle); - await expect(messagesState).toEqual("1"); + await settingsNotifications.validateMessagesNotificationsIsEnabled(); // Validate that toggle switch for SETTINGS still has value = "0" (disabled) - const settingsToggle = - await settingsNotifications.settingsNotificationsControllerValue; - const settingsState = - await settingsNotifications.getToggleState(settingsToggle); - await expect(settingsState).toEqual("0"); + await settingsNotifications.validateSettingsNotificationsIsDisabled(); }); it("Settings Notifications - Enable only SETTINGS notifications", async () => { @@ -193,31 +129,15 @@ export default async function settingsNotificationsTests() { await settingsNotifications.clickOnSettingsNotifications(); // Validate that toggle switch for ENABLED still has value = "1" (enabled) - const enabledToggle = - await settingsNotifications.enabledNotificationsControllerValue; - const enabledState = - await settingsNotifications.getToggleState(enabledToggle); - await expect(enabledState).toEqual("1"); + await settingsNotifications.validateEnabledNotificationsIsEnabled(); // Validate that toggle switch for FRIENDS still has value = "0" (disabled) - const friendsToggle = - await settingsNotifications.friendsNotificationsControllerValue; - const friendsState = - await settingsNotifications.getToggleState(friendsToggle); - await expect(friendsState).toEqual("0"); + await settingsNotifications.validateFriendsNotificationsIsDisabled(); // Validate that toggle switch for MESSAGES still has value = "0" (disabled) - const messagesToggle = - await settingsNotifications.messagesNotificationsControllerValue; - const messagesState = - await settingsNotifications.getToggleState(messagesToggle); - await expect(messagesState).toEqual("0"); + await settingsNotifications.validateMessagesNotificationsIsDisabled(); // Validate that toggle switch for SETTINGS now has value = "1" (enabled) - const settingsToggle = - await settingsNotifications.settingsNotificationsControllerValue; - const settingsState = - await settingsNotifications.getToggleState(settingsToggle); - await expect(settingsState).toEqual("1"); + await settingsNotifications.validateSettingsNotificationsIsEnabled(); }); } diff --git a/tests/specs/10-settings-accessibility.spec.ts b/tests/specs/10-settings-accessibility.spec.ts index 97b7b19ac5..e4ab44c4b7 100644 --- a/tests/specs/10-settings-accessibility.spec.ts +++ b/tests/specs/10-settings-accessibility.spec.ts @@ -33,12 +33,7 @@ export default async function settingsAccessibilityTests() { await settingsAccessibility.clickOnOpenDyslexic(); // Validate that toggle has now value = "1" (enabled) - const toggleElement = - await settingsAccessibility.openDyslexicControllerValue; - const openDyslexicStatus = - await settingsAccessibility.getToggleState(toggleElement); - - await expect(openDyslexicStatus).toEqual("1"); + await settingsAccessibility.validateOpenDyslexicIsEnabled(); }); it("Settings Audio - Click on slider switches to disable the options", async () => { @@ -46,11 +41,6 @@ export default async function settingsAccessibilityTests() { await settingsAccessibility.clickOnOpenDyslexic(); // Validate that toggle has now value = "0" (disabled) - const toggleElement = - await settingsAccessibility.openDyslexicControllerValue; - const openDyslexicStatus = - await settingsAccessibility.getToggleState(toggleElement); - - await expect(openDyslexicStatus).toEqual("0"); + await settingsAccessibility.validateOpenDyslexicIsDisabled(); }); } diff --git a/tests/specs/13-settings-developer.spec.ts b/tests/specs/13-settings-developer.spec.ts index 9bb7885821..2262c88be0 100644 --- a/tests/specs/13-settings-developer.spec.ts +++ b/tests/specs/13-settings-developer.spec.ts @@ -23,10 +23,8 @@ export default async function settingsDeveloperTests() { await settingsDeveloper.experimentalFeaturesHeader; const experimentalDescription = await settingsDeveloper.experimentalFeaturesDescription; - await expect(experimentalHeader).toHaveTextContaining( - "EXPERIMENTAL FEATURES", - ); - await expect(experimentalDescription).toHaveTextContaining( + await expect(experimentalHeader).toHaveText("EXPERIMENTAL FEATURES"); + await expect(experimentalDescription).toHaveText( "Enables features which may be incomplete or non-functional.", ); @@ -34,8 +32,8 @@ export default async function settingsDeveloperTests() { const developerModeHeader = await settingsDeveloper.developerModeHeader; const developerModeDescription = await settingsDeveloper.developerModeDescription; - await expect(developerModeHeader).toHaveTextContaining("DEVELOPER MODE"); - await expect(developerModeDescription).toHaveTextContaining( + await expect(developerModeHeader).toHaveText("DEVELOPER MODE"); + await expect(developerModeDescription).toHaveText( "Enabling developer mode adds logging and displays helpful debug information on the UI.", ); @@ -44,18 +42,16 @@ export default async function settingsDeveloperTests() { await settingsDeveloper.testNotificationHeader; const testNotificationDescription = await settingsDeveloper.testNotificationDescription; - await expect(testNotificationHeader).toHaveTextContaining( - "TEST NOTIFICATION", - ); - await expect(testNotificationDescription).toHaveTextContaining( - "Sends a test notification", + await expect(testNotificationHeader).toHaveText("TEST NOTIFICATION"); + await expect(testNotificationDescription).toHaveText( + "Sends a test notification.", ); // Validate OPEN CACHE section const openCacheHeader = await settingsDeveloper.openCacheHeader; const openCacheDescription = await settingsDeveloper.openCacheDescription; - await expect(openCacheHeader).toHaveTextContaining("OPEN CACHE"); - await expect(openCacheDescription).toHaveTextContaining( + await expect(openCacheHeader).toHaveText("OPEN CACHE"); + await expect(openCacheDescription).toHaveText( "Open the cache in your default file browser.", ); @@ -64,34 +60,34 @@ export default async function settingsDeveloperTests() { await settingsDeveloper.compressAndDownloadCacheHeader; const compressAndDownloadDescription = await settingsDeveloper.compressAndDownloadCacheDescription; - await expect(compressAndDownloadHeader).toHaveTextContaining( + await expect(compressAndDownloadHeader).toHaveText( "COMPRESS & DOWNLOAD CACHE", ); - await expect(compressAndDownloadDescription).toHaveTextContaining( + await expect(compressAndDownloadDescription).toHaveText( "For debugging with other developers, you can compress your cache to zip and share it. Don't do this if this is a real account you use.", ); // Validate PRINT STATE section const printStateHeader = await settingsDeveloper.printStateHeader; const printStateDescription = await settingsDeveloper.printStateDescription; - await expect(printStateHeader).toHaveTextContaining("PRINT STATE"); - await expect(printStateDescription).toHaveTextContaining( - "Display State in the debug logger", + await expect(printStateHeader).toHaveText("PRINT STATE"); + await expect(printStateDescription).toHaveText( + "Display State in the debug logger.", ); // Validate CLEAR CACHE section const clearCacheHeader = await settingsDeveloper.clearCacheHeader; const clearCacheDescription = await settingsDeveloper.clearCacheDescription; - await expect(clearCacheHeader).toHaveTextContaining("CLEAR CACHE"); - await expect(clearCacheDescription).toHaveTextContaining( + await expect(clearCacheHeader).toHaveText("CLEAR CACHE"); + await expect(clearCacheDescription).toHaveText( "Reset your account, basically.", ); // Validate SAVE LOGS IN A FILE section const saveLogsHeader = await settingsDeveloper.saveLogsHeader; const saveLogsDescription = await settingsDeveloper.saveLogsDescription; - await expect(saveLogsHeader).toHaveTextContaining("SAVE LOGS IN A FILE"); - await expect(saveLogsDescription).toHaveTextContaining( + await expect(saveLogsHeader).toHaveText("SAVE LOGS IN A FILE"); + await expect(saveLogsDescription).toHaveText( "Enabling this option, logs will be saved in a file and will be persistent.", ); }); @@ -101,10 +97,7 @@ export default async function settingsDeveloperTests() { await settingsDeveloper.clickOnSaveLogs(); // Validate that switch has now value = '1' (active) - const toggleElement = await settingsDeveloper.saveLogsControllerValue; - const saveLogsStatus = - await settingsDeveloper.getToggleState(toggleElement); - await expect(saveLogsStatus).toEqual("1"); + await settingsDeveloper.validateSaveLogsIsEnabled(); }); // Skipped due to failure on app when disabling the switch the app crashes @@ -113,15 +106,15 @@ export default async function settingsDeveloperTests() { await settingsDeveloper.clickOnSaveLogs(); // Validate that switch has now value = '0' (disabled) - const toggleElement = await settingsDeveloper.saveLogsControllerValue; - const saveLogsStatus = - await settingsDeveloper.getToggleState(toggleElement); - await expect(saveLogsStatus).toEqual("0"); + await settingsDeveloper.validateSaveLogsIsDisabled(); }); it("Settings Developer - Enable Developer Mode", async () => { // Click on DEVELOPER MODE switch to activate the option await settingsDeveloper.clickOnDeveloperMode(); + + // Validate that switch has now value = '1' (active) + await settingsDeveloper.validateDeveloperModeIsEnabled(); }); // Test skipped since it fails on Windows CI @@ -130,10 +123,7 @@ export default async function settingsDeveloperTests() { await settingsDeveloper.clickOnDeveloperMode(); // Validate that switch has now value = '0' (disabled) - const toggleElement = await settingsDeveloper.developerModeControllerValue; - const developerModeStatus = - await settingsDeveloper.getToggleState(toggleElement); - await expect(developerModeStatus).toEqual("0"); + await settingsDeveloper.validateDeveloperModeIsDisabled(); }); // Skipped because it needs the aria label fixed for test notifications button diff --git a/tests/specs/15-settings-messages.spec.ts b/tests/specs/15-settings-messages.spec.ts index ca93be50bd..84b573df09 100644 --- a/tests/specs/15-settings-messages.spec.ts +++ b/tests/specs/15-settings-messages.spec.ts @@ -36,38 +36,20 @@ export default async function settingsMessagesTests() { it("Settings Messages - Disable both convert emoji and markdown support toggles", async () => { // Click on switch slider for Convert Emoji to disable option and then validate that toggle has now value = "0" (disabled) await settingsMessages.clickOnConvertEmoji(); - const convertEmojiToggle = - await settingsMessages.convertEmojiControllerValue; - const convertEmojiState = - await settingsMessages.getToggleState(convertEmojiToggle); - await expect(convertEmojiState).toEqual("0"); + await settingsMessages.validateConvertEmojiIsDisabled(); // Click on switch slider for Markdown Support to disable option and then validate that toggle has now value = "0" (disabled) await settingsMessages.clickOnMarkdownSupport(); - const markdownSupportToggle = - await settingsMessages.markdownSupportControllerValue; - const markdownSupportState = await settingsMessages.getToggleState( - markdownSupportToggle, - ); - await expect(markdownSupportState).toEqual("0"); + await settingsMessages.validateMarkdownSupportIsDisabled(); }); it("Settings Messages - Enable again both convert emoji and markdown support toggles", async () => { // Click on switch slider for Convert Emoji to enable option and then validate that toggle has now value = "1" (enabled) await settingsMessages.clickOnConvertEmoji(); - const convertEmojiToggle = - await settingsMessages.convertEmojiControllerValue; - const convertEmojiState = - await settingsMessages.getToggleState(convertEmojiToggle); - await expect(convertEmojiState).toEqual("1"); + await settingsMessages.validateConvertEmojiIsEnabled(); // Click on switch slider for Markdown Support to enable option and then validate that toggle has now value = "1" (enabled) await settingsMessages.clickOnMarkdownSupport(); - const markdownSupportToggle = - await settingsMessages.markdownSupportControllerValue; - const markdownSupportState = await settingsMessages.getToggleState( - markdownSupportToggle, - ); - await expect(markdownSupportState).toEqual("1"); + await settingsMessages.validateMarkdownSupportIsEnabled(); }); }