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

Get e2e working for seedphrase and login #1861

Merged
merged 3 commits into from
Oct 2, 2020
Merged
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
48 changes: 21 additions & 27 deletions e2e/import-seed-phrase.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
'use strict';
import TestHelpers from './helpers';
import { strings } from '../locales/i18n';

// use i18n for these
// this way if the strings ever change the tests will not break :)
const Incorrect_Password_Length = strings('import_from_seed.password_length_error');
const Invalid_Seed_Error = strings('import_from_seed.invalid_seed_phrase');
const Password_Warning = strings('reveal_credential.unknown_error');

const Incorrect_Seed_Words = 'fold media south add since false relax immense pause cloth just falcon';
const Correct_Seed_Words = 'fold media south add since false relax immense pause cloth just raven';
const Incorrect_Password_Length = 'The password needs to be at least 8 characters long';
const Invalid_Seed_Error = `Error: Seed phrase is invalid.`;
const Correct_Password = `12345678`;
const Incorrect_Password = `1234567`;
const Password_Warning = "Couldn't unlock your account. Please try again.";
const Incorrect_Password2 = `12345679`;

describe('Import seedphrase flow', () => {
beforeEach(() => {
Expand Down Expand Up @@ -37,15 +42,9 @@ describe('Import seedphrase flow', () => {
// Input short password confirm
await TestHelpers.typeTextAndHideKeyboard(`input-password-field-confirm`, Incorrect_Password);
// ensure alert box is displayed with correct text
await TestHelpers.checkIfElementByTextIsVisible(Incorrect_Password_Length);
await TestHelpers.checkIfElementByTextIsVisible(Invalid_Seed_Error);
// dismiss alert by tapping ok
await TestHelpers.tapAlertWithButton('OK');
// Input password
await TestHelpers.typeTextAndHideKeyboard(`input-password-field`, Correct_Password);
// Input password confirm
await TestHelpers.typeTextAndHideKeyboard(`input-password-field-confirm`, Correct_Password);
// Ensure error is displayed
await TestHelpers.checkIfHasText('invalid-seed-phrase', Invalid_Seed_Error);
// Clear field content
await TestHelpers.clearField('input-seed-phrase');
// Input correct seed phrase
Expand All @@ -55,19 +54,15 @@ describe('Import seedphrase flow', () => {
} else {
await TestHelpers.typeTextAndHideKeyboard(`input-seed-phrase`, Correct_Seed_Words);
}

// Input Correct password and Submit
if (device.getPlatform() === 'android') {
// Input password
await TestHelpers.typeTextAndHideKeyboard(`input-password-field`, Correct_Password);
// Input password confirm
await TestHelpers.typeTextAndHideKeyboard(`input-password-field-confirm`, Correct_Password);
} else {
await TestHelpers.tapAtPoint('import-from-seed-screen', { x: 40, y: 20 });
// Tap import to continue
await TestHelpers.waitAndTap('submit');
}

await TestHelpers.typeTextAndHideKeyboard(`input-password-field`, Incorrect_Password);
// Input short password confirm
await TestHelpers.typeTextAndHideKeyboard(`input-password-field-confirm`, Incorrect_Password);
await TestHelpers.checkIfElementByTextIsVisible(Incorrect_Password_Length);
await TestHelpers.tapAlertWithButton('OK');
// Input password
await TestHelpers.typeTextAndHideKeyboard(`input-password-field`, Correct_Password);
// Input password confirm
await TestHelpers.typeTextAndHideKeyboard(`input-password-field-confirm`, Correct_Password);
// 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 Down Expand Up @@ -130,11 +125,10 @@ describe('Import seedphrase flow', () => {
await TestHelpers.relaunchApp();
// Check that we are on login screen
await TestHelpers.checkIfVisible('login');
// Tap on log in button
await TestHelpers.tap('log-in-button');
// Check that the invalid error is displayed
// Fail login attempt
await TestHelpers.typeTextAndHideKeyboard('login-password-input', Incorrect_Password2);
await TestHelpers.checkIfVisible('invalid-password-error');
// Log in
// Login
await TestHelpers.typeTextAndHideKeyboard('login-password-input', Correct_Password);
// Check that we are on the wallet screen
await TestHelpers.checkIfVisible('wallet-screen');
Expand Down