Skip to content

Commit

Permalink
screenobject(update): minor fixes for flaky macos tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luisecm committed Mar 27, 2024
1 parent 60e0c7b commit 84d3a8a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion tests/screenobjects/account-creation/CreatePinScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,17 @@ class CreatePinScreen extends UplinkMainScreen {
}

async enterPinOnLogin(pin: string) {
await this.pinInput.waitForExist();
const pinInput = await this.pinInput;
await pinInput.click();
await pinInput.clearValue();
await pinInput.setValue(pin);

const pinToEnterLength = pin.length;
const expectedMaskedPin = "•".repeat(pinToEnterLength);
const maskedPin = await pinInput.getText();
if (maskedPin !== expectedMaskedPin) {
await this.enterPinOnCreateAccount(pin);
}
}

async enterPinOnCreateAccount(pin: string) {
Expand Down
10 changes: 8 additions & 2 deletions tests/screenobjects/settings/SettingsAccessibilityScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const SELECTORS_WINDOWS: selectorContainer = {
SETTINGS_INFO: '[name="settings-info"]',
SETTINGS_INFO_DESCRIPTION: "<Text>[2]",
SETTINGS_INFO_HEADER: "//Text[1]/Text",
SETTINGS_LAYOUT: '[name="settings-layout"]',
SWITCH_SLIDER: '[name="Switch Slider"]',
};

Expand All @@ -26,6 +27,7 @@ const SELECTORS_MACOS: selectorContainer = {
SETTINGS_INFO_DESCRIPTION:
"-ios class chain:**/XCUIElementTypeGroup/XCUIElementTypeStaticText",
SETTINGS_INFO_HEADER: "-ios class chain:**/XCUIElementTypeStaticText[1]",
SETTINGS_LAYOUT: "~settings-layout",
SWITCH_SLIDER: "~Switch Slider",
};

Expand All @@ -35,7 +37,7 @@ process.env.DRIVER === WINDOWS_DRIVER

class SettingsAccessibilityScreen extends SettingsBaseScreen {
constructor() {
super(SELECTORS.OPEN_DYSLEXIC_SECTION);
super(SELECTORS.SETTINGS_LAYOUT);
}

public get openDyslexicCheckbox() {
Expand Down Expand Up @@ -63,7 +65,11 @@ class SettingsAccessibilityScreen extends SettingsBaseScreen {
}

public get openDyslexicSection() {
return $(SELECTORS.OPEN_DYSLEXIC_SECTION);
return this.settingsLayout.$(SELECTORS.OPEN_DYSLEXIC_SECTION);
}

public get settingsLayout() {
return $(SELECTORS.SETTINGS_LAYOUT);
}

async clickOnOpenDyslexic() {
Expand Down

0 comments on commit 84d3a8a

Please sign in to comment.