1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Remove ONBOARDING_V2 flag for release (#16865)

* Remove ONBOARDING_V2 flag for release

* Remove new usage

* Update e2e tests

* Update incremental-security.spec.js

* Fix lint

Co-authored-by: PeterYinusa <peter.yinusa@consensys.net>
This commit is contained in:
David Walsh 2023-01-13 10:25:01 -06:00 committed by GitHub
parent 15ee9e1556
commit 7760f4d658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 154 additions and 356 deletions

View File

@ -2,7 +2,6 @@
PASSWORD=METAMASK PASSWORD
INFURA_PROJECT_ID=00000000000
SEGMENT_WRITE_KEY=
ONBOARDING_V2=
SWAPS_USE_DEV_APIS=
NFTS_V1=
PUBNUB_PUB_KEY=

View File

@ -9,7 +9,6 @@ const configurationPropertyNames = [
...commonConfigurationPropertyNames,
'NFTS_V1',
'INFURA_PROJECT_ID',
'ONBOARDING_V2',
'PHISHING_WARNING_PAGE_URL',
'PORTFOLIO_URL',
'SEGMENT_HOST',

View File

@ -1032,7 +1032,6 @@ async function getEnvironmentVariables({ buildTarget, buildType, version }) {
METAMASK_VERSION: version,
METAMASK_BUILD_TYPE: buildType,
NODE_ENV: devMode ? ENVIRONMENT.DEVELOPMENT : ENVIRONMENT.PRODUCTION,
ONBOARDING_V2: config.ONBOARDING_V2 === '1',
PHISHING_WARNING_PAGE_URL: getPhishingWarningPageUrl({ config, testing }),
PORTFOLIO_URL: config.PORTFOLIO_URL || 'https://portfolio.metamask.io',
PUBNUB_PUB_KEY: config.PUBNUB_PUB_KEY || '',

View File

@ -3,7 +3,6 @@ const { promises: fs } = require('fs');
const BigNumber = require('bignumber.js');
const mockttp = require('mockttp');
const createStaticServer = require('../../development/create-static-server');
const enLocaleMessages = require('../../app/_locales/en/messages.json');
const { setupMocking } = require('./mock-e2e');
const Ganache = require('./ganache');
const FixtureServer = require('./fixture-server');
@ -246,7 +245,6 @@ const completeImportSRPOnboardingFlow = async (
seedPhrase,
password,
) => {
if (process.env.ONBOARDING_V2 === '1') {
// welcome
await driver.clickElement('[data-testid="onboarding-import-wallet"]');
@ -254,7 +252,10 @@ const completeImportSRPOnboardingFlow = async (
await driver.clickElement('[data-testid="metametrics-no-thanks"]');
// import with recovery phrase
await driver.fill('[data-testid="import-srp-text"]', seedPhrase);
await driver.pasteIntoField(
'[data-testid="import-srp__srp-word-0"]',
seedPhrase,
);
await driver.clickElement('[data-testid="import-srp-confirm"]');
// create password
@ -269,42 +270,6 @@ const completeImportSRPOnboardingFlow = async (
// pin extension
await driver.clickElement('[data-testid="pin-extension-next"]');
await driver.clickElement('[data-testid="pin-extension-done"]');
} else {
// clicks the continue button on the welcome screen
await driver.findElement('.welcome-page__header');
await driver.clickElement({
text: enLocaleMessages.getStarted.message,
tag: 'button',
});
// clicks the "No thanks" option on the metametrics opt-in screen
await driver.clickElement('.btn-secondary');
// clicks the "Import Wallet" option
await driver.clickElement({ text: 'Import wallet', tag: 'button' });
// Import Secret Recovery Phrase
await driver.pasteIntoField(
'[data-testid="import-srp__srp-word-0"]',
seedPhrase,
);
await driver.fill('#password', password);
await driver.fill('#confirm-password', password);
await driver.clickElement(
'[data-testid="create-new-vault__terms-checkbox"]',
);
await driver.clickElement({ text: 'Import', tag: 'button' });
// clicks through the success screen
await driver.findElement({ text: 'Congratulations', tag: 'div' });
await driver.clickElement({
text: enLocaleMessages.endOfFlowMessage10.message,
tag: 'button',
});
}
};
const completeImportSRPOnboardingFlowWordByWord = async (
@ -312,19 +277,13 @@ const completeImportSRPOnboardingFlowWordByWord = async (
seedPhrase,
password,
) => {
// clicks the continue button on the welcome screen
await driver.findElement('.welcome-page__header');
await driver.clickElement({
text: enLocaleMessages.getStarted.message,
tag: 'button',
});
// welcome
await driver.clickElement('[data-testid="onboarding-import-wallet"]');
// clicks the "No thanks" option on the metametrics opt-in screen
await driver.clickElement('.btn-secondary');
// clicks the "Import Wallet" option
await driver.clickElement({ text: 'Import wallet', tag: 'button' });
// metrics
await driver.clickElement('[data-testid="metametrics-no-thanks"]');
// import with recovery phrase, word by word
const words = seedPhrase.split(' ');
for (const word of words) {
await driver.pasteIntoField(
@ -332,20 +291,20 @@ const completeImportSRPOnboardingFlowWordByWord = async (
word,
);
}
await driver.clickElement('[data-testid="import-srp-confirm"]');
await driver.fill('#password', password);
await driver.fill('#confirm-password', password);
// create password
await driver.fill('[data-testid="create-password-new"]', password);
await driver.fill('[data-testid="create-password-confirm"]', password);
await driver.clickElement('[data-testid="create-password-terms"]');
await driver.clickElement('[data-testid="create-password-import"]');
await driver.clickElement('[data-testid="create-new-vault__terms-checkbox"]');
// complete
await driver.clickElement('[data-testid="onboarding-complete-done"]');
await driver.clickElement({ text: 'Import', tag: 'button' });
// clicks through the success screen
await driver.findElement({ text: 'Congratulations', tag: 'div' });
await driver.clickElement({
text: enLocaleMessages.endOfFlowMessage10.message,
tag: 'button',
});
// pin extension
await driver.clickElement('[data-testid="pin-extension-next"]');
await driver.clickElement('[data-testid="pin-extension-done"]');
};
module.exports = {

View File

@ -90,94 +90,53 @@ describe('MetaMask', function () {
});
describe('Going through the first time flow', function () {
it('clicks the continue button on the welcome screen', async function () {
await driver.findElement('.welcome-page__header');
await driver.clickElement({
text: enLocaleMessages.getStarted.message,
tag: 'button',
});
await driver.delay(largeDelayMs);
it('clicks the "Create New Wallet" button on the welcome screen', async function () {
await driver.clickElement('[data-testid="onboarding-create-wallet"]');
});
it('clicks the "No thanks" option on the metametrics opt-in screen', async function () {
await driver.clickElement('.btn-secondary');
await driver.delay(largeDelayMs);
});
it('clicks the "Create New Wallet" option', async function () {
await driver.clickElement({ text: 'Create a wallet', tag: 'button' });
await driver.delay(largeDelayMs);
await driver.clickElement('[data-testid="metametrics-no-thanks"]');
});
it('accepts a secure password', async function () {
await driver.fill(
'.first-time-flow__form #create-password',
'correct horse battery staple',
);
await driver.fill(
'.first-time-flow__form #confirm-password',
'correct horse battery staple',
);
await driver.clickElement('.first-time-flow__checkbox');
await driver.clickElement('.first-time-flow__form button');
await driver.delay(regularDelayMs);
const password = 'correct horse battery staple';
await driver.fill('[data-testid="create-password-new"]', password);
await driver.fill('[data-testid="create-password-confirm"]', password);
await driver.clickElement('[data-testid="create-password-terms"]');
await driver.clickElement('[data-testid="create-password-wallet"]');
});
let seedPhrase;
it('renders the Secret Recovery Phrase intro screen', async function () {
await driver.clickElement('.seed-phrase-intro__left button');
await driver.delay(regularDelayMs);
await driver.clickElement('[data-testid="secure-wallet-recommended"]');
});
let chipTwo, chipThree, chipSeven;
it('reveals the Secret Recovery Phrase', async function () {
const byRevealButton =
'.reveal-seed-phrase__secret-blocker .reveal-seed-phrase__reveal-button';
await driver.findElement(byRevealButton);
await driver.clickElement(byRevealButton);
await driver.delay(regularDelayMs);
const revealedSeedPhrase = await driver.findElement(
'.reveal-seed-phrase__secret-words',
);
seedPhrase = await revealedSeedPhrase.getText();
assert.equal(seedPhrase.split(' ').length, 12);
await driver.delay(regularDelayMs);
await driver.clickElement({
text: enLocaleMessages.next.message,
tag: 'button',
await driver.clickElement('[data-testid="recovery-phrase-reveal"]');
chipTwo = await (
await driver.findElement('[data-testid="recovery-phrase-chip-2"]')
).getText();
chipThree = await (
await driver.findElement('[data-testid="recovery-phrase-chip-3"]')
).getText();
chipSeven = await (
await driver.findElement('[data-testid="recovery-phrase-chip-7"]')
).getText();
await driver.clickElement('[data-testid="recovery-phrase-next"]');
});
await driver.delay(regularDelayMs);
});
async function clickWordAndWait(word) {
await driver.clickElement(
`[data-testid="seed-phrase-sorted"] [data-testid="draggable-seed-${word}"]`,
);
await driver.delay(tinyDelayMs);
}
it('can retype the Secret Recovery Phrase', async function () {
const words = seedPhrase.split(' ');
for (const word of words) {
await clickWordAndWait(word);
}
await driver.clickElement({ text: 'Confirm', tag: 'button' });
await driver.delay(regularDelayMs);
await driver.fill('[data-testid="recovery-phrase-input-2"]', chipTwo);
await driver.fill('[data-testid="recovery-phrase-input-3"]', chipThree);
await driver.fill('[data-testid="recovery-phrase-input-7"]', chipSeven);
await driver.clickElement('[data-testid="recovery-phrase-confirm"]');
});
it('clicks through the success screen', async function () {
await driver.findElement({ text: 'Congratulations', tag: 'div' });
await driver.clickElement({
text: enLocaleMessages.endOfFlowMessage10.message,
tag: 'button',
});
await driver.delay(regularDelayMs);
await driver.clickElement('[data-testid="onboarding-complete-done"]');
await driver.clickElement('[data-testid="pin-extension-next"]');
await driver.clickElement('[data-testid="pin-extension-done"]');
});
});

View File

@ -1,6 +1,5 @@
const { strict: assert } = require('assert');
const { convertToHexValue, withFixtures, tinyDelayMs } = require('../helpers');
const enLocaleMessages = require('../../../app/_locales/en/messages.json');
const { convertToHexValue, withFixtures } = require('../helpers');
const FixtureBuilder = require('../fixture-builder');
describe('Incremental Security', function () {
@ -30,42 +29,40 @@ describe('Incremental Security', function () {
},
async ({ driver }) => {
await driver.navigate();
await driver.delay(tinyDelayMs);
// clicks the continue button on the welcome screen
await driver.findElement('.welcome-page__header');
await driver.clickElement({
text: enLocaleMessages.getStarted.message,
tag: 'button',
});
// welcome
await driver.clickElement('[data-testid="onboarding-create-wallet"]');
// clicks the "No thanks" option on the metametrics opt-in screen
await driver.clickElement('.btn-secondary');
// metrics
await driver.clickElement('[data-testid="metametrics-no-thanks"]');
// clicks the "Create New Wallet" option
await driver.clickElement({ text: 'Create a wallet', tag: 'button' });
// accepts a secure password
// create password
await driver.fill(
'.first-time-flow__form #create-password',
'[data-testid="create-password-new"]',
'correct horse battery staple',
);
await driver.fill(
'.first-time-flow__form #confirm-password',
'[data-testid="create-password-confirm"]',
'correct horse battery staple',
);
await driver.clickElement('.first-time-flow__checkbox');
await driver.clickElement('.first-time-flow__form button');
await driver.clickElement('[data-testid="create-password-terms"]');
await driver.clickElement('[data-testid="create-password-wallet"]');
// renders the Secret Recovery Phrase intro screen'
await driver.clickElement('.seed-phrase-intro__left button');
// secure wallet later
await driver.clickElement('[data-testid="secure-wallet-later"]');
await driver.clickElement(
'[data-testid="skip-srp-backup-popover-checkbox"]',
);
await driver.clickElement('[data-testid="skip-srp-backup"]');
// skips the Secret Recovery Phrase challenge
await driver.clickElement({
text: enLocaleMessages.remindMeLater.message,
tag: 'button',
});
// complete
await driver.clickElement('[data-testid="onboarding-complete-done"]');
// pin extension
await driver.clickElement('[data-testid="pin-extension-next"]');
await driver.clickElement('[data-testid="pin-extension-done"]');
// open account menu
await driver.clickElement(
'[data-testid="account-options-menu-button"]',
);
@ -124,41 +121,24 @@ describe('Incremental Security', function () {
await driver.clickElement('.home-notification__accept-button');
// reveals the Secret Recovery Phrase
await driver.clickElement(
'.reveal-seed-phrase__secret-blocker .reveal-seed-phrase__reveal-button',
);
const revealedSeedPhrase = await driver.findElement(
'.reveal-seed-phrase__secret-words',
);
await driver.waitForNonEmptyElement(revealedSeedPhrase);
const seedPhrase = await revealedSeedPhrase.getText();
assert.equal(seedPhrase.split(' ').length, 12);
await driver.clickElement({
text: enLocaleMessages.next.message,
tag: 'button',
});
// selecting the words from seedphrase
async function clickWordAndWait(word) {
await driver.clickElement(
`[data-testid="seed-phrase-sorted"] [data-testid="draggable-seed-${word}"]`,
);
await driver.delay(tinyDelayMs);
}
await driver.clickElement('[data-testid="secure-wallet-recommended"]');
await driver.clickElement('[data-testid="recovery-phrase-reveal"]');
const chipTwo = await (
await driver.findElement('[data-testid="recovery-phrase-chip-2"]')
).getText();
const chipThree = await (
await driver.findElement('[data-testid="recovery-phrase-chip-3"]')
).getText();
const chipSeven = await (
await driver.findElement('[data-testid="recovery-phrase-chip-7"]')
).getText();
await driver.clickElement('[data-testid="recovery-phrase-next"]');
// can retype the Secret Recovery Phrase
const words = seedPhrase.split(' ');
for (const word of words) {
await clickWordAndWait(word);
}
await driver.clickElement({ text: 'Confirm', tag: 'button' });
// can click through the success screen
await driver.clickElement({ text: 'All done', tag: 'button' });
await driver.fill('[data-testid="recovery-phrase-input-2"]', chipTwo);
await driver.fill('[data-testid="recovery-phrase-input-3"]', chipThree);
await driver.fill('[data-testid="recovery-phrase-input-7"]', chipSeven);
await driver.clickElement('[data-testid="recovery-phrase-confirm"]');
// should have the correct amount of eth
currencyDisplay = await driver.waitForSelector({

View File

@ -1,6 +1,5 @@
const { strict: assert } = require('assert');
const { convertToHexValue, withFixtures, tinyDelayMs } = require('../helpers');
const enLocaleMessages = require('../../../app/_locales/en/messages.json');
const { convertToHexValue, withFixtures } = require('../helpers');
const FixtureBuilder = require('../fixture-builder');
describe('MetaMask Responsive UI', function () {
@ -17,14 +16,6 @@ describe('MetaMask Responsive UI', function () {
async ({ driver }) => {
await driver.navigate();
async function clickWordAndWait(word) {
await driver.clickElement(
`[data-testid="seed-phrase-sorted"] [data-testid="draggable-seed-${word}"]`,
);
await driver.delay(tinyDelayMs);
}
if (process.env.ONBOARDING_V2 === '1') {
// welcome
await driver.clickElement('[data-testid="onboarding-create-wallet"]');
@ -44,9 +35,7 @@ describe('MetaMask Responsive UI', function () {
await driver.clickElement('[data-testid="create-password-wallet"]');
// secure wallet
await driver.clickElement(
'[data-testid="secure-wallet-recommended"]',
);
await driver.clickElement('[data-testid="secure-wallet-recommended"]');
// review
await driver.clickElement('[data-testid="recovery-phrase-reveal"]');
@ -63,14 +52,8 @@ describe('MetaMask Responsive UI', function () {
// confirm
await driver.fill('[data-testid="recovery-phrase-input-2"]', chipTwo);
await driver.fill(
'[data-testid="recovery-phrase-input-3"]',
chipThree,
);
await driver.fill(
'[data-testid="recovery-phrase-input-7"]',
chipSeven,
);
await driver.fill('[data-testid="recovery-phrase-input-3"]', chipThree);
await driver.fill('[data-testid="recovery-phrase-input-7"]', chipSeven);
await driver.clickElement('[data-testid="recovery-phrase-confirm"]');
// complete
@ -79,65 +62,6 @@ describe('MetaMask Responsive UI', function () {
// pin extension
await driver.clickElement('[data-testid="pin-extension-next"]');
await driver.clickElement('[data-testid="pin-extension-done"]');
} else {
// clicks the continue button on the welcome screen
await driver.findElement('.welcome-page__header');
await driver.clickElement({
text: enLocaleMessages.getStarted.message,
tag: 'button',
});
await driver.delay(tinyDelayMs);
// clicks the "I agree" option on the metametrics opt-in screen
await driver.clickElement('.btn-primary');
// clicks the "Create New Wallet" option
await driver.clickElement({ text: 'Create a wallet', tag: 'button' });
// accepts a secure password
await driver.fill(
'.first-time-flow__form #create-password',
'correct horse battery staple',
);
await driver.fill(
'.first-time-flow__form #confirm-password',
'correct horse battery staple',
);
await driver.clickElement('.first-time-flow__checkbox');
await driver.clickElement('.first-time-flow__form button');
// renders the Secret Recovery Phrase intro screen
await driver.clickElement('.seed-phrase-intro__left button');
// reveals the Secret Recovery Phrase
await driver.clickElement(
'.reveal-seed-phrase__secret-blocker .reveal-seed-phrase__reveal-button',
);
const revealedSeedPhrase = await driver.findElement(
'.reveal-seed-phrase__secret-words',
);
const seedPhrase = await revealedSeedPhrase.getText();
assert.equal(seedPhrase.split(' ').length, 12);
await driver.clickElement({
text: enLocaleMessages.next.message,
tag: 'button',
});
// can retype the Secret Recovery Phrase
const words = seedPhrase.split(' ');
for (const word of words) {
await clickWordAndWait(word);
}
await driver.clickElement({ text: 'Confirm', tag: 'button' });
// clicks through the success screen
await driver.findElement({ text: 'Congratulations', tag: 'div' });
await driver.clickElement({
text: enLocaleMessages.endOfFlowMessage10.message,
tag: 'button',
});
}
// assert balance
const balance = await driver.findElement(

View File

@ -1,11 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Redirect, Route } from 'react-router-dom';
import {
UNLOCK_ROUTE,
INITIALIZE_ROUTE,
ONBOARDING_ROUTE,
} from '../../constants/routes';
import { UNLOCK_ROUTE, ONBOARDING_ROUTE } from '../../constants/routes';
export default function Authenticated(props) {
const { isUnlocked, completedOnboarding } = props;
@ -16,9 +12,7 @@ export default function Authenticated(props) {
return (
<Redirect
to={{
pathname: process.env.ONBOARDING_V2
? ONBOARDING_ROUTE
: INITIALIZE_ROUTE,
pathname: ONBOARDING_ROUTE,
}}
/>
);

View File

@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Redirect, Route } from 'react-router-dom';
import { INITIALIZE_ROUTE, ONBOARDING_ROUTE } from '../../constants/routes';
import { ONBOARDING_ROUTE } from '../../constants/routes';
export default function Initialized(props) {
return props.completedOnboarding ? (
@ -9,9 +9,7 @@ export default function Initialized(props) {
) : (
<Redirect
to={{
pathname: process.env.ONBOARDING_V2
? ONBOARDING_ROUTE
: INITIALIZE_ROUTE,
pathname: ONBOARDING_ROUTE,
}}
/>
);

View File

@ -36,7 +36,6 @@ import {
RESTORE_VAULT_ROUTE,
CONFIRM_TRANSACTION_ROUTE,
CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE,
INITIALIZE_BACKUP_SEED_PHRASE_ROUTE,
CONNECT_ROUTE,
CONNECTED_ROUTE,
CONNECTED_ACCOUNTS_ROUTE,
@ -415,9 +414,7 @@ export default class Home extends PureComponent {
descriptionText={t('backupApprovalNotice')}
acceptText={t('backupNow')}
onAccept={() => {
const backUpSRPRoute = process.env.ONBOARDING_V2
? `${ONBOARDING_SECURE_YOUR_WALLET_ROUTE}/?isFromReminder=true`
: INITIALIZE_BACKUP_SEED_PHRASE_ROUTE;
const backUpSRPRoute = `${ONBOARDING_SECURE_YOUR_WALLET_ROUTE}/?isFromReminder=true`;
if (isPopup) {
global.platform.openExtensionInBrowser(backUpSRPRoute);
} else {

View File

@ -174,9 +174,7 @@ export default class Routes extends Component {
const routes = (
<Switch>
{process.env.ONBOARDING_V2 && (
<Route path={ONBOARDING_ROUTE} component={OnboardingFlow} />
)}
<Route path={LOCK_ROUTE} component={Lock} exact />
<Route path={INITIALIZE_ROUTE} component={FirstTimeFlow} />
<Initialized path={UNLOCK_ROUTE} component={UnlockPage} exact />
@ -307,7 +305,7 @@ export default class Routes extends Component {
const isInitializing = Boolean(
matchPath(location.pathname, {
path: process.env.ONBOARDING_V2 ? ONBOARDING_ROUTE : INITIALIZE_ROUTE,
path: ONBOARDING_ROUTE,
exact: false,
}),
);
@ -436,9 +434,7 @@ export default class Routes extends Component {
}
/>
)}
{process.env.ONBOARDING_V2 && this.showOnboardingHeader() && (
<OnboardingAppHeader />
)}
{this.showOnboardingHeader() && <OnboardingAppHeader />}
{completedOnboarding ? <NetworkDropdown /> : null}
<AccountMenu />
<div className="main-container-wrapper">

View File

@ -1,6 +1,4 @@
import {
INITIALIZE_CREATE_PASSWORD_ROUTE,
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
DEFAULT_ROUTE,
ONBOARDING_CREATE_PASSWORD_ROUTE,
ONBOARDING_IMPORT_WITH_SRP_ROUTE,
@ -11,13 +9,9 @@ export function getFirstTimeFlowTypeRoute(state) {
let nextRoute;
if (firstTimeFlowType === 'create') {
nextRoute = process.env.ONBOARDING_V2
? ONBOARDING_CREATE_PASSWORD_ROUTE
: INITIALIZE_CREATE_PASSWORD_ROUTE;
nextRoute = ONBOARDING_CREATE_PASSWORD_ROUTE;
} else if (firstTimeFlowType === 'import') {
nextRoute = process.env.ONBOARDING_V2
? ONBOARDING_IMPORT_WITH_SRP_ROUTE
: INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE;
nextRoute = ONBOARDING_IMPORT_WITH_SRP_ROUTE;
} else {
nextRoute = DEFAULT_ROUTE;
}