Manually Recording a Test

Meticulous is designed to run in the background, continuously recording the hundreds of user flows you already perform naturally every day when developing your application. Meticulous then automatically selects a subset of these user flows to run in CI by aiming to ensure coverage over every line of code. However you can also explicitly record a specific user flow, and, if you wish, specify it to always be run.

There are two ways to record a test:

  1. Recording tests on an environment with the Meticulous recorder enabled
  2. Recording tests via the Meticulous CLI

If you already have Meticulous set up, we recommend the former.

Recording tests on an environment with the Meticulous recorder enabled

Any user flows on an environment with the Meticulous recorder installed will automatically be recorded, and if they provide coverage over edge cases or lines of code that other user flows do not then they will automatically be selected to run in CI. However if you wish to record a specific user flow and open it in the Meticulous UI then you can do so by following the steps below:

  1. Navigate to your application on an environment that you've already configured Meticulous to record, for example localhost.
  2. Perform the user flow you wish to test.
  3. Open the developer tools console: COMMAND + OPTION + I on Mac, CTRL + SHIFT + I on Windows.
  4. Run window.Meticulous.record.getSessionUrl() in the console, and click the link printed out to view the recorded session.

Recording tests via the Meticulous CLI

You can use the Meticulous CLI to record a test from any environment:

Create tests

npx @alwaysmeticulous/cli record --apiToken="<API_TOKEN>"
  • Note: the above command includes your API token. Make sure to keep this secret: it provides access to all your recorded user sessions.
  • The command will open up a web browser with a blank page. You can now navigate to the site which you want to record a test on. This could be your production URL, or localhost.
  • Your interactions with the site will be recorded. Go through the flow that you wish to record, like signing up.
  • Once you are finished you can close the browser. Meticulous will print out links for the sessions recorded.
  • If you navigate across multiple pages then Meticulous may record one separate session per page. This allows it to run the tests for the multiple pages in parallel. If it prints out multiple links then often the first ones are the login pages, and it's the last link that you want to use.
  • Open the link to the recorded session, and click on the 'Simulate' tab. Run the command to simulate the session, and check it simulates as intended.
  • Now that the session is recorded Meticulous will automatically test against the session in CI if Meticulous deems it to be one of the sessions that maximizes the test coverage of your application. If you want to force the session to be used then click the "Add to selected sessions" button on the session page. Learn more here.
  • If Meticulous isn't yet set up to run on CI then you can set it up by following the instructions here.

TypeScript Types

For TypeScript type definitions for the window.Meticulous object, see TypeScript Types for window.Meticulous.