-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: make it work with beforeAll or think if global setup will do fine
- Loading branch information
1 parent
d02298f
commit 688b918
Showing
2 changed files
with
17 additions
and
34 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,25 +1,10 @@ | ||
import type { BrowserContext, Worker } from '@playwright/test'; | ||
import type { BrowserContext } from '@playwright/test'; | ||
|
||
// TODO: add browserName param | ||
export async function openPopup( | ||
context: BrowserContext, | ||
background: Worker, | ||
extensionId: string, | ||
) { | ||
// load a page from which to open the extension popup, make it the active tab | ||
const page = await context.newPage(); | ||
export async function openPopup(context: BrowserContext, extensionId: string) { | ||
const popup = await context.newPage(); | ||
|
||
await popup.goto(`chrome-extension://${extensionId}/popup/index.html`); | ||
|
||
await background.evaluate(async () => { | ||
// @ts-expect-error TODO | ||
chrome.action.openPopup(); | ||
}); | ||
|
||
await page.bringToFront(); | ||
return { | ||
page: page, | ||
popup: popup, | ||
}; | ||
const url = `chrome-extension://${extensionId}/popup/index.html`; | ||
await popup.goto(url); | ||
await popup.waitForLoadState("networkidle"); | ||
return popup; | ||
} |