1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

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
This commit is contained in:
Dan J Miller 2020-10-09 13:07:11 -02:30 committed by GitHub
parent 89a0f75942
commit 98f049f8cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 5 additions and 55 deletions

View File

@ -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 () {

View File

@ -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"]'))
})

View File

@ -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 () {

View File

@ -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"]'))
})

View File

@ -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 () {

View File

@ -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 () {

View File

@ -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"]'))
})

View File

@ -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 () {

View File

@ -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))

View File

@ -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 {
<Route path={CONNECTED_ROUTE} component={ConnectedSites} exact />
<Route path={CONNECTED_ACCOUNTS_ROUTE} component={ConnectedAccounts} exact />
<div className="home__container">
{!swapsWelcomeMessageHasBeenShown && swapsEnabled ? (
{!swapsWelcomeMessageHasBeenShown && swapsEnabled && isMainnet ? (
<SwapsIntroPopup onClose={setSwapsWelcomeMessageHasBeenShown} />
) : null}
{ isPopup && !connectedStatusPopoverHasBeenShown ? this.renderPopover() : null }

View File

@ -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),
}
}