Skip to content

Commit

Permalink
Improve extension testing
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanw committed Jan 27, 2024
1 parent 844f54a commit 42adb34
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ test('content script', async ({ page, context }) => {
// library login page is opened in a new tab
// but not as a popup from current page, instead via the background script
const pages = context.pages()
const lastPage = pages[pages.length - 1]
expect(lastPage.url()).toContain('https://www.voebb.de/oidcp/authorize')
const newPage = pages.find(p => p.url().indexOf('https://www.voebb.de/oidcp/authorize') !== -1)
expect(newPage).toBeTruthy()
})

test('popup page', async ({ page, extensionId, context }) => {
await page.goto(`chrome-extension:https://${extensionId}/popup/popup.html`)
await expect(page.locator('body')).toContainText('BibBot')
const settingsLink = await page.locator('#settings')
await expect(settingsLink).toHaveText('Einstellungen')
// await settingsLink.click()
// const pages = await context.pages()
// const lastPage = pages[pages.length - 1]
// await expect(lastPage.url()).toBe(`chrome-extension:https://${extensionId}/options/options.html`)
await settingsLink.click()
const pages = context.pages()
const newPage = pages.find(p => p.url().indexOf(`chrome-extension:https://${extensionId}/options/options.html`) !== -1)
expect(newPage).toBeTruthy()
})

test('option page', async ({ page, extensionId }) => {
Expand Down

0 comments on commit 42adb34

Please sign in to comment.