Skip to content

Commit

Permalink
most actions done
Browse files Browse the repository at this point in the history
  • Loading branch information
Seroxdesign committed Jul 8, 2024
1 parent cdd98f2 commit 339fdab
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
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;
}
11 changes: 6 additions & 5 deletions wallets/phantom/src/pages/LockPage/actions/unlock.ts
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;
}
8 changes: 8 additions & 0 deletions wallets/phantom/src/pages/NotificationPage/actions/index.ts
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'
5 changes: 3 additions & 2 deletions wallets/phantom/src/pages/NotificationPage/actions/lock.ts
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;
}

0 comments on commit 339fdab

Please sign in to comment.