Description

The /explore command is used to execute a single step in a test file and add it to a specified file. This command generates and performs steps in an interactive way while creating a test file.

/explore is the default command sent to TestDriver when no command is provided.

Usage

testdriverai <filename.yaml>
/run prompt

Example usage

> /explore add an item to the shopping cart

This command creates the command step(s) necessary to add an item to the shopping cart in the specified test file, executing the generated command(s) after writing them into the test file. If there are intermediate steps to be taken, they’re added to the test file as well.

thinking...

    To add an item to the shopping cart, we need to identify
    the "Add to Cart" button from the screenshot. However,
    since the screenshot shows a code editor, we need to
    assume the button isn't visible here. Let's proceed with
    a generic approach:
    
    commands:
      - command: focus-application
        name: Google Chrome
      - command: hover-text
        text: Add to Cart
        description: add to cart button on the shopping page
        action: click
    
    ### Explanation:
    
    1. Focus Google Chrome: Ensure the browser is active to interact with the shopping page.
    2. Click 'Add to Cart': Use hover-text to find and click the "Add to Cart" button, assuming it's present on the shopping page.

command='focus-application' name='Google Chrome'
command='hover-text' text='Add to Cart' description='add to cart button on the shopping page' action='click'

thinking...

In this case, the user wasn’t logged in, so the AI will ‘undo’ the steps it thought it should take, and add steps to log in first.

undoing...
thinking...

    The screenshot shows a "Sign In" button on the webpage.
    Let's try clicking that instead, as it might be necessary
    before adding items to the cart.
    
    commands:
      - command: hover-text
        text: Sign In
        description: sign in button on the webpage
        action: click

command='hover-text' text='Sign In' description='sign in button on the webpage' action='click'

thinking...

Behavior

  • TestDriver will generate an idea to complete the task, try to execute it, and add the steps to the test file.
  • The steps will be executed in the order generated.
  • If the steps are successful, they’re added to the test file.
  • If the steps fail, TestDriver will attempt to fall back to AI, undo the last step and provide an explanation of what went wrong. The AI will retry the step with new commands.
  • If the commands are successful, the program will output the results and exit with code 0.
  • If any failures occur during the test, the program will output the errors and exit with code 1.

Protips

  • Use descriptive prompts for higher success with generating test steps with /explore.
  • Use /explore multiple times in succession to build a comprehensive test file.

Gotchas

  • The AI will retry 3 times if it can’t complete the task.

Notes

  • The /explore command is ideal for creating test files in an interactive session.