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

chore: refactor e2e #11483

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions e2e/pages/EnableDeviceNotificationsAlert.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
import TestHelpers from '../helpers';
import Gestures from '../utils/Gestures';
import Matchers from '../utils/Matchers';

import {
ENABLE_DEVICE_NOTIFICATIONS_CONTAINER_ID,
ENABLE_DEVICE_NOTIFICATIONS_NO_THANKS_BUTTON_ID,
ENABLE_DEVICE_NOTIFICATIONS_YES_BUTTON_ID
} from '../../wdio/screen-objects/testIDs/Screens/EnableDeviceNotificationsChecksAlert.testIds';

export default class EnableDeviceNotificationsAlert {
static async tapNoThanks() {
await TestHelpers.waitAndTapByLabel(
ENABLE_DEVICE_NOTIFICATIONS_NO_THANKS_BUTTON_ID
);
class EnableDeviceNotificationsAlert {
get stepOneContainer() {
return Matchers.getSystemElementByText(ENABLE_DEVICE_NOTIFICATIONS_CONTAINER_ID);
}

static async tapYes() {
await TestHelpers.waitAndTapByLabel(
get getEnableDeviceNotificationsButton() {
return Matchers.getSystemElementByText(
ENABLE_DEVICE_NOTIFICATIONS_YES_BUTTON_ID,
);
}

static async isVisible() {
await TestHelpers.checkIfElementWithTextIsVisible(
ENABLE_DEVICE_NOTIFICATIONS_CONTAINER_ID,
get getNotEnableDeviceNotificationsButton() {
return Matchers.getSystemElementByText(
ENABLE_DEVICE_NOTIFICATIONS_NO_THANKS_BUTTON_ID,
);
}

async tapOnEnableDeviceNotificationsButton() {
await Gestures.waitAndTap(this.getEnableDeviceNotificationsButton);
}

async tapOnNotEnableDeviceNotificationsButton() {
await Gestures.waitAndTap(this.getNotEnableDeviceNotificationsButton);
}
}

export default new EnableDeviceNotificationsAlert();
24 changes: 20 additions & 4 deletions e2e/viewHelper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

import EnableAutomaticSecurityChecksView from './pages/EnableAutomaticSecurityChecksView';
import EnableDeviceNotificationsAlert from './pages/EnableDeviceNotificationsAlert';
import ImportWalletView from './pages/Onboarding/ImportWalletView';
import MetaMetricsOptIn from './pages/Onboarding/MetaMetricsOptInView';
import NetworkEducationModal from './pages/modals/NetworkEducationModal';
Expand Down Expand Up @@ -68,6 +69,21 @@ have to have all these workarounds in the tests
}
};

export const skipNotificationsDeviceSettings = async () => {

await TestHelpers.delay(1000);

try {
await Assertions.checkIfVisible(EnableDeviceNotificationsAlert.stepOneContainer);
await EnableDeviceNotificationsAlert.tapOnNotEnableDeviceNotificationsButton();
await Assertions.checkIfNotVisible(EnableDeviceNotificationsAlert.stepOneContainer);
} catch {
/* eslint-disable no-console */

console.log('The notification device alert modal is not visible');
}
};

export const importWalletWithRecoveryPhrase = async () => {
// tap on import seed phrase button
await Assertions.checkIfVisible(OnboardingCarouselView.container);
Expand All @@ -83,14 +99,13 @@ export const importWalletWithRecoveryPhrase = async () => {
await ImportWalletView.enterPassword(validAccount.password);
await ImportWalletView.reEnterPassword(validAccount.password);


//'Should dismiss Enable device Notifications checks alert'
await TestHelpers.delay(3500);
await OnboardingSuccessView.tapDone();
//'Should dismiss Enable device Notifications checks alert'
await this.skipNotificationsDeviceSettings();
// Should dismiss Automatic Security checks screen
await EnableAutomaticSecurityChecksView.isVisible();
await EnableAutomaticSecurityChecksView.tapNoThanks();

// should dismiss the onboarding wizard
// dealing with flakiness on bitrise.
await this.closeOnboardingModals();
Expand Down Expand Up @@ -122,9 +137,10 @@ export const CreateNewWallet = async () => {
await device.enableSynchronization();
await Assertions.checkIfVisible(WalletView.container);

//'Should dismiss Enable device Notifications checks alert'
await TestHelpers.delay(3500);
await OnboardingSuccessView.tapDone();
//'Should dismiss Enable device Notifications checks alert'
await this.skipNotificationsDeviceSettings();
//'Should dismiss Automatic Security checks screen'
await EnableAutomaticSecurityChecksView.isVisible();
await EnableAutomaticSecurityChecksView.tapNoThanks();
Expand Down
Loading