Skip to content

Commit

Permalink
added more assertions and beefed up onboarding wizard tests (#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimtaveras00 authored Oct 22, 2019
1 parent 921efcd commit 8b61445
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 58 deletions.
4 changes: 3 additions & 1 deletion app/components/UI/OnboardingWizard/Step2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class Step2 extends PureComponent {
*/
content = () => (
<View style={onboardingStyles.contentContainer}>
<Text style={onboardingStyles.content}>{strings('onboarding_wizard.step2.content1')}</Text>
<Text style={onboardingStyles.content} testID={'step2-title'}>
{strings('onboarding_wizard.step2.content1')}
</Text>
<Text style={onboardingStyles.content}>{strings('onboarding_wizard.step2.content2')}</Text>
</View>
);
Expand Down
6 changes: 4 additions & 2 deletions app/components/UI/OnboardingWizard/Step3/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ class Step3 extends PureComponent {
*/
content = () => (
<View style={onboardingStyles.contentContainer}>
<Text style={onboardingStyles.content}>{strings('onboarding_wizard.step3.content1')}</Text>
<Text style={onboardingStyles.content} testID={'step3-title'}>
{strings('onboarding_wizard.step3.content1')}
</Text>
<Text style={onboardingStyles.content}>
<Text style={fontStyles.bold}>{strings('onboarding_wizard.step3.content2')} </Text>
{strings('onboarding_wizard.step3.content3')}
Expand All @@ -136,7 +138,7 @@ class Step3 extends PureComponent {
if (!coachmarkTopReady || !viewTopReady) return null;
return (
<View style={[styles.main, { top: this.state.viewTop }]}>
<View style={styles.accountLabelContainer}>
<View style={styles.accountLabelContainer} testID={'account-label'}>
<AccountOverview account={account} currentCurrency={currentCurrency} onboardingWizard />
</View>
<View style={[styles.coachmarkContainer, { top: -this.state.coachmarkTop }]}>
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/OnboardingWizard/Step4/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Step4 extends PureComponent {
*/
content = () => (
<View style={onboardingStyles.contentContainer}>
<Text style={onboardingStyles.content}>
<Text style={onboardingStyles.content} testID={'step4-title'}>
<Text style={fontStyles.bold}>{strings('onboarding_wizard.step4.content1')} </Text>
{strings('onboarding_wizard.step4.content2')}
</Text>
Expand Down
4 changes: 3 additions & 1 deletion app/components/UI/OnboardingWizard/Step5/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ class Step5 extends PureComponent {
*/
content = () => (
<View style={onboardingStyles.contentContainer}>
<Text style={onboardingStyles.content}>{strings('onboarding_wizard.step5.content1')}</Text>
<Text style={onboardingStyles.content} testID={'step5-title'}>
{strings('onboarding_wizard.step5.content1')}
</Text>
</View>
);

Expand Down
4 changes: 3 additions & 1 deletion app/components/UI/OnboardingWizard/Step6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class Step6 extends PureComponent {
*/
content = () => (
<View style={onboardingStyles.contentContainer}>
<Text style={onboardingStyles.content}>{strings('onboarding_wizard.step6.content')}</Text>
<Text style={onboardingStyles.content} testID={'step6-title'}>
{strings('onboarding_wizard.step6.content')}
</Text>
</View>
);

Expand Down
4 changes: 3 additions & 1 deletion app/components/Views/Onboarding/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ class Onboarding extends PureComponent {
<ScrollView style={baseStyles.flexGrow} contentContainerStyle={styles.scroll}>
<View style={styles.wrapper}>
<View style={styles.ctas}>
<Text style={styles.title}>{strings('onboarding.title')}</Text>
<Text style={styles.title} testID={'onboarding-screen-title'}>
{strings('onboarding.title')}
</Text>
<View style={styles.importWrapper}>
<Text style={styles.buttonDescription}>{strings('onboarding.sync_desc')}</Text>
<View style={styles.buttonWrapper}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ exports[`OnboardingCarousel should render correctly 1`] = `
"textAlign": "center",
}
}
testID="carousel-screen-one"
>
Welcome to MetaMask
</Text>
Expand Down Expand Up @@ -119,6 +120,7 @@ exports[`OnboardingCarousel should render correctly 1`] = `
},
]
}
testID="carousel-one-image"
/>
</View>
</View>
Expand Down Expand Up @@ -149,6 +151,7 @@ exports[`OnboardingCarousel should render correctly 1`] = `
"textAlign": "center",
}
}
testID="carousel-screen-two"
>
Say hello to your wallet...
</Text>
Expand Down Expand Up @@ -196,6 +199,7 @@ exports[`OnboardingCarousel should render correctly 1`] = `
},
]
}
testID="carousel-two-image"
/>
</View>
</View>
Expand Down Expand Up @@ -226,6 +230,7 @@ exports[`OnboardingCarousel should render correctly 1`] = `
"textAlign": "center",
}
}
testID="carousel-screen-three"
>
Explore decentralized apps
</Text>
Expand Down Expand Up @@ -273,6 +278,7 @@ exports[`OnboardingCarousel should render correctly 1`] = `
},
]
}
testID="carousel-three-image"
/>
</View>
</View>
Expand Down
15 changes: 12 additions & 3 deletions app/components/Views/OnboardingCarousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,40 +140,49 @@ export default class OnboardingCarousel extends PureComponent {
>
<View key={'1'} style={baseStyles.flexGrow}>
<View style={styles.tab}>
<Text style={styles.title}>{strings('onboarding_carousel.title1')}</Text>
<Text style={styles.title} testID={'carousel-screen-one'}>
{strings('onboarding_carousel.title1')}
</Text>
<Text style={styles.subtitle}>{strings('onboarding_carousel.subtitle1')}</Text>
</View>
<View style={styles.carouselImageWrapper}>
<Image
source={onboarding_carousel_1}
style={[styles.carouselImage, styles.carouselImage1]}
resizeMethod={'auto'}
testID={'carousel-one-image'}
/>
</View>
</View>
<View key={'2'} style={baseStyles.flexGrow}>
<View style={styles.tab}>
<Text style={styles.title}>{strings('onboarding_carousel.title2')}</Text>
<Text style={styles.title} testID={'carousel-screen-two'}>
{strings('onboarding_carousel.title2')}
</Text>
<Text style={styles.subtitle}>{strings('onboarding_carousel.subtitle2')}</Text>
</View>
<View style={styles.carouselImageWrapper}>
<Image
source={onboarding_carousel_2}
style={[styles.carouselImage, styles.carouselImage2]}
resizeMethod={'auto'}
testID={'carousel-two-image'}
/>
</View>
</View>
<View key={'3'} style={baseStyles.flexGrow}>
<View style={styles.tab}>
<Text style={styles.title}>{strings('onboarding_carousel.title3')}</Text>
<Text style={styles.title} testID={'carousel-screen-three'}>
{strings('onboarding_carousel.title3')}
</Text>
<Text style={styles.subtitle}>{strings('onboarding_carousel.subtitle3')}</Text>
</View>
<View style={styles.carouselImageWrapper}>
<Image
source={onboarding_carousel_3}
style={[styles.carouselImage, styles.carouselImage3]}
resizeMethod={'auto'}
testID={'carousel-three-image'}
/>
</View>
</View>
Expand Down
94 changes: 47 additions & 47 deletions e2e/dapp-initiated-txn.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Correct_Password = `12345678`;
const Ropsten = 'Ropsten Test Network';
const Ropsten_Faucet = 'https://faucet.metamask.io';
const CryptoKitties_url = 'https://cryptokitties.co';
// const ETH_Faucet = 'Test Ether Faucet';
const ETH_Faucet = 'Test Ether Faucet';

describe('Import seedphrase flow', () => {
beforeEach(() => {
Expand Down Expand Up @@ -102,51 +102,51 @@ describe('Import seedphrase flow', () => {
await TestHelpers.waitAndTap('go-back-button');
});

// it('should donate ETH on MM Ropsten', async () => {
// // Tap to donate 1 ETH
// await TestHelpers.tapAtPoint('browser-screen', { x: 76, y: 189 });
// // Check that account approval is displayed with correct dapp name
// await TestHelpers.checkIfHasText('dapp-name-title', ETH_Faucet);
// // Tap on CONNECT button
// await TestHelpers.tapByText('CONNECT');
// // Check that we are on the confirm transaction screen
// await TestHelpers.checkIfVisible('confirm-transaction-screen');
// // Tap Edit
// await TestHelpers.tapAtPoint('confirm-transaction-screen', { x: 30, y: -20 });
// // Input Amount
// await TestHelpers.replaceTextInField('amount-input', '0.000001');
// // Tap on NEXT button
// await TestHelpers.tapByText('NEXT');
// // Tap on CONFIRM button
// await TestHelpers.tapByText('CONFIRM');
// // Check that we are on the browser screen
// await TestHelpers.checkIfVisible('browser-screen');
// // Wait for enable notifications alert to show up
// await TestHelpers.delay(10000);
// // Dismiss alert
// await TestHelpers.tapAlertWithButton('No, thanks');
// // Open Drawer
// await TestHelpers.tapAtPoint('browser-screen', { x: 30, y: -5 });
// // Check that the drawer is visbile
// await TestHelpers.checkIfVisible('drawer-screen');
// // Tap on Wallet
// await TestHelpers.tapByText('Wallet');
// // Check that we are on the wallet screen
// await TestHelpers.checkIfVisible('wallet-screen');
// // Ensure ETH Value is correct
// await TestHelpers.checkIfElementHasString('balance', '1.9 ETH');
// });
it('should donate ETH on MM Ropsten', async () => {
// Tap to donate 1 ETH
await TestHelpers.tapAtPoint('browser-screen', { x: 76, y: 189 });
// Check that account approval is displayed with correct dapp name
await TestHelpers.checkIfHasText('dapp-name-title', ETH_Faucet);
// Tap on CONNECT button
await TestHelpers.tapByText('CONNECT');
// Check that we are on the confirm transaction screen
await TestHelpers.checkIfVisible('confirm-transaction-screen');
// Tap Edit
await TestHelpers.tapAtPoint('confirm-transaction-screen', { x: 30, y: -20 });
// Input Amount
await TestHelpers.replaceTextInField('amount-input', '0.000001');
// Tap on NEXT button
await TestHelpers.tapByText('NEXT');
// Tap on CONFIRM button
await TestHelpers.tapByText('CONFIRM');
// Check that we are on the browser screen
await TestHelpers.checkIfVisible('browser-screen');
// Wait for enable notifications alert to show up
await TestHelpers.delay(10000);
// Dismiss alert
await TestHelpers.tapAlertWithButton('No, thanks');
// Open Drawer
await TestHelpers.tapAtPoint('browser-screen', { x: 30, y: -5 });
// Check that the drawer is visbile
await TestHelpers.checkIfVisible('drawer-screen');
// Tap on Wallet
await TestHelpers.tapByText('Wallet');
// Check that we are on the wallet screen
await TestHelpers.checkIfVisible('wallet-screen');
// Ensure ETH Value is correct
await TestHelpers.checkIfElementHasString('balance', '1.9 ETH');
});

// it('should log out', async () => {
// // Open Drawer
// await TestHelpers.tapAtPoint('wallet-screen', { x: 30, y: -5 });
// // Check that the drawer is visbile
// await TestHelpers.checkIfVisible('drawer-screen');
// // Tap on Log Out
// await TestHelpers.tapByText('Log Out');
// // Tap YES
// await TestHelpers.tapAlertWithButton('YES');
// // Check that we are on the wallet screen
// await TestHelpers.checkIfVisible('login');
// });
it('should log out', async () => {
// Open Drawer
await TestHelpers.tapAtPoint('wallet-screen', { x: 30, y: -5 });
// Check that the drawer is visbile
await TestHelpers.checkIfVisible('drawer-screen');
// Tap on Log Out
await TestHelpers.tapByText('Log Out');
// Tap YES
await TestHelpers.tapAlertWithButton('YES');
// Check that we are on the wallet screen
await TestHelpers.checkIfVisible('login');
});
});
58 changes: 57 additions & 1 deletion e2e/start-exploring.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
'use strict';
import TestHelpers from './helpers';

const Account = 'Test Account One';

describe('Start Exploring', () => {
it('onboarding show the onboarding screen', async () => {
it('should show the onboarding screen', async () => {
// Check that we are on the onboarding carousel screen
await TestHelpers.checkIfVisible('onboarding-carousel-screen');
// Check that title of screen 1 is correct
await TestHelpers.checkIfElementHasString('carousel-screen-one', 'Welcome to MetaMask');
// Check that right image is displayed
await TestHelpers.checkIfVisible('carousel-one-image');
// Swipe left
await TestHelpers.swipe('onboarding-carousel-screen', 'left');
// Check that title of screen 2 is correct
await TestHelpers.checkIfElementHasString('carousel-screen-two', 'Say hello to your wallet...');
// Check that right image is displayed
await TestHelpers.checkIfVisible('carousel-two-image');
// Swipe left
await TestHelpers.swipe('onboarding-carousel-screen', 'left');
// Check that title of screen 3 is correct
await TestHelpers.checkIfElementHasString('carousel-screen-three', 'Explore decentralized apps');
// Check that right image is displayed
await TestHelpers.checkIfVisible('carousel-three-image');
// Check that Get started CTA is visible & tap it
await TestHelpers.waitAndTap('onboarding-get-started-button');
// Check that we are on the onboarding screen
await TestHelpers.checkIfVisible('onboarding-screen');
// Check that the title is correct
await TestHelpers.checkIfElementHasString('onboarding-screen-title', 'Get started!');
});

it('should allow you to create a new wallet', async () => {
Expand All @@ -30,14 +50,50 @@ describe('Start Exploring', () => {
it('should go through the onboarding wizard flow', async () => {
// Check that Take the tour CTA is visible and tap it
await TestHelpers.waitAndTap('onboarding-wizard-next-button');
// Ensure step 2 is shown correctly
await TestHelpers.checkIfVisible('step2-title');
// Check that Got it! CTA is visible and tap it
await TestHelpers.tapByText('Got it!');
// Ensure step 3 is shown correctly
await TestHelpers.checkIfVisible('step3-title');
// Focus into account 1 name
await TestHelpers.tapAndLongPress('account-label');
// Clear text
await TestHelpers.clearField('account-label-text-input');
// Change account name
await TestHelpers.typeTextAndHideKeyboard('account-label-text-input', Account);
// Tap outside to implement name change
await TestHelpers.tapAtPoint('wallet-screen', { x: 350, y: 37 });
// Check that the account name edit stuck
await TestHelpers.checkIfElementHasString('account-label-text-input', Account);
// Check that Got it! CTA is visible and tap it
await TestHelpers.tapByText('Got it!');
// Ensure step 4 is shown correctly
await TestHelpers.checkIfVisible('step4-title');
// Tap on the menu navigation
await TestHelpers.tapAtPoint('wallet-screen', { x: 30, y: -5 });
// Ensure step 5 is shown correctly
await TestHelpers.checkIfVisible('step5-title');
// Tap on Back
await TestHelpers.tapByText('Back');
// Ensure step 4 is shown correctly
await TestHelpers.checkIfVisible('step4-title');
// Check that Got it! CTA is visible and tap it
await TestHelpers.tapByText('Got it!');
// Ensure step 5 is shown correctly
await TestHelpers.checkIfVisible('step5-title');
// Check that Got it! CTA is visible and tap it
await TestHelpers.tapByText('Got it!');
// Ensure step 6 is shown correctly
await TestHelpers.checkIfVisible('step6-title');
// Tap on Back
await TestHelpers.tapByText('Back');
// Ensure step 5 is shown correctly
await TestHelpers.checkIfVisible('step5-title');
// Check that Got it! CTA is visible and tap it
await TestHelpers.tapByText('Got it!');
// Ensure step 6 is shown correctly
await TestHelpers.checkIfVisible('step6-title');
// Check that Got it! CTA is visible and tap it
await TestHelpers.tapByText('Got it!');
// Check that we are on the Browser page
Expand Down

0 comments on commit 8b61445

Please sign in to comment.