Skip to content

Commit

Permalink
feat: Removed multichain flag for v1 release (#24362)
Browse files Browse the repository at this point in the history
This PR is to remove all the Multichain flags from code except the send
and swap flow

## **Related issues**

Fixes:
[MetaMask/MetaMask-planning#2431
)
## **Manual testing steps**

1. Run the extension without Multichain flag.
2. All the changes should be there

## **Screenshots/Recordings**


### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
NidhiKJha committed May 9, 2024
1 parent 8db28c7 commit 4dce340
Show file tree
Hide file tree
Showing 28 changed files with 1,517 additions and 831 deletions.
10 changes: 8 additions & 2 deletions test/e2e/accounts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,15 @@ export async function connectAccountToTestDapp(driver: Driver) {
export async function disconnectFromTestDapp(driver: Driver) {
await driver.switchToWindowWithTitle(WINDOW_TITLES.ExtensionInFullScreenView);
await driver.clickElement('[data-testid="account-options-menu-button"]');
await driver.clickElement('[data-testid="global-menu-connected-sites"]');
await driver.clickElement({ text: 'Disconnect', tag: 'a' });
await driver.clickElement({ text: 'All Permissions', tag: 'div' });
await driver.clickElement({ text: 'Got it', tag: 'button' });
await driver.clickElement({
text: '127.0.0.1:8080',
tag: 'p',
});
await driver.clickElement('[data-testid="account-list-item-menu-button"]');
await driver.clickElement({ text: 'Disconnect', tag: 'button' });
await driver.clickElement('[data-testid ="disconnect-all"]');
}

export async function approveOrRejectRequest(driver: Driver, flowType: string) {
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/tests/account/add-account.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,9 @@ describe('Add account', function () {

// Land in 1st account home page
await driver.findElement('.home__main-view');

if (!process.env.MULTICHAIN) {
await waitForAccountRendered(driver);
}

// Check address of 1st account
await driver.findElement('[data-testid="app-header-copy-button"]');

Expand Down
13 changes: 6 additions & 7 deletions test/e2e/tests/dapp-interactions/dapp-interactions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const {
defaultGanacheOptions,
withFixtures,
openDapp,
DAPP_URL,
DAPP_ONE_URL,
unlockWallet,
WINDOW_TITLES,
Expand Down Expand Up @@ -84,17 +83,17 @@ describe('Dapp interactions', function () {
'[data-testid ="account-options-menu-button"]',
);

await driver.clickElement({ text: 'Connected sites', tag: 'div' });
await driver.clickElement({ text: 'All Permissions', tag: 'div' });
await driver.clickElement({ text: 'Got it', tag: 'button' });

const connectedDapp1 = await driver.isElementPresent({
text: DAPP_URL,
tag: 'bdi',
text: '127.0.0.1:8080',
tag: 'p',
});
const connectedDapp2 = await driver.isElementPresent({
text: DAPP_ONE_URL,
tag: 'bdi',
text: '127.0.0.1:8081',
tag: 'p',
});

assert.ok(connectedDapp1, 'Account not connected to Dapp1');
assert.ok(connectedDapp2, 'Account not connected to Dapp2');
},
Expand Down
13 changes: 6 additions & 7 deletions test/e2e/tests/dapp-interactions/permissions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,17 @@ describe('Permissions', function () {
await driver.clickElement(
'[data-testid="account-options-menu-button"]',
);
await driver.clickElement('.menu-item:nth-of-type(3)');

await driver.findElement({
text: 'Connected sites',
tag: 'h2',
await driver.clickElement({
text: 'All Permissions',
tag: 'div',
});
await driver.clickElement({ text: 'Got it', tag: 'button' });
await driver.waitForSelector({
css: '.connected-sites-list__subject-name',
text: '127.0.0.1:8080',
tag: 'p',
});
const domains = await driver.findClickableElements(
'.connected-sites-list__subject-name',
'[data-testid="connection-list-item"]',
);
assert.equal(domains.length, 1);

Expand Down
32 changes: 21 additions & 11 deletions test/e2e/tests/metrics/dapp-viewed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const {
openDapp,
waitForAccountRendered,
WINDOW_TITLES,
DAPP_URL,
} = require('../../helpers');
const FixtureBuilder = require('../../fixture-builder');
const {
Expand Down Expand Up @@ -332,24 +331,35 @@ describe('Dapp viewed Event @no-mmi', function () {
await driver.clickElement(
'[data-testid ="account-options-menu-button"]',
);
await driver.clickElement({ text: 'Connected sites', tag: 'div' });
await driver.findElement({
text: DAPP_URL,
tag: 'bdi',
await driver.clickElement({
text: 'All Permissions',
tag: 'div',
});
await driver.clickElement({ text: 'Got it', tag: 'button' });
await driver.clickElement({
text: '127.0.0.1:8080',
tag: 'p',
});
await driver.clickElement({ text: 'Disconnect', tag: 'a' });
await driver.clickElement(
'[data-testid ="account-list-item-menu-button"]',
);
await driver.clickElement({
text: `Disconnect ${DAPP_URL}`,
tag: 'h2',
text: 'Disconnect',
tag: 'button',
});
await driver.clickElement({ text: 'Disconnect', tag: 'button' });
await driver.clickElement('[data-testid ="disconnect-all"]');
await driver.clickElement('button[aria-label="Back"]');
await driver.clickElement('button[aria-label="Back"]');
// validate dapp is not connected
await driver.clickElement(
'[data-testid ="account-options-menu-button"]',
);
await driver.clickElement({ text: 'Connected sites', tag: 'div' });
await driver.clickElement({
text: 'All Permissions',
tag: 'div',
});
await driver.findElement({
text: 'Account 1 is not connected to any sites.',
text: 'Nothing to see here',
tag: 'p',
});
// reconnect again
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/tests/multichain/connection-page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ describe('Connections page', function () {
title: this.test.fullTitle(),
},
async ({ driver }) => {
if (!process.env.MULTICHAIN) {
return;
}
await unlockWallet(driver);
await waitForAccountRendered(driver);
await connectToDapp(driver);
Expand Down Expand Up @@ -99,9 +96,6 @@ describe('Connections page', function () {
title: this.test.fullTitle(),
},
async ({ driver }) => {
if (!process.env.MULTICHAIN) {
return;
}
await unlockWallet(driver);
await waitForAccountRendered(driver);
await connectToDapp(driver);
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/tests/multichain/permission-page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ describe('Permissions Page', function () {
},
async ({ driver }) => {
await unlockWallet(driver);
if (!process.env.MULTICHAIN) {
return;
}
await waitForAccountRendered(driver);
await connectToDapp(driver);

Expand Down Expand Up @@ -54,9 +51,6 @@ describe('Permissions Page', function () {
},
async ({ driver }) => {
await unlockWallet(driver);
if (!process.env.MULTICHAIN) {
return;
}
await waitForAccountRendered(driver);
await connectToDapp(driver);

Expand Down
14 changes: 6 additions & 8 deletions test/e2e/tests/settings/change-language.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const selectors = {
headerText: { text: 'الإعدادات', tag: 'h3' },
};

async function changeLanguage(driver: Driver , languageIndex: number) {
async function changeLanguage(driver: Driver, languageIndex: number) {
await driver.clickElement(selectors.accountOptionsMenuButton);
await driver.clickElement(selectors.settingsOption);

Expand Down Expand Up @@ -91,7 +91,7 @@ describe('Settings - general tab @no-mmi', function (this: Suite) {

async ({ driver }: { driver: Driver }) => {
await unlockWallet(driver);
await changeLanguage(driver, languageIndex );
await changeLanguage(driver, languageIndex);

await driver.assertElementNotPresent('.loading-overlay__spinner');

Expand Down Expand Up @@ -134,7 +134,6 @@ describe('Settings - general tab @no-mmi', function (this: Suite) {
if (process.env.MULTICHAIN) {
return;
}

const languageIndex = 7;
await withFixtures(
{
Expand All @@ -145,7 +144,7 @@ describe('Settings - general tab @no-mmi', function (this: Suite) {

async ({ driver }: { driver: Driver }) => {
await unlockWallet(driver);
await changeLanguage( driver, languageIndex );
await changeLanguage(driver, languageIndex);
await driver.navigate();
await driver.clickElement(selectors.ethOverviewSend);
await driver.fill(selectors.ensInput, 'test');
Expand All @@ -167,7 +166,6 @@ describe('Settings - general tab @no-mmi', function (this: Suite) {
if (process.env.MULTICHAIN) {
return;
}

const languageIndex = 19;
await withFixtures(
{
Expand All @@ -178,7 +176,7 @@ describe('Settings - general tab @no-mmi', function (this: Suite) {

async ({ driver }: { driver: Driver }) => {
await unlockWallet(driver);
await changeLanguage( driver, languageIndex );
await changeLanguage(driver, languageIndex);
await driver.navigate();

// Validate the account tooltip
Expand Down Expand Up @@ -216,7 +214,7 @@ describe('Settings - general tab @no-mmi', function (this: Suite) {
async ({ driver }: { driver: Driver }) => {
await unlockWallet(driver);
// selects "Magyar" language
await changeLanguage( driver, languageIndex );
await changeLanguage(driver, languageIndex);
await driver.navigate();
await driver.clickElement(selectors.nftsTab);

Expand All @@ -243,7 +241,7 @@ describe('Settings - general tab @no-mmi', function (this: Suite) {
},
async ({ driver }: { driver: Driver }) => {
await unlockWallet(driver);
await changeLanguage( driver, languageIndex );
await changeLanguage(driver, languageIndex);

// Validate the header text
const isHeaderTextChanged = await driver.isElementPresent(
Expand Down
2 changes: 1 addition & 1 deletion ui/components/app/alerts/alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Alerts = ({ history }) => {
if (_invalidCustomNetworkAlertIsOpen) {
return <InvalidCustomNetworkAlert history={history} />;
}
if (_unconnectedAccountAlertIsOpen && !process.env.MULTICHAIN) {
if (_unconnectedAccountAlertIsOpen) {
return <UnconnectedAccountAlert />;
}

Expand Down

0 comments on commit 4dce340

Please sign in to comment.