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

Introduce Puppeteer for handling browsers during tests #11807

Merged
merged 3 commits into from
Apr 27, 2020

Commits on Apr 26, 2020

  1. Identify browsers using the name instead of the path

    The other testing code already uses the name of the browser as the
    unique identifier, so I don't see a good reason to not use that for
    identifying browsers to quit as well. Doing so simplifies the (already
    somewhat complex) testing logic and ensures that we can use existing
    functionality (such as the `getSession` function) to retrieve sessions.
    timvandermeij committed Apr 26, 2020
    Configuration menu
    Copy the full SHA
    d86720b View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2020

  1. Introduce Puppeteer for handling browsers during tests

    This commit replaces our own infrastructure for handling browsers during
    tests with Puppeteer. Using our own infrastructure for this had a few
    downsides:
    
    - It has proven to not always be reliable, especially when closing the
      browser, causing failures on the bots because browsers were still
      running even though they should have been stopped. Puppeteer should do
      a better job with this because it uses the browser's test built-in
      instrumentation tools for this (the devtools protocol) which our code
      didn't. This also means that we don't have to pass
      parameters/preferences to tweak browser behavior anymore.
    - It requires the browsers under test to be installed on the system,
      whereas Puppeteer downloads the browsers before the test. This means
      that setup is much easier (no more manual installations and browser
      manifest files) as well as testing with different browser versions
      (since they can be provisioned on demand). Moreover, this ensures that
      contributors always run the tests in both Firefox and Chrome,
      regardless of which browsers they have installed locally.
    - It's all code we have to maintain, so Puppeteer abstracts away how the
      browsers start/stop for us so we don't have to keep that code.
    
    By default, Puppeteer only installs one browser during installation,
    hence the need for a post-install script to install the second browser.
    This requires `cross-env` to make passing the environment variable work
    on both Linux and Windows.
    timvandermeij committed Apr 27, 2020
    Configuration menu
    Copy the full SHA
    4834a27 View commit details
    Browse the repository at this point in the history
  2. Implement a command line flag to skip Chrome when running tests

    To save time or resources during development it can be useful to run
    tests only in Firefox. Previously this could be done by editing the
    browser manifest file, but since that file is no longer used for
    Puppeteer, this command line flag replaces it. For example, executing
    `gulp unittest --noChrome` will only run the unit tests in Firefox.
    timvandermeij committed Apr 27, 2020
    Configuration menu
    Copy the full SHA
    9ebb18f View commit details
    Browse the repository at this point in the history