Environments enable users to share common configuration between tests, including environment variables, secret credentials, and browser settings. The environments key in your Momentic project configuration file defines what environments are available.

Overview

Each local Momentic environment allows you to configure the following settings:

  1. Base URL: the URL that all tests using the environment will start on by default. The BASE_URL variable will also point to this value. Individual tests can override this setting.
  2. Variables: the variables that are available to the test at runtime. Variables can be defined as constants, injected from the enclosing shell, or read from a locally accessible file.
  3. Browser settings: properties that instruct Momentic on how to initialize the headless browser used for test automation.

Defining variables

Variables can be defined and sourced from several locations. In order from highest to lowest priority:

Example

The following excerpt from a Momentic project configuration file showcases different environment features:

Configuring the browser

Each environment definition supports a browser key that enables you to configure default settings for the headless browser that Momentic initializes. Individual tests may still override this setting in their test options.

Currently, the only supported key under browser is localChromeExtensionPaths, an array of paths to unpacked Chrome extensions accessible on the local machine. These extensions will be loaded onto the browser before the test begins.

Example

momentic.config.yaml
name: example-project
[...]
environments:
  - name: chrome-extension
    baseUrl: https://dummyjson.com/products
    browser:
      localChromeExtensionPaths:
        - /tmp/eimadpbcbfnmbkopoojfekhnkhdbieeh
        - /tmp/bcjindcccaagfpapjjmafapmmgkkhgoa