CLI
This quickstart guide will walk you through the process of building and running your first test locally and integrated into CI/CD with the Momentic CLI.
The CLI integrates directly with your codebase and CI/CD pipelines, making it ideal for co-located tests, version control, and PR checks. You can test any app, including http://localhost:3000
without complex tunneling setups.
Here is a sample GitHub repository that runs tests on every pull request.
Get your API key
To get started, log in to Momentic Cloud and generate an API key.
You can export the API key in your shell configuration file (usually .bashrc
or .zshrc
) like so:
You can also pass the API key as an argument to the CLI:
Install the CLI
To work locally with your tests, install the CLI, called momentic, by running the following command in your terminal:
Install browsers
Momentic relies on headless browsers that must be installed prior to running tests. To install all available browsers:
Initialize a new project
To create a new Momentic project, run the following command in your terminal:
Start the Momentic Local App
Start the Local App by running the following command in your terminal:
Create a test
Click on the Create test button in the top-right corner.
Name it example-test
and set the URL to be https://practicetestautomation.com/practice-test-login/
. This is a demo site that we use for testing purposes.
This will open the Momentic Editor, where you can add instructions in natural language. Click Run from start to execute the test live.
This will create a new file in your project directory called example-test.test.yaml
. Changes are saved automatically, so you don’t need to worry about losing your work.
Run the test
You can run the test using the CLI by running the following command in your terminal:
Push the changes
When you’re ready, simply push the changes to your repository. You can also set up a CI/CD pipeline to run the tests automatically on every commit.