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

feat: display full terms of service during onboarding #29392

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 0 additions & 4 deletions app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/en_GB/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/es/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/fr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/hi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/id/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/ja/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/ko/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/pt/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/ru/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/tl/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/tr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/vi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/zh_CN/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions test/e2e/page-objects/flows/onboarding.flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const createNewWalletOnboardingFlow = async ({
}
const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickCreateWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
Expand Down Expand Up @@ -80,7 +79,6 @@ export const importSRPOnboardingFlow = async ({

const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickImportWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
Expand Down
31 changes: 25 additions & 6 deletions test/e2e/page-objects/pages/onboarding/start-onboarding-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ class StartOnboardingPage {
tag: 'h2',
};

private readonly termsModal = '[data-testid="terms-of-use-modal-body"]';

private readonly termsCheckbox = '[data-testid="onboarding-terms-checkbox"]';

private readonly termsConfirmButton =
'[data-testid="onboarding-terms-accept"]';

constructor(driver: Driver) {
this.driver = driver;
}

async check_pageIsLoaded(): Promise<void> {
try {
await this.driver.waitForMultipleSelectors([
this.startMessage,
this.termsCheckbox,
]);
await this.driver.waitForMultipleSelectors([this.startMessage]);
} catch (e) {
console.log(
'Timeout while waiting for start onboarding page to be loaded',
Expand All @@ -37,15 +39,32 @@ class StartOnboardingPage {
}

async checkTermsCheckbox(): Promise<void> {
await this.driver.waitForSelector(this.termsModal);

await this.driver.executeScript(`
const modalBody = document.querySelector('[data-testid="terms-of-use-modal-body"]');
if (modalBody) {
modalBody.scrollTo({ top: modalBody.scrollHeight, behavior: 'instant' });
}
`);

await this.driver.findClickableElement(this.termsCheckbox);
await this.driver.clickElement(this.termsCheckbox);

await this.driver.findClickableElement(this.termsConfirmButton);
await this.driver.clickElement(this.termsConfirmButton);
}

async clickCreateWalletButton(): Promise<void> {
await this.driver.clickElementAndWaitToDisappear(this.createWalletButton);
await this.driver.findClickableElement(this.createWalletButton);
await this.driver.clickElement(this.createWalletButton);
await this.checkTermsCheckbox();
}

async clickImportWalletButton(): Promise<void> {
await this.driver.clickElementAndWaitToDisappear(this.importWalletButton);
await this.driver.findClickableElement(this.importWalletButton);
await this.driver.clickElement(this.importWalletButton);
await this.checkTermsCheckbox();
}
}

Expand Down
4 changes: 3 additions & 1 deletion test/e2e/playwright/shared/pageObjects/extension-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export class ChromeExtensionPage {
await context.waitForEvent('page');
const pages = context.pages();
const page = pages[pages.length - 1]; // return last tab
await page.waitForSelector('text=/I agree to MetaMask/');
await page
.getByTestId('onboarding-create-wallet')
.waitFor({ state: 'visible' });
return page;
}
}
16 changes: 13 additions & 3 deletions test/e2e/playwright/shared/pageObjects/signup-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@

readonly skipSrpBackupBtn: Locator;

readonly termsModalBody: Locator;
readonly popOverBtn: Locator;

Check failure on line 53 in test/e2e/playwright/shared/pageObjects/signup-page.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Expected blank line between class members

constructor(page: Page) {
this.page = page;
Expand Down Expand Up @@ -79,13 +80,22 @@
this.nextBtn = page.getByTestId('pin-extension-next');
this.agreeBtn = page.locator('button:has-text("I agree")');
this.enableBtn = page.locator('button:has-text("Enable")');
this.termsModalBody = page.getByTestId('terms-of-use-modal-body');
this.popOverBtn = page.getByTestId('popover-close');
}

async importWallet() {
private async handleTermsModal() {
await this.termsModalBody.waitFor({ state: 'visible' });
for (let i = 0; i < 1000; i++) {
await this.termsModalBody.press('ArrowDown');
}
await this.agreeTandCCheck.click();
await this.page.getByTestId('onboarding-terms-accept').click();
}

async importWallet() {
await this.importWalletBtn.click();
await this.agreeBtn.click();
await this.handleTermsModal();

const seeds = SEED_PHRASE?.trim().split(/\s+/u);
for (const [index, element] of (seeds as string[]).entries()) {
Expand All @@ -104,8 +114,8 @@
}

async createWallet() {
await this.agreeTandCCheck.click();
await this.createWalletBtn.click();
await this.handleTermsModal();
await this.metametricsBtn.click();
await this.passwordTxt.fill(ACCOUNT_PASSWORD as string);
await this.passwordConfirmTxt.fill(ACCOUNT_PASSWORD as string);
Expand Down
9 changes: 5 additions & 4 deletions test/e2e/tests/account/incremental-security.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { strict: assert } = require('assert');
const { convertToHexValue, withFixtures, openDapp } = require('../../helpers');
const FixtureBuilder = require('../../fixture-builder');
const StartOnboardingPage =
require('../../page-objects/pages/onboarding/start-onboarding-page').default;

const WALLET_PASSWORD = 'correct horse battery staple';

Expand Down Expand Up @@ -31,11 +33,10 @@ describe('Incremental Security', function () {
},
async ({ driver }) => {
await driver.navigate();
// agree to terms of use
await driver.clickElement('[data-testid="onboarding-terms-checkbox"]');

// welcome
await driver.clickElement('[data-testid="onboarding-create-wallet"]');
const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.clickCreateWalletButton();

// metrics
await driver.clickElement('[data-testid="metametrics-no-thanks"]');
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/tests/metrics/app-installed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe('App Installed Events @no-mmi', function () {
await driver.navigate();
const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickCreateWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
Expand Down Expand Up @@ -81,7 +80,6 @@ describe('App Installed Events @no-mmi', function () {
await driver.navigate();
const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickCreateWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/tests/onboarding/onboarding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ describe('MetaMask onboarding @no-mmi', function () {
await driver.navigate();
const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickImportWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
Expand Down Expand Up @@ -106,7 +105,6 @@ describe('MetaMask onboarding @no-mmi', function () {
await driver.navigate();
const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickImportWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
Expand All @@ -131,7 +129,6 @@ describe('MetaMask onboarding @no-mmi', function () {
await driver.navigate();
const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickCreateWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
Expand Down
12 changes: 5 additions & 7 deletions test/e2e/tests/responsive-ui/metamask-responsive-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const {
tempToggleSettingRedesignedTransactionConfirmations,
} = require('../../helpers');
const FixtureBuilder = require('../../fixture-builder');
const StartOnboardingPage =
require('../../page-objects/pages/onboarding/start-onboarding-page').default;

describe('MetaMask Responsive UI', function () {
describe('Old confirmation screens', function () {
Expand Down Expand Up @@ -80,13 +82,9 @@ describe('MetaMask Responsive UI', function () {
async ({ driver }) => {
await driver.navigate();

// agree to terms of use
await driver.clickElement(
'[data-testid="onboarding-terms-checkbox"]',
);

// welcome
await driver.clickElement('[data-testid="onboarding-create-wallet"]');
const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.clickCreateWalletButton();

// metrics
await driver.clickElement('[data-testid="metametrics-no-thanks"]');
Expand Down
Loading
Loading