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 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
momentic.config.yaml:momentic.config.yaml
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:- Open the test’s Test options and select the Browser tab.
- Set Browser type to Chromium.
- Enter the unpacked extension directory in Load Chrome extension. Use comma-separated paths to load multiple extensions.
- Save the settings. The editor reloads the browser session with the extension.
Run in CI
Make the unpacked extension available on the CI runner beforemomentic 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.jsondirectly 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-regionflag 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.