Skip to content

Commit

Permalink
chore(runway): cherry-pick fix: Fix/use portfolio home page (#11561)
Browse files Browse the repository at this point in the history
- fix: Fix/use portfolio home page (#11554)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

Replaces the browser home page from `https://home.metamask.io` to
`https://portfolio.metamask.io/explore?MetaMaskEntry=mobile`

## **Related issues**

Fixes: Thread -
https://consensys.slack.com/archives/C07PHNQ61SA/p1727810879864649

## **Manual testing steps**

1. Install a new version of the app
2. Switch to the browser tab
3. Default home page should show portfolio explore page

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

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

### **After**

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



https://github.com/user-attachments/assets/5211a097-baaf-4489-9cd4-b69871321f26

Old MM home still works
<img width="444" alt="image"

src="https://github.com/user-attachments/assets/127eaf65-f304-42bc-862b-7eb42354847b">


## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding

Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling

guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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.
[3084746](3084746)

Co-authored-by: Cal Leung <[email protected]>
  • Loading branch information
runway-github[bot] and Cal-L authored Oct 1, 2024
1 parent e2090a8 commit 7788094
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 37 deletions.
7 changes: 5 additions & 2 deletions app/components/Views/BrowserTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ import handleWebViewFocus from '../../../util/browser/webViewFocus';
import { isTest } from '../../../util/test/utils.js';
import { EXTERNAL_LINK_TYPE } from '../../../constants/browser';

const { HOMEPAGE_URL, NOTIFICATION_NAMES } = AppConstants;
const { HOMEPAGE_URL, NOTIFICATION_NAMES, OLD_HOMEPAGE_URL_HOST } =
AppConstants;
const HOMEPAGE_HOST = new URL(HOMEPAGE_URL)?.hostname;
const MM_MIXPANEL_TOKEN = process.env.MM_MIXPANEL_TOKEN;

Expand Down Expand Up @@ -363,7 +364,9 @@ export const BrowserTab = (props) => {
const currentPage = checkUrl || url.current;
const prefixedUrl = prefixUrlWithProtocol(currentPage);
const { host: currentHost } = getUrlObj(prefixedUrl);
return currentHost === HOMEPAGE_HOST;
return (
currentHost === HOMEPAGE_HOST || currentHost === OLD_HOMEPAGE_URL_HOST
);
}, []);

const notifyAllConnections = useCallback((payload, restricted = true) => {
Expand Down
5 changes: 4 additions & 1 deletion app/core/AppConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export default {
MM_UNIVERSAL_LINK_HOST: 'metamask.app.link',
MM_DEEP_ITMS_APP_LINK: 'https://metamask.app.link/skAH3BaF99',
SAI_ADDRESS: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359',
HOMEPAGE_URL: process.env.MM_HOMEPAGE || 'https://home.metamask.io/',
HOMEPAGE_URL:
process.env.MM_HOMEPAGE ||
'https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/',
OLD_HOMEPAGE_URL_HOST: 'home.metamask.io',
SHORT_HOMEPAGE_URL: 'MetaMask.io',
ZERO_ADDRESS: '0x0000000000000000000000000000000000000000',
USER_AGENT: Device.isAndroid()
Expand Down
12 changes: 6 additions & 6 deletions app/util/browser/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ describe('Browser utils :: trustedProtocolToDeeplink', () => {
expect(trustedProtocolToDeeplink.includes(protocol)).toBeTruthy();
});
it('should match metamask: protocol', () => {
const { protocol } = new URL('metamask://dapp/home.metamask.io');
const { protocol } = new URL('metamask://dapp/portfolio.metamask.io');

expect(trustedProtocolToDeeplink.includes(protocol)).toBeTruthy();
});
Expand All @@ -217,27 +217,27 @@ describe('Browser utils :: trustedProtocolToDeeplink', () => {
expect(trustedProtocolToDeeplink.includes(protocol)).toBeTruthy();
});
it('should match dapp: protocol', () => {
const { protocol } = new URL('dapp://home.metamask.io');
const { protocol } = new URL('dapp://portfolio.metamask.io');

expect(trustedProtocolToDeeplink.includes(protocol)).toBeTruthy();
});
it('should not match eth: protocol', () => {
const { protocol } = new URL('eth://home.metamask.io');
const { protocol } = new URL('eth://portfolio.metamask.io');

expect(trustedProtocolToDeeplink.includes(protocol)).toBeFalsy();
});
it('should not match tel: protocol', () => {
const { protocol } = new URL('tel://home.metamask.io');
const { protocol } = new URL('tel://portfolio.metamask.io');

expect(trustedProtocolToDeeplink.includes(protocol)).toBeFalsy();
});
it('should not match mailto: protocol', () => {
const { protocol } = new URL('mailto://home.metamask.io');
const { protocol } = new URL('mailto://portfolio.metamask.io');

expect(trustedProtocolToDeeplink.includes(protocol)).toBeFalsy();
});
it('should not match ldap: protocol', () => {
const { protocol } = new URL('ldap://home.metamask.io');
const { protocol } = new URL('ldap://portfolio.metamask.io');

expect(trustedProtocolToDeeplink.includes(protocol)).toBeFalsy();
});
Expand Down
2 changes: 1 addition & 1 deletion e2e/fixtures/fixture-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class FixtureBuilder {
whitelist: [],
tabs: [
{
url: 'https://home.metamask.io/',
url: 'https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/',
id: 1692550481062,
},
],
Expand Down
34 changes: 17 additions & 17 deletions e2e/specs/browser/browser-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,27 @@ describe(SmokeCore('Browser Tests'), () => {
await Browser.waitForBrowserPageToLoad();
});

it('should add the test dapp to favorites', async () => {
// Check that we are still on the browser screen
// it('should add the test dapp to favorites', async () => {
// // Check that we are still on the browser screen

// Tap on options
await Browser.tapOptionsButton();
await Browser.tapAddToFavoritesButton();
// // Tap on options
// await Browser.tapOptionsButton();
// await Browser.tapAddToFavoritesButton();

await Assertions.checkIfVisible(AddBookmarkView.container);
// await Assertions.checkIfVisible(AddBookmarkView.container);

await AddBookmarkView.tapAddBookmarksButton();
await Assertions.checkIfNotVisible(AddBookmarkView.container);
});
// await AddBookmarkView.tapAddBookmarksButton();
// await Assertions.checkIfNotVisible(AddBookmarkView.container);
// });

it('should tap on the test dapp in favorites on the home page', async () => {
await Browser.tapHomeButton();
// Wait for page to load
await TestHelpers.delay(3000);
await Browser.tapDappInFavorites();
await Assertions.checkIfTextIsDisplayed('metamask.github.io');
// }
});
// it('should tap on the test dapp in favorites on the home page', async () => {
// await Browser.tapHomeButton();
// // Wait for page to load
// await TestHelpers.delay(3000);
// await Browser.tapDappInFavorites();
// await Assertions.checkIfTextIsDisplayed('metamask.github.io');
// // }
// });

it('should test invalid URL', async () => {
await TestHelpers.delay(2000);
Expand Down
4 changes: 2 additions & 2 deletions wdio/features/BrowserFlow/AddFavorite.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Feature: Browser Add Favorite

Scenario: Adding browser Favorites
Add, click and delete favorites. Display favorites in the Favorites tab of home.metamask.io
Add, click and delete favorites. Display favorites in the Favorites tab of portfolio.metamask.io

Given the app displayed the splash animation
And I have imported my wallet
Expand All @@ -22,7 +22,7 @@ Feature: Browser Add Favorite
And Url field is pre populated with "https://app.uniswap.org/"
When I tap on "Cancel" on the Add Favorite Screen
Then the "https://app.uniswap.org/" is displayed in the browser tab
And the favorite is not added on the home "https://home.metamask.io" page
And the favorite is not added on the home "https://portfolio.metamask.io/explore?MetaMaskEntry=mobile" page
When I navigate to "https://uniswap.exchange"
And I tap on browser control menu icon on the bottom right of the browser view
And I tap the "Add to Favorites" option on the Option Menu
Expand Down
4 changes: 2 additions & 2 deletions wdio/features/BrowserFlow/AddressBar.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Feature: Browser Address Bar
And I have 1 browser tab displayed
When I tap on address bar
Then browser address view is displayed
And the "https://home.metamask.io/" url is displayed in address field
And the "https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/" url is displayed in address field
When I tap on "clear icon" in address field
Then address field is cleared
When I tap on "Cancel button" in address field
Then browser address bar input view is no longer displayed
And the browser view is on the "https://home.metamask.io/" website
And the browser view is on the "https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/" website
When I tap on address bar
And I navigate to "reddit.com"
Then the browser view is on the "https://www.reddit.com/" website
2 changes: 1 addition & 1 deletion wdio/features/BrowserFlow/InvalidURL.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Feature: Browser Invalid URL
Then I should see "Something went wrong" error title
And I should see "We couldn't load that page" error message
When I tap on the Return button from the error page
Then the browser view is on the "https://home.metamask.io/" website
Then the browser view is on the "https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/" website
2 changes: 1 addition & 1 deletion wdio/features/BrowserFlow/NavigationControls.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Browser Control Options
When I navigate to "reddit.com"
Then the browser view is on the "https://www.reddit.com/" website
And I tap on the back arrow control button
Then the browser view is on the "https://home.metamask.io/" website
Then the browser view is on the "https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/" website
When I tap on browser tab button with count 1
Then multi browser tab view is displayed
When I tap on "Add" button on multi browser tab view
Expand Down
2 changes: 1 addition & 1 deletion wdio/features/BrowserFlow/OptionMenu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ Feature: Browser Options Menu
And "New tab" option item is displayed in browser options menu
When I tap the "New Tab" option on the Option Menu
Then new browser tab is added
#And the browser view is on the "https://home.metamask.io/" website
#And the browser view is on the "https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/" website
2 changes: 1 addition & 1 deletion wdio/features/BrowserFlow/PhishingDetection.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Feature: Browser Phishing Detection
When I navigate to "http://www.empowr.com/FanFeed/Home.aspx"
Then I should see a warning screen with Ethereum Phishing Detection title
When I tap the Back button on Phishing Detection page
And the browser view is on the "https://home.metamask.io/" website
And the browser view is on the "https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/" website
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const CANCEL_BUTTON_ON_BROWSER_ID = 'cancel-url-button';

export const UNISWAP_SUGGESTION = 'https://uniswap.exchange/';

export const HOME_SUGGESTION = 'https://home.metamask.io/';
export const HOME_SUGGESTION = 'https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/';

export const URL_CLEAR_ICON = 'url-clear-icon';
2 changes: 1 addition & 1 deletion wdio/step-definitions/browser-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const TEST_DAPP = 'https://metamask.github.io/test-dapp/';
Given(/^I am on Home MetaMask website$/, async () => {
await ExternalWebsitesScreen.isHomeFavoriteButtonDisplayed();
await BrowserScreen.tapUrlBar();
await AddressBarScreen.isUrlValueContains('https://home.metamask.io/');
await AddressBarScreen.isUrlValueContains('https://portfolio.metamask.io/explore?MetaMaskEntry=mobile/');
await AddressBarScreen.tapUrlCancelButton();
});

Expand Down

0 comments on commit 7788094

Please sign in to comment.