Skip to main content
This test logs in to a demo store, clicks the shopping cart icon, and asserts that the cart is empty.

Watch it run

The test

click-icon.test.mjs

How it works

  • performLogin() is a plain function that takes the TestDriver instance, so any test can reuse it.
  • The demo store shows its password on screen, so extract() reads it.
  • type(password, { secret: true }) keeps the password out of logs.
  • focusApplication('Google Chrome') brings Chrome to the front before the test uses it.
  • The find() description names the icon and its position (“next to the Cart text in the top right corner”). This helps the AI pick the right one.

Run it

The test is in the TestDriver SDK repository. Clone it, install dependencies, and run the file:
The test reads your API key from TD_API_KEY. Create a key at console.testdriver.ai/team/api-keys. Then set it in your environment or a .env file.