-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
cdd98f2
commit 339fdab
Showing
4 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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); | ||
// 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() | ||
if (popupIsVisible) { | ||
const popupBackground = await notificationPage.locator(homePageElements.popup.background) | ||
const popupBackgroundBox = await popupBackground.boundingBox(); | ||
await notificationPage.mouse.click(popupBackgroundBox?.x! + 1, popupBackgroundBox?.y! + 1) | ||
} | ||
if (closeIsVisible) { | ||
await page.click(homePageElements.tippyTooltip.closeButton); | ||
} | ||
if (actionableMessageIsVisible) { | ||
await page.click(homePageElements.actionableMessage.closeButton) | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import type { Page } from '@playwright/test' | ||
import { lockPageElements } from "../selectors"; | ||
import { closePopupAndTooltips } from '../../HomePage/actions/closePopupAndTooltips'; | ||
|
||
export const unlock = async (page: Page, extensionId: string, password: string, close = false) => { | ||
|
||
export const unlock = async (page: Page, password: string, close = false) => { | ||
console.log('close', close) | ||
await page.waitForLoadState('domcontentloaded') | ||
|
||
const inputField = await page.locator(lockPageElements.unlockPageElements.passwordInput) | ||
await inputField.fill(password) | ||
|
||
await page.click(lockPageElements.unlockPageElements.unlockButton); | ||
|
||
// if(close) { | ||
// await module.exports.closePopupAndTooltips(); | ||
// } | ||
if(close) { | ||
await closePopupAndTooltips(page, extensionId); | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export * from './acceptAccess' | ||
export * from './confirmSignature' | ||
export * from './rejectSignature' | ||
export * from './lock' | ||
export * from './selectWallet' | ||
export * from './rejectTransaction' | ||
export * from './confirmTransaction' | ||
export * from './confirmIncorrectNetwork' |
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,13 +1,14 @@ | ||
import type { Page } from '@playwright/test' | ||
import { notificationPageElements } from '../selectors' | ||
import { settingsPageElements } from '../../SettingsPage/selectors' | ||
import { closePopupAndTooltips } from '../../HomePage/actions/closePopupAndTooltips' | ||
|
||
export const lock = async (page: Page) => { | ||
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.sidebar.settings) | ||
await page.click(settingsPageElements.buttons.lockWallet) | ||
|
||
// await module.exports.closePopupAndTooltips(); | ||
await closePopupAndTooltips(page, extensionId); | ||
return true; | ||
} |