diff --git a/tests/screenobjects/settings/SettingsAudioScreen.ts b/tests/screenobjects/settings/SettingsAudioScreen.ts index 7d50d1d9afb..3ebfa6f4f2d 100644 --- a/tests/screenobjects/settings/SettingsAudioScreen.ts +++ b/tests/screenobjects/settings/SettingsAudioScreen.ts @@ -17,15 +17,6 @@ const SELECTORS_COMMON = { const SELECTORS_WINDOWS = { DROPDOWN_MENU: "", DROPDOWN_OPTION: '[name="Selector Option"]', - RADIO_OPTION_HIGH: '[name="radio-option-High"]', - RADIO_OPTION_LOW: '[name="radio-option-Low"]', - RADIO_OPTION_MEDIUM: '[name="radio-option-Medium"]', - RADIO_OPTION_NONE: '[name="radio-option-None"]', - RANGE_INPUT_DEVICE: '[name="range-input-device"]', - RANGE_OUTPUT_DEVICE: '[name="range-output-device"]', - RANGE_SLIDER_BAR: '[name="range-input"]', - RANGE_SLIDER_VALUE: '[name="range-value"]', - RANGE_SLIDER_VALUE_TEXT: "", SETTINGS_CONTROL: '[name="settings-control"]', SETTINGS_CONTROL_CHECKBOX: '[name="switch-slider-value"]', SETTINGS_INFO: '[name="settings-info"]', @@ -42,15 +33,6 @@ const SELECTORS_WINDOWS = { const SELECTORS_MACOS = { DROPDOWN_MENU: "~Selector", DROPDOWN_OPTION: "~Selector Option", - RADIO_OPTION_HIGH: "~radio-option-High", - RADIO_OPTION_LOW: "~radio-option-Low", - RADIO_OPTION_MEDIUM: "~radio-option-Medium", - RADIO_OPTION_NONE: "~radio-option-None", - RANGE_INPUT_DEVICE: "~range-input-device", - RANGE_OUTPUT_DEVICE: "~range-output-device", - RANGE_SLIDER_BAR: "~range-input", - RANGE_SLIDER_VALUE: "~range-value", - RANGE_SLIDER_VALUE_TEXT: "-ios class chain:**/XCUIElementTypeStaticText", SETTINGS_CONTROL: "~settings-control", SETTINGS_CONTROL_CHECKBOX: "~switch-slider-value", SETTINGS_INFO: "~settings-info", @@ -75,66 +57,54 @@ export default class SettingsAudioScreen extends SettingsBaseScreen { get callTimerCheckbox() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[12] + .$$(SELECTORS.SETTINGS_SECTION)[6] .$(SELECTORS.SWITCH_SLIDER); } get callTimerControllerValue() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[12] + .$$(SELECTORS.SETTINGS_SECTION)[6] .$(SELECTORS.SETTINGS_CONTROL_CHECKBOX); } get callTimerDescription() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[12] + .$$(SELECTORS.SETTINGS_SECTION)[6] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get callTimerHeader() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[12] - .$(SELECTORS.SETTINGS_INFO) - .$(SELECTORS.SETTINGS_INFO_HEADER); - } - - get echoCancellationDescription() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[7] - .$(SELECTORS.SETTINGS_INFO) - .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); - } - - get echoCancellationHeader() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[7] + .$$(SELECTORS.SETTINGS_SECTION)[6] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } - get echoCancellationRadioOptionHigh() { + get echoCancellationCheckbox() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[8] - .$(SELECTORS.RADIO_OPTION_HIGH); + .$$(SELECTORS.SETTINGS_SECTION)[2] + .$(SELECTORS.SWITCH_SLIDER); } - get echoCancellationRadioOptionLow() { + get echoCancellationControllerValue() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[8] - .$(SELECTORS.RADIO_OPTION_LOW); + .$$(SELECTORS.SETTINGS_SECTION)[2] + .$(SELECTORS.SETTINGS_CONTROL_CHECKBOX); } - get echoCancellationRadioOptionMedium() { + get echoCancellationDescription() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[8] - .$(SELECTORS.RADIO_OPTION_MEDIUM); + .$$(SELECTORS.SETTINGS_SECTION)[2] + .$(SELECTORS.SETTINGS_INFO) + .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } - get echoCancellationRadioOptionNone() { + get echoCancellationHeader() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[8] - .$(SELECTORS.RADIO_OPTION_NONE); + .$$(SELECTORS.SETTINGS_SECTION)[2] + .$(SELECTORS.SETTINGS_INFO) + .$(SELECTORS.SETTINGS_INFO_HEADER); } get inputDeviceDescription() { @@ -164,208 +134,107 @@ export default class SettingsAudioScreen extends SettingsBaseScreen { .$(SELECTORS.SETTINGS_INFO_HEADER); } - get inputDeviceRange() { - return this.instance.$(SELECTORS.RANGE_INPUT_DEVICE); - } - - get inputDeviceSlider() { - return this.inputDeviceRange.$(SELECTORS.RANGE_SLIDER_BAR); - } - - get inputDeviceSliderValueIndicator() { - return this.inputDeviceRange.$(SELECTORS.RANGE_SLIDER_VALUE); - } - - get inputDeviceSliderValueText() { - return this.inputDeviceSliderValueIndicator.$( - SELECTORS.RANGE_SLIDER_VALUE_TEXT - ); - } - get interfaceSoundsCheckbox() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[9] + .$$(SELECTORS.SETTINGS_SECTION)[3] .$(SELECTORS.SWITCH_SLIDER); } get interfaceSoundsControllerValue() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[9] + .$$(SELECTORS.SETTINGS_SECTION)[3] .$(SELECTORS.SETTINGS_CONTROL_CHECKBOX); } get interfaceSoundsDescription() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[9] + .$$(SELECTORS.SETTINGS_SECTION)[3] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get interfaceSoundsHeader() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[9] + .$$(SELECTORS.SETTINGS_SECTION)[3] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } get mediaSoundsCheckbox() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[10] + .$$(SELECTORS.SETTINGS_SECTION)[4] .$(SELECTORS.SWITCH_SLIDER); } get mediaSoundsControllerValue() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[10] + .$$(SELECTORS.SETTINGS_SECTION)[4] .$(SELECTORS.SETTINGS_CONTROL_CHECKBOX); } get mediaSoundsDescription() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[10] + .$$(SELECTORS.SETTINGS_SECTION)[4] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get mediaSoundsHeader() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[10] + .$$(SELECTORS.SETTINGS_SECTION)[4] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } get messageSoundsCheckbox() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[11] + .$$(SELECTORS.SETTINGS_SECTION)[5] .$(SELECTORS.SWITCH_SLIDER); } get messageSoundsControllerValue() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[11] + .$$(SELECTORS.SETTINGS_SECTION)[5] .$(SELECTORS.SETTINGS_CONTROL_CHECKBOX); } get messageSoundsDescription() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[11] - .$(SELECTORS.SETTINGS_INFO) - .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); - } - - get messageSoundsHeader() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[11] - .$(SELECTORS.SETTINGS_INFO) - .$(SELECTORS.SETTINGS_INFO_HEADER); - } - - get noiseSuppressionDescription() { return this.instance .$$(SELECTORS.SETTINGS_SECTION)[5] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } - get noiseSuppressionHeader() { + get messageSoundsHeader() { return this.instance .$$(SELECTORS.SETTINGS_SECTION)[5] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } - get noiseSuppressionRadioOptionHigh() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[6] - .$(SELECTORS.RADIO_OPTION_HIGH); - } - - get noiseSuppressionRadioOptionLow() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[6] - .$(SELECTORS.RADIO_OPTION_LOW); - } - - get noiseSuppressionRadioOptionMedium() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[6] - .$(SELECTORS.RADIO_OPTION_MEDIUM); - } - - get noiseSuppressionRadioOptionNone() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[6] - .$(SELECTORS.RADIO_OPTION_NONE); - } - get outputDeviceDescription() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[2] + .$$(SELECTORS.SETTINGS_SECTION)[1] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); } get outputDeviceDropdown() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[2] + .$$(SELECTORS.SETTINGS_SECTION)[1] .$(SELECTORS.DROPDOWN_MENU); } get outputDeviceDropdownOption() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[2] + .$$(SELECTORS.SETTINGS_SECTION)[1] .$(SELECTORS.DROPDOWN_MENU) .$$(SELECTORS.DROPDOWN_OPTION); } get outputDeviceHeader() { return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[2] - .$(SELECTORS.SETTINGS_INFO) - .$(SELECTORS.SETTINGS_INFO_HEADER); - } - - get outputDeviceRange() { - return this.instance.$(SELECTORS.RANGE_OUTPUT_DEVICE); - } - - get outputDeviceSlider() { - return this.outputDeviceRange.$(SELECTORS.RANGE_SLIDER_BAR); - } - - get outputDeviceSliderValueIndicator() { - return this.outputDeviceRange.$(SELECTORS.RANGE_SLIDER_VALUE); - } - - get outputDeviceSliderValueText() { - return this.outputDeviceSliderValueIndicator.$( - SELECTORS.RANGE_SLIDER_VALUE_TEXT - ); - } - - get sampleRateDescription() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[4] - .$(SELECTORS.SETTINGS_INFO) - .$(SELECTORS.SETTINGS_INFO_DESCRIPTION); - } - - get sampleRateDropdown() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[4] - .$(SELECTORS.DROPDOWN_MENU); - } - - get sampleRateDropdownOption() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[4] - .$(SELECTORS.DROPDOWN_MENU) - .$$(SELECTORS.DROPDOWN_OPTION); - } - - get sampleRateHeader() { - return this.instance - .$$(SELECTORS.SETTINGS_SECTION)[4] + .$$(SELECTORS.SETTINGS_SECTION)[1] .$(SELECTORS.SETTINGS_INFO) .$(SELECTORS.SETTINGS_INFO_HEADER); } @@ -374,6 +243,8 @@ export default class SettingsAudioScreen extends SettingsBaseScreen { return this.instance.$(SELECTORS.SETTINGS_AUDIO); } + // Click on dropdowns and sliders methods + async clickOnInputDeviceDropdown() { const inputDeviceDropdown = await this.inputDeviceDropdown; await inputDeviceDropdown.click(); @@ -389,6 +260,16 @@ export default class SettingsAudioScreen extends SettingsBaseScreen { } } + async clickOnEchoCancellation() { + const currentDriver = await this.getCurrentDriver(); + const echoCancellationCheckbox = await this.echoCancellationCheckbox; + if (currentDriver === WINDOWS_DRIVER) { + await echoCancellationCheckbox.click(); + } else if (currentDriver === MACOS_DRIVER) { + await clickOnSwitchMacOS(echoCancellationCheckbox, this.executor); + } + } + async clickOnInterfaceSounds() { const currentDriver = await this.getCurrentDriver(); const interfaceSoundsCheckbox = await this.interfaceSoundsCheckbox; @@ -424,55 +305,6 @@ export default class SettingsAudioScreen extends SettingsBaseScreen { await outputDeviceDropdown.click(); } - async clickOnSampleRateDropdown() { - const sampleRateDropdown = await this.sampleRateDropdown; - await sampleRateDropdown.click(); - } - - // Echo Cancellation Select Methods - - async selectEchoCancellationHigh() { - const echoCancellationHigh = await this.echoCancellationRadioOptionHigh; - await echoCancellationHigh.click(); - } - - async selectEchoCancellationLow() { - const echoCancellationLow = await this.echoCancellationRadioOptionLow; - await echoCancellationLow.click(); - } - - async selectEchoCancellationMedium() { - const echoCancellationMedium = await this.echoCancellationRadioOptionMedium; - await echoCancellationMedium.click(); - } - - async selectEchoCancellationNone() { - const echoCancellationNone = await this.echoCancellationRadioOptionNone; - await echoCancellationNone.click(); - } - - // Noise Suppression Select Methods - - async selectNoiseSuppressionHigh() { - const noiseSuppressionHigh = await this.noiseSuppressionRadioOptionHigh; - await noiseSuppressionHigh.click(); - } - - async selectNoiseSuppressionLow() { - const noiseSuppressionLow = await this.noiseSuppressionRadioOptionLow; - await noiseSuppressionLow.click(); - } - - async selectNoiseSuppressionMedium() { - const noiseSuppressionMedium = await this.noiseSuppressionRadioOptionMedium; - await noiseSuppressionMedium.click(); - } - - async selectNoiseSuppressionNone() { - const noiseSuppressionNone = await this.noiseSuppressionRadioOptionNone; - await noiseSuppressionNone.click(); - } - // Input, Output and Sample Rate selection methods async selectInputDevice(device: string) { @@ -494,14 +326,4 @@ export default class SettingsAudioScreen extends SettingsBaseScreen { await outputDeviceDropdown.addValue(device + "\uE007"); } } - - async selectSampleRate(rate: string) { - const currentDriver = await this.getCurrentDriver(); - const sampleRateDropdown = await this.sampleRateDropdown; - if (currentDriver === MACOS_DRIVER) { - await sampleRateDropdown.addValue(rate + "\n"); - } else if (currentDriver === WINDOWS_DRIVER) { - await sampleRateDropdown.addValue(rate + "\uE007"); - } - } } diff --git a/tests/specs/07-settings-audio.spec.ts b/tests/specs/07-settings-audio.spec.ts index cf4e5984df7..6d775af3f2e 100644 --- a/tests/specs/07-settings-audio.spec.ts +++ b/tests/specs/07-settings-audio.spec.ts @@ -28,30 +28,9 @@ export default async function settingsAudio() { await expect(outputDeviceDescription).toHaveTextContaining( "This is where all sounds will be played. (Usually your headphones)." ); - - // Validate texts for Sample Rate selection - const sampleRateHeader = await settingsAudioFirstUser.sampleRateHeader; - const sampleRateDescription = - await settingsAudioFirstUser.sampleRateDescription; - await expect(sampleRateHeader).toHaveTextContaining("SAMPLE RATE"); - await expect(sampleRateDescription).toHaveTextContaining( - 'Higher sample rates will capture more "frames" of your audio and sound "clearer".' - ); }); - it("Settings Audio - Assert screen texts for Noise Suppression and Echo Cancellation", async () => { - // Validate texts for Noise Suppression Settings Section - const noiseSuppressionHeader = - await settingsAudioFirstUser.noiseSuppressionHeader; - const noiseSuppressionDescription = - await settingsAudioFirstUser.noiseSuppressionDescription; - await expect(noiseSuppressionHeader).toHaveTextContaining( - "NOISE SUPPRESSION" - ); - await expect(noiseSuppressionDescription).toHaveTextContaining( - "Helps to minimize background noise and focus on your voice." - ); - + it("Settings Audio - Assert screen texts for Echo Cancellation and Interface Sounds", async () => { // Validate texts for Echo Cancellation Settings Section const echoCancellationHeader = await settingsAudioFirstUser.echoCancellationHeader; @@ -63,9 +42,7 @@ export default async function settingsAudio() { await expect(echoCancellationDescription).toHaveTextContaining( "Helps to minimize feedback from speakers into your microphone." ); - }); - it("Settings Audio - Assert screen texts for switch sliders", async () => { // Validate texts for Interface Sounds Settings Section const interfaceSoundsHeader = await settingsAudioFirstUser.interfaceSoundsHeader; @@ -77,7 +54,9 @@ export default async function settingsAudio() { await expect(interfaceSoundsDescription).toHaveTextContaining( "When enabled, some additional sounds will play when you interact with the app." ); + }); + it("Settings Audio - Assert screen texts for Media-Message Sounds and Call Timer", async () => { // Validate texts for Media Sounds Settings Section const mediaSoundsHeader = await settingsAudioFirstUser.mediaSoundsHeader; const mediaSoundsDescription = @@ -107,35 +86,28 @@ export default async function settingsAudio() { ); }); - it("Settings Audio - Validate Noise Suppression radio buttons can be selected", async () => { - // Change Noise Suppression to Low, Medium, High and return it to None - await settingsAudioFirstUser.selectNoiseSuppressionLow(); - await settingsAudioFirstUser.selectNoiseSuppressionMedium(); - await settingsAudioFirstUser.selectNoiseSuppressionHigh(); - await settingsAudioFirstUser.selectNoiseSuppressionNone(); - }); - - it("Settings Audio - Validate Echo Cancellation radio buttons can be selected", async () => { - // Change Echo Cancellation to Low, Medium, High and return it to None - await settingsAudioFirstUser.selectEchoCancellationLow(); - await settingsAudioFirstUser.selectEchoCancellationMedium(); - await settingsAudioFirstUser.selectEchoCancellationHigh(); - await settingsAudioFirstUser.selectEchoCancellationNone(); - }); - it("Settings Audio - Disable switches enabled by default", async () => { - // Since Media Sounds and Message Sounds are enabled by default, first we need to click on these checkboxes before starting the test + // Since Echo Cancellation, Media Sounds and Message Sounds are enabled by default, first we need to click on these checkboxes before starting the test + await settingsAudioFirstUser.clickOnEchoCancellation(); await settingsAudioFirstUser.clickOnMediaSounds(); await settingsAudioFirstUser.clickOnMessageSounds(); }); it("Settings Audio - Click on slider switches to enable the options", async () => { - // Click on the four switch sliders from the Settings Sounds & Audio Screen + // Click on the five switch sliders from the Settings Sounds & Audio Screen + await settingsAudioFirstUser.clickOnEchoCancellation() await settingsAudioFirstUser.clickOnInterfaceSounds(); await settingsAudioFirstUser.clickOnMediaSounds(); await settingsAudioFirstUser.clickOnMessageSounds(); + await settingsAudioFirstUser.clickOnCallTimer(); // Validate that all toggles have now value = "1" (enabled) + const toggleElementEcho = + await settingsAudioFirstUser.messageSoundsControllerValue; + const echoCancellationStatus = await settingsAudioFirstUser.getToggleState( + toggleElementEcho + ); + const toggleElementInterface = await settingsAudioFirstUser.interfaceSoundsControllerValue; const interfaceSoundsStatus = await settingsAudioFirstUser.getToggleState( @@ -154,18 +126,34 @@ export default async function settingsAudio() { toggleElementMessage ); + const toggleElementTimer = + await settingsAudioFirstUser.messageSoundsControllerValue; + const callTimerStatus = await settingsAudioFirstUser.getToggleState( + toggleElementTimer + ); + + 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"); }); 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 + await settingsAudioFirstUser.clickOnEchoCancellation() await settingsAudioFirstUser.clickOnInterfaceSounds(); await settingsAudioFirstUser.clickOnMediaSounds(); await settingsAudioFirstUser.clickOnMessageSounds(); + await settingsAudioFirstUser.clickOnCallTimer(); // Validate that all toggles have now value = "0" (disabled) + const toggleElementEcho = + await settingsAudioFirstUser.messageSoundsControllerValue; + const echoCancellationStatus = await settingsAudioFirstUser.getToggleState( + toggleElementEcho + ); + const toggleElementInterface = await settingsAudioFirstUser.interfaceSoundsControllerValue; const interfaceSoundsStatus = await settingsAudioFirstUser.getToggleState( @@ -184,8 +172,16 @@ export default async function settingsAudio() { toggleElementMessage ); + const toggleElementTimer = + await settingsAudioFirstUser.messageSoundsControllerValue; + const callTimerStatus = await settingsAudioFirstUser.getToggleState( + toggleElementTimer + ); + + 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"); }); }