Skip to content

Commit

Permalink
Detox/ Update e2e based on v1 updates (#1851)
Browse files Browse the repository at this point in the history
* fix a lot of tests

* fixed browser test

Co-authored-by: Ibrahim Taveras <[email protected]>
Co-authored-by: Esteban Miño <[email protected]>
  • Loading branch information
3 people authored Sep 28, 2020
1 parent ca6e812 commit 682c6f3
Show file tree
Hide file tree
Showing 23 changed files with 419 additions and 340 deletions.
6 changes: 4 additions & 2 deletions app/components/UI/BackupAlert/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class BackupAlert extends PureComponent {
inBrowserView ? styles.modalViewInBrowserView : styles.modalViewNotInBrowserView
]}
>
<View style={styles.touchableView}>
<View style={styles.touchableView} testID={'backup-alert'}>
<View style={styles.backupAlertIconWrapper}>
<EvilIcons name="bell" style={styles.backupAlertIcon} />
</View>
Expand All @@ -156,7 +156,9 @@ class BackupAlert extends PureComponent {
</Text>
</TouchableOpacity>
<TouchableOpacity onPress={this.props.backUpSeedphraseAlertNotVisible}>
<Text style={styles.backupAlertMessage}>{strings('backup_alert.left_button')}</Text>
<Text style={styles.backupAlertMessage} testID={'notification-remind-later-button'}>
{strings('backup_alert.left_button')}
</Text>
</TouchableOpacity>
</View>
</View>
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/ProtectYourWalletModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ProtectYourWalletModal extends PureComponent {
confirmButtonMode={'transparent-blue'}
verticalButtons
>
<View style={styles.wrapper}>
<View style={styles.wrapper} testID={'protect-wallet-modal'}>
<View style={styles.titleWrapper}>
<Text style={styles.title}>{strings('protect_wallet_modal.title')}</Text>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ exports[`ReceiveRequest should render correctly 1`] = `
"paddingHorizontal": 15,
}
}
testID="account-address"
>
<Text
bold={false}
Expand Down Expand Up @@ -215,6 +216,7 @@ exports[`ReceiveRequest should render correctly 1`] = `
"opacity": 0.6,
}
}
testID="request-payment-button"
type="normal"
>
Request Payment
Expand Down
13 changes: 11 additions & 2 deletions app/components/UI/ReceiveRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ class ReceiveRequest extends PureComponent {

<Text>{strings('receive_request.scan_address')}</Text>

<TouchableOpacity style={styles.addressWrapper} onPress={this.copyAccountToClipboard}>
<TouchableOpacity
style={styles.addressWrapper}
onPress={this.copyAccountToClipboard}
testID={'account-address'}
>
<Text>
<EthereumAddress address={this.props.selectedAddress} type={'short'} />
</Text>
Expand All @@ -287,7 +291,12 @@ class ReceiveRequest extends PureComponent {
{strings('fiat_on_ramp.buy_eth')}
</StyledButton>
)}
<StyledButton type={'normal'} onPress={this.onReceive} containerStyle={styles.actionButton}>
<StyledButton
type={'normal'}
onPress={this.onReceive}
containerStyle={styles.actionButton}
testID={'request-payment-button'}
>
{strings('receive_request.request_payment')}
</StyledButton>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ exports[`AccountBackupStep1 should render correctly 1`] = `
"zIndex": 10,
}
}
testID="remind-me-later-button"
>
<Text
style={
Expand Down Expand Up @@ -340,6 +341,7 @@ exports[`AccountBackupStep1 should render correctly 1`] = `
"width": 18,
}
}
testID="skip-backup-check"
tintColors={
Object {
"true": "#037dd6",
Expand All @@ -358,6 +360,7 @@ exports[`AccountBackupStep1 should render correctly 1`] = `
"lineHeight": 20,
}
}
testID="skip-backup-text"
>
I understand that if I lose my seed phrase I will not be able to access my wallet.
</Text>
Expand Down
4 changes: 3 additions & 1 deletion app/components/Views/AccountBackupStep1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ const AccountBackupStep1 = props => {
style={styles.remindLaterButton}
onPress={showRemindLater}
hitSlop={{ top: 10, left: 10, bottom: 10, right: 10 }}
testID={'remind-me-later-button'}
>
<Text style={styles.remindLaterText}>
{strings('account_backup_step_1.remind_me_later')}
Expand Down Expand Up @@ -316,8 +317,9 @@ const AccountBackupStep1 = props => {
onValueChange={toggleSkipCheckbox}
boxType={'square'}
tintColors={{ true: colors.blue }}
testID={'skip-backup-check'}
/>
<Text onPress={toggleSkipCheckbox} style={styles.skipModalText}>
<Text onPress={toggleSkipCheckbox} style={styles.skipModalText} testID={'skip-backup-text'}>
{strings('account_backup_step_1.skip_check')}
</Text>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ exports[`AccountBackupStep1B should render correctly 1`] = `
}
}
>
Don’t risk loosing your funds. Protect your wallet by saving your seed phrase in a place you trust.
Don’t risk losing your funds. Protect your wallet by saving your seed phrase in a place you trust.
<Text
style={
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ exports[`ChoosePassword should render correctly 1`] = `
"width": 18,
}
}
testID="password-understand-box"
tintColors={
Object {
"true": "#037dd6",
Expand All @@ -350,6 +351,7 @@ exports[`ChoosePassword should render correctly 1`] = `
"paddingHorizontal": 10,
}
}
testID="i-understand-text"
>
I understand that MetaMask cannot recover this password for me.
Expand Down
3 changes: 2 additions & 1 deletion app/components/Views/ChoosePassword/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,9 @@ class ChoosePassword extends PureComponent {
style={styles.checkbox}
tintColors={{ true: colors.blue }}
boxType="square"
testID={'password-understand-box'}
/>
<Text style={styles.label} onPress={this.setSelection}>
<Text style={styles.label} onPress={this.setSelection} testID={'i-understand-text'}>
{strings('choose_password.i_understand')}{' '}
<Text onPress={this.learnMore} style={styles.learnMore}>
{strings('choose_password.learn_more')}
Expand Down
2 changes: 1 addition & 1 deletion app/components/Views/Onboarding/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ class Onboarding extends PureComponent {
style={styles.button}
type={'blue'}
onPress={this.onPressCreate}
testID={'start-exploring-button'}
testID={'create-wallet-button'}
>
{strings('onboarding.start_exploring_now')}
</StyledButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ exports[`SecuritySettings should render correctly 1`] = `
<Switch
ios_backgroundColor="#f2f3f4"
onValueChange={[Function]}
testID="metametrics-switch"
trackColor={
Object {
"false": "#f2f3f4",
Expand All @@ -138,6 +139,7 @@ exports[`SecuritySettings should render correctly 1`] = `
"marginTop": 50,
}
}
testID="third-party-section"
>
<Text
style={
Expand Down Expand Up @@ -402,6 +404,7 @@ exports[`SecuritySettings should render correctly 1`] = `
"marginTop": 50,
}
}
testID="reveal-private-key-section"
>
<Text
style={
Expand Down
5 changes: 3 additions & 2 deletions app/components/Views/Settings/SecuritySettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,11 @@ class Settings extends PureComponent {
onValueChange={this.toggleMetricsOptIn}
trackColor={Device.isIos() ? { true: colors.blue, false: colors.grey000 } : null}
ios_backgroundColor={colors.grey000}
testID={'metametrics-switch'}
/>
</View>
</View>
<View style={styles.setting}>
<View style={styles.setting} testID={'third-party-section'}>
<Text style={styles.title}>{strings('app_settings.third_party_title')}</Text>
<Text style={styles.desc}>{strings('app_settings.third_party_description')}</Text>
<View style={styles.switchElement}>
Expand Down Expand Up @@ -574,7 +575,7 @@ class Settings extends PureComponent {
</View>
</View>
)}
<View style={styles.setting}>
<View style={styles.setting} testID={'reveal-private-key-section'}>
<Text style={styles.title}>
{strings('reveal_credential.private_key_title_for_account', { accountName: account.name })}
</Text>
Expand Down
39 changes: 37 additions & 2 deletions e2e/add-custom-rpc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import TestHelpers from './helpers';
const RINKEBY = 'Rinkeby Test Network';
const XDAI_URL = 'https://dai.poa.network/';
const MAINNET = 'Ethereum Main Network';
const PASSWORD = '12345678';

describe('Custom RPC Tests', () => {
beforeEach(() => {
Expand All @@ -17,8 +18,38 @@ describe('Custom RPC Tests', () => {
await TestHelpers.waitAndTap('onboarding-get-started-button');
// Check that we are on the onboarding screen
await TestHelpers.checkIfVisible('onboarding-screen');
// Check that Start Exploring CTA is visible & tap it
await TestHelpers.waitAndTap('start-exploring-button');
// Check that Create a new wallet CTA is visible & tap it
await TestHelpers.waitAndTap('create-wallet-button');
// Check that we are on the Create password screen
await TestHelpers.checkIfVisible('create-password-screen');
// Input new password
await TestHelpers.typeTextAndHideKeyboard('input-password', PASSWORD);
// Input confirm password
await TestHelpers.typeTextAndHideKeyboard('input-password-confirm', PASSWORD);
// Mark the checkbox that you understand the password cannot be recovered
if (device.getPlatform() === 'ios') {
await TestHelpers.tap('password-understand-box');
} else {
// Tap by the I understand text
await TestHelpers.delay(1000);
await TestHelpers.tap('i-understand-text');
}
// Tap on create password button
await TestHelpers.tap('submit-button');
// Check that we are on the Secure your wallet screen
await TestHelpers.checkIfVisible('protect-your-account-screen');
// Tap on the remind me later button
await TestHelpers.tap('remind-me-later-button');
// Check the box to state you understand
if (device.getPlatform() === 'ios') {
await TestHelpers.tap('skip-backup-check');
} else {
// Tap by the I understand text
await TestHelpers.delay(1000);
await TestHelpers.tap('skip-backup-text');
}
// Tap on Skip button
await TestHelpers.tapByText('Skip');
// Check that we are on the metametrics optIn screen
await TestHelpers.checkIfVisible('metaMetrics-OptIn');
// Check that I Agree CTA is visible and tap it
Expand All @@ -34,6 +65,10 @@ describe('Custom RPC Tests', () => {
await TestHelpers.waitAndTap('onboarding-wizard-back-button');
// Check that the onboarding wizard is gone
await TestHelpers.checkIfNotVisible('onboarding-wizard-step1-view');
// Check that the protect your wallet modal is visible
await TestHelpers.checkIfVisible('backup-alert');
// Tap on remind me later
await TestHelpers.tap('notification-remind-later-button');
});

it('should go to settings then networks', async () => {
Expand Down
40 changes: 38 additions & 2 deletions e2e/addressbook-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import TestHelpers from './helpers';
const INVALID_ADDRESS = '0xB8B4EE5B1b693971eB60bDa15211570df2dB221L';
const MYTH_ADDRESS = '0x1FDb169Ef12954F20A15852980e1F0C122BfC1D6';
const MEMO = 'Test adding ENS';
const PASSWORD = '12345678';

describe('Addressbook Tests', () => {
beforeEach(() => {
Expand All @@ -17,8 +18,38 @@ describe('Addressbook Tests', () => {
await TestHelpers.waitAndTap('onboarding-get-started-button');
// Check that we are on the onboarding screen
await TestHelpers.checkIfVisible('onboarding-screen');
// Check that Start Exploring CTA is visible & tap it
await TestHelpers.waitAndTap('start-exploring-button');
// Check that Create a new wallet CTA is visible & tap it
await TestHelpers.waitAndTap('create-wallet-button');
// Check that we are on the Create password screen
await TestHelpers.checkIfVisible('create-password-screen');
// Input new password
await TestHelpers.typeTextAndHideKeyboard('input-password', PASSWORD);
// Input confirm password
await TestHelpers.typeTextAndHideKeyboard('input-password-confirm', PASSWORD);
// Mark the checkbox that you understand the password cannot be recovered
if (device.getPlatform() === 'ios') {
await TestHelpers.tap('password-understand-box');
} else {
// Tap by the I understand text
await TestHelpers.delay(1000);
await TestHelpers.tap('i-understand-text');
}
// Tap on create password button
await TestHelpers.tap('submit-button');
// Check that we are on the Secure your wallet screen
await TestHelpers.checkIfVisible('protect-your-account-screen');
// Tap on the remind me later button
await TestHelpers.tap('remind-me-later-button');
// Check the box to state you understand
if (device.getPlatform() === 'ios') {
await TestHelpers.tap('skip-backup-check');
} else {
// Tap by the I understand text
await TestHelpers.delay(1000);
await TestHelpers.tap('skip-backup-text');
}
// Tap on Skip button
await TestHelpers.tapByText('Skip');
// Check that we are on the metametrics optIn screen
await TestHelpers.checkIfVisible('metaMetrics-OptIn');
// Check that I Agree CTA is visible and tap it
Expand All @@ -34,6 +65,10 @@ describe('Addressbook Tests', () => {
await TestHelpers.waitAndTap('onboarding-wizard-back-button');
// Check that the onboarding wizard is gone
await TestHelpers.checkIfNotVisible('onboarding-wizard-step1-view');
// Check that the protect your wallet modal is visible
await TestHelpers.checkIfVisible('backup-alert');
// Tap on remind me later
await TestHelpers.tap('notification-remind-later-button');
});

it('should go to send view', async () => {
Expand Down Expand Up @@ -143,6 +178,7 @@ describe('Addressbook Tests', () => {
if (device.getPlatform() === 'android') {
await TestHelpers.tapByText('Add contact');
await TestHelpers.delay(1000);
await TestHelpers.tapByText('Add contact');
} else {
await TestHelpers.tap('contact-add-contact-button');
await TestHelpers.tap('contact-add-contact-button');
Expand Down
Loading

0 comments on commit 682c6f3

Please sign in to comment.