Prerequisite: Please install Node.js (version 18 or higher) before proceeding.

Before you begin, you must already have a package.json file. If you don’t, make sure to run npm init or yarn init to create the file beforehand.

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:

export MOMENTIC_API_KEY=your-api-key

Install the Momentic CLI

Install the CLI, momentic, by running the following command in your terminal:

npm install momentic --save-dev

Install browsers

Momentic relies on headless browsers that must be installed. To install all available browsers:

npx momentic install-browsers --all

Initialize a new project

To create a new Momentic project, run the following command in your terminal:

npx momentic init

Start the Momentic Local App

Start the Local App by running the following command in your terminal:

npx momentic app

It will open a new browser window with the Momentic Local App, where you can manage your tests, view results, and more.

Create a test

Click on the Create test button in the top-right corner.

Enter these details:

  • Name: example-test
  • Base URL: https://practicetestautomation.com/practice-test-login/ (a demo site for testing)

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 you just created by running the following command in your terminal:

npx momentic run example-test

Next steps

Congratulations! You have successfully built and ran your first test with Momentic. Here are suggested next steps:

Set up GitHub Actions

Integrate Momentic tests into your GitHub Actions workflows

Variables

Learn how to use variables to make your tests more dynamic and reusable