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 19 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.

4 changes: 2 additions & 2 deletions shared/modules/bridge-utils/bridge.util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('Bridge utils', () => {

(fetchWithCache as jest.Mock).mockRejectedValue(mockError);

await expect(fetchBridgeFeatureFlags()).rejects.toThrowError(mockError);
await expect(fetchBridgeFeatureFlags()).rejects.toThrow(mockError);
});
});

Expand Down Expand Up @@ -223,7 +223,7 @@ describe('Bridge utils', () => {

(fetchWithCache as jest.Mock).mockRejectedValue(mockError);

await expect(fetchBridgeTokens('0xa')).rejects.toThrowError(mockError);
await expect(fetchBridgeTokens('0xa')).rejects.toThrow(mockError);
});
});

Expand Down
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
28 changes: 25 additions & 3 deletions test/e2e/playwright/shared/pageObjects/signup-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,32 @@ export class SignUpPage {
this.enableBtn = page.locator('button:has-text("Enable")');
}

async importWallet() {
private async handleTermsModal() {
console.log('Waiting for terms modal...');
await this.page.waitForSelector('[data-testid="terms-of-use-modal-body"]');
console.log('Found terms modal');

console.log('Scrolling modal to bottom...');
await this.page.evaluate(`
const modalBody = document.querySelector('[data-testid="terms-of-use-modal-body"]');
if (modalBody) {
modalBody.scrollTo({ top: modalBody.scrollHeight, behavior: 'instant' });
console.log('Modal scrolled');
} else {
console.log('Modal body not found');
}
`);

console.log('Clicking terms checkbox...');
await this.agreeTandCCheck.click();
console.log('Clicking accept button...');
await this.page.getByTestId('onboarding-terms-accept').click();
console.log('Terms accepted');
}

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 @@ -101,8 +123,8 @@ export class SignUpPage {
}

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
Loading
Loading