Skip to content

Commit

Permalink
Merge pull request #596 from Satellite-im/luis/settings-profile
Browse files Browse the repository at this point in the history
test(add): change status and reveal seed on settings profile
  • Loading branch information
luisecm authored Jan 19, 2024
2 parents 1f7e3a2 + 137bfd9 commit 4f2936a
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 0 deletions.
82 changes: 82 additions & 0 deletions tests/screenobjects/settings/RemoveSeedPhraseModal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
require("module-alias/register");
import { WINDOWS_DRIVER } from "@helpers/constants";
import UplinkMainScreen from "@screenobjects/UplinkMainScreen";

let SELECTORS = {};

const SELECTORS_COMMON = {};

const SELECTORS_WINDOWS = {
REMOVE_SEED_PHRASE_CANCEL_BUTTON: '[name="cancel-remove-seed-phrase-btn"]',
REMOVE_SEED_PHRASE_HELPER_TEXT:
'//Group/Text[contains(@Name, "Removing the seed phrase")]',
REMOVE_SEED_PHRASE_LABEL: '[name="remove-phrase-label"]',
REMOVE_SEED_PHRASE_LABEL_TEXT: "<Text>",
REMOVE_SEED_PHRASE_MODAL: '[name="modal"]',
REMOVE_SEED_PHRASE_OK_BUTTON: '[name="remove-seed-phrase-btn"]',
};

const SELECTORS_MACOS = {
REMOVE_SEED_PHRASE_CANCEL_BUTTON: "~cancel-remove-seed-phrase-btn",
REMOVE_SEED_PHRASE_HELPER_TEXT:
'-ios class chain:**/XCUIElementTypeGroup/XCUIElementTypeStaticText[`value CONTAINS[cd] "Removing the seed phrase"`]',
REMOVE_SEED_PHRASE_LABEL: "~remove-phrase-label",
REMOVE_SEED_PHRASE_LABEL_TEXT:
"-ios class chain:**/XCUIElementTypeStaticText",
REMOVE_SEED_PHRASE_MODAL: "~modal",
REMOVE_SEED_PHRASE_OK_BUTTON: "~remove-seed-phrase-btn",
};

process.env.DRIVER === WINDOWS_DRIVER
? (SELECTORS = { ...SELECTORS_WINDOWS, ...SELECTORS_COMMON })
: (SELECTORS = { ...SELECTORS_MACOS, ...SELECTORS_COMMON });

export default class RemoveSeedPhraseModal extends UplinkMainScreen {
constructor() {
super(SELECTORS.REMOVE_SEED_PHRASE_MODAL);
}

// Getters from UI Locators

get removeSeedPhraseCancelButton() {
return this.removeSeedPhraseModal.$(
SELECTORS.REMOVE_SEED_PHRASE_CANCEL_BUTTON,
);
}

get removeSeedPhraseHelperText() {
return this.removeSeedPhraseModal.$(
SELECTORS.REMOVE_SEED_PHRASE_HELPER_TEXT,
);
}

get removeSeedPhraseOKButton() {
return this.removeSeedPhraseModal.$(SELECTORS.REMOVE_SEED_PHRASE_OK_BUTTON);
}

get removeSeedPhraseLabel() {
return this.removeSeedPhraseModal.$(SELECTORS.REMOVE_SEED_PHRASE_LABEL);
}

get removeSeedPhraseLabelText() {
return this.removeSeedPhraseLabel.$(
SELECTORS.REMOVE_SEED_PHRASE_LABEL_TEXT,
);
}

get removeSeedPhraseModal() {
return $(SELECTORS.REMOVE_SEED_PHRASE_MODAL);
}

// Methods to interact with the UI

async clickOnCancelButton() {
const cancelButton = await this.removeSeedPhraseCancelButton;
await cancelButton.click();
}

async clickOnConfirmButton() {
const confirmButton = await this.removeSeedPhraseOKButton;
await confirmButton.click();
}
}
91 changes: 91 additions & 0 deletions tests/screenobjects/settings/SettingsProfileScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,28 @@ const SELECTORS_WINDOWS = {
DISMISS_BUTTON: '[name="welcome-message-dismiss"]',
INPUT_ERROR: '[name="input-error"]',
INPUT_ERROR_MESSAGE: "<Text>",
ONLINE_STATUS_SECTION: "[name='online-status-section']",
PROFILE_BANNER: '[name="profile-banner"]',
PROFILE_BANNER_CLEAR: '[name="clear-banner"]',
PROFILE_BANNER_TOOLTIP: "<Text>",
PROFILE_CONTENT: '[name="profile-content"]',
PROFILE_HEADER: '[name="profile-header"]',
PROFILE_PICTURE: '[name="profile-picture"]',
PROFILE_PICTURE_CLEAR: '[name="clear-avatar"]',
RECOVERY_SEED_SECTION: "[name='recovery-seed-section']",
REVEAL_RECOVERY_SEED_BUTTON: "[name='reveal-recovery-seed-button']",
SEED_WORDS_SECTION: "[name='seed-words-section']",
SELECTOR: "<ComboBox>",
SELECTOR_OPTION: '[name="selector-option"]',
SELECTOR_OPTION_INDICATOR_DO_NOT_DISTURB: "[name='indicator-do-not-disturb']",
SELECTOR_OPTION_INDICATOR_IDLE: "[name='indicator-idle']",
SELECTOR_OPTION_INDICATOR_OFFLINE: "[name='indicator-offline']",
SELECTOR_OPTION_INDICATOR_ONLINE: "[name='indicator-online']",
SELECTOR_OPTIONS_LIST: '[name="selector-options-list"]',
SETTINGS_CONTROL: '[name="settings-control"]',
SETTINGS_INFO: '[name="settings-info"]',
SETTINGS_INFO_DESCRIPTION: "<Text>[2]",
SETTINGS_INFO_HEADER: "//Text[1]/Text",
STATUS_INPUT: '[name="status-input"]',
STATUS_LABEL: '//Text[@Name="profile-status-label"]/Text',
TOOLTIP: '[name="tooltip"]',
Expand Down Expand Up @@ -65,6 +80,7 @@ const SELECTORS_MACOS = {
DISMISS_BUTTON: "~welcome-message-dismiss",
INPUT_ERROR: "~input-error",
INPUT_ERROR_MESSAGE: "-ios class chain:**/XCUIElementTypeStaticText",
ONLINE_STATUS_SECTION: "~online-status-section",
PROFILE_BANNER: "~profile-banner",
PROFILE_BANNER_CLEAR: "~clear-banner",
PROFILE_BANNER_TOOLTIP:
Expand All @@ -73,6 +89,21 @@ const SELECTORS_MACOS = {
PROFILE_HEADER: "~profile-header",
PROFILE_PICTURE: "~profile-picture",
PROFILE_PICTURE_CLEAR: "~clear-avatar",
RECOVERY_SEED_SECTION: "~recovery-seed-section",
REVEAL_RECOVERY_SEED_BUTTON: "~reveal-recovery-seed-button",
SEED_WORDS_SECTION: "~seed-words-section",
SELECTOR: "~Selector",
SELECTOR_OPTION: "~selector-option",
SELECTOR_OPTION_INDICATOR_DO_NOT_DISTURB: "~indicator-do-not-disturb",
SELECTOR_OPTION_INDICATOR_IDLE: "~indicator-idle",
SELECTOR_OPTION_INDICATOR_OFFLINE: "~indicator-offline",
SELECTOR_OPTION_INDICATOR_ONLINE: "~indicator-online",
SELECTOR_OPTIONS_LIST: "~selector-options-list",
SETTINGS_CONTROL: "~settings-control",
SETTINGS_INFO: "~settings-info",
SETTINGS_INFO_DESCRIPTION:
"-ios class chain:**/XCUIElementTypeGroup/XCUIElementTypeStaticText",
SETTINGS_INFO_HEADER: "-ios class chain:**/XCUIElementTypeStaticText[1]",
STATUS_INPUT: "~status-input",
STATUS_LABEL: "-ios class chain:**/XCUIElementTypeStaticText[2]",
TOOLTIP: "~tooltip",
Expand Down Expand Up @@ -150,6 +181,22 @@ export default class SettingsProfileScreen extends SettingsBaseScreen {
return $(SELECTORS.INPUT_ERROR).$(SELECTORS.INPUT_ERROR_MESSAGE);
}

get onlineStatusSection() {
return $(SELECTORS.ONLINE_STATUS_SECTION);
}

get onlineStatusDescription() {
return $(SELECTORS.ONLINE_STATUS_SECTION)
.$(SELECTORS.SETTINGS_INFO)
.$(SELECTORS.SETTINGS_INFO_DESCRIPTION);
}

get onlineStatusHeader() {
return $(SELECTORS.ONLINE_STATUS_SECTION)
.$(SELECTORS.SETTINGS_INFO)
.$(SELECTORS.SETTINGS_INFO_HEADER);
}

get profileBanner() {
return $(SELECTORS.PROFILE_BANNER);
}
Expand Down Expand Up @@ -178,6 +225,50 @@ export default class SettingsProfileScreen extends SettingsBaseScreen {
return $(SELECTORS.PROFILE_PICTURE_CLEAR);
}

get recoverySeedDescription() {
return $(SELECTORS.RECOVERY_SEED_SECTION)
.$(SELECTORS.SETTINGS_INFO)
.$(SELECTORS.SETTINGS_INFO_DESCRIPTION);
}

get recoverySeedHeader() {
return $(SELECTORS.RECOVERY_SEED_SECTION)
.$(SELECTORS.SETTINGS_INFO)
.$(SELECTORS.SETTINGS_INFO_HEADER);
}

get recoverySeedSection() {
return $(SELECTORS.RECOVERY_SEED_SECTION);
}

get revealRecoverySeedButton() {
return $(SELECTORS.REVEAL_RECOVERY_SEED_BUTTON);
}

get seedWordsDescription() {
return $(SELECTORS.SEED_WORDS_SECTION)
.$(SELECTORS.SETTINGS_INFO)
.$(SELECTORS.SETTINGS_INFO_DESCRIPTION);
}

get seedWordsHeader() {
return $(SELECTORS.SEED_WORDS_SECTION)
.$(SELECTORS.SETTINGS_INFO)
.$(SELECTORS.SETTINGS_INFO_HEADER);
}

get seedWordsSection() {
return $(SELECTORS.SEED_WORDS_SECTION);
}

get seedWordsWarningPhraseHidden() {
return $$(SELECTORS.SETTINGS_CONTROL)[2].$(SELECTORS.SETTINGS_INFO_HEADER);
}

get seedWordsWarningPhraseNotHidden() {
return $$(SELECTORS.SETTINGS_CONTROL)[3].$(SELECTORS.SETTINGS_INFO_HEADER);
}

get settingsProfile() {
return $(SELECTORS.SETTINGS_PROFILE);
}
Expand Down

0 comments on commit 4f2936a

Please sign in to comment.