Skip to content

v0.10.0

Compare
Choose a tag to compare
@github-actions github-actions released this 21 Jul 10:55
· 196 commits to main since this release

Bug Fixes

Features

New authenticate hook (c7afd0c)

Works the same as the previous puppeteer:before-go-to hook but this will only be called a single time before any routes are scanned. It will automatically collect any set cookies and local storage items during the hook.

// unlighthouse.config.ts
export default {
  hooks: {
    async authenticate (page) {
      // login to the page
      await page.goto('https://example.com/login')
      const emailInput = await page.$('input[type="email"]')
      await emailInput.type('[email protected]')
      const passwordInput = await page.$('input[type="password"]')
      await passwordInput.type('password')
      await Promise.all([
        page.$eval('.login-form', form => form.submit()),
        page.waitForNavigation(),
      ])
    },
  },
}