Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for --puppeteer-script #89

Closed
patrickhulce opened this issue Nov 15, 2019 · 1 comment · Fixed by #118
Closed

Support for --puppeteer-script #89

patrickhulce opened this issue Nov 15, 2019 · 1 comment · Fixed by #118
Labels

Comments

@patrickhulce
Copy link
Collaborator

Usage:

lhci collect --puppeteer-script=./path/to/script.js

// This function is invoked before the first run of each URL under test
module.exports = async (browser, urlUnderTest, allCollectOptions) => {
  if (!urlUnderTest.includes('/app')) return;

  const page = await browser.newPage();
  await page.goto('http://localhost:3000/login');
  await page.type('#username', 'test_user');
  await page.type('#password', 'password');
  await page.click('button');
  await page.waitFor('.welcome-logged-in-user');
}
@connorjclark
Copy link
Collaborator

Should there be a similar construct for setting / tweaking the LH config based on the URL? For example, I am imagining wanting to clear cache in the general case, but for one URL set up auth and disable cache clearing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants