-
-
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.
- Loading branch information
1 parent
769d933
commit 2327937
Showing
33 changed files
with
353 additions
and
356 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
declare module 'unzip-crx-3'; | ||
declare module 'unzip-crx-3' |
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 +1 @@ | ||
export * from './getExtensionId' | ||
export * from './getExtensionId' |
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,3 +1,3 @@ | ||
export * from './PhantomWallet' | ||
export * from './utils' | ||
export * from './fixtures/phantomFixtures' | ||
export * from './fixtures/phantomFixtures' |
12 changes: 6 additions & 6 deletions
12
wallets/phantom/src/pages/ConfirmationPage/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 |
---|---|---|
@@ -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, | ||
}; | ||
footer | ||
} |
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,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)) | ||
} | ||
} |
20 changes: 11 additions & 9 deletions
20
wallets/phantom/src/pages/HomePage/actions/closePopupAndTooltips.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 |
---|---|---|
@@ -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; | ||
} | ||
return true | ||
} |
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
16 changes: 8 additions & 8 deletions
16
wallets/phantom/src/pages/HomePage/actions/getWalletAddress.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 |
---|---|---|
@@ -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; | ||
} | ||
return walletAddress | ||
} |
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,4 +1,4 @@ | ||
export * from './changeAccount' | ||
export * from './closePopupAndTooltips' | ||
export * from './getWalletAddress' | ||
export * from './disconnectFromApp' | ||
export * from './disconnectFromApp' |
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.