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

Detox version bump from 19.6.5 to 19.7.1 #4782

Merged
merged 8 commits into from
Aug 29, 2022
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
6 changes: 4 additions & 2 deletions app/components/UI/LoginOptionsSwitch/LoginOptionsSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const LoginOptionsSwitch = ({
// if both are disabled then this component returns null
if (shouldRenderBiometricOption !== null) {
return (
<View style={styles.container} testID={LOGIN_WITH_BIOMETRICS_SWITCH}>
<View style={styles.container}>
<Text style={styles.label}>
{strings(
`biometrics.enable_${shouldRenderBiometricOption.toLowerCase()}`,
Expand All @@ -67,12 +67,13 @@ const LoginOptionsSwitch = ({
}}
thumbColor={colors.white}
ios_backgroundColor={colors.border.muted}
testID={LOGIN_WITH_BIOMETRICS_SWITCH}
/>
</View>
);
} else if (shouldRenderBiometricOption === null && allowLoginWithRememberMe) {
return (
<View style={styles.container} testID={LOGIN_WITH_REMEMBER_ME_SWITCH}>
<View style={styles.container}>
<Text style={styles.label}>
{strings(`choose_password.remember_me`)}
</Text>
Expand All @@ -86,6 +87,7 @@ const LoginOptionsSwitch = ({
}}
thumbColor={colors.white}
ios_backgroundColor={colors.border.muted}
testID={LOGIN_WITH_REMEMBER_ME_SWITCH}
/>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ const SecurityOptionToggle = ({
[onOptionUpdated],
);
return (
<View style={styles.setting} testID={testId}>
<View style={styles.setting}>
<Text style={styles.title}>{title}</Text>
{description ? <Text style={styles.desc}>{description}</Text> : null}
<View style={styles.switchElement}>
<Switch
testID={testId}
value={value}
onValueChange={(newValue: boolean) => handleOnValueChange(newValue)}
trackColor={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { setAllowLoginWithRememberMe } from '../../../../../actions/security';
import { useNavigation } from '@react-navigation/native';
import { createTurnOffRememberMeModalNavDetails } from '../../../..//UI/TurnOffRememberMeModal/TurnOffRememberMeModal';

import { REMEMBER_ME_TOGGLE_ON_SETTINGS_AND_PRIVACY } from '../../../../../constants/test-ids';

const RememberMeOptionSection = () => {
const { navigate } = useNavigation();
const allowLoginWithRememberMe = useSelector(
Expand Down Expand Up @@ -46,6 +48,7 @@ const RememberMeOptionSection = () => {
description={strings(`remember_me.enable_remember_me_description`)}
value={allowLoginWithRememberMe}
onOptionUpdated={(value) => onValueChanged(value)}
testId={REMEMBER_ME_TOGGLE_ON_SETTINGS_AND_PRIVACY}
/>
);
};
Expand Down
1 change: 1 addition & 0 deletions app/constants/test-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ export const STACKED_AVATARS_OVERFLOW_COUNTER =
export const LOGIN_WITH_BIOMETRICS_SWITCH = 'login-with-biometrics-switch';
export const LOGIN_WITH_REMEMBER_ME_SWITCH = 'login-with-remember-me-switch';
export const TURN_OFF_REMEMBER_ME_MODAL = 'TurnOffRememberMeConfirm';
export const REMEMBER_ME_TOGGLE_ON_SETTINGS_AND_PRIVACY = 'turn-on-remember-me';
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CHANGE_PASSWORD_BUTTON_ID,
CHANGE_PASSWORD_TITLE_ID,
BACK_ARROW_BUTTON_ID,
REMEMBER_ME_TOGGLE_ON_SETTINGS_AND_PRIVACY,
} from '../../../../../app/constants/test-ids';

const SECURITY_SETTINGS_SCROLL_ID = 'security-settings-scrollview';
Expand Down Expand Up @@ -38,7 +39,18 @@ export default class SecurityAndPrivacy {
await TestHelpers.swipe(SECURITY_SETTINGS_SCROLL_ID, 'up', 'fast');
await TestHelpers.delay(1000);
} else {
await TestHelpers.swipe(CHANGE_PASSWORD_TITLE_ID, 'up', 'fast', 0.8);
await TestHelpers.swipe(CHANGE_PASSWORD_TITLE_ID, 'up', 'fast', 0.9);
}
//await TestHelpers.swipe(PRIVACY_MODE_SECTION_ID, 'up', 'fast');
}

static async scrollToTurnOnRememberMe() {
// Scroll to the bottom
if (device.getPlatform() === 'android') {
await TestHelpers.swipe(SECURITY_SETTINGS_SCROLL_ID, 'up', 'slow');
await TestHelpers.delay(1000);
} else {
await TestHelpers.swipe(CHANGE_PASSWORD_TITLE_ID, 'up', 'slow', 0.6);
}
//await TestHelpers.swipe(PRIVACY_MODE_SECTION_ID, 'up', 'fast');
}
Expand All @@ -51,6 +63,10 @@ export default class SecurityAndPrivacy {
await TestHelpers.tap(METAMETRICS_SWITCH_ID);
}

static async tapTurnOnRememberMeToggle() {
await TestHelpers.tap(REMEMBER_ME_TOGGLE_ON_SETTINGS_AND_PRIVACY);
}

static async isMetaMetricsToggleOn() {
await TestHelpers.checkIfToggleIsOn(METAMETRICS_SWITCH_ID);
}
Expand All @@ -59,6 +75,17 @@ export default class SecurityAndPrivacy {
await TestHelpers.checkIfToggleIsOff(METAMETRICS_SWITCH_ID);
}

static async isRememberMeToggleOn() {
await TestHelpers.checkIfToggleIsOn(
REMEMBER_ME_TOGGLE_ON_SETTINGS_AND_PRIVACY,
);
}

static async isRememberMeToggleOff() {
await TestHelpers.checkIfToggleIsOff(
REMEMBER_ME_TOGGLE_ON_SETTINGS_AND_PRIVACY,
);
}
static async isChangePasswordSectionVisible() {
await TestHelpers.checkIfVisible(CHANGE_PASSWORD_TITLE_ID);
}
Expand Down
4 changes: 4 additions & 0 deletions e2e/pages/LoginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
RESET_WALLET_ID,
LOGIN_CONTAINER_ID,
LOGIN_PASSWORD_ERROR,
LOGIN_WITH_REMEMBER_ME_SWITCH,
} from '../../app/constants/test-ids';
export default class LoginView {
static async enterPassword(password) {
Expand All @@ -12,6 +13,9 @@ export default class LoginView {
static async tapResetWalletButton() {
await TestHelpers.tap(RESET_WALLET_ID);
}
static async toggleRememberMe() {
await TestHelpers.tap(LOGIN_WITH_REMEMBER_ME_SWITCH);
}

static async isVisible() {
await TestHelpers.checkIfVisible(LOGIN_CONTAINER_ID);
Expand Down
15 changes: 9 additions & 6 deletions e2e/specs/browser-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import WhatsNewModal from '../pages/modals/WhatsNewModal';

const ENS_Example = 'https://brunobarbieri.eth';
const ENS_TLD = 'https://inbox.mailchain.xyz';
const UNISWAP = 'https://uniswap.exchange';
const SUSHI_SWAP = 'https://app.sushi.com/swap';
const PASSWORD = '12345678';
const PHISHING_SITE = 'http://www.empowr.com/FanFeed/Home.aspx';
const INVALID_URL = 'https://quackquakc.easq';
Expand Down Expand Up @@ -116,18 +116,18 @@ describe('Browser Tests', () => {
}
});

it('should go to uniswap', async () => {
it('should go to sushi swap', async () => {
await TestHelpers.delay(3000);
// Tap on search in bottom navbar
await Browser.tapBrowser();
await Browser.navigateToURL(UNISWAP);
await Browser.navigateToURL(SUSHI_SWAP);

// Wait for page to load
await Browser.waitForBrowserPageToLoad();

if (device.getPlatform() === 'android') {
// Check that the dapp title is correct
await TestHelpers.checkIfElementWithTextIsVisible('app.uniswap.org', 0);
await TestHelpers.checkIfElementWithTextIsVisible('app.sushi.com', 0);
}
await TestHelpers.delay(5000);
await ConnectModal.tapCancelButton();
Expand All @@ -140,7 +140,7 @@ describe('Browser Tests', () => {
await Browser.isVisible();
});

it('should add uniswap to favorites', async () => {
it('should add sushi swap to favorites', async () => {
// Check that we are still on the browser screen
await Browser.isVisible();
// Tap on options
Expand All @@ -160,7 +160,7 @@ describe('Browser Tests', () => {
await Browser.isVisible();
});

it('should tap on Uniswap in favorites', async () => {
it('should tap on sushi swap in favorites', async () => {
if (device.getPlatform() === 'ios') {
// Tapping on favourite tap
await TestHelpers.tapAtPoint(BROWSER_SCREEN_ID, { x: 174, y: 281 });
Expand All @@ -174,6 +174,9 @@ describe('Browser Tests', () => {
// Wait for connect prompt to display
await TestHelpers.delay(5000);
await ConnectModal.tapConnectButton();

await TestHelpers.tapAtPoint(BROWSER_SCREEN_ID, { x: 20, y: 130 }); // tapping to dismiss keyboard

await Browser.isVisible();
});

Expand Down
67 changes: 51 additions & 16 deletions e2e/specs/deeplinks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ import { Browser } from '../pages/Drawer/Browser';
import DrawerView from '../pages/Drawer/DrawerView';
import NetworkView from '../pages/Drawer/Settings/NetworksView';
import SettingsView from '../pages/Drawer/Settings/SettingsView';

import LoginView from '../pages/LoginView';
import TransactionConfirmationView from '../pages/TransactionConfirmView';

import SecurityAndPrivacy from '../pages/Drawer/Settings/SecurityAndPrivacy/SecurityAndPrivacyView';

import WalletView from '../pages/WalletView';

const SECRET_RECOVERY_PHRASE =
Expand All @@ -35,10 +38,14 @@ const POLYGON_DEEPLINK_URL =

const ETHEREUM_DEEPLINK_URL =
'https://metamask.app.link/send/0x1FDb169Ef12954F20A15852980e1F0C122BfC1D6@1?value=1e13';
const RINKEBY_DEEPLINK_URL =
'https://metamask.app.link/send/0x1FDb169Ef12954F20A15852980e1F0C122BfC1D6@4?value=1e13';
const GOERLI_DEEPLINK_URL =
'https://metamask.app.link/send/0x1FDb169Ef12954F20A15852980e1F0C122BfC1D6@5?value=1e13';

const DAPP_DEEPLINK_URL = 'https://metamask.app.link/dapp/app.uniswap.org';
const DAPP_DEEPLINK_URL = 'https://metamask.app.link/dapp/app.sushi.com';

const networkNotFoundText = 'Network not found';
const networkErrorBodyMessage =
'Network with chain id 56 not found in your wallet. Please add the network first.';

describe('Deep linking Tests', () => {
beforeEach(() => {
Expand All @@ -59,12 +66,11 @@ describe('Deep linking Tests', () => {
});

it('should attempt to import wallet with invalid secret recovery phrase', async () => {
await ImportWalletView.toggleRememberMe();
//await ImportWalletView.toggleRememberMe();
await ImportWalletView.enterSecretRecoveryPhrase(SECRET_RECOVERY_PHRASE);
await ImportWalletView.enterPassword(PASSWORD);
await ImportWalletView.reEnterPassword(PASSWORD);
await WalletView.isVisible();
///
});

it('should tap on the close button in the whats new modal', async () => {
Expand All @@ -89,11 +95,38 @@ describe('Deep linking Tests', () => {
//
}
});
it('should deep link to the send flow with a custom network not added to wallet', async () => {
const networkNotFoundText = 'Network not found';
const networkErrorBodyMessage =
'Network with chain id 56 not found in your wallet. Please add the network first.';

it('should go to the Privacy and settings view', async () => {
await WalletView.tapDrawerButton(); // tapping burger menu

await DrawerView.isVisible();
await DrawerView.tapSettings();

await SettingsView.tapSecurityAndPrivacy();

await SecurityAndPrivacy.scrollToTurnOnRememberMe();
TestHelpers.delay(3000);
});

it('should enable remember me', async () => {
await SecurityAndPrivacy.isRememberMeToggleOff();
await SecurityAndPrivacy.tapTurnOnRememberMeToggle();
await SecurityAndPrivacy.isRememberMeToggleOn();

TestHelpers.delay(1500);
});

it('should relaunch the app then enable remember me', async () => {
// Relaunch app
await TestHelpers.relaunchApp();
await LoginView.isVisible();
await LoginView.toggleRememberMe();

await LoginView.enterPassword(PASSWORD);
await WalletView.isVisible();
});

it('should deep link to Binance Smart Chain & show a network not found error message', async () => {
await TestHelpers.openDeepLink(BINANCE_DEEPLINK_URL);
await TestHelpers.delay(3000);
await TestHelpers.checkIfElementWithTextIsVisible(networkNotFoundText);
Expand Down Expand Up @@ -169,14 +202,16 @@ describe('Deep linking Tests', () => {
await TransactionConfirmationView.isNetworkNameVisible('BNB Smart Chain');
});

it('should deep link to the send flow on Rinkeby and submit the transaction', async () => {
await TestHelpers.openDeepLink(RINKEBY_DEEPLINK_URL);
it('should deep link to the send flow on Goerli and submit the transaction', async () => {
await TestHelpers.openDeepLink(GOERLI_DEEPLINK_URL);
await TestHelpers.delay(4500);
await TransactionConfirmationView.isVisible();
await TransactionConfirmationView.isNetworkNameVisible(
'Rinkeby Test Network',
'Goerli Test Network',
);
await TransactionConfirmationView.isTransactionTotalCorrect(
'0.00001 GoerliETH',
);
await TransactionConfirmationView.isTransactionTotalCorrect('0.00001 ETH');
// Tap on the Send CTA
await TransactionConfirmationView.tapConfirmButton();
// Check that we are on the wallet screen
Expand All @@ -194,14 +229,14 @@ describe('Deep linking Tests', () => {
await TransactionConfirmationView.tapCancelButton();
});

it('should deep link to a dapp (Uniswap)', async () => {
it('should deep link to a dapp (Sushi swap)', async () => {
await TestHelpers.openDeepLink(DAPP_DEEPLINK_URL);
await TestHelpers.delay(4500);

await ConnectModal.isVisible();
await ConnectModal.tapConnectButton();

await TestHelpers.checkIfElementWithTextIsVisible('app.uniswap.org', 0);
await TestHelpers.checkIfElementWithTextIsVisible('app.sushi.com', 0);

await Browser.isVisible();
await ConnectModal.isNotVisible();
Expand Down
1 change: 1 addition & 0 deletions e2e/specs/onboarding-wizard-opt-in.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ describe('Onboarding wizard opt-in, metametrics opt out from settings', () => {
await SettingsView.tapSecurityAndPrivacy();

await SecurityAndPrivacy.scrollToBottomOfView();
TestHelpers.delay(2000);
await SecurityAndPrivacy.isMetaMetricsToggleOn();

TestHelpers.delay(1500);
Expand Down
17 changes: 13 additions & 4 deletions e2e/specs/wallet-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const SECRET_RECOVERY_PHRASE =
const PASSWORD = `12345678`;
const TEST_PUBLIC_ADDRESS = '0xd3B9Cbea7856AECf4A6F7c3F4E8791F79cBeeD62';
const RINKEBY = 'Rinkeby Test Network';
const GOERLI = 'Goerli Test Network';
const ETHEREUM = 'Ethereum Main Network';
const COLLECTIBLE_CONTRACT_ADDRESS =
'0x16baf0de678e52367adc69fd067e5edd1d33e3bf';
Expand Down Expand Up @@ -280,11 +281,17 @@ describe('Wallet Tests', () => {
await WalletView.isTokenVisibleInWallet('0 BLT');
});

it('should switch back to Rinkeby network', async () => {
it('should switch to Goerli network', async () => {
await WalletView.tapNetworksButtonOnNavBar();
await NetworkListModal.isVisible();
await NetworkListModal.changeNetwork(RINKEBY);
await WalletView.isNetworkNameVisible(RINKEBY);
await NetworkListModal.changeNetwork(GOERLI);
await WalletView.isNetworkNameVisible(GOERLI);
});

it('should dismiss network education modal', async () => {
await NetworkEducationModal.isVisible();
await NetworkEducationModal.tapGotItButton();
await NetworkEducationModal.isNotVisible();
});

it('should input a valid address', async () => {
Expand Down Expand Up @@ -320,7 +327,9 @@ describe('Wallet Tests', () => {

it('should send ETH to Account 2', async () => {
// Check that the amount is correct
await TransactionConfirmationView.isTransactionTotalCorrect('0.00004 ETH');
await TransactionConfirmationView.isTransactionTotalCorrect(
'0.00004 GoerliETH',
);
// Tap on the Send CTA
await TransactionConfirmationView.tapConfirmButton();
// Check that we are on the wallet screen
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.3",
"concat-cli": "4.0.0",
"detox": "19.6.5",
"detox": "19.7.1",
"enzyme": "3.9.0",
"enzyme-adapter-react-16": "1.10.0",
"enzyme-to-json": "3.3.5",
Expand Down
Loading