# Custom Script Gen Agent Source: https://documentation.litmuscheck.com/agents/custom-script-generation Creates tailored scripts and utilities for complex flows ## Overview The Custom Script Gen Agent is used by the AI script step in compose mode to generate custom Node.js scripts for complex test scenarios. It analyzes the full current DOM and creates a complete script in a single shot, making it ideal for handling complex logic, dynamic actions, and sophisticated verifications that go beyond standard test steps. ## How It Works 1. **AI Script Step**: The agent is triggered when you use the AI script step in compose mode, providing a natural language description of the complex action or verification you need. 2. **DOM Analysis**: The agent analyzes the full current DOM to understand the page structure and available elements. 3. **Script Generation**: Based on your description and the DOM analysis, the agent generates a complete Node.js script in a single attempt, including helpful comments for easier understanding. 4. **Execution and Verification**: The agent automatically executes the generated script to ensure it works correctly before marking the step as successful. 5. **Add to Test**: Once verified, the script can be added to your test as a custom step. ## Use Cases The Custom Script Gen Agent is perfect for scenarios that require custom logic or complex operations, such as: * **Custom Logic**: Generating random strings with specific formatting requirements or custom validation rules * **Data Manipulation**: Sorting elements from a list before taking action, filtering data, or transforming values * **Dynamic Actions**: Performing actions based on runtime conditions or calculated values * **Complex Verifications**: Validating multiple conditions, comparing complex data structures, or performing advanced assertions * **Custom Utilities**: Creating helper scripts for specific test scenarios ## Key Features * **Single-Shot Generation**: Creates complete, working scripts in a single generation, eliminating the need for iterative refinement. * **Commented Code**: Generates Node.js scripts with clear comments explaining the logic, making it easier to understand and maintain. * **Automatic Verification**: Executes the generated script to ensure it works before marking the step as successful, reducing the need for manual review. * **Full DOM Access**: Uses the complete current DOM for analysis, providing comprehensive context for script generation. **Current DOM limitation** The Custom Script Gen Agent can only conduct actions on the current DOM in a single shot. For multi-page actions or workflows that span multiple pages, use the Goal-to-Test Agent instead, which is designed to handle complex, multi-page scenarios. **Editing generated scripts** If you need to customize the generated script, you can copy the script code and use the Run Script action to add your manually customized version. This allows you to refine the script while maintaining the agent's initial logic as a starting point. **Run-time AI execution** The Custom Script Gen Agent can also be configured to use AI at run-time in every single execution. This enables dynamic, AI-powered actions or verifications that adapt to the current page state during each test run, making it ideal for handling complex, context-dependent scenarios. ## Best Practices * **Be Specific**: Clearly describe the complex logic or verification you need, including any specific requirements or constraints. * **Use for Complex Scenarios**: Reserve this agent for truly complex scenarios that can't be handled by standard test steps or simpler AI actions. * **Review Generated Scripts**: Always review the generated script and its comments to ensure it matches your requirements before adding it to your test. * **Test After Customization**: If you customize the generated script, test it thoroughly to ensure it works as expected in your test environment. # Goal-to-Test Agent Source: https://documentation.litmuscheck.com/agents/goal-to-test Converts high-level goals into executable test steps ## Overview The Goal-to-Test Agent converts natural language goals into executable test steps during test creation. It takes your high-level objectives and triggers an AI agent that completes multiple browser actions to fulfill the goal, generating ready-to-use test steps with corresponding Playwright scripts. ## How It Works 1. **Enter a Natural Language Goal**: During test creation, provide a goal in plain, human language describing what you want to test. The agent understands your intent and breaks it down into actionable browser steps. 2. **AI Agent Execution**: The Goal-to-Test Agent triggers an AI agent that performs multiple browser actions to complete your goal. The agent can handle complex, multi-step workflows automatically. 3. **Generate Test Steps**: As the agent executes, it outputs multiple test steps, each with corresponding Playwright script code. These steps can be directly added to your test. 4. **Add to Test**: Review the generated steps and add them to your test. The Playwright scripts are ready to use. You can also edit existing steps or add new steps once you accept the goal steps. ## Key Features * **Compose Mode Integration**: The Goal-to-Test Agent can be used inside the compose mode, allowing you to seamlessly integrate AI-generated steps into your test creation workflow. * **Multi-Page Multi-Step Actions**: The agent can perform complex workflows that span multiple pages and involve numerous sequential actions, making it ideal for end-to-end test scenarios. * **Rapid Step Generation**: The agent uses multiple low-latency sub-agents working in parallel to generate test steps rapidly, significantly reducing the time needed to create comprehensive tests. * **Transparent Reasoning**: The agent's reasoning process is shared with you as logs, providing visibility into how it interprets your goal and executes the necessary actions. **Optimal goal size** For best results, use goals that cover roughly 5-10 action steps. This provides enough context for the agent to understand the workflow while maintaining clarity and focus. Add verifications separately after the main action steps are generated. ## Best Practices * **Be Specific**: Clearly describe the actions you want performed, including target elements, expected behaviors, and any relevant context. * **Break Down Complex Goals**: For very complex workflows, consider breaking them into multiple smaller goals (5-10 steps each) rather than one large goal. * **Add Verifications Separately**: Generate the main action steps first, then add verification and assertion steps separately for better control and clarity. * **Review Generated Steps**: Always review the generated Playwright scripts to ensure they match your expectations before adding them to your test. # Test Healing Agent Source: https://documentation.litmuscheck.com/agents/heal-test Automatically heals flaky tests by updating steps/selectors ## Enable Test Healing Suggestions To enable healing suggestions for flaky tests: 1. Go to the suite. 2. Click on the **Settings** tab. 3. Find the **Offer Healing Suggestions** option under the **On test failure** dropdown. 4. Click on the **Save** button. ## Using Healing Suggestions in Logs After every run, if a test fails, the report will include a section called **Healing Suggestions**. This section will suggest changes to fix the failure. 1. Review the reasoning provided for the suggested change. 2. Click **View Suggestion** to see the proposed update. 3. If the change looks good, click **Accept**. The change will be applied directly to the test. 4. If you do not want to apply the suggestion, click **Reject** to dismiss it. Scheduling runs Scheduling runs # Prompt to Page Element Source: https://documentation.litmuscheck.com/agents/locator-generation Generates robust selectors for Elements (POM) from natural language prompt ## Overview The Prompt to Page Element AI Agent is the core engine behind all AI steps in compose mode. It intelligently matches your natural language prompts to the correct page elements, generating robust selectors that eliminate flakiness in your tests. This agent is specifically optimized for test case generation for web applications and does not hallucinate—it only works with elements that actually exist on the page. ## How It Works 1. **Takes Active Page and Prompt**: The agent receives the current active page state and your natural language prompt describing the element you want to interact with. 2. **Filters Relevant Elements**: The agent analyzes all elements currently visible in the viewport and filters them to identify those relevant to your prompt. 3. **Element Selection**: Using advanced reasoning, the agent determines which element is directly associated with your prompt, ensuring accurate element identification. 4. **Generates Multiple Selectors**: The agent generates multiple unique selectors for the identified element, giving you options to choose from. This approach eliminates flakiness by providing alternative selector strategies. 5. **Selector Options**: You can review and select the most appropriate selector from the generated options, ensuring your tests remain stable even if the page structure changes slightly. ## Key Features * **Compose Mode Engine**: This agent powers all AI-driven steps in compose mode, making it the foundation of intelligent test creation. * **Viewport-Based Analysis**: The agent only analyzes elements currently visible in the viewport, ensuring it works with what's actually on screen. * **No Hallucination**: The agent is designed to never create or reference elements that don't exist on the page, making it reliable and trustworthy for test automation. * **Multiple Selector Generation**: By generating multiple unique selectors, the agent provides fallback options that help maintain test stability over time. * **Web Application Optimized**: Specifically tuned for web application test case generation, understanding common patterns and structures in modern web applications. ## Important Considerations * **Viewport Limitation**: The agent only looks at the current viewport. If an element is not visible, you should scroll to bring it into the viewport before using the agent to locate it. * **Element Visibility**: Ensure the target element is visible on the page before prompting the agent, as it cannot locate elements outside the current viewport. **Getting elements into viewport** If the element you want to interact with is not currently visible, use a scroll action first to bring it into the viewport. The agent can then accurately identify and generate selectors for the element. ## Best Practices * **Be Specific in Prompts**: Provide clear, descriptive prompts that uniquely identify the element you want to interact with. * **Ensure Visibility**: Always scroll elements into the viewport before attempting to locate them with the agent. * **Review Selector Options**: When multiple selectors are generated, choose the one that best matches your test's needs and is least likely to break with page changes. * **Use Descriptive Prompts**: Include context in your prompts (e.g., "the login button in the header" rather than just "button") to help the agent identify the correct element. # Planning Agent Source: https://documentation.litmuscheck.com/agents/planning Plans test goals, segments, and execution strategy ## Overview The Planning AI Agent creates comprehensive test plans based on feature descriptions. It analyzes your feature requirements and generates a structured set of test cases that cover various scenarios, edge cases, and user flows. ## How It Works 1. **Provide a Feature Description**: Go to the **Plan** tab in any suite and enter a detailed description of the feature you want to test. The more context you provide, the better the generated test plan will be. 2. **Generate Test Cases**: The Planning Agent generates **10 test cases at a time**, covering different aspects of your feature including: * Happy path scenarios * Edge cases * Error handling 3. **Review**: Review the generated test cases and dsicard the ones that are not relevant to your testing needs. 4. **Add to Suite**: Selected test cases are added to your suite as **draft tests**, which you can then refine, edit, and execute. Plan Image **Generating better plans** Adding descriptions to your suite and existing test cases helps the Planning Agent generate better, more contextually relevant test cases. The agent uses this information to understand your testing patterns, coverage gaps, and the overall structure of your test suite. ## Best Practices * **Be Specific**: Provide detailed feature descriptions including user roles, expected behaviors, and key interactions. * **Include Context**: Mention related features, dependencies, or constraints that might affect testing. * **Review Generated Cases**: Not all generated test cases may be relevant—select only those that align with your testing goals. # Failure Triaging Agent Source: https://documentation.litmuscheck.com/agents/triage-failure Diagnoses failures with logs, traces, and probable causes ## Overview The Failure Triaging Agent automatically diagnoses test failures after a test fails in a suite run. It intelligently analyzes failures by re-running the test and comparing the results, then provides clear classifications and reasoning to help you understand what went wrong and how to address it. ## How It Works 1. **Automatic Trigger**: The agent is automatically triggered after a test fails during a suite run. 2. **Re-run the Test**: The agent re-runs the failed test to gather additional diagnostic information and compare the results. 3. **Failure Analysis**: The agent analyzes both the original failure and the re-run results to classify the failure type. 4. **Classification and Reasoning**: Based on the analysis, the agent provides a clear classification along with concise reasoning explaining the root cause. ## Classification Outcomes ### Successful on Retry If the test succeeds during the triage run, it is marked as **successful\_on\_retry**. The agent provides reasoning explaining why the first run failed, helping you understand transient issues like: * Network timeouts * Race conditions * Temporary service unavailability * Resource contention ### Persistent Failures If the test still fails during the triage run, the agent classifies the failure into one of three categories: * **Bug**: The failure indicates an actual issue in the application under test. The agent identifies what went wrong and why it's a bug. * **Update Test**: The test itself needs to be updated, perhaps due to: * Changes in the application UI or functionality * Outdated selectors or assertions * Missing wait conditions or timeouts * **Manual Review Required**: The failure requires human review to determine the root cause. The agent provides context to help with the investigation. ## Key Features * **Automatic Diagnosis**: No manual intervention needed—the agent automatically triages failures as they occur. * **Automatic Retry**: The agent automatically retries the test to account for flakiness, helping distinguish between transient failures and persistent issues. * **Comprehensive Analysis**: The agent uses both page screenshots and failure logs to understand the root cause, providing a complete picture of what happened. * **Clear Reasoning**: Each classification comes with clear and concise reasoning, making it easy to understand why the failure occurred and what action to take. * **Comparison Analysis**: By comparing the original failure with the re-run, the agent can distinguish between transient and persistent issues. **Suite runs only** The triage agent is only triggered after suite runs and not on manually triggered test run failures. This ensures that triage runs are performed in a consistent environment and helps maintain the reliability of failure analysis. ## Best Practices * **Act on Recommendations**: Use the classification to prioritize your response—bugs need immediate attention, while test updates can be scheduled. * **Learn from Retries**: Pay attention to "successful\_on\_retry" classifications to identify patterns in transient failures that might need addressing. * **Manual Review**: When the agent recommends manual review, use the provided reasoning and screenshots to investigate further. # AI Script Source: https://documentation.litmuscheck.com/composing/ai-script-generation Execute complex or custom actions using a plain-English prompt ## Usecase **Purpose:** This is your most flexible AI action, designed to perform custom tasks that are not covered by the standard (no-code) instructions. If you feel restricted by the other actions, you can use this to write a command in plain English. This option is available under the "Add an instruction" dropdown. *** ### Arguments This action requires two inputs: * **Enter Description here:** A plain-English overview of what your prompt is supposed to do (e.g., "Find the third item and click delete"). This is for your own reference to keep the test readable. * **Enter your prompt here:** The actual plain-English command you want the AI to perform (e.g., "Scroll to the 'Get Started' button and click it"). *** ### How to Use 1. Select **"AI Script"** from the "Add an instruction" dropdown. 2. Fill in the **Description** and **Prompt** fields with your notes and your command for the AI. Test script 3.s Click the **"Add"** button. The AI will immediately interpret your prompt and start performing the described action in the browser context. 4.s You can see the AI performing the action (e.g., clicking the "Talk to us" button) in the execution window. Test script # AI Steps Source: https://documentation.litmuscheck.com/composing/ai-steps Use AI-driven actions to perform complex interactions All the actions in this section are from the "Add an instruction" dropdown. ## Common Element Selection Methods A few aspects remain common for every action. When you select an action (like "Click" or "Input"), you will always be presented with two primary methods for choosing *which* element to act upon: 1. **New Element:** This option uses AI. You provide a text prompt (e.g., "the 'Add task' button") that helps the AI find the specific element on the page. 2. **Existing Element:** This option allows you to select from a list of pre-saved elements that you have already defined. > **Note:** For complete context on how to create and use pre-saved elements, please refer to the "Using elements" section under Reusability. Here is what these two options look like in the UI: Test script *** ## 1. Click **Purpose:** Simulates a user clicking on an element. This is the most common action, used for interacting with buttons, links, or any other clickable element. You simply identify the target element (using the common methods above), and the script will perform a click. * **Arguments:** This action only expects element rendering arguments. *** ## 2. Hover **Purpose:** Simulates a user moving their mouse cursor over an element. This is essential for testing elements that only appear on mouse-over. * **Use Case:** Use this to trigger tooltips, open dropdown sub-menus, or reveal "hover-to-show" buttons before you can click them. * **Arguments:** This action only expects element rendering arguments. *** ## 3. Select **Purpose:** Selects an option from a dropdown menu. This action is specifically designed for dropdown (`