What are AI actions?
AI actions are smart test actions that are driven by vision and LLM reasoning, and executed via Playwright. AI actions help the Playmatic agent create reliable tests for complex verifications and dynamic applications.All AI actions are designed to be bounded by deterministic code (e.g., one click) so that tests can run predictably at runtime
aiClick(description, page)
: Click on an element on the page based on a natural language descriptor.aiVerify(description, page)
: Assert a verification based on a natural language descriptor.
When are AI actions used?
AI actions are only used by Playmatic in test development when the agent determines that existing Playwright selectors cannot create a stable test. The agent always prefers traditional Playwright actions.AI actions typically take a few seconds to execute. Avoid using them if you can achieve the same result with normal Playwright selectors.
Best Practices for Writing Descriptors for AI Actions
Each AI action is driven by the natural language descriptor. When you write the descriptor, keep in mind that the level of specificity that you use will determine the behavior of the action. For example,aiClick("submit button")
will be more durable than aiClick("the blue submit button on the right sidebar")
.
We recommend the following best practices for writing descriptions:
- Be specific but natural: “Click the submit button” vs “Click the blue button on the right.”
- Describe the purpose: Reference elements by their purpose and not just their appearance