From 98f049f8cb0ccf44fe49e53d27152953f5c22a38 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Fri, 9 Oct 2020 13:07:11 -0230 Subject: [PATCH] Only shows the swaps intro popup on mainnet (#9534) * Only shows the swaps intro popup on mainnet * Remove code that closes swaps popup from e2e tests * correct casing on isMainnet prop in home component --- test/e2e/address-book.spec.js | 6 ------ test/e2e/ethereum-on.spec.js | 4 ---- test/e2e/from-import-ui.spec.js | 6 ------ test/e2e/incremental-security.spec.js | 4 ---- test/e2e/metamask-responsive-ui.spec.js | 6 ------ test/e2e/metamask-ui.spec.js | 6 ------ test/e2e/permissions.spec.js | 4 ---- test/e2e/send-edit.spec.js | 6 ------ test/e2e/threebox.spec.js | 12 ------------ ui/app/pages/home/home.component.js | 4 +++- ui/app/pages/home/home.container.js | 2 ++ 11 files changed, 5 insertions(+), 55 deletions(-) diff --git a/test/e2e/address-book.spec.js b/test/e2e/address-book.spec.js index 30b7c7203..aac315235 100644 --- a/test/e2e/address-book.spec.js +++ b/test/e2e/address-book.spec.js @@ -118,12 +118,6 @@ describe('MetaMask', function () { await driver.clickElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`)) await driver.delay(regularDelayMs) }) - - it('closes the swaps intro popup', async function () { - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - }) }) describe('Import seed phrase', function () { diff --git a/test/e2e/ethereum-on.spec.js b/test/e2e/ethereum-on.spec.js index 29720ec32..5dd15d5fd 100644 --- a/test/e2e/ethereum-on.spec.js +++ b/test/e2e/ethereum-on.spec.js @@ -84,10 +84,6 @@ describe('MetaMask', function () { await driver.clickElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.remindMeLater.message}')]`)) await driver.delay(regularDelayMs) - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - await driver.clickElement(By.css('[data-testid="account-options-menu-button"]')) await driver.clickElement(By.css('[data-testid="account-options-menu__account-details"]')) }) diff --git a/test/e2e/from-import-ui.spec.js b/test/e2e/from-import-ui.spec.js index 2430d7adf..70774b04f 100644 --- a/test/e2e/from-import-ui.spec.js +++ b/test/e2e/from-import-ui.spec.js @@ -93,12 +93,6 @@ describe('Using MetaMask with an existing account', function () { await driver.clickElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`)) await driver.delay(regularDelayMs) }) - - it('closes the swaps intro popup', async function () { - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - }) }) describe('Show account information', function () { diff --git a/test/e2e/incremental-security.spec.js b/test/e2e/incremental-security.spec.js index 8bf990696..6b76bae12 100644 --- a/test/e2e/incremental-security.spec.js +++ b/test/e2e/incremental-security.spec.js @@ -90,10 +90,6 @@ describe('MetaMask', function () { await driver.clickElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.remindMeLater.message}')]`)) await driver.delay(regularDelayMs) - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - await driver.clickElement(By.css('[data-testid="account-options-menu-button"]')) await driver.clickElement(By.css('[data-testid="account-options-menu__account-details"]')) }) diff --git a/test/e2e/metamask-responsive-ui.spec.js b/test/e2e/metamask-responsive-ui.spec.js index 9f1356900..a4b7e92c9 100644 --- a/test/e2e/metamask-responsive-ui.spec.js +++ b/test/e2e/metamask-responsive-ui.spec.js @@ -113,12 +113,6 @@ describe('MetaMask', function () { await driver.clickElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`)) await driver.delay(regularDelayMs) }) - - it('closes the swaps intro popup', async function () { - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - }) }) describe('Show account information', function () { diff --git a/test/e2e/metamask-ui.spec.js b/test/e2e/metamask-ui.spec.js index fd2acaf98..88e7be305 100644 --- a/test/e2e/metamask-ui.spec.js +++ b/test/e2e/metamask-ui.spec.js @@ -115,12 +115,6 @@ describe('MetaMask', function () { await driver.clickElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`)) await driver.delay(regularDelayMs) }) - - it('closes the swaps intro popup', async function () { - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - }) }) describe('Show account information', function () { diff --git a/test/e2e/permissions.spec.js b/test/e2e/permissions.spec.js index 2c66a1bc4..87c439c0c 100644 --- a/test/e2e/permissions.spec.js +++ b/test/e2e/permissions.spec.js @@ -85,10 +85,6 @@ describe('MetaMask', function () { await driver.clickElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.remindMeLater.message}')]`)) await driver.delay(regularDelayMs) - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - await driver.clickElement(By.css('[data-testid="account-options-menu-button"]')) await driver.clickElement(By.css('[data-testid="account-options-menu__account-details"]')) }) diff --git a/test/e2e/send-edit.spec.js b/test/e2e/send-edit.spec.js index 566743f14..1dba2c396 100644 --- a/test/e2e/send-edit.spec.js +++ b/test/e2e/send-edit.spec.js @@ -91,12 +91,6 @@ describe('Using MetaMask with an existing account', function () { await driver.clickElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`)) await driver.delay(regularDelayMs) }) - - it('closes the swaps intro popup', async function () { - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - }) }) describe('Send ETH from inside MetaMask', function () { diff --git a/test/e2e/threebox.spec.js b/test/e2e/threebox.spec.js index 04da1c545..3254d8cb9 100644 --- a/test/e2e/threebox.spec.js +++ b/test/e2e/threebox.spec.js @@ -95,12 +95,6 @@ describe('MetaMask', function () { await driver.delay(regularDelayMs) }) - it('closes the swaps intro popup', async function () { - await driver.findElement(By.css(`.popover-header__subtitle`)) - await driver.clickElement(By.css('.popover-header__button')) - await driver.delay(regularDelayMs) - }) - it('balance renders', async function () { const balance = await driver.findElement(By.css('[data-testid="wallet-balance"] .list-item__heading')) await driver.wait(until.elementTextMatches(balance, /25\s*ETH/u)) @@ -207,12 +201,6 @@ describe('MetaMask', function () { await driver2.delay(regularDelayMs) }) - it('closes the swaps intro popup', async function () { - await driver2.findElement(By.css(`.popover-header__subtitle`)) - await driver2.clickElement(By.css('.popover-header__button')) - await driver2.delay(regularDelayMs) - }) - it('balance renders', async function () { const balance = await driver2.findElement(By.css('[data-testid="wallet-balance"] .list-item__heading')) await driver2.wait(until.elementTextMatches(balance, /25\s*ETH/u)) diff --git a/ui/app/pages/home/home.component.js b/ui/app/pages/home/home.component.js index 37042d74c..aa5a2091e 100644 --- a/ui/app/pages/home/home.component.js +++ b/ui/app/pages/home/home.component.js @@ -64,6 +64,7 @@ export default class Home extends PureComponent { showAwaitingSwapScreen: PropTypes.bool.isRequired, swapsFetchParams: PropTypes.object, swapsEnabled: PropTypes.bool, + isMainnet: PropTypes.bool, } state = { @@ -271,6 +272,7 @@ export default class Home extends PureComponent { swapsWelcomeMessageHasBeenShown, setSwapsWelcomeMessageHasBeenShown, swapsEnabled, + isMainnet, } = this.props if (forgottenPassword) { @@ -284,7 +286,7 @@ export default class Home extends PureComponent {
- {!swapsWelcomeMessageHasBeenShown && swapsEnabled ? ( + {!swapsWelcomeMessageHasBeenShown && swapsEnabled && isMainnet ? ( ) : null} { isPopup && !connectedStatusPopoverHasBeenShown ? this.renderPopover() : null } diff --git a/ui/app/pages/home/home.container.js b/ui/app/pages/home/home.container.js index ac7183ddb..1c9fef4da 100644 --- a/ui/app/pages/home/home.container.js +++ b/ui/app/pages/home/home.container.js @@ -6,6 +6,7 @@ import { getCurrentEthBalance, getFirstPermissionRequest, getTotalUnapprovedCount, + getIsMainnet, } from '../../selectors' import { @@ -73,6 +74,7 @@ const mapStateToProps = (state) => { haveSwapsQuotes: Boolean(Object.values(swapsState.quotes || {}).length), swapsFetchParams: swapsState.fetchParams, showAwaitingSwapScreen: swapsState.routeState === 'awaiting', + isMainnet: getIsMainnet(state), } }