-
-
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.
♻️ refactor(metamask): Move and update
getNotificationPage
(#986)
- Loading branch information
1 parent
28d1339
commit 6ad9a81
Showing
4 changed files
with
23 additions
and
39 deletions.
There are no files selected for viewing
10 changes: 1 addition & 9 deletions
10
wallets/metamask/src/pages/NotificationPage/actions/connectToDapp.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
29 changes: 0 additions & 29 deletions
29
wallets/metamask/src/pages/NotificationPage/utils/getNotificationPage.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 { BrowserContext, Page } from '@playwright/test' | ||
|
||
export async function getNotificationPage(context: BrowserContext, extensionId: string) { | ||
const notificationPageUrl = `chrome-extension://${extensionId}/notification.html` | ||
|
||
const isNotificationPage = (page: Page) => page.url().includes(notificationPageUrl) | ||
|
||
// Check if notification page is already open. | ||
let notificationPage = context.pages().find(isNotificationPage) | ||
|
||
if (!notificationPage) { | ||
notificationPage = await context.waitForEvent('page', { predicate: isNotificationPage }) | ||
} | ||
|
||
// Set pop-up window viewport size to resemble the actual MetaMask pop-up window. | ||
await notificationPage.setViewportSize({ | ||
width: 360, | ||
height: 592 | ||
}) | ||
|
||
return notificationPage | ||
} |