Skip to main content

Script Generation (Script Gen Tab)

Use the Script Gen tab to record interactions in your application and convert them into SmartTests without writing code by hand.

How to capture steps

  1. Install the Chrome extension and sign in with your TestChimp account
  2. Navigate to the page you want to test
  3. Open the extension and go to the Script Gen tab
  4. Click Start Step Capture
  5. Perform your test steps in the app
  6. Click End Step Capture, name the test, and create the SmartTest
  7. Review and refine the generated script in the Web IDE
Chrome Extension Script Gen tab with Start Step Capture
Script Gen tab with Start Step Capture

Linking to a test-planning scenario

When you start capture from Test Planning (“Record via extension”), the extension associates the generated SmartTest with that scenario for traceability. You can also restore a pending scenario id if capture was started from the web app within a few minutes.

Adding assertions

While capturing steps, add assertions to verify expected behavior:

  1. Select an assertion mode from the mode buttons in the extension sidebar:

    • Assert Visible: Verify that an element is visible
    • Assert Text: Verify that an element contains specific text
    • Assert Value: Verify that an input/field has a specific value
    • Assert Enabled/Disabled: Verify that an element is enabled or disabled
    • Assert Count: Verify that multiple elements match a selector and count
  2. Choose assertion behavior:

    • Single click on an assertion mode button: One-shot mode—applies to the next click only, then returns to normal mode
    • Double click on an assertion mode button: Sticky mode—stays in that assertion mode until you click Normal
    • Click Normal: Return to action mode (default)
  3. Click on an element in your app to generate the assertion

Generated assertions appear as steps in your captured list using Playwright's expect() API.

Cycling through code options

For each captured step, the extension may generate multiple selector strategies (e.g. getByRole, getByText, getByTestId):

  1. Identify steps with multiple options: When you hover over a step, a reload icon appears if that step has multiple code unit options
  2. Cycle through options: Click the reload icon to cycle through alternatives
  3. Select the best option: Prefer stable selectors such as getByTestId or accessible getByRole as appropriate

You can also edit any step directly in the extension before creating the SmartTest.

What gets generated

Recorded steps are converted into a SmartTest with:

  • Playwright code aligned to your project where possible (optional reuse of existing POMs and env patterns)
  • Intent comments (optional) inferred from DOM context at key steps
  • Screen-state annotations (optional) when the extension identifies screen-states
  • Scenario linkage (optional) when capture was started from test planning

Compared to Playwright codegen

The Script Gen tab offers:

  • Intent comments from DOM context at important steps—not only raw actions
  • Multiple selector options per step with easy cycling to pick the best fit
  • TestChimp integration—SmartTests land in your project and can tie to scenarios and ExploreChimp workflows

For manual execution evidence (scenario or open-ended, pass/fail, notes, bugs, screenshots), use the Manual tab instead.