diff --git a/packages/cache/src/prepareExtension.ts b/packages/cache/src/prepareExtension.ts index bd2dea080..c98c16016 100644 --- a/packages/cache/src/prepareExtension.ts +++ b/packages/cache/src/prepareExtension.ts @@ -1,5 +1,5 @@ import download from 'download' -import unzipCrx from 'unzip-crx-3'; +import unzipCrx from 'unzip-crx-3' import { downloadFile, ensureCacheDirExists, unzipArchive } from '.' interface ExtensionConfig { @@ -26,8 +26,7 @@ export async function getExtensionConfig(name: string): Promise { name: 'Phantom', version: 'phantom-chrome-latest', - downloadUrl: - 'https://crx-backup.phantom.dev/latest.crx' + downloadUrl: 'https://crx-backup.phantom.dev/latest.crx' } ] } @@ -47,13 +46,12 @@ export async function prepareExtension(extensionName: string) { const outputPath = `${cacheDirPath}/latest` downloadResult = await download(extensionConfig.downloadUrl, cacheDirPath, { headers: { - Accept: 'application/octet-stream', - }, - }); + Accept: 'application/octet-stream' + } + }) await unzipCrx('.cache-synpress/latest.crx', outputPath) return outputPath - } - else { + } else { downloadResult = await downloadFile({ url: extensionConfig.downloadUrl, outputDir: cacheDirPath, @@ -62,7 +60,7 @@ export async function prepareExtension(extensionName: string) { const unzipResult = await unzipArchive({ archivePath: downloadResult.filePath }) - + return unzipResult.outputPath } } diff --git a/packages/cache/src/unzip.d.ts b/packages/cache/src/unzip.d.ts index 74f5f100f..bee17e7ac 100644 --- a/packages/cache/src/unzip.d.ts +++ b/packages/cache/src/unzip.d.ts @@ -1 +1 @@ -declare module 'unzip-crx-3'; \ No newline at end of file +declare module 'unzip-crx-3' diff --git a/wallets/phantom/src/PhantomWallet.ts b/wallets/phantom/src/PhantomWallet.ts index 5eb5a190a..5d2b0145a 100644 --- a/wallets/phantom/src/PhantomWallet.ts +++ b/wallets/phantom/src/PhantomWallet.ts @@ -1,9 +1,9 @@ import { type BrowserContext, type Page } from '@playwright/test' +import { ConfirmationPage } from './pages/ConfirmationPage/page' import { HomePage } from './pages/HomePage/page' import { LockPage } from './pages/LockPage/page' import { NotificationPage } from './pages/NotificationPage/page' import { SettingsPage } from './pages/SettingsPage/page' -import { ConfirmationPage } from './pages/ConfirmationPage/page' export class PhantomWallet { readonly lockPage: LockPage diff --git a/wallets/phantom/src/fixtureActions/index.ts b/wallets/phantom/src/fixtureActions/index.ts index 77a094411..525f21338 100644 --- a/wallets/phantom/src/fixtureActions/index.ts +++ b/wallets/phantom/src/fixtureActions/index.ts @@ -1 +1 @@ -export * from './getExtensionId' \ No newline at end of file +export * from './getExtensionId' diff --git a/wallets/phantom/src/index.ts b/wallets/phantom/src/index.ts index 237c76da9..c67eebaf4 100644 --- a/wallets/phantom/src/index.ts +++ b/wallets/phantom/src/index.ts @@ -1,3 +1,3 @@ export * from './PhantomWallet' export * from './utils' -export * from './fixtures/phantomFixtures' \ No newline at end of file +export * from './fixtures/phantomFixtures' diff --git a/wallets/phantom/src/pages/ConfirmationPage/selectors/index.ts b/wallets/phantom/src/pages/ConfirmationPage/selectors/index.ts index 224ff168e..106a1ef74 100644 --- a/wallets/phantom/src/pages/ConfirmationPage/selectors/index.ts +++ b/wallets/phantom/src/pages/ConfirmationPage/selectors/index.ts @@ -1,12 +1,12 @@ -const confirmationPage = '.confirmation-page'; -const confirmationPageFooter = `${confirmationPage} .confirmation-footer`; +const confirmationPage = '.confirmation-page' +const confirmationPageFooter = `${confirmationPage} .confirmation-footer` const footer = { footer: confirmationPageFooter, cancelButton: `${confirmationPageFooter} .btn-secondary`, - approveButton: `${confirmationPageFooter} .btn-primary`, -}; + approveButton: `${confirmationPageFooter} .btn-primary` +} export const confirmationPageElements = { confirmationPage, - footer, -}; \ No newline at end of file + footer +} diff --git a/wallets/phantom/src/pages/HomePage/actions/changeAccount.ts b/wallets/phantom/src/pages/HomePage/actions/changeAccount.ts index 30172fd33..d5a7d1305 100644 --- a/wallets/phantom/src/pages/HomePage/actions/changeAccount.ts +++ b/wallets/phantom/src/pages/HomePage/actions/changeAccount.ts @@ -1,8 +1,8 @@ -import type { Page } from "@playwright/test"; -import { homePageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { homePageElements } from '../selectors' export const changeAccount = async (page: Page, accountIndex = 1) => { await page.waitForLoadState('domcontentloaded') - await page.click(homePageElements.settingsMenu.settingsMenuButton); + await page.click(homePageElements.settingsMenu.settingsMenuButton) await page.click(homePageElements.accountMenu.accountButton(accountIndex)) -} \ No newline at end of file +} diff --git a/wallets/phantom/src/pages/HomePage/actions/closePopupAndTooltips.ts b/wallets/phantom/src/pages/HomePage/actions/closePopupAndTooltips.ts index cb495cdfd..06b83ce28 100644 --- a/wallets/phantom/src/pages/HomePage/actions/closePopupAndTooltips.ts +++ b/wallets/phantom/src/pages/HomePage/actions/closePopupAndTooltips.ts @@ -1,24 +1,26 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { homePageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { homePageElements } from '../selectors' export const closePopupAndTooltips = async (page: Page, extensionId: string) => { - const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId); + const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) // note: this is required for fast execution of e2e tests to avoid flakiness // otherwise popup may not be detected properly and not closed const popupIsVisible = await notificationPage.locator(homePageElements.popup.container).isVisible() const closeIsVisible = await notificationPage.locator(homePageElements.tippyTooltip.closeButton).isVisible() - const actionableMessageIsVisible = await notificationPage.locator(homePageElements.actionableMessage.closeButton).isVisible() + const actionableMessageIsVisible = await notificationPage + .locator(homePageElements.actionableMessage.closeButton) + .isVisible() if (popupIsVisible) { const popupBackground = await notificationPage.locator(homePageElements.popup.background) - const popupBackgroundBox = await popupBackground.boundingBox(); + const popupBackgroundBox = await popupBackground.boundingBox() await notificationPage.mouse.click(popupBackgroundBox?.x! + 1, popupBackgroundBox?.y! + 1) } if (closeIsVisible) { - await page.click(homePageElements.tippyTooltip.closeButton); + await page.click(homePageElements.tippyTooltip.closeButton) } if (actionableMessageIsVisible) { await page.click(homePageElements.actionableMessage.closeButton) } - return true; -} \ No newline at end of file + return true +} diff --git a/wallets/phantom/src/pages/HomePage/actions/disconnectFromApp.ts b/wallets/phantom/src/pages/HomePage/actions/disconnectFromApp.ts index c8fae57f0..237ac4b02 100644 --- a/wallets/phantom/src/pages/HomePage/actions/disconnectFromApp.ts +++ b/wallets/phantom/src/pages/HomePage/actions/disconnectFromApp.ts @@ -1,6 +1,6 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { homePageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { homePageElements } from '../selectors' export const disconnectFromApp = async (page: Page, extensionId: string) => { const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) @@ -10,19 +10,16 @@ export const disconnectFromApp = async (page: Page, extensionId: string) => { await notificationPage.click(homePageElements.settingsMenu.trustedAppsRow) const rowButtonLocator = await notificationPage.locator(homePageElements.connectedSites.rowButton) - const hasConnectedSite = await rowButtonLocator.isVisible(); + const hasConnectedSite = await rowButtonLocator.isVisible() - let isDisconnected = false; + let isDisconnected = false if (hasConnectedSite) { await rowButtonLocator.click() await notificationPage.click(homePageElements.connectedSites.trustedAppsRevokeButton) isDisconnected = true + } else { + console.log('[disconnectWalletFromDapp] Wallet is not connected to a dapp, skipping...') } - else { - console.log( - '[disconnectWalletFromDapp] Wallet is not connected to a dapp, skipping...', - ); - } - - return isDisconnected; -} \ No newline at end of file + + return isDisconnected +} diff --git a/wallets/phantom/src/pages/HomePage/actions/getWalletAddress.ts b/wallets/phantom/src/pages/HomePage/actions/getWalletAddress.ts index dd2bfd072..e7c33c097 100644 --- a/wallets/phantom/src/pages/HomePage/actions/getWalletAddress.ts +++ b/wallets/phantom/src/pages/HomePage/actions/getWalletAddress.ts @@ -1,20 +1,20 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { homePageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { homePageElements } from '../selectors' export const getWalletAddress = async (page: Page, extensionId: string, chain = 'eth') => { const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) await notificationPage.hover(homePageElements.accountBar.title) - await new Promise(resolve => setTimeout(resolve, 100)); + await new Promise((resolve) => setTimeout(resolve, 100)) await notificationPage.waitForLoadState('domcontentloaded') if (chain === 'eth') { - await notificationPage.click(homePageElements.accountBar.ethRow); + await notificationPage.click(homePageElements.accountBar.ethRow) } else if (chain === 'solana') { - await notificationPage.click(homePageElements.accountBar.solanaRow); + await notificationPage.click(homePageElements.accountBar.solanaRow) } const walletAddress = await notificationPage.evaluate('navigator.clipboard.readText()') - return walletAddress; -} \ No newline at end of file + return walletAddress +} diff --git a/wallets/phantom/src/pages/HomePage/actions/index.ts b/wallets/phantom/src/pages/HomePage/actions/index.ts index fbc6bf642..579f5447a 100644 --- a/wallets/phantom/src/pages/HomePage/actions/index.ts +++ b/wallets/phantom/src/pages/HomePage/actions/index.ts @@ -1,4 +1,4 @@ export * from './changeAccount' export * from './closePopupAndTooltips' export * from './getWalletAddress' -export * from './disconnectFromApp' \ No newline at end of file +export * from './disconnectFromApp' diff --git a/wallets/phantom/src/pages/HomePage/page.ts b/wallets/phantom/src/pages/HomePage/page.ts index f44be3ce8..1219a49ea 100644 --- a/wallets/phantom/src/pages/HomePage/page.ts +++ b/wallets/phantom/src/pages/HomePage/page.ts @@ -1,6 +1,6 @@ import type { Page } from '@playwright/test' +import { changeAccount, closePopupAndTooltips, disconnectFromApp, getWalletAddress } from './actions' import { homePageElements } from './selectors' -import { changeAccount, getWalletAddress, closePopupAndTooltips, disconnectFromApp } from './actions' export class HomePage { static readonly selectors = homePageElements @@ -16,7 +16,7 @@ export class HomePage { return await changeAccount(this.page, accountIndex) } - async getWalletAddress(extensionId: string, chainId: string){ + async getWalletAddress(extensionId: string, chainId: string) { return await getWalletAddress(this.page, extensionId, chainId) } diff --git a/wallets/phantom/src/pages/HomePage/selectors/index.ts b/wallets/phantom/src/pages/HomePage/selectors/index.ts index 0bddd2f03..08ef3f541 100644 --- a/wallets/phantom/src/pages/HomePage/selectors/index.ts +++ b/wallets/phantom/src/pages/HomePage/selectors/index.ts @@ -1,4 +1,4 @@ -const networkSwitcherButtonSelector = '.network-display'; +const networkSwitcherButtonSelector = '.network-display' const networkSwitcher = { button: networkSwitcherButtonSelector, @@ -9,33 +9,29 @@ const networkSwitcher = { goerliNetworkItem: `[data-testid="network-droppo"] [data-testid="goerli-network-item"]`, sepoliaNetworkItem: `[data-testid="network-droppo"] [data-testid="sepolia-network-item"]`, localhostNetworkItem: `[data-testid="network-droppo"] [data-testid="Localhost 8545-network-item"]`, - networkButton: (number: number) => - `[data-testid="network-droppo"] .dropdown-menu-item:nth-child(${ - 3 + number - })`, -}; + networkButton: (number: number) => `[data-testid="network-droppo"] .dropdown-menu-item:nth-child(${3 + number})` +} - -const walletOverview = '.wallet-overview'; +const walletOverview = '.wallet-overview' const tabs = { assetsButton: '[data-testid="home__asset-tab"] button', - activityButton: '[data-testid="home__activity-tab"] button', -}; + activityButton: '[data-testid="home__activity-tab"] button' +} -const transactionList = '.transaction-list__transactions'; -const pendingTransactionsList = `${transactionList} .transaction-list__pending-transactions`; -const completedTransactionsList = `${transactionList} .transaction-list__completed-transactions`; +const transactionList = '.transaction-list__transactions' +const pendingTransactionsList = `${transactionList} .transaction-list__pending-transactions` +const completedTransactionsList = `${transactionList} .transaction-list__completed-transactions` const activityTab = { transactionList, pendingTransactionsList, completedTransactionsList, unconfirmedTransaction: `${pendingTransactionsList} .transaction-list-item--unconfirmed`, - confirmedTransaction: `${completedTransactionsList} .transaction-list-item`, -}; + confirmedTransaction: `${completedTransactionsList} .transaction-list-item` +} -const popupSelector = '.popover-container'; -const sendPopupSelector = `${popupSelector} .transaction-list-item-details`; +const popupSelector = '.popover-container' +const sendPopupSelector = `${popupSelector} .transaction-list-item-details` const popup = { container: popupSelector, closeButton: '.popover-header__button', @@ -45,25 +41,26 @@ const popup = { speedUpButton: `${sendPopupSelector} .btn-primary`, cancelButton: `${sendPopupSelector} .btn-secondary`, transactionStatus: `${sendPopupSelector} .transaction-status`, - copyTxIdButton: `${sendPopupSelector} .transaction-list-item-details__tx-hash .transaction-list-item-details__header-button a`, - }, -}; + copyTxIdButton: `${sendPopupSelector} .transaction-list-item-details__tx-hash .transaction-list-item-details__header-button a` + } +} -const tippyTooltipSelector = '.tippy-popper'; +const tippyTooltipSelector = '.tippy-popper' const tippyTooltip = { container: tippyTooltipSelector, - closeButton: `${tippyTooltipSelector} button`, -}; + closeButton: `${tippyTooltipSelector} button` +} -const actionableMessageSelector = '.actionable-message'; +const actionableMessageSelector = '.actionable-message' const actionableMessage = { container: actionableMessageSelector, - closeButton: `${actionableMessageSelector} button`, -}; + closeButton: `${actionableMessageSelector} button` +} const accountMenu = { - accountButton: (number: number) => `[data-testid="account-menu"] [data-testid="tooltip_interactive-wrapper"]:nth-child(${number})`, -}; + accountButton: (number: number) => + `[data-testid="account-menu"] [data-testid="tooltip_interactive-wrapper"]:nth-child(${number})` +} const settingsMenu = { settingsMenuButton: '[data-testid="settings-menu-open-button"]', @@ -72,58 +69,58 @@ const settingsMenu = { settingsPreferencesButton: '[data-testid="settings-item-preferences"]', trustedAppsRow: '[data-testid="settings-item-trusted-apps"]', developerSettingsRow: '[data-testid="settings-item-developer-settings"]', - defaultAppWalletRow: '[data-testid="settings-item-metamask-override"]', -}; + defaultAppWalletRow: '[data-testid="settings-item-metamask-override"]' +} const whatsNew = { header: '[data-testid="whats_new-header"]', - continueButton: '[data-testid="whats_new-continue_button"]', -}; + continueButton: '[data-testid="whats_new-continue_button"]' +} const welcome = { takeTheTourButton: '[data-testid="welcome-take_the_tour"]', takeTheTourButtonNext: '[data-testid="primary-button"]', - finishSetup: ['data-testid="onboarding-form-submit-button"'], -}; + finishSetup: ['data-testid="onboarding-form-submit-button"'] +} const accountBar = { title: '[data-testid="tooltip_interactive-wrapper"]', ethRow: '[data-testid="account-header-chain-eip155:1"]', - solanaRow: '[data-testid="account-header-chain-solana:101"]', -}; + solanaRow: '[data-testid="account-header-chain-solana:101"]' +} const defaultWallet = { metamask: '[data-testid="metamask-override--USE_METAMASK"]', phantom: '[data-testid="metamask-override--USE_PHANTOM"]', - always_ask: '[data-testid="metamask-override--ALWAYS_ASK"]', -}; + always_ask: '[data-testid="metamask-override--ALWAYS_ASK"]' +} const connectedSites = { trustedAppsRevokeButton: '[data-testid="trusted-apps-revoke-button"]', trustedAppsBackButton: '[data-testid="header--back"]', - rowButton: '[data-testid="trusted_apps_row-button"]', -}; + rowButton: '[data-testid="trusted_apps_row-button"]' +} const accountModal = { walletAddressInput: '.account-modal .qr-code__address', - closeButton: '.account-modal__close', -}; + closeButton: '.account-modal__close' +} -const importAccountSelector = '.new-account'; +const importAccountSelector = '.new-account' const importAccount = { page: importAccountSelector, input: `${importAccountSelector} #private-key-box`, cancelButton: `${importAccountSelector} .new-account-create-form__button:nth-child(1)`, - importButton: `${importAccountSelector} .new-account-create-form__button:nth-child(2)`, -}; + importButton: `${importAccountSelector} .new-account-create-form__button:nth-child(2)` +} const createAccount = { page: importAccountSelector, input: `${importAccountSelector} .new-account-create-form__input`, cancelButton: `${importAccountSelector} .new-account-create-form__button:nth-child(1)`, - createButton: `${importAccountSelector} .new-account-create-form__button:nth-child(2)`, -}; + createButton: `${importAccountSelector} .new-account-create-form__button:nth-child(2)` +} -const importTokenFormSelector = '.import-token__custom-token-form'; +const importTokenFormSelector = '.import-token__custom-token-form' const importToken = { form: importTokenFormSelector, tokenContractAddressInput: `${importTokenFormSelector} #custom-address`, @@ -132,15 +129,14 @@ const importToken = { tokenDecimalInput: `${importTokenFormSelector} #custom-decimals`, addCustomTokenButton: `[data-testid="page-container-footer-next"]`, confirmImportTokenContent: '.confirm-import-token', - importTokensButton: `.btn-primary`, -}; + importTokensButton: `.btn-primary` +} -const assetNavigationSelector = '.asset-navigation'; +const assetNavigationSelector = '.asset-navigation' const asset = { navigation: assetNavigationSelector, - backButton: `${assetNavigationSelector} [data-testid="asset__back"]`, -}; - + backButton: `${assetNavigationSelector} [data-testid="asset__back"]` +} export const homePageElements = { networkSwitcher, @@ -162,4 +158,4 @@ export const homePageElements = { settingsMenu, actionableMessage, tippyTooltip -} \ No newline at end of file +} diff --git a/wallets/phantom/src/pages/LockPage/actions/createAccount.ts b/wallets/phantom/src/pages/LockPage/actions/createAccount.ts index 9274c33ea..fbf801cd2 100644 --- a/wallets/phantom/src/pages/LockPage/actions/createAccount.ts +++ b/wallets/phantom/src/pages/LockPage/actions/createAccount.ts @@ -1,5 +1,5 @@ import type { Page } from '@playwright/test' -import { lockPageElements } from "../selectors"; +import { lockPageElements } from '../selectors' export const createAccount = async (page: Page, password: string) => { console.log(lockPageElements, page, password) @@ -30,4 +30,4 @@ export const createAccount = async (page: Page, password: string) => { // await page.click(lockPageElements.firstTimeFlowImportPageElements.getStartedButton); // return true; -} \ No newline at end of file +} diff --git a/wallets/phantom/src/pages/LockPage/actions/importAccount.ts b/wallets/phantom/src/pages/LockPage/actions/importAccount.ts index ac82a3293..b40b6c453 100644 --- a/wallets/phantom/src/pages/LockPage/actions/importAccount.ts +++ b/wallets/phantom/src/pages/LockPage/actions/importAccount.ts @@ -1,5 +1,5 @@ import type { Page } from '@playwright/test' -import { lockPageElements } from "../selectors"; +import { lockPageElements } from '../selectors' export const importWallet = async (page: Page, secretWords: string, password: string) => { await page.click(lockPageElements.firstTimeFlowPageElements.importWalletButton) @@ -26,7 +26,7 @@ export const importWallet = async (page: Page, secretWords: string, password: st await page.click(lockPageElements.firstTimeFlowImportPageElements.continueAfterPasswordButton) - await page.click(lockPageElements.firstTimeFlowImportPageElements.getStartedButton); + await page.click(lockPageElements.firstTimeFlowImportPageElements.getStartedButton) - return true; -} \ No newline at end of file + return true +} diff --git a/wallets/phantom/src/pages/LockPage/actions/index.ts b/wallets/phantom/src/pages/LockPage/actions/index.ts index 1110a77a7..aa79e727b 100644 --- a/wallets/phantom/src/pages/LockPage/actions/index.ts +++ b/wallets/phantom/src/pages/LockPage/actions/index.ts @@ -1,3 +1,3 @@ export * from './importAccount' export * from './createAccount' -export * from './unlock' \ No newline at end of file +export * from './unlock' diff --git a/wallets/phantom/src/pages/LockPage/actions/unlock.ts b/wallets/phantom/src/pages/LockPage/actions/unlock.ts index 73a5322bf..1dd8913a2 100644 --- a/wallets/phantom/src/pages/LockPage/actions/unlock.ts +++ b/wallets/phantom/src/pages/LockPage/actions/unlock.ts @@ -1,19 +1,18 @@ import type { Page } from '@playwright/test' -import { lockPageElements } from "../selectors"; -import { closePopupAndTooltips } from '../../HomePage/actions/closePopupAndTooltips'; +import { closePopupAndTooltips } from '../../HomePage/actions/closePopupAndTooltips' +import { lockPageElements } from '../selectors' export const unlock = async (page: Page, extensionId: string, password: string, close = false) => { - await page.waitForLoadState('domcontentloaded') - + const inputField = await page.locator(lockPageElements.unlockPageElements.passwordInput) await inputField.fill(password) - await page.click(lockPageElements.unlockPageElements.unlockButton); + await page.click(lockPageElements.unlockPageElements.unlockButton) - if(close) { - await closePopupAndTooltips(page, extensionId); + if (close) { + await closePopupAndTooltips(page, extensionId) } - - return true; -} \ No newline at end of file + + return true +} diff --git a/wallets/phantom/src/pages/LockPage/page.ts b/wallets/phantom/src/pages/LockPage/page.ts index da7326aec..e7548166a 100644 --- a/wallets/phantom/src/pages/LockPage/page.ts +++ b/wallets/phantom/src/pages/LockPage/page.ts @@ -1,6 +1,6 @@ import type { Page } from '@playwright/test' +import { createAccount, importWallet, unlock } from './actions' import { lockPageElements } from './selectors' -import { importWallet, createAccount, unlock } from './actions' export class LockPage { static readonly selectors = lockPageElements @@ -19,7 +19,7 @@ export class LockPage { //@todo: get this written async createWallet(password: string) { await createAccount(this.page, password) - } + } async unlock(extensionId: string, password: string) { await unlock(this.page, extensionId, password, true) diff --git a/wallets/phantom/src/pages/LockPage/selectors/index.ts b/wallets/phantom/src/pages/LockPage/selectors/index.ts index 2e6da5a88..065f803d0 100644 --- a/wallets/phantom/src/pages/LockPage/selectors/index.ts +++ b/wallets/phantom/src/pages/LockPage/selectors/index.ts @@ -1,44 +1,42 @@ -const app = '#root'; -const welcomePage = '#root'; -const confirmButton = `${welcomePage} .first-time-flow__button`; +const app = '#root' +const welcomePage = '#root' +const confirmButton = `${welcomePage} .first-time-flow__button` const welcomePageElements = { app, welcomePage, - confirmButton, -}; + confirmButton +} -const metametricsPage = '.metametrics-opt-in'; -const optOutAnalyticsButton = `${metametricsPage} [data-testid="page-container-footer-cancel"]`; +const metametricsPage = '.metametrics-opt-in' +const optOutAnalyticsButton = `${metametricsPage} [data-testid="page-container-footer-cancel"]` const metametricsPageElements = { metametricsPage, - optOutAnalyticsButton, -}; + optOutAnalyticsButton +} -const firstTimeFlowPage = '.first-time-flow'; -const importWalletButton = `[data-testid="import-wallet-button"]`; -const importRecoveryPhraseButton = `[data-testid="import-seed-phrase-button"]`; -const createWalletButton = `${firstTimeFlowPage} [data-testid="create-wallet-button"]`; +const firstTimeFlowPage = '.first-time-flow' +const importWalletButton = `[data-testid="import-wallet-button"]` +const importRecoveryPhraseButton = `[data-testid="import-seed-phrase-button"]` +const createWalletButton = `${firstTimeFlowPage} [data-testid="create-wallet-button"]` const firstTimeFlowPageElements = { firstTimeFlowPage, importWalletButton, importRecoveryPhraseButton, - createWalletButton, -}; - -const firstTimeFlowImportPage = '.first-time-flow__import'; -const newVaultForm = `${firstTimeFlowImportPage} .create-new-vault__form`; -const secretWordsInput = (number: number) => - `[data-testid="secret-recovery-phrase-word-input-${number}"]`; -const confirmWordsButton = `[data-testid="onboarding-form-submit-button"]`; -const passwordInput = `[data-testid="onboarding-form-password-input"]`; -const confirmPasswordInput = `[data-testid="onboarding-form-confirm-password-input"]`; -const termsCheckbox = `[data-testid="onboarding-form-terms-of-service-checkbox"]`; -const continueAfterPasswordButton = - '[data-testid="onboarding-form-submit-button"]'; -const getStartedButton = '[data-testid="onboarding-form-submit-button"]'; -const importButton = `${newVaultForm} .create-new-vault__submit-button`; + createWalletButton +} + +const firstTimeFlowImportPage = '.first-time-flow__import' +const newVaultForm = `${firstTimeFlowImportPage} .create-new-vault__form` +const secretWordsInput = (number: number) => `[data-testid="secret-recovery-phrase-word-input-${number}"]` +const confirmWordsButton = `[data-testid="onboarding-form-submit-button"]` +const passwordInput = `[data-testid="onboarding-form-password-input"]` +const confirmPasswordInput = `[data-testid="onboarding-form-confirm-password-input"]` +const termsCheckbox = `[data-testid="onboarding-form-terms-of-service-checkbox"]` +const continueAfterPasswordButton = '[data-testid="onboarding-form-submit-button"]' +const getStartedButton = '[data-testid="onboarding-form-submit-button"]' +const importButton = `${newVaultForm} .create-new-vault__submit-button` const firstTimeFlowImportPageElements = { firstTimeFlowImportPage, @@ -50,51 +48,51 @@ const firstTimeFlowImportPageElements = { importButton, confirmWordsButton, continueAfterPasswordButton, - getStartedButton, -}; + getStartedButton +} -const firstTimeFlowCreatePage = '.first-time-flow'; -const newPasswordInput = `${firstTimeFlowCreatePage} [data-testid="create-password"]`; -const confirmNewPasswordInput = `${firstTimeFlowCreatePage} [data-testid="confirm-password"]`; -const newSignupCheckbox = `${firstTimeFlowCreatePage} .first-time-flow__checkbox`; -const createButton = `${firstTimeFlowCreatePage} .first-time-flow__button`; +const firstTimeFlowCreatePage = '.first-time-flow' +const newPasswordInput = `${firstTimeFlowCreatePage} [data-testid="create-password"]` +const confirmNewPasswordInput = `${firstTimeFlowCreatePage} [data-testid="confirm-password"]` +const newSignupCheckbox = `${firstTimeFlowCreatePage} .first-time-flow__checkbox` +const createButton = `${firstTimeFlowCreatePage} .first-time-flow__button` const firstTimeFlowCreatePagePageElements = { firstTimeFlowCreatePage, newPasswordInput, confirmNewPasswordInput, newSignupCheckbox, - createButton, -}; + createButton +} -const secureYourWalletPage = '[data-testid="seed-phrase-intro"]'; -const nextButton = `${secureYourWalletPage} button`; +const secureYourWalletPage = '[data-testid="seed-phrase-intro"]' +const nextButton = `${secureYourWalletPage} button` const secureYourWalletPageElements = { secureYourWalletPage, - nextButton, -}; + nextButton +} -const revealSeedPage = '[data-testid="reveal-seed-phrase"]'; -const remindLaterButton = `${revealSeedPage} .first-time-flow__button`; +const revealSeedPage = '[data-testid="reveal-seed-phrase"]' +const remindLaterButton = `${revealSeedPage} .first-time-flow__button` const revealSeedPageElements = { revealSeedPage, - remindLaterButton, -}; + remindLaterButton +} -const endOfFlowPage = '[data-testid="end-of-flow"]'; -const allDoneButton = `${endOfFlowPage} [data-testid="EOF-complete-button"]`; +const endOfFlowPage = '[data-testid="end-of-flow"]' +const allDoneButton = `${endOfFlowPage} [data-testid="EOF-complete-button"]` const endOfFlowPageElements = { endOfFlowPage, - allDoneButton, -}; + allDoneButton +} const unlockPageElements = { passwordInput: '[data-testid="unlock-form-password-input"]', - unlockButton: '[data-testid="unlock-form-submit-button"]', -}; + unlockButton: '[data-testid="unlock-form-submit-button"]' +} export const lockPageElements = { endOfFlowPageElements, @@ -105,5 +103,5 @@ export const lockPageElements = { firstTimeFlowPageElements, metametricsPageElements, welcomePageElements, - unlockPageElements, -} \ No newline at end of file + unlockPageElements +} diff --git a/wallets/phantom/src/pages/NotificationPage/actions/acceptAccess.ts b/wallets/phantom/src/pages/NotificationPage/actions/acceptAccess.ts index 552c72b31..2326d7bc0 100644 --- a/wallets/phantom/src/pages/NotificationPage/actions/acceptAccess.ts +++ b/wallets/phantom/src/pages/NotificationPage/actions/acceptAccess.ts @@ -1,9 +1,9 @@ -import { notificationPageElements } from "../selectors"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import type { Page } from "@playwright/test"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { notificationPageElements } from '../selectors' export const acceptAccess = async (page: Page, extensionId: string) => { const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) - await notificationPage.click(notificationPageElements.buttons.primaryButton); - return true; -} \ No newline at end of file + await notificationPage.click(notificationPageElements.buttons.primaryButton) + return true +} diff --git a/wallets/phantom/src/pages/NotificationPage/actions/confirmIncorrectNetwork.ts b/wallets/phantom/src/pages/NotificationPage/actions/confirmIncorrectNetwork.ts index 7d70de68a..dd1d5d079 100644 --- a/wallets/phantom/src/pages/NotificationPage/actions/confirmIncorrectNetwork.ts +++ b/wallets/phantom/src/pages/NotificationPage/actions/confirmIncorrectNetwork.ts @@ -1,10 +1,10 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { notificationPageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { notificationPageElements } from '../selectors' export const confirmIncorrectNetwork = async (page: Page, extensionId: string) => { - const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId); - await notificationPage.click(notificationPageElements.incorrectModePageElements.buttons.close); + const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) + await notificationPage.click(notificationPageElements.incorrectModePageElements.buttons.close) - return true; -} \ No newline at end of file + return true +} diff --git a/wallets/phantom/src/pages/NotificationPage/actions/confirmSignature.ts b/wallets/phantom/src/pages/NotificationPage/actions/confirmSignature.ts index 6c746ec3a..95a6dc645 100644 --- a/wallets/phantom/src/pages/NotificationPage/actions/confirmSignature.ts +++ b/wallets/phantom/src/pages/NotificationPage/actions/confirmSignature.ts @@ -1,10 +1,10 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { notificationPageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { notificationPageElements } from '../selectors' export const confirmSignatureRequest = async (page: Page, extensionId: string) => { - const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId); - await notificationPage.click(notificationPageElements.signaturePageElements.buttons.confirmSign); + const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) + await notificationPage.click(notificationPageElements.signaturePageElements.buttons.confirmSign) - return true; -} \ No newline at end of file + return true +} diff --git a/wallets/phantom/src/pages/NotificationPage/actions/confirmTransaction.ts b/wallets/phantom/src/pages/NotificationPage/actions/confirmTransaction.ts index 3c507229c..033ff1d74 100644 --- a/wallets/phantom/src/pages/NotificationPage/actions/confirmTransaction.ts +++ b/wallets/phantom/src/pages/NotificationPage/actions/confirmTransaction.ts @@ -1,10 +1,10 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { notificationPageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { notificationPageElements } from '../selectors' export const confirmTransaction = async (page: Page, extensionId: string) => { - const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId); - await notificationPage.click(notificationPageElements.transactionPageElements.buttons.confirmTransaction); + const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) + await notificationPage.click(notificationPageElements.transactionPageElements.buttons.confirmTransaction) - return true; -} \ No newline at end of file + return true +} diff --git a/wallets/phantom/src/pages/NotificationPage/actions/lock.ts b/wallets/phantom/src/pages/NotificationPage/actions/lock.ts index f3506fded..bac64ce15 100644 --- a/wallets/phantom/src/pages/NotificationPage/actions/lock.ts +++ b/wallets/phantom/src/pages/NotificationPage/actions/lock.ts @@ -1,14 +1,14 @@ import type { Page } from '@playwright/test' -import { notificationPageElements } from '../selectors' -import { settingsPageElements } from '../../SettingsPage/selectors' import { closePopupAndTooltips } from '../../HomePage/actions/closePopupAndTooltips' +import { settingsPageElements } from '../../SettingsPage/selectors' +import { notificationPageElements } from '../selectors' export const lock = async (page: Page, extensionId: string) => { await page.waitForLoadState('domcontentloaded') - await page.click(notificationPageElements.menu.buttons.settings); + await page.click(notificationPageElements.menu.buttons.settings) await page.click(notificationPageElements.menu.buttons.sidebar.settings) await page.click(settingsPageElements.buttons.lockWallet) - await closePopupAndTooltips(page, extensionId); - return true; -} \ No newline at end of file + await closePopupAndTooltips(page, extensionId) + return true +} diff --git a/wallets/phantom/src/pages/NotificationPage/actions/rejectSignature.ts b/wallets/phantom/src/pages/NotificationPage/actions/rejectSignature.ts index dc1982aa9..505e495e6 100644 --- a/wallets/phantom/src/pages/NotificationPage/actions/rejectSignature.ts +++ b/wallets/phantom/src/pages/NotificationPage/actions/rejectSignature.ts @@ -1,10 +1,10 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { notificationPageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { notificationPageElements } from '../selectors' export const rejectSignatureRequest = async (page: Page, extensionId: string) => { - const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId); - await notificationPage.click(notificationPageElements.signaturePageElements.buttons.rejectSign); + const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) + await notificationPage.click(notificationPageElements.signaturePageElements.buttons.rejectSign) - return true; -} \ No newline at end of file + return true +} diff --git a/wallets/phantom/src/pages/NotificationPage/actions/rejectTransaction.ts b/wallets/phantom/src/pages/NotificationPage/actions/rejectTransaction.ts index 016ff2988..78f7ca9d6 100644 --- a/wallets/phantom/src/pages/NotificationPage/actions/rejectTransaction.ts +++ b/wallets/phantom/src/pages/NotificationPage/actions/rejectTransaction.ts @@ -1,11 +1,10 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { notificationPageElements } from "../selectors"; - +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { notificationPageElements } from '../selectors' export const rejectTransaction = async (page: Page, extensionId: string) => { - const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId); - await notificationPage.click(notificationPageElements.transactionPageElements.buttons.rejectTransaction); + const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) + await notificationPage.click(notificationPageElements.transactionPageElements.buttons.rejectTransaction) - return true; -} \ No newline at end of file + return true +} diff --git a/wallets/phantom/src/pages/NotificationPage/actions/selectWallet.ts b/wallets/phantom/src/pages/NotificationPage/actions/selectWallet.ts index b5cf623ed..b57e22e5b 100644 --- a/wallets/phantom/src/pages/NotificationPage/actions/selectWallet.ts +++ b/wallets/phantom/src/pages/NotificationPage/actions/selectWallet.ts @@ -1,9 +1,9 @@ -import type { Page } from "@playwright/test"; -import { getNotificationPageAndWaitForLoad } from "../../../utils/getNotificationAndWaitForLoads"; -import { notificationPageElements } from "../selectors"; +import type { Page } from '@playwright/test' +import { getNotificationPageAndWaitForLoad } from '../../../utils/getNotificationAndWaitForLoads' +import { notificationPageElements } from '../selectors' export const selectWallet = async (page: Page, extensionId: string, wallet: string) => { - const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId); + const notificationPage = await getNotificationPageAndWaitForLoad(page.context(), extensionId) if (wallet === 'metamask') { await notificationPage.click(notificationPageElements.selectWalletElements.buttons.continueWithMetamask) } @@ -11,5 +11,5 @@ export const selectWallet = async (page: Page, extensionId: string, wallet: stri await notificationPage.click(notificationPageElements.selectWalletElements.buttons.continueWithPhantom) } - return true; -} \ No newline at end of file + return true +} diff --git a/wallets/phantom/src/pages/NotificationPage/page.ts b/wallets/phantom/src/pages/NotificationPage/page.ts index 7259d54d9..f80d42687 100644 --- a/wallets/phantom/src/pages/NotificationPage/page.ts +++ b/wallets/phantom/src/pages/NotificationPage/page.ts @@ -1,6 +1,15 @@ import type { Page } from '@playwright/test' +import { + acceptAccess, + confirmIncorrectNetwork, + confirmSignatureRequest, + confirmTransaction, + lock, + rejectSignatureRequest, + rejectTransaction, + selectWallet +} from './actions' import { notificationPageElements } from './selectors' -import { acceptAccess, confirmIncorrectNetwork, confirmSignatureRequest, confirmTransaction, rejectSignatureRequest, rejectTransaction, lock, selectWallet } from './actions' export class NotificationPage { static readonly selectors = notificationPageElements diff --git a/wallets/phantom/src/pages/NotificationPage/selectors/index.ts b/wallets/phantom/src/pages/NotificationPage/selectors/index.ts index da3521978..efdf02b16 100644 --- a/wallets/phantom/src/pages/NotificationPage/selectors/index.ts +++ b/wallets/phantom/src/pages/NotificationPage/selectors/index.ts @@ -1,11 +1,11 @@ -const notificationPage = '.notification'; -const notificationAppContent = `${notificationPage} #app-content .app`; -const loadingLogo = `${notificationPage} #loading__logo`; -const loadingSpinner = `${notificationPage} #loading__spinner`; -const nextButton = `${notificationPage} .permissions-connect-choose-account__bottom-buttons .btn-primary`; -const allowToSpendButton = `${notificationPage} [data-testid="page-container-footer-next"]`; -const rejectToSpendButton = `${notificationPage} [data-testid="page-container-footer-cancel"]`; -const selectAllCheckbox = `${notificationPage} .choose-account-list__header-check-box`; +const notificationPage = '.notification' +const notificationAppContent = `${notificationPage} #app-content .app` +const loadingLogo = `${notificationPage} #loading__logo` +const loadingSpinner = `${notificationPage} #loading__spinner` +const nextButton = `${notificationPage} .permissions-connect-choose-account__bottom-buttons .btn-primary` +const allowToSpendButton = `${notificationPage} [data-testid="page-container-footer-next"]` +const rejectToSpendButton = `${notificationPage} [data-testid="page-container-footer-cancel"]` +const selectAllCheckbox = `${notificationPage} .choose-account-list__header-check-box` const notificationElements = { notificationPage, @@ -15,76 +15,76 @@ const notificationElements = { nextButton, allowToSpendButton, rejectToSpendButton, - selectAllCheckbox, -}; + selectAllCheckbox +} -const confirmSignatureRequestButton = `${notificationPage} .request-signature__footer__sign-button`; -const rejectSignatureRequestButton = `${notificationPage} .request-signature__footer__cancel-button`; -const signatureRequestScrollDownButton = `${notificationPage} [data-testid="signature-request-scroll-button"]`; +const confirmSignatureRequestButton = `${notificationPage} .request-signature__footer__sign-button` +const rejectSignatureRequestButton = `${notificationPage} .request-signature__footer__cancel-button` +const signatureRequestScrollDownButton = `${notificationPage} [data-testid="signature-request-scroll-button"]` -const confirmDataSignatureRequestButton = `${notificationPage} [data-testid="signature-sign-button"]`; -const rejectDataSignatureRequestButton = `${notificationPage} [data-testid="signature-cancel-button"]`; +const confirmDataSignatureRequestButton = `${notificationPage} [data-testid="signature-sign-button"]` +const rejectDataSignatureRequestButton = `${notificationPage} [data-testid="signature-cancel-button"]` const dataSignaturePageElements = { confirmDataSignatureRequestButton, rejectDataSignatureRequestButton, - signatureRequestScrollDownButton, -}; + signatureRequestScrollDownButton +} -const permissionsPage = '.permissions-connect'; -const connectButton = `${permissionsPage} .permission-approval-container__footers .btn-primary`; +const permissionsPage = '.permissions-connect' +const connectButton = `${permissionsPage} .permission-approval-container__footers .btn-primary` const permissionsPageElements = { permissionsPage, - connectButton, -}; + connectButton +} -const popupContainer = '.popover-container'; -const popupCloseButton = `${popupContainer} .popover-header__button`; -const popupCopyRecipientPublicAddressButton = `${popupContainer} .nickname-popover__public-address button`; -const recipientPublicAddress = `${popupContainer} .nickname-popover__public-address__constant`; +const popupContainer = '.popover-container' +const popupCloseButton = `${popupContainer} .popover-header__button` +const popupCopyRecipientPublicAddressButton = `${popupContainer} .nickname-popover__public-address button` +const recipientPublicAddress = `${popupContainer} .nickname-popover__public-address__constant` const recipientPopupElements = { popupContainer, popupCloseButton, popupCopyRecipientPublicAddressButton, - recipientPublicAddress, -}; - -const confirmPageHeader = `${notificationPage} .confirm-page-container-header`; -const confirmPageContent = `${notificationPage} .confirm-page-container-content`; -const networkLabel = `${confirmPageHeader} .network-display`; -const senderButton = `${confirmPageHeader} .sender-to-recipient__party--sender`; -const recipientButton = `${confirmPageHeader} .sender-to-recipient__party--recipient-with-address`; -const editGasFeeLegacyButton = `${notificationPage} .transaction-detail-edit button`; -const editGasFeeLegacyOverrideAckButton = `${notificationPage} .edit-gas-display .edit-gas-display__dapp-acknowledgement-button`; -const editGasLegacyPopup = `${notificationPage} .edit-gas-popover__wrapper`; -const advancedLegacyGasControls = `${editGasLegacyPopup} .edit-gas-display .advanced-gas-controls`; -const gasLimitLegacyInput = `${advancedLegacyGasControls} .form-field:nth-child(1) input`; -const gasPriceLegacyInput = `${advancedLegacyGasControls} .form-field:nth-child(2) input`; -const saveLegacyButton = `${editGasLegacyPopup} .popover-footer .btn-primary`; -const editGasFeeButton = `${notificationPage} [data-testid="edit-gas-fee-button"]`; -const gasOptionLowButton = `${notificationPage} [data-testid="edit-gas-fee-item-low"]`; -const gasOptionMediumButton = `${notificationPage} [data-testid="edit-gas-fee-item-medium"]`; -const gasOptionHighButton = `${notificationPage} [data-testid="edit-gas-fee-item-high"]`; -const gasOptionDappSuggestedButton = `${notificationPage} [data-testid="edit-gas-fee-item-dappSuggested"]`; -const gasOptionCustomButton = `${notificationPage} [data-testid="edit-gas-fee-item-custom"]`; -const baseFeeInput = `${notificationPage} [data-testid="base-fee-input"]`; -const priorityFeeInput = `${notificationPage} [data-testid="priority-fee-input"]`; -const editGasLimitButton = `${notificationPage} [data-testid="advanced-gas-fee-edit"]`; -const gasLimitInput = `${notificationPage} [data-testid="gas-limit-input"]`; -const saveCustomGasFeeButton = `${notificationPage} .popover-container .btn-primary`; -const totalLabel = `${confirmPageContent} .transaction-detail-item:nth-child(2) .transaction-detail-item__detail-values h6:nth-child(2)`; -const customNonceInput = `${confirmPageContent} .custom-nonce-input input`; -const tabs = `${confirmPageContent} .tabs`; -const detailsButton = `${tabs} .tab:nth-child(1) button`; -const dataButton = `${tabs} .tab:nth-child(2) button`; -const dataTab = `${tabs} .confirm-page-container-content__data`; -const originValue = `${dataTab} .confirm-page-container-content__data-box:nth-child(1) .confirm-page-container-content__data-field:nth-child(1) div:nth-child(2)`; -const bytesValue = `${dataTab} .confirm-page-container-content__data-box:nth-child(1) .confirm-page-container-content__data-field:nth-child(2) div:nth-child(2)`; -const hexDataValue = `${dataTab} .confirm-page-container-content__data-box:nth-child(3)`; -const rejectButton = `${confirmPageContent} [data-testid="page-container-footer-cancel"]`; -const confirmButton = `${confirmPageContent} [data-testid="page-container-footer-next"]`; + recipientPublicAddress +} + +const confirmPageHeader = `${notificationPage} .confirm-page-container-header` +const confirmPageContent = `${notificationPage} .confirm-page-container-content` +const networkLabel = `${confirmPageHeader} .network-display` +const senderButton = `${confirmPageHeader} .sender-to-recipient__party--sender` +const recipientButton = `${confirmPageHeader} .sender-to-recipient__party--recipient-with-address` +const editGasFeeLegacyButton = `${notificationPage} .transaction-detail-edit button` +const editGasFeeLegacyOverrideAckButton = `${notificationPage} .edit-gas-display .edit-gas-display__dapp-acknowledgement-button` +const editGasLegacyPopup = `${notificationPage} .edit-gas-popover__wrapper` +const advancedLegacyGasControls = `${editGasLegacyPopup} .edit-gas-display .advanced-gas-controls` +const gasLimitLegacyInput = `${advancedLegacyGasControls} .form-field:nth-child(1) input` +const gasPriceLegacyInput = `${advancedLegacyGasControls} .form-field:nth-child(2) input` +const saveLegacyButton = `${editGasLegacyPopup} .popover-footer .btn-primary` +const editGasFeeButton = `${notificationPage} [data-testid="edit-gas-fee-button"]` +const gasOptionLowButton = `${notificationPage} [data-testid="edit-gas-fee-item-low"]` +const gasOptionMediumButton = `${notificationPage} [data-testid="edit-gas-fee-item-medium"]` +const gasOptionHighButton = `${notificationPage} [data-testid="edit-gas-fee-item-high"]` +const gasOptionDappSuggestedButton = `${notificationPage} [data-testid="edit-gas-fee-item-dappSuggested"]` +const gasOptionCustomButton = `${notificationPage} [data-testid="edit-gas-fee-item-custom"]` +const baseFeeInput = `${notificationPage} [data-testid="base-fee-input"]` +const priorityFeeInput = `${notificationPage} [data-testid="priority-fee-input"]` +const editGasLimitButton = `${notificationPage} [data-testid="advanced-gas-fee-edit"]` +const gasLimitInput = `${notificationPage} [data-testid="gas-limit-input"]` +const saveCustomGasFeeButton = `${notificationPage} .popover-container .btn-primary` +const totalLabel = `${confirmPageContent} .transaction-detail-item:nth-child(2) .transaction-detail-item__detail-values h6:nth-child(2)` +const customNonceInput = `${confirmPageContent} .custom-nonce-input input` +const tabs = `${confirmPageContent} .tabs` +const detailsButton = `${tabs} .tab:nth-child(1) button` +const dataButton = `${tabs} .tab:nth-child(2) button` +const dataTab = `${tabs} .confirm-page-container-content__data` +const originValue = `${dataTab} .confirm-page-container-content__data-box:nth-child(1) .confirm-page-container-content__data-field:nth-child(1) div:nth-child(2)` +const bytesValue = `${dataTab} .confirm-page-container-content__data-box:nth-child(1) .confirm-page-container-content__data-field:nth-child(2) div:nth-child(2)` +const hexDataValue = `${dataTab} .confirm-page-container-content__data-box:nth-child(3)` +const rejectButton = `${confirmPageContent} [data-testid="page-container-footer-cancel"]` +const confirmButton = `${confirmPageContent} [data-testid="page-container-footer-next"]` const confirmPageElements = { notificationPage, @@ -121,47 +121,47 @@ const confirmPageElements = { bytesValue, hexDataValue, rejectButton, - confirmButton, -}; + confirmButton +} -const confirmEncryptionPublicKeyButton = `${notificationPage} .request-encryption-public-key__footer__sign-button`; -const rejectEncryptionPublicKeyButton = `${notificationPage} .request-encryption-public-key__footer__cancel-button`; +const confirmEncryptionPublicKeyButton = `${notificationPage} .request-encryption-public-key__footer__sign-button` +const rejectEncryptionPublicKeyButton = `${notificationPage} .request-encryption-public-key__footer__cancel-button` const encryptionPublicKeyPageElements = { confirmEncryptionPublicKeyButton, - rejectEncryptionPublicKeyButton, -}; + rejectEncryptionPublicKeyButton +} -const confirmDecryptionRequestButton = `${notificationPage} .request-decrypt-message__footer__sign-button`; -const rejectDecryptionRequestButton = `${notificationPage} .request-decrypt-message__footer__cancel-button`; +const confirmDecryptionRequestButton = `${notificationPage} .request-decrypt-message__footer__sign-button` +const rejectDecryptionRequestButton = `${notificationPage} .request-decrypt-message__footer__cancel-button` const decryptPageElements = { confirmDecryptionRequestButton, - rejectDecryptionRequestButton, -}; + rejectDecryptionRequestButton +} -const confirmAddTokenButton = `${notificationPage} .btn-primary`; -const rejectAddTokenButton = `${notificationPage} .btn-secondary`; +const confirmAddTokenButton = `${notificationPage} .btn-primary` +const rejectAddTokenButton = `${notificationPage} .btn-secondary` const addTokenPageElements = { confirmAddTokenButton, - rejectAddTokenButton, -}; + rejectAddTokenButton +} /** * ADJUSTED */ -const root = '#root'; +const root = '#root' const app = { - root, -}; + root +} -const primaryButton = '[data-testid="primary-button"]'; +const primaryButton = '[data-testid="primary-button"]' const buttons = { - primaryButton, -}; + primaryButton +} /** * NEW @@ -170,42 +170,42 @@ const signaturePageElements = { buttons: { confirmSign: '[data-testid="primary-button"]', rejectSign: '[data-testid="secondary-button"]', - signatureRequestScrollDownButton, - }, -}; + signatureRequestScrollDownButton + } +} const transactionPageElements = { buttons: { confirmTransaction: '[data-testid="primary-button"]', - rejectTransaction: '[data-testid="secondary-button"]', - }, -}; + rejectTransaction: '[data-testid="secondary-button"]' + } +} const menu = { buttons: { settings: '[data-testid="settings-menu-open-button"]', sidebar: { - settings: '[data-testid="sidebar_menu-button-settings"]', - }, - }, -}; + settings: '[data-testid="sidebar_menu-button-settings"]' + } + } +} const incorrectModePageElements = { buttons: { - close: '[data-testid="incorrect-mode"] button', - }, -}; + close: '[data-testid="incorrect-mode"] button' + } +} const selectWalletElements = { buttons: { continueWithPhantom: '[data-testid="select_wallet--phantom"]', - continueWithMetamask: '[data-testid="select_wallet--metamask"]', - }, -}; + continueWithMetamask: '[data-testid="select_wallet--metamask"]' + } +} export const notificationPageElements = { notificationElements, - incorrectModePageElements, + incorrectModePageElements, menu, transactionPageElements, signaturePageElements, @@ -221,5 +221,5 @@ export const notificationPageElements = { permissionsPageElements, confirmSignatureRequestButton, rejectSignatureRequestButton, - selectWalletElements, -} \ No newline at end of file + selectWalletElements +} diff --git a/wallets/phantom/src/pages/SettingsPage/selectors/index.ts b/wallets/phantom/src/pages/SettingsPage/selectors/index.ts index 0e5207508..5a2c8da0c 100644 --- a/wallets/phantom/src/pages/SettingsPage/selectors/index.ts +++ b/wallets/phantom/src/pages/SettingsPage/selectors/index.ts @@ -1,5 +1,5 @@ export const settingsPageElements = { buttons: { - lockWallet: '[data-testid="lock-menu-item"]', - }, -}; \ No newline at end of file + lockWallet: '[data-testid="lock-menu-item"]' + } +} diff --git a/wallets/phantom/src/utils/getExtensionPage.ts b/wallets/phantom/src/utils/getExtensionPage.ts index 816efd0bb..0a684dcee 100644 --- a/wallets/phantom/src/utils/getExtensionPage.ts +++ b/wallets/phantom/src/utils/getExtensionPage.ts @@ -1,7 +1,7 @@ -import type { Page } from "@playwright/test"; +import type { Page } from '@playwright/test' export const getExtensionPage = async (page: Page, extensionId: string, route: string) => { - const extensionHomeUrl = `chrome-extension://${extensionId}/notification.html`; + const extensionHomeUrl = `chrome-extension://${extensionId}/notification.html` const routes: any = { advanced: `${extensionHomeUrl}#settings/advanced`, @@ -10,8 +10,8 @@ export const getExtensionPage = async (page: Page, extensionId: string, route: s addNetwork: `${extensionHomeUrl}#settings/networks/add-network`, newAccount: `${extensionHomeUrl}#new-account`, importAccount: `${extensionHomeUrl}#new-account/import`, - importToken: `${extensionHomeUrl}#import-token`, + importToken: `${extensionHomeUrl}#import-token` } page.goto(routes[route]) -} \ No newline at end of file +} diff --git a/wallets/phantom/src/utils/index.ts b/wallets/phantom/src/utils/index.ts index d6f677629..77ad67959 100644 --- a/wallets/phantom/src/utils/index.ts +++ b/wallets/phantom/src/utils/index.ts @@ -1 +1 @@ -export * from './selectors/loading' \ No newline at end of file +export * from './selectors/loading' diff --git a/wallets/phantom/src/utils/selectors/loading.ts b/wallets/phantom/src/utils/selectors/loading.ts index 762984e45..68ff4a0ad 100644 --- a/wallets/phantom/src/utils/selectors/loading.ts +++ b/wallets/phantom/src/utils/selectors/loading.ts @@ -1,10 +1,9 @@ -const loadingLogo = '.loading-logo'; -const loadingSpinner = '.loading-spinner'; -const loadingOverlay = '.loading-overlay'; -const loadingOverlaySpinner = '.loading-overlay__spinner'; -const loadingOverlayErrorButtons = '.loading-overlay__error-buttons'; -const loadingOverlayErrorButtonsRetryButton = - '.loading-overlay__error-buttons .btn-primary'; +const loadingLogo = '.loading-logo' +const loadingSpinner = '.loading-spinner' +const loadingOverlay = '.loading-overlay' +const loadingOverlaySpinner = '.loading-overlay__spinner' +const loadingOverlayErrorButtons = '.loading-overlay__error-buttons' +const loadingOverlayErrorButtonsRetryButton = '.loading-overlay__error-buttons .btn-primary' export const loadingElements = { loadingLogo, @@ -12,5 +11,5 @@ export const loadingElements = { loadingOverlay, loadingOverlaySpinner, loadingOverlayErrorButtons, - loadingOverlayErrorButtonsRetryButton, -}; \ No newline at end of file + loadingOverlayErrorButtonsRetryButton +}