async function testUrlFromDevtools(url, options = {}) {
  const {config, chromeFlags = []} = options;

  const newChromeFlags = [
    ...chromeFlags,
    '--auto-open-devtools-for-tabs',
  ];

  const chrome = await launch({chromeFlags: newChromeFlags});

  const browser = await puppeteer.connect({
    browserURL: `http://127.0.0.1:${chrome.port}`,
    defaultViewport: null,
    protocolTimeout: 300_000, // 5 min
  });

  /** @type {puppeteer.CDPSession|undefined} */
  let inspectorSession;

  try {
    if ((await browser.version()).startsWith('Headless')) {
      throw new Error('You cannot use headless');
    }

    const page = (await browser.pages())[0];

    const inspectorTarget = await browser.waitForTarget(t => t.url().includes('devtools'));
    inspectorSession = await inspectorTarget.createCDPSession();

    /** @type {string[]} */
    const logs = [];
    await installConsoleListener(inspectorSession, logs);

    page.on('dialog', dismissDialog);

    await page.goto(url, {waitUntil: ['domcontentloaded']});

    await waitForFunction(inspectorSession, waitForLighthouseReady);

    page.off('dialog', dismissDialog);

    if (config) {
      await installCustomLighthouseConfig(inspectorSession, config);
    }

    const result = await evaluateInSession(inspectorSession, runLighthouse, [addSniffer]);

    return {...result, logs};
  } catch (err) {
    if (inspectorSession) {
      const {data} = await inspectorSession.send('Page.captureScreenshot', {format: 'webp'});
      const image = `data:image/webp;base64,${data}`;
      throw new Error(
        `Lighthouse in DevTool failed. DevTools screenshot:\n${image}`,
        {cause: err}
      );
    }
    throw err;
  } finally {
    await browser.close();
  }
}
@param {string} url
@param {{config?: LH.Config, chromeFlags?: string[]}} [options]
@return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, logs: string[]}>}