Skip to main content
Load a Chrome extension before your test starts to verify how it changes your app. Use an unpacked extension with a locally launched Chromium browser, on your machine or on a continuous integration (CI) runner.
Extensions aren’t supported on Momentic-hosted browsers or the cloud dashboard. Use Chromium. Google Chrome 137 and later no longer support the extension-loading mechanism Momentic uses, and Momentic doesn’t support loading extensions in Chrome for Testing.

Configure your project

Start with an existing Momentic project and a test you want to run with the extension.
1

Prepare the extension

Build or extract the extension into a directory on the machine running Momentic. An unpacked extension is a folder containing manifest.json and the extension’s scripts and assets. Point Momentic at that folder, not a Chrome Web Store URL, extension ID, or packed .crx file.For example, place the extension in extensions/checkout-helper/ at your project root. Check that extensions/checkout-helper/manifest.json exists before continuing.
2

Set the browser and extension path

Add these settings to your existing momentic.config.yaml:
momentic.config.yaml
Relative extension paths resolve from the directory where you launch Momentic. Run the commands below from your project root, or use an absolute path. Add another list entry for each additional extension.Environment settings and per-test settings can override these defaults. Check that your test still uses Chromium and remoteBrowser: false. Don’t pass --remote-browser-region, which enables hosted browsers for the run.
3

Run the test

Install the Chromium build for your Momentic version:
Run an existing test with the extension. Replace the path with your test’s path:
Momentic loads the extension before the test starts. Assert on the extension’s effect in your app, such as an injected element or a change to the page’s appearance.

Configure one test in the local editor

To set extension paths for one test instead of the whole project, open the local editor from your project root:
  1. Open the test’s Test options and select the Browser tab.
  2. Set Browser type to Chromium.
  3. Enter the unpacked extension directory in Load Chrome extension. Use comma-separated paths to load multiple extensions.
  4. Save the settings. The editor reloads the browser session with the extension.

Run in CI

Make the unpacked extension available on the CI runner before momentic run. If you build the extension in CI, finish the build first. Keep the same directory layout and run Momentic from the same project directory as you do locally. An absolute path on your laptop won’t exist on the runner. Install Chromium on the runner and keep remoteBrowser: false. Your existing CI configuration otherwise runs the test the same way.

Troubleshooting

  • If Momentic reports that an extension path doesn’t exist, check for manifest.json directly inside the configured directory. Check the directory where you launched Momentic when using a relative path.
  • If Momentic rejects a hosted browser connection, check the project, environment, and test settings for remoteBrowser: true. Remove any --remote-browser-region flag from the run command.
  • If the extension doesn’t affect the page, confirm that the test uses Chromium and that the extension’s manifest matches your app’s URL.
See browser configuration for the setting reference and supported browsers for the browser options.