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

test: Refactor AdvancedView.js #10712

Merged
merged 10 commits into from
Aug 21, 2024
46 changes: 19 additions & 27 deletions e2e/pages/Settings/AdvancedView.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
import TestHelpers from '../../helpers';
import { AdvancedViewSelectorsIDs } from '../../selectors/Settings/AdvancedView.selectors';
import Gestures from '../../utils/Gestures';
import Matchers from '../../utils/Matchers';

export default class AdvancedSettingsView {
static async tapEthSignSwitch() {
await TestHelpers.delay(2500);

if (device.getPlatform() === 'android') {
await TestHelpers.swipeByLabel('Show Hex Data', 'up', 'slow', 0.5);
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
await TestHelpers.delay(2500);

await TestHelpers.waitAndTap(AdvancedViewSelectorsIDs.ETH_SIGN_SWITCH);
} else {
await TestHelpers.swipe(
AdvancedViewSelectorsIDs.CONTAINER,
'up',
'slow',
0.2,
);
await TestHelpers.waitAndTap(AdvancedViewSelectorsIDs.ETH_SIGN_SWITCH);
}
}

static get scrollViewIdentifier() {
class AdvancedSettingsView {
get scrollViewIdentifier() {
return Matchers.getIdentifier(
AdvancedViewSelectorsIDs.ADVANCED_SETTINGS_SCROLLVIEW,
);
}

static get showFiatOnTestnetsToggle() {
get showFiatOnTestnetsToggle() {
return Matchers.getElementByID(
AdvancedViewSelectorsIDs.SHOW_FIAT_ON_TESTNETS,
);
}

static async tapShowFiatOnTestnetsSwitch() {
await TestHelpers.waitAndTap(
AdvancedViewSelectorsIDs.SHOW_FIAT_ON_TESTNETS,
get ethSignSwitch() {
return Matchers.getElementByID(AdvancedViewSelectorsIDs.ETH_SIGN_SWITCH);
}

async tapShowFiatOnTestnetsSwitch() {
await Gestures.waitAndTap(this.showFiatOnTestnetsToggle);
}

async tapEthSignSwitch() {
await Gestures.scrollToElement(
this.ethSignSwitch,
this.scrollViewIdentifier,
);
await Gestures.waitAndTap(this.ethSignSwitch);
}

static async scrollToShowFiatOnTestnetsToggle() {
async scrollToShowFiatOnTestnetsToggle() {
await Gestures.scrollToElement(
this.showFiatOnTestnetsToggle,
this.scrollViewIdentifier,
);
}
}

export default new AdvancedSettingsView();
Loading