Create a test in chat

Describe one flow to Re:agent, watch it walk the flow in a browser, and keep what it did as a test.

When you already know the flow you want to protect, you can describe it to Re:agent in the chat. Re:agent walks the flow in a real browser, signing in the way a person would, and once it reaches the end you described, it saves the flow. Rehearsal then writes a test from it and checks the test twice before it runs on its own.

Chat or exploration Link to Chat or exploration

An exploration is for finding out what to test. Subagents work through your app, report the bugs they find, and the tests you keep come from the journeys they walked. The chat is for the opposite case, when you know the steps and the result you expect. Describe one flow when:

  • You want one particular journey protected, such as adding a saved card or checking out a cart.
  • More than one person takes part, such as a member who invites a new teammate to the team. Flows with more than one person covers those.
  • The flow sends an invitation or a message. An exploration leaves those alone unless a CLI switch allows them, while in the chat Re:agent takes the steps you describe.

If you are not sure what to test, explore first. Re:agent decides from your words which one you asked for, so "Check Parcel before the release" starts an exploration, and "Create a test that adds a saved card" stays in the chat.

Describe the flow Link to Describe the flow

  1. Step 1: Open a new chat

    Open Re:agent and press New chat, then check the project and the app at the top of the page. Re:agent starts on that app unless you name another. New test in Tests does the same, with "Create a test for" and the app's address already typed in the message box.

  2. Step 2: Say what to do and what should be true at the end

    Output
    Sign in as member, add a card on the Saved cards page, and check that the new card appears in the list.

    Write the steps the way you would tell a colleague. The end matters most, because what should be true there becomes the check the test makes on every run. "The new card appears in the list" is a check, while "add a card" alone gives the test nothing to prove.

  3. Step 3: Name the account if the flow signs in

    Re:agent signs in with one of the project's test accounts, so name the one you mean, such as member. If you name none, Re:agent picks one from the project or asks a question that starts with the person's name, such as "member: Which account should it use?". It lists the accounts to choose from and Go on without an account, and someone with Manage projects also sees Add a test account. A flow that signs up a new user needs no account.

Watch Re:agent work Link to Watch Re:agent work

Re:agent opens a browser on Rehearsal's servers, and the panel beside the chat shows it live. Each thing Re:agent does becomes a row in its reply, such as Opened a browser on parcel.example as member and Clicked Add card. Rehearsal writes those words, never the model, as Watch an exploration explains.

If the app has more than one address, such as production and staging, Re:agent asks which one to open. An address on your computer opens only while it is connected, as Test an app on your computer shows.

You can talk to Re:agent while it works:

  • Send a message with Enter, and it waits in the queue until the reply ends. Press Cmd+Enter, or Ctrl+Enter on Windows and Linux, to send it into the reply instead, and Re:agent reads it after the current step.
  • Answer a question above the message box when Re:agent needs something only you know. Your answer continues the flow, and Questions from Re:agent explains how long the browser waits for it.
  • Press Stop in the message box to end the reply. The browser keeps its page, so your next message carries on from there, and any messages that were waiting come back to the box.

When the flow is saved Link to When the flow is saved

Once the flow works, Re:agent saves it with a name and a line about what it checks, and its last row reads Saved the flow. A block in the reply then follows the new test through four stages:

StageWhat happened
Flow savedRe:agent kept the steps it took and what proved the flow worked.
Test writtenRehearsal wrote a test from the flow.
First run passedThe test ran once and passed.
Verified in a fresh browserThe test passed again in a new browser that knew nothing about the first run.

After the last stage, a card shows the test's name, what it checks, how many steps it takes and the page it ends on. Click the name or the description to change it, then press Enter to save or Escape to cancel. Run now opens a dialog where you choose the address and the screens, then starts a run that the card follows by its number. Where Rehearsal offers more than one browser, the dialog also shows Browsers, with Chromium chosen. Tests run only in Chromium today, so a run in another browser ends blocked with "This test runs only in Chromium." Open test opens the test's page in Tests, and Watch recording plays what Re:agent did.

The panel's head now offers Code beside the browser, which shows the test Rehearsal wrote. Create tests explains how a test is written and checked.

If it does not become a test Link to If it does not become a test

  • A run did not pass. The block names the step where the test stopped, such as "The test stopped at step 4: Clicked Add card", and quotes the first line of what the run reported. Press Retry to try again from the same flow, or tell Re:agent what should be different.
  • Something went wrong on our side. The block says so, and Retry runs the check again. Nothing about your app was judged.
  • The flow needs something tests cannot do yet. The block gives the reason in one sentence, such as "This flow uploads a file. Tests cannot upload files yet." The flow stays saved, but no test is written from it.
  • Re:agent could not finish the flow. It closes the browsers without saving and says what stopped it, such as a CAPTCHA, so nothing becomes a test.

Change a test Link to Change a test

  1. Step 1: Open the test

    Open Tests, choose the test and press Edit in chat.

  2. Step 2: Say what should change

    A new chat opens on the question "What should change in Add a saved card?", with "Change the test Add a saved card:" already typed in the box. Finish the sentence, such as "use a card that expires next year", and send it.

  3. Step 3: Let Re:agent walk it again

    Re:agent opens the test's own app with the test's own account and changes only what you asked for. Saving writes a new version of the same test, which keeps its name.

The new version is checked the same way. Runs keep using the newest version that passed its checks, so until the new one passes, they run the one before it.

Good to know

Creating or changing a test needs the Use Re:agent and Manage projects permissions. With Use Re:agent and View projects alone, Re:agent can still read your tests and runs and answer questions about them.

Next steps Link to Next steps