-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: Upgrade MetaMask to version
11.5.1
- Loading branch information
1 parent
96a413e
commit 7aeb8e5
Showing
51 changed files
with
347 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export * from './popups' | ||
export * from './lock' | ||
export * from './importWalletFromPrivateKey' | ||
export * from './switchAccount' | ||
export * from './settings' | ||
export * from './switchNetwork' | ||
export * from './addNetwork' | ||
export * from './toggleShowTestNetworks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
wallets/metamask/src/pages/HomePage/actions/popups/closePopover.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Page } from '@playwright/test' | ||
import { clickLocatorIfCondition } from '../../../../utils/closePopup' | ||
import Selectors from '../../selectors' | ||
|
||
// Closes the popover with news, rainbows, unicorns, and other stuff. | ||
export async function closePopover(page: Page) { | ||
const closeButtonLocator = page.locator(Selectors.popover.closeButton) | ||
|
||
// TODO: Extract & make configurable | ||
await clickLocatorIfCondition(closeButtonLocator, () => closeButtonLocator.isVisible(), 1_000) | ||
} |
10 changes: 10 additions & 0 deletions
10
wallets/metamask/src/pages/HomePage/actions/popups/closeRecoveryPhraseReminder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { Page } from '@playwright/test' | ||
import { clickLocatorIfCondition } from '../../../../utils/closePopup' | ||
import Selectors from '../../selectors' | ||
|
||
export async function closeRecoveryPhraseReminder(page: Page) { | ||
const closeButtonLocator = page.locator(Selectors.recoveryPhraseReminder.gotItButton) | ||
|
||
// TODO: Extract & make configurable | ||
await clickLocatorIfCondition(closeButtonLocator, () => closeButtonLocator.isVisible(), 1_000) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './closePopover' | ||
export * from './closeRecoveryPhraseReminder' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,28 @@ | ||
import type { Locator, Page } from '@playwright/test' | ||
import { waitFor } from '../../../utils/waitFor' | ||
import type { Page } from '@playwright/test' | ||
import { toggle } from '../../../utils/toggle' | ||
import Selectors from '../selectors' | ||
import type { SettingsSidebarMenus } from '../selectors/settings' | ||
|
||
async function openSettings(page: Page) { | ||
await page.locator(Selectors.accountMenu.accountMenuButton).click() | ||
await page.locator(Selectors.accountMenu.settingsButton).click() | ||
await page.locator(Selectors.threeDotsMenu.threeDotsButton).click() | ||
await page.locator(Selectors.threeDotsMenu.settingsButton).click() | ||
} | ||
|
||
async function openSidebarMenu(page: Page, menu: SettingsSidebarMenus) { | ||
await page.locator(Selectors.settings.sidebarMenu(menu)).click() | ||
} | ||
|
||
async function toggle(toggleLocator: Locator) { | ||
// TODO: Extract timeout | ||
const classes = await toggleLocator.getAttribute('class', { timeout: 3_000 }) | ||
|
||
if (!classes) { | ||
throw new Error('[ToggleShowTestNetworks] Toggle class returned null') | ||
} | ||
|
||
const isOn = classes.includes('toggle-button--on') | ||
|
||
await toggleLocator.click() | ||
|
||
const waitForAction = async () => { | ||
const classes = await toggleLocator.getAttribute('class') | ||
|
||
if (!classes) { | ||
throw new Error('[ToggleShowTestNetworks] Toggle class returned null inside waitFor') | ||
} | ||
|
||
if (isOn) { | ||
return classes.includes('toggle-button--off') | ||
} | ||
|
||
return classes.includes('toggle-button--on') | ||
} | ||
|
||
// TODO: Extract timeout | ||
await waitFor(waitForAction, 3_000, true) | ||
} | ||
|
||
async function toggleShowTestNetworks(page: Page) { | ||
// .nth(0) -> Show conversion on test networks | ||
// .nth(1) -> Show test networks | ||
const toggleLocator = page.locator(Selectors.settings.advanced.showTestNetworksToggle).nth(1) | ||
await toggle(toggleLocator) | ||
} | ||
|
||
async function toggleImprovedTokenAllowanceExperience(page: Page) { | ||
const toggleLocator = page.locator(Selectors.settings.experimental.toggleImprovedTokenAllowanceExperience) | ||
async function toggleDismissSecretRecoveryPhraseReminder(page: Page) { | ||
const toggleLocator = page.locator(Selectors.settings.advanced.dismissSecretRecoveryPhraseReminderToggle) | ||
await toggle(toggleLocator) | ||
} | ||
|
||
const advanced = { | ||
toggleShowTestNetworks | ||
} | ||
|
||
const experimental = { | ||
toggleImprovedTokenAllowanceExperience | ||
toggleDismissSecretRecoveryPhraseReminder | ||
} | ||
|
||
export const settings = { | ||
openSettings, | ||
openSidebarMenu, | ||
advanced, | ||
experimental | ||
advanced | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
wallets/metamask/src/pages/HomePage/actions/toggleShowTestNetworks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Page } from '@playwright/test' | ||
import { toggle } from '../../../utils/toggle' | ||
import Selectors from '../selectors' | ||
|
||
// Toggling this through the network dropdown instead of the settings page is a better approach. | ||
// This is in most cases the faster approach, but it's also more reliable. | ||
export async function toggleShowTestNetworks(page: Page) { | ||
await page.locator(Selectors.networkDropdown.dropdownButton).click() | ||
|
||
await toggle(page.locator(Selectors.networkDropdown.showTestNetworksToggle)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.