-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: eth_sign, MetaMask settings page
- Loading branch information
Showing
10 changed files
with
136 additions
and
5 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
7 changes: 7 additions & 0 deletions
7
wallets/metamask/src/pages/SettingsPage/actions/disableEthSign.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,7 @@ | ||
import type { Page } from '@playwright/test' | ||
import Selectors from '../selectors' | ||
|
||
export default async function disableEthSign(page: Page) { | ||
await page.locator(Selectors.settings.advancedSettings).click() | ||
await page.locator(Selectors.settings.ethSignToggle).click() | ||
} |
18 changes: 18 additions & 0 deletions
18
wallets/metamask/src/pages/SettingsPage/actions/enableEthSign.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,18 @@ | ||
import type { Page } from '@playwright/test' | ||
import Selectors from '../selectors' | ||
|
||
export default async function enableEthSign(page: Page) { | ||
// Settings | ||
await page.locator(Selectors.settings.advancedSettings).click() | ||
await page.locator(Selectors.settings.ethSignToggle).click() | ||
|
||
// Confirmation modal | ||
await page.locator(Selectors.confirmationModal.confirmationCheckbox).click() | ||
await page.locator(Selectors.confirmationModal.continueButton).click() | ||
await page.locator(Selectors.confirmationModal.manualConfirmationInput).focus() | ||
await page.locator(Selectors.confirmationModal.manualConfirmationInput).fill('I only sign what I understand') | ||
await page.locator(Selectors.confirmationModal.enableButton).click() | ||
|
||
// Wait for warning | ||
await page.locator(Selectors.settings.ethSignWarning).isVisible() | ||
} |
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 { default as enableEthSign } from './enableEthSign' | ||
export { default as disableEthSign } from './disableEthSign' |
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,22 @@ | ||
import type { Page } from '@playwright/test' | ||
import { enableEthSign } from './actions' | ||
import Selectors from './selectors' | ||
import disableEthSign from './actions/disableEthSign' | ||
|
||
export class SettingsPage { | ||
static readonly selectors = Selectors | ||
|
||
readonly page: Page | ||
|
||
constructor(page: Page) { | ||
this.page = page | ||
} | ||
|
||
async enableEthSign() { | ||
await enableEthSign(this.page) | ||
} | ||
|
||
async disableEthSign() { | ||
await disableEthSign(this.page) | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
wallets/metamask/src/pages/SettingsPage/selectors/index.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,23 @@ | ||
import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector' | ||
|
||
const menuOption = '.settings-page__content__tabs .tab-bar .tab-bar__tab' | ||
|
||
const settings = { | ||
menuOption, | ||
advancedSettings: `${menuOption}:nth-child(2)`, | ||
ethSignToggle: `${createDataTestSelector('advanced-setting-toggle-ethsign')} .eth-sign-toggle`, | ||
ethSignWarning: | ||
'.settings-page__content-row .mm-banner-alert.mm-banner-alert--severity-danger.mm-box--background-color-error-muted' | ||
} | ||
|
||
const confirmationModal = { | ||
confirmationCheckbox: createDataTestSelector('eth-sign__checkbox'), | ||
continueButton: '.modal__content button.mm-button-primary', | ||
manualConfirmationInput: '#enter-eth-sign-text', | ||
enableButton: '.modal__content button.mm-button-primary.mm-button-primary--type-danger' | ||
} | ||
|
||
export default { | ||
settings, | ||
confirmationModal | ||
} |
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