diff --git a/.changelog/1780.internal.md b/.changelog/1780.internal.md new file mode 100644 index 0000000000..e1bf891d94 --- /dev/null +++ b/.changelog/1780.internal.md @@ -0,0 +1 @@ +Improve e2e tests diff --git a/playwright/utils/extensionTestExtend.ts b/playwright/utils/extensionTestExtend.ts index d4659766d7..87f8ce4232 100644 --- a/playwright/utils/extensionTestExtend.ts +++ b/playwright/utils/extensionTestExtend.ts @@ -13,6 +13,7 @@ export const test = base.extend<{ context: BrowserContext extensionId: string extensionPopupURL: `chrome-extension://${string}` + extensionManifestURL: `chrome-extension://${string}/manifest.json` }>({ // eslint-disable-next-line no-empty-pattern context: async ({}, use) => { @@ -38,4 +39,7 @@ export const test = base.extend<{ extensionPopupURL: async ({ extensionId }, use) => { await use(`chrome-extension://${extensionId}/${popupFile}#`) }, + extensionManifestURL: async ({ extensionId }, use) => { + await use(`chrome-extension://${extensionId}/manifest.json`) + }, }) diff --git a/playwright/utils/storage.ts b/playwright/utils/storage.ts index b8e9ff0cca..acf38ca155 100644 --- a/playwright/utils/storage.ts +++ b/playwright/utils/storage.ts @@ -3,16 +3,21 @@ import { privateKeyPersistedState } from '../../src/utils/__fixtures__/test-inpu export async function clearPersistedStorage( page: Page, - url: '/app.webmanifest' | `chrome-extension://${string}`, + url: '/app.webmanifest' | `chrome-extension://${string}/manifest.json`, ) { // Move to the right domain, but don't needlessly load HTML and JS. await page.goto(url) - await page.evaluate(() => window.localStorage.clear()) + await page.evaluate(() => { + window.localStorage.clear() + + const chrome = (window as any).chrome + chrome?.extension?.getBackgroundPage?.().location.reload() + }) } export async function addPersistedStorageV1( page: Page, - url: '/app.webmanifest' | `chrome-extension://${string}`, + url: '/app.webmanifest' | `chrome-extension://${string}/manifest.json`, ) { // Move to the right domain, but don't needlessly load HTML and JS. await page.goto(url)