Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screenobject(update): update switch sliders validation methods #641

Merged
merged 8 commits into from
Feb 23, 2024
32 changes: 28 additions & 4 deletions tests/screenobjects/UplinkMainScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
32 changes: 22 additions & 10 deletions tests/screenobjects/settings/SettingsAccessibilityScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"]',
Expand Down Expand Up @@ -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() {
Expand All @@ -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);
}
}
58 changes: 58 additions & 0 deletions tests/screenobjects/settings/SettingsAudioScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
36 changes: 36 additions & 0 deletions tests/screenobjects/settings/SettingsDeveloperScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
22 changes: 22 additions & 0 deletions tests/screenobjects/settings/SettingsExtensionsScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
22 changes: 22 additions & 0 deletions tests/screenobjects/settings/SettingsMessagesScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Loading
Loading