modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.15k stars 271 forks source link

Using `@web/test-runner-webdriver`, how do you select which browser to launch from the CLI? #2273

Open NullVoxPopuli opened 1 year ago

NullVoxPopuli commented 1 year ago

fwiw, I may be blocked by this issue: https://github.com/modernweb-dev/web/issues/2272 (web-test-runner bin hangs)

I'm looking at: https://modern-web.dev/docs/test-runner/browser-launchers/webdriver/ And the CLI says there is a --browsers flag, but it only supports puppeteer and playwright?.

Given the config from the docs:

import { webdriverLauncher } from '@web/test-runner-webdriver';

module.exports = {
  browsers: [
    webdriverLauncher({
      automationProtocol: 'webdriver',
      path: '/wd/hub/',
      capabilities: {
        browserName: 'chrome',
        'goog:chromeOptions': {
          args: ['--no-sandbox', '--headless'],
        },
      },
    }),
    webdriverLauncher({
      automationProtocol: 'webdriver',
      path: '/wd/hub/',
      capabilities: {
        browserName: 'firefox',
        'moz:firefoxOptions': {
          args: ['-headless'],
        },
      },
    }),
  ],
};

How do I launch firefox?

pnpm web-test-runner ???
koddsson commented 1 year ago

What happens if you run web-test-runner with that config? It launches both browsers, right?

NullVoxPopuli commented 1 year ago

It tries to, yeah. but, is there a way to choose only one from cli?

Or is this something i'd need to do myself with env flags or something similar?