Skip to content

Commit

Permalink
Merge branch 'main' of github.com:MetaMask/metamask-extension into qq…
Browse files Browse the repository at this point in the history
…-more-token-tests
  • Loading branch information
cmd-ob committed Dec 20, 2024
2 parents 8ea7007 + 356ad47 commit 6be682d
Show file tree
Hide file tree
Showing 28 changed files with 683 additions and 527 deletions.
7 changes: 7 additions & 0 deletions test/e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ export const DEFAULT_SOLANA_BALANCE = 1; // SOL

/* Title of the mocked E2E test empty HTML page */
export const EMPTY_E2E_TEST_PAGE_TITLE = 'E2E Test Page';

/* Account types */
export enum ACCOUNT_TYPE {
Ethereum,
Bitcoin,
Solana,
}
4 changes: 2 additions & 2 deletions test/e2e/flask/btc/common-btc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Mockttp } from 'mockttp';
import FixtureBuilder from '../../fixture-builder';
import { withFixtures } from '../../helpers';
import {
ACCOUNT_TYPE,
DEFAULT_BTC_ACCOUNT,
DEFAULT_BTC_BALANCE,
DEFAULT_BTC_FEES_RATE,
Expand All @@ -14,7 +15,6 @@ import { Driver } from '../../webdriver/driver';
import { loginWithBalanceValidation } from '../../page-objects/flows/login.flow';
import AccountListPage from '../../page-objects/pages/account-list-page';
import HeaderNavbar from '../../page-objects/pages/header-navbar';
import { ACCOUNT_TYPE } from '../../page-objects/common';

const QUICKNODE_URL_REGEX = /^https:\/\/.*\.btc.*\.quiknode\.pro(\/|$)/u;

Expand Down Expand Up @@ -218,7 +218,7 @@ export async function withBtcAccountSnap(
await new HeaderNavbar(driver).openAccountMenu();
const accountListPage = new AccountListPage(driver);
await accountListPage.check_pageIsLoaded();
await accountListPage.addAccount(ACCOUNT_TYPE.Bitcoin, '');
await accountListPage.addAccount({ accountType: ACCOUNT_TYPE.Bitcoin });
await test(driver, mockServer);
},
);
Expand Down
37 changes: 22 additions & 15 deletions test/e2e/flask/btc/create-btc-account.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { strict as assert } from 'assert';
import { Suite } from 'mocha';
import { WALLET_PASSWORD } from '../../helpers';
import AccountDetailsModal from '../../page-objects/pages/dialog/account-details-modal';
import AccountListPage from '../../page-objects/pages/account-list-page';
import HeaderNavbar from '../../page-objects/pages/header-navbar';
import LoginPage from '../../page-objects/pages/login-page';
import PrivacySettings from '../../page-objects/pages/settings/privacy-settings';
import ResetPasswordPage from '../../page-objects/pages/reset-password-page';
import SettingsPage from '../../page-objects/pages/settings/settings-page';
import { ACCOUNT_TYPE } from '../../page-objects/common';
import { ACCOUNT_TYPE } from '../../constants';
import { withBtcAccountSnap } from './common-btc';

describe('Create BTC Account', function (this: Suite) {
Expand Down Expand Up @@ -82,9 +83,11 @@ describe('Create BTC Account', function (this: Suite) {
await headerNavbar.openAccountMenu();
const accountListPage = new AccountListPage(driver);
await accountListPage.check_pageIsLoaded();
const accountAddress = await accountListPage.getAccountAddress(
'Bitcoin Account',
);
await accountListPage.openAccountDetailsModal('Bitcoin Account');

const accountDetailsModal = new AccountDetailsModal(driver);
await accountDetailsModal.check_pageIsLoaded();
const accountAddress = await accountDetailsModal.getAccountAddress();
await headerNavbar.openAccountMenu();
await accountListPage.removeAccount('Bitcoin Account');

Expand All @@ -97,14 +100,15 @@ describe('Create BTC Account', function (this: Suite) {
);
await accountListPage.closeAccountModal();
await headerNavbar.openAccountMenu();
await accountListPage.addAccount(ACCOUNT_TYPE.Bitcoin, '');
await accountListPage.addAccount({ accountType: ACCOUNT_TYPE.Bitcoin });
await headerNavbar.check_accountLabel('Bitcoin Account');

await headerNavbar.openAccountMenu();
await accountListPage.check_pageIsLoaded();
const recreatedAccountAddress = await accountListPage.getAccountAddress(
'Bitcoin Account',
);
await accountListPage.openAccountDetailsModal('Bitcoin Account');
await accountDetailsModal.check_pageIsLoaded();
const recreatedAccountAddress =
await accountDetailsModal.getAccountAddress();

assert(accountAddress === recreatedAccountAddress);
},
Expand All @@ -123,9 +127,10 @@ describe('Create BTC Account', function (this: Suite) {
await headerNavbar.openAccountMenu();
const accountListPage = new AccountListPage(driver);
await accountListPage.check_pageIsLoaded();
const accountAddress = await accountListPage.getAccountAddress(
'Bitcoin Account',
);
await accountListPage.openAccountDetailsModal('Bitcoin Account');
const accountDetailsModal = new AccountDetailsModal(driver);
await accountDetailsModal.check_pageIsLoaded();
const accountAddress = await accountDetailsModal.getAccountAddress();

// go to privacy settings page and get the SRP
await headerNavbar.openSettingsPage();
Expand All @@ -151,14 +156,16 @@ describe('Create BTC Account', function (this: Suite) {
await headerNavbar.check_pageIsLoaded();
await headerNavbar.openAccountMenu();
await accountListPage.check_pageIsLoaded();
await accountListPage.addAccount(ACCOUNT_TYPE.Bitcoin, '');
await accountListPage.addAccount({ accountType: ACCOUNT_TYPE.Bitcoin });
await headerNavbar.check_accountLabel('Bitcoin Account');

await headerNavbar.openAccountMenu();
await accountListPage.check_pageIsLoaded();
const recreatedAccountAddress = await accountListPage.getAccountAddress(
'Bitcoin Account',
);
await accountListPage.openAccountDetailsModal('Bitcoin Account');
await accountDetailsModal.check_pageIsLoaded();
const recreatedAccountAddress =
await accountDetailsModal.getAccountAddress();

assert(accountAddress === recreatedAccountAddress);
},
);
Expand Down
Loading

0 comments on commit 6be682d

Please sign in to comment.