run
Run Momentic tests in the current project.
By default, tests will output results to a local directory. You can then upload results to Momentic Cloud using the momentic results upload
command.
- [tests…]: The tests to run. If not specified, selects all tests in the current project. You can specify multiple tests separated by spaces, test paths, or folder paths. You can also pass substrings to match test names.
Options
-c, --config <config>
Path to the Momentic configuration file. If not specified, it defaults to momentic.config.yaml
in the current directory.
-f, --filter <filter>
Only applicable when using Workspaces. Loads the project with the specified name.
--custom-headers <customHeaders...>
Custom headers to include in the test run. You can specify multiple headers by separating them with spaces.
--input-csv <inputCsv>
Path to a CSV file containing input data for the tests. Each row in the CSV file will be used as input for a separate test run.
--env <env>
The base URL set on the test will always take precedence over the environment.
If you want to override the base URL set on the test, use the --url-override
option.
The environment to run the test in. This will override any environment specified by the test.
--url-override <urlOverride>
The URL to override the base URL set on the test or the environment. This is useful if you want to run the test against a different URL than the one specified in the test or environment.
--start <start>
A command to run before starting the test. This can be used to start a local server or any other command that needs to be run before the test starts.
--wait-on <waitOn>
The resource to wait for before starting the test. This can be a URL, a file, or any other resource that can be waited on. This is useful for ensuring that the resource is available before starting the test.
--wait-on-timeout <waitOnTimeout>
The timeout for the --wait-on
option. If the resource is not available within this time, the test will fail.
--retries <retries>
The number of times to retry a test if it fails.
-p, --parallel <parallel>
The number of tests to run in parallel. This can be useful for speeding up test execution, especially for large test suites. Each test will start its own browser instance.
--labels <labels...>
Run tests with the specified labels. This allows you to filter tests based on assigned labels.
--update-golden-files
Update the golden files for Visual diff.
--reporter <reporter>
Specify the reporter to use for the output. Momentic supports the following reporters: junit
, allure-json
, and playwright-json
.
--reporter-dir <reporterDir>
Specify the directory where the reporter output will be saved. If not specified, it defaults to ./reports
.
--output-dir <outputDir>
Directory to store run artifacts such as screenshots, results, and logs. This directory will be cleared at the start of execution.
--shard-index <shardIndex>
The index of the shard to run. This is used in conjunction with --shard-count
to determine which tests to run in this shard. This is useful for running tests in parallel across multiple machines or processes. The index starts at 1.
--shard-count <shardCount>
The total number of shards to run. This is used in conjunction with --shard-index
to determine which tests to run in this shard. For example, if you have 3 shards and you set --shard-index
to 1, only the tests that belong to the first shard will be executed.
--include <includePatterns...>
Only include tests that match the provided regex patterns. Multiple patterns can be provided. The patterns will be matched against the test file paths and the pattern only needs to match a part of the path for the test to be included.
--exclude <excludePatterns...>
The opposite of --include
: a test that matches any of the provided regex patterns will be excluded from running.