# 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.
# 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.
**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.
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.
# 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:
***
## 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 (``) elements.
* **How it works:** First, you target the dropdown element itself. Then, you provide the exact text of the option you want to select.
* **Arguments:**
* **Enter a value:** The exact text of the option you want the script to select from the list.
***
## 4. Input
**Purpose:** Types text into a form field.
This is used for filling out forms, search bars, or any text-entry field.
* **How it works:** You first select the target element (like a username field). Then, you provide the text value you want the script to type.
* **Arguments:**
* **Enter a value:** The text you want the script to type into the field.
***
## 5. Upload File
**Purpose:** Simulates a user uploading a file from their computer.
* **How it works:** This is a two-part action. First, you attach the file in the test composer. Then, you select the element on your website (like the "Upload" button) to trigger the upload.
* **Arguments:**
* **File:** A dropdown menu to select the file you want to upload.
***
## 6. Verify (Assertion)
**Purpose:** Checks if a condition is true, which determines if a test step passes or fails. This is the most critical action for *verifying* your application's state.
This action has two primary modes: **Page** (verifying the URL or Title) and **Element** (verifying an element on the page).
* **Arguments (if verifying a PAGE):**
* **Select what you want to verify:** A dropdown with options: "Verify URL" or "Verify Title".
* **Select check type:** The assertion logic (Options: "is", "contains").
* **Enter value:** The expected text for the title or URL.
* **Arguments (if verifying an ELEMENT):**
* First, you select the target element using the **Common Element Selection Methods**.
* Then, you choose the assertion type (e.g., "is visible," "contains text," "is enabled").
* **Common Options (for both modes):**
* **Fail test on verification failure?:** (Yes/No) Choose if this step should fail the entire test if the check is false.
* **Expected result:** (Pass/Fail) Use this to check for *negative* outcomes (e.g., "I expect this verification to *fail*").
***
## 7. AI Script (Custom AI Action)
**Purpose:** Performs complex or custom actions using a plain-English prompt.
If you feel restricted by the standard actions, this is your flexible solution. You can write a command like, "Find the third item in the list and click the delete icon next to it" or "Scroll to the bottom of the page." The AI will interpret your instruction.
* **Arguments:**
* **Prompt:** A text field where you enter your plain-English command for the AI to execute.
# When to Use AI
Source: https://documentation.litmuscheck.com/composing/ai-use
Choose between using AI to generate a script or to execute a step at run time
Our platform offers powerful AI features to accelerate test creation. When building test steps that interact with elements (like "Click" or "Input"), the most important concept to understand is the difference between using AI to **generate a script** (a one-time action) versus using AI to **execute a step** (a repeatable runtime action).
This guide will help you understand the critical choice you'll make when building your test steps.
***
## The "AI Step" Choice: Generate Script vs. Execute Every Time
When you add a step, you have two primary ways to tell the test how to find the element:
1. **"New Element" (Use AI):** You use an AI prompt (e.g., "the login button") to find the element.
2. **"Existing Element" (Use Saved):** You select an element you have already saved.
When you use the **"New Element"** option, you are presented with a critical choice that determines the stability and reliability of your test:
### 1. `Use AI to: "Generate script only"` (Recommended Best Practice)
This is the most stable and recommended method.
* **How it works:** In Compose Mode, the AI finds the element *once* based on your prompt. It then analyzes the element and saves its permanent, stable selector (like an ID or `data-test`) as part of the test step.
* **Why it's better:** The AI *does not run again* during your daily tests. Your test runs fast and reliably, using the saved selector. This gives you the speed of AI for *composing* and the stability of a traditional script for *executing*. You don't need to worry about AI failures during a run.
> **Rule of Thumb:** AI for composing is excellent. For daily runs, you should prefer saved elements and code, not live AI rendering.
### 2. `Use AI to: "Execute step every time"` (Advanced Cases)
This method is your **"Dynamic Finder."**
* **How it works:** The test step *saves your text prompt*, not a selector. Every single time the test runs, the AI must re-read the prompt and search the page to find the element.
* **When to use it:** This should *only* be used for advanced cases where an element is highly dynamic and has no stable selector (e.g., its ID changes every time the page loads).
* **The Trade-Off:** This method is slower and less stable. It carries a higher risk of failure if the AI cannot find the element during a run.
***
## Summary: Element Handling Methods
| AI Method | How it Works | Best For... |
| :---------------------------- | :------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------- |
| **`Generate script only`** | AI finds a stable selector *once* in compose mode. The saved test uses this selector. | **Recommended Best Practice.** Building 99% of tests. Fast creation & stable daily runs. |
| **`Execute step every time`** | AI finds the element based on your *prompt* every time the test runs. | **Advanced cases only.** For highly dynamic elements where selectors always fail. |
# Data‑Driven Tests
Source: https://documentation.litmuscheck.com/composing/data-driven-tests
Iterate test steps over datasets with parameters
Data-driven testing allows you to run the same test multiple times with different sets of data. For example, instead of creating three separate tests for three different user logins, you can create *one* test that runs three times, pulling each username and password from a data file.
Here is how to set it up:
***
## 1. Upload Your Data File
First, you must upload your dataset, which should be in CSV format.
1. Navigate to the **Data** section from the main navigation.
2. Click on the **"Upload CSV"** button.
3. Select and upload the file containing your test data (e.g., `user_logins.csv`).
***
## 2. Link Data to Your Test
Next, you need to tell your test which data file to use.
1. Open the test you want to make data-driven.
2. In Compose Mode, click the **Settings** button (the gear icon) located next to the "Save" button.
3. A new screen will appear. Find the **"Use test data"** toggle and turn it on.
4. From the dropdown, select the CSV file you just uploaded.
5. Click **"Save"** to link the file to this test.
***
## 3. Use the Data in Your Test Steps
Now you can reference the data from your file in any test step.
To use a value, you reference the column header from your CSV file using the following format: `${COLUMN_HEADER}`
> **Example:**
> If your CSV has a column header named `Task_data`, you would enter `'${Task_data}'` into an "Input" step's value field.
### How it Works:
* **In Compose Mode:** The test will *only* use the data from the **first row** (Row 1) of your CSV file for validation and composing.
* **In a Saved Run:** When you save and run the test, it will execute **one full time for every single row** in your CSV file. You can see the results for each data row in the "Logs" section.
As seen in the image above, the test ran 10 times (once for each data row). The **data index** in the logs shows which row was used for that specific execution, allowing you to see which data sets passed or failed.
# From Goal to Test
Source: https://documentation.litmuscheck.com/composing/goal
Turn a natural-language goal into an executable test, or part of a test
## Argument
* **Prompt:** This feature accepts a plain, human-language prompt and converts it into one or more executable test steps.
"Goal" is an AI-powered mode that turns your natural language prompts into executable test steps. This feature can be used in two primary ways: to build an entire end-to-end test from scratch or to add specific steps to a test you are already building.
***
## 1. Perform a Complete End-to-End Test
Use this method to generate an entire test flow, like a login, purchase, or user-registration, all from a single prompt.
1. Begin by adding the **"Go to url"** instruction to load the starting page for your test.
2. In the **"Tell Agent what to do"** field, write a detailed, multi-step prompt that describes the entire test.
> **Example:**
> "Enter 'standard\_user' as username and 'secret\_sauce' as Password, click login. Then, select any product and complete the checkout process."
3. The AI will execute these steps in the compose mode.
4. After the execution is complete, you can **add the generated steps** to your test. This automatically converts the AI's actions into a permanent, reusable Playwright script, so you don't need to use the prompt again for this test.
This process makes automation testing significantly faster by turning a high-level goal into a complete script.
***
## 2. Perform Partial Actions
Use this method when you are already halfway through writing a test and want the AI to perform the next one or two actions.
1. While building your test, simply use the **"Tell Agent what to do"** field.
2. Provide a specific, single-action prompt.
> **Example:**
> "Find the 'Add' CTA under the 'Today' section and click on it."
3. The AI will find the element, perform the action, and show you the code or element it used for the operation. You can then add this single step to your test.
***
Current Limitations :
Please be aware that while the AI mode can *perform* "Verify" and "Visible" assertions during its run, the feature to "add these assertion steps" to your saved test is still in development.
# Run Script
Source: https://documentation.litmuscheck.com/composing/manual-script-generation
Execute custom Playwright code snippets within your test
## Usecase
**Purpose:** This is a powerful, advanced action for users who need to run custom code snippets. It gives you direct access to the Playwright execution context, allowing you to perform complex actions, custom assertions, or page manipulations.
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 code does (e.g., "Fetches a value from local storage"). This is for your own reference to keep the test readable.
* **Enter your script here:** The actual Playwright-compatible JavaScript code you want to execute.
***
### How to Use
1. Select **"Run Script"** from the "Add an instruction" dropdown.
2. Fill in the **Description** and **Script** fields with your notes and code.
3. Click the **"Add"** button. The custom script will immediately execute in the browser context.
4. You can see the result or output of your script in the execution window, just like a standard test step.
# Non‑AI Steps
Source: https://documentation.litmuscheck.com/composing/non-ai-steps
Define deterministic steps like go-to, wait, reload
These are deterministic browser and utility actions. Unlike AI-driven steps, they perform precise, predefined operations—like navigation, waiting, or switching tabs—giving you granular control over your test flow.
***
## 1. Go Back
**Purpose:** Simulates a user clicking the browser's "back" button. This navigates the browser to the previous page in its session history.
***
## 2. Go to URL
**Purpose:** Navigates the current browser tab to a new web address.
* **Arguments:**
* **URL to navigate to:** The full URL (e.g., `https://...`) that you want the browser to load.
***
## 3. Wait Time
**Purpose:** Pauses the test execution for a specified duration. This is useful for waiting for non-interactive elements, like an animation to finish, or for deliberately slowing down a test.
* **Arguments:**
* **Time to wait in seconds:** The number of seconds the test should pause (e.g., `5`).
***
## 4. New Tab
**Purpose:** Opens a new browser tab and navigates it to a specified URL. The test's focus (context) will automatically switch to this new tab.
* **Arguments:**
* **URL to navigate to:** The URL you want the new tab to open.
***
## 5. Switch Tab
**Purpose:** Changes the test's focus from the current tab to another tab that is already open. Use this when your test opens multiple tabs and you need to perform actions on a different tab.
* **Arguments:**
* This step provides two methods for selecting the tab:
1. **Select a tab by title:** Choose from a dropdown list of all currently open tab titles. This is ideal when a previous step (like a "Click") opened a new tab.
2. **Enter URL or pattern:** Specify the URL (or a part of it) of the tab you want to switch to. The test will find the first tab that matches the pattern.
***
## 6. Run Script
**Purpose:** Executes a custom code snippet (e.g., Playwright commands) for advanced, custom actions. This is a powerful feature for advanced users when a standard action isn't enough.
***
## 7. Reuse Test (Use Segment)
**Purpose:** Inserts a pre-saved sequence of test steps (a "Segment") into the current test. This works just like a reusable function in programming, making your tests modular and easy to maintain.
> **Note:** To learn how to create and manage segments, see the "Using Segments" section under Reusability.
***
## 8. Key Press
**Purpose:** Simulates pressing one or more keys on the keyboard. This is used for submitting forms (pressing "Enter"), using keyboard shortcuts (like "Ctrl+S"), or testing keyboard navigation.
* **Arguments:**
* **Key type to press:** A dropdown of the keyboard action (e.g., `press`, `down`, `up`). `press` is the most common, as it simulates both a key down and key up event.
* **Value to press:** The key you want to press. This accepts single keys (e.g., `Enter`, `Tab`, `a`) or combinations (e.g., `Control+S`, `Shift+Tab`).
***
## 9. Page Reload
**Purpose:** Reloads (refreshes) the current page, identical to a user clicking the browser's refresh button.
***
## 10. Set State Variable
**Purpose:** Creates or updates a variable within the test's memory. This allows you to store a value and reuse it in later steps (e.g., in an "Input" or "Verify" action).
* **Arguments:**
* **Variable name:** The name of the variable to store (e.g., `myUser`).
* **Variable value:** The value to assign to the variable (e.g., `standard_user`).
***
## 11. Scroll
**Purpose:** Scrolls the page in a specified direction.
* **Arguments:**
* **Direction to scroll:** A dropdown list of options (e.g., `down`, `up`, `to bottom`, `to top`).
* **Number of pixels to scroll:** The number of pixels to scroll (e.g., `500`). This is a mandatory field for all scroll types.
# Compose a Test
Source: https://documentation.litmuscheck.com/composing/overview
Create a new test in English with side-by-side live execution
## Writing your First Script
1. Begin on the script creation page, where you will find an option to "Enter URL".
2. Enter your website's URL into the provided field to load the page.
3. Once the page loads, you can add subsequent steps (like clicks, text input, etc.) to build out your test script.
## Adding Instructions to your Test
1. After loading your URL, "Compose Mode" becomes active, prompting you to add your first instruction.
2. All available automation actions (such as 'Click', 'Type', 'Assert') are listed under the **"Add an instruction"** dropdown.
3. Select an action (e.g., "Click"). You can then choose from a list of saved elements or use the AI prompt to find a new one (e.g., "Click on Add task CTA"). After you click 'Add', the script will perform the action.
## Editing and Running your Test
You have several controls to manage the test execution and edit steps.
* **Stop / Rerun:** The **Stop** button pauses the execution, allowing you to make changes. The **Rerun** button runs the test again from the beginning.
* **Drag and Drop:** Use the drag icon on the left of each step to change the order of execution.
* **Edit / Delete:** Clicking the three dots on a step allows you to either **Edit** its content or **Delete** the step entirely.
## Saving a Test
1. When you are satisfied with the test execution, locate the **"Save"** button at the top-left of the screen.
2. Click "Save" to open a pop-up, which will ask you to name your test.
3. You also have a **"Close"** option, which closes the Compose window without saving the test.
## Viewing and Exporting Test Scripts
1. After saving, navigate to the test.
2. Click the **Scripts** tab to see the generated code for each instruction.
3. Click **Export** to download the full test script.
# Using Elements
Source: https://documentation.litmuscheck.com/composing/using-elements
Save, manage, and reuse elements to create stable, maintainable tests
The **Elements** section is one of the most impactful parts of the dashboard. It is our implementation of the traditional **Page Object Model (POM)** design pattern.
The core idea is to separate your element selectors (like CSS or XPath) from your test logic. Instead of hard-coding a selector (like `a[data-testid="login-btn"]`) in ten different tests, you save it *once* as an "Element." If that button's selector ever changes, you only have to **update it in one place**, not in all ten tests.
This makes your entire test suite incredibly robust and easy to maintain.
***
## Key Features
* **Store (Element Tagging):** A **Store** acts as a folder or a tag for your elements. This is just like a "Page Object" file (e.g., `LoginPage.js` or `CheckoutPage.js`). By assigning elements to a Store (like "Login Page"), you keep your elements organized and easy to find.
* **Merge:** Sometimes, you might accidentally save the same element (or selector) twice but with different names. The **Merge** feature allows you to combine these duplicates into a single, master element. This cleans up your element list and ensures consistency.
* **Update Existing:** This is one of the most powerful features. If a selector for a saved element becomes flaky or breaks, you can update it *once* in the Elements tab. This change will **automatically apply** to every single test that uses that element, saving you hours of manual work.
***
## How to Create and Save an Element
You can easily save a new element directly from the test composer.
1. In Compose Mode, find a test step that uses an element you want to save. Click the step to expand it and see the action details.
2. The UI will show the selectors the AI found for that element. Click the **"Save to Store"** button.
3. A new pop-up will appear. Fill in the details:
* **Name:** A clear, human-readable name (e.g., "Login Button").
* **Description:** A brief note on what this element is.
* **Store:** Select an existing Store (e.g., "Login Page") from the dropdown. If you're using this for the first time, you can also select the option to create a new Store directly from here.
4. Click **"Save"**. The element is now saved as a reusable Page Object.
5. Now, in any test, you can select this element from the **"Existing Element"** dropdown instead of using the "New Element" AI prompt.
***
## Managing Your Elements
After you've saved elements, you can manage them all from the main **Elements** tab. From here, you can:
* **Edit:** Click an element to update its name, description, or store.
* **Merge:** Select multiple elements to merge them into one.
* **Delete:** Remove elements you no longer need.
* **Selectors:** Update the selector in case you want to change them.\\
# Using Segments
Source: https://documentation.litmuscheck.com/composing/using-segments
Compose flows by reusing grouped steps and actions
Segments work just like reusable functions in a normal Playwright structure. They allow you to save a common portion of a test (like a "Login" or "Add to Cart" flow) and then reuse that set of steps in any other test.
***
## How to Create a Segment
Let's say you have a test called "Login Test" and you want to use those same login steps at the beginning of all your other tests.
1. Navigate to the **Segments** tab in the main navigation.
2. Click the **"Add Segment"** button.
3. A pop-up will appear. First, give your new segment a clear name (e.g., "Login Flow").
4. Next, select the test you want to build from (e.g., "Login Test") from the dropdown.
5. Finally, choose the **Start Step** and the **End Step**. This tells the system that all steps *between* (and including) these two points will be saved as your reusable segment.
6. Click **"Save"**.\\
***
## How to Use a Segment
Once your segment is saved, you can add it to any test.
1. Go to the test where you want to use the segment.
2. In the "Add an instruction" dropdown, choose the **"Reuse Test"** action.
3. From the new dropdown that appears, select the name of the segment you want to add (e.g., "Login Flow").
This will insert all the steps from that segment directly into your current test.
# Compose
Source: https://documentation.litmuscheck.com/core-concepts/compose
Compose a new test in english with live visual execution
## What is Compose?
**Compose** is LitmusCheck's interactive test creation mode that allows you to build tests using natural language instructions while watching them execute in real-time. It provides a side-by-side view where you can see your test steps being performed on a live browser, making test creation intuitive and visual.
Compose mode bridges the gap between test design and execution, enabling you to create reliable end-to-end tests without writing code manually. You describe what you want to test in plain English, and LitmusCheck translates your instructions into executable test steps.
***
## Key Features
### 1. **Live Visual Execution**
* Watch your test steps execute in real-time as you add them
* See exactly how each action interacts with your application
* Validate that your test behaves correctly before saving
### 2. **Natural Language Instructions**
* Write test steps in plain English (e.g., "Click on the login button")
* No need to write code or memorize complex selectors
* AI-powered element detection understands your intent
### 3. **Interactive Test Building**
* Add, edit, delete, and reorder steps with drag-and-drop
* Stop execution at any time to make changes
* Rerun tests from the beginning to verify changes
### 4. **AI-Powered Element Detection**
* Use AI prompts to find elements on the page
* Choose between generating stable selectors or dynamic AI execution
* Save detected elements for reuse across tests
### 5. **Immediate Feedback**
* See step-by-step execution status (success, failure, pending)
* Identify issues immediately during test creation
* Debug and fix problems in real-time
***
## How Compose Works
1. **Enter a URL**: Load your application in the Compose browser
2. **Add Instructions**: Select actions from the dropdown (Click, Type, Verify, etc.)
3. **Watch Execution**: Each step executes immediately after being added
4. **Refine Steps**: Edit, reorder, or delete steps as needed
5. **Save Test**: Once satisfied, save your test for future runs
***
## Use Cases
* **Rapid Test Creation**: Build tests quickly without writing code
* **Visual Validation**: Ensure tests work correctly before committing them
* **Exploratory Testing**: Discover and document test scenarios interactively
* **Test Maintenance**: Update existing tests by watching them execute and making adjustments
***
## Best Practices
* **Use Stable Selectors**: When AI finds elements, prefer saving them as reusable elements rather than using dynamic AI execution for better reliability
* **Test Incrementally**: Add a few steps at a time and verify they work before adding more
* **Use Rerun**: Regularly rerun your test from the beginning to catch regressions
* **Save Frequently**: Save your work periodically to avoid losing progress
# Data-Driven Testing
Source: https://documentation.litmuscheck.com/core-concepts/data-driven-testing
Run tests with datasets (CSV) using parameterization
## What is Data-Driven Testing?
**Data-Driven Testing** is a testing approach that allows you to run the same test multiple times with different input data. Instead of creating separate tests for each data scenario, you create one test and provide it with a dataset (CSV file) containing multiple rows of test data. The test executes once for each row in your dataset, using the values from that row as variables.
This approach significantly reduces test maintenance overhead and makes it easy to test multiple scenarios, user accounts, or data combinations without duplicating test logic.
***
## Key Features
### 1. **CSV File Support**
* Upload CSV files containing your test data
* Each row represents a separate test execution
* Column headers become variable names
### 2. **Variable Substitution**
* Reference CSV columns using `${COLUMN_NAME}` syntax
* Variables are automatically replaced with values from the current row
* Works in any test step that accepts text input except prompts
### 3. **Automatic Iteration**
* Test runs once per row in your CSV file
* Each execution uses data from a different row
* Results are tracked separately for each iteration
### 4. **Compose Mode Support**
* During test creation, uses the first row for validation
* Allows you to build and test your test logic with sample data
* Full dataset is used when running saved tests
### 5. **Result Tracking**
* Each data row execution is tracked independently
* View results for each iteration in test logs
* Identify which data combinations passed or failed
***
## How Data-Driven Testing Works
1. **Upload CSV File**: Create and upload a CSV file with your test data
2. **Link to Test**: Associate the CSV file with your test via settings
3. **Use Variables**: Reference CSV columns in test steps using `${COLUMN_NAME}`
4. **Run Test**: Test executes once for each row in the CSV
5. **Review Results**: Check results for each data iteration
***
## Example Use Cases
* **Multiple User Logins**: Test login functionality with different username/password combinations
* **Form Validation**: Test form submissions with various valid and invalid inputs
* **Product Testing**: Test e-commerce flows with different products, prices, and quantities
* **API Testing**: Test endpoints with different request parameters
* **Cross-Browser Data**: Test the same flow with different browser configurations
***
## Variable Syntax
Use the `${COLUMN_NAME}` format to reference CSV columns:
* **In Input Steps**: `'${username}'` or `'${password}'`
* **In Verify Steps**: `'${expected_text}'`
* **In Any Text Field**: Variables work anywhere text is accepted
***
## Best Practices
* **Clear Column Names**: Use descriptive, consistent column headers
* **First Row for Validation**: Ensure the first row contains valid test data for Compose mode
* **Data Independence**: Each row should represent a complete, independent test scenario
* **Error Handling**: Consider edge cases and invalid data in your dataset
* **Data Organization**: Group related test data together in logical CSV files
# Elements
Source: https://documentation.litmuscheck.com/core-concepts/elements
Define page elements (selectors), and reuse best practices
## What are Elements?
**Elements** are saved page element definitions that store selectors and metadata for UI components in your application. They implement the Page Object Model (POM) design pattern, allowing you to centralize element selectors and reuse them across multiple tests.
Instead of hard-coding selectors like `#login-button` or `button[data-testid="submit"]` directly in your tests, you save them once as Elements. If a selector changes, you update it in one place, and all tests using that element automatically use the new selector.
***
## Key Features
### 1. **Centralized Selector Management**
* Store element selectors in one location
* Update selectors once to fix all tests using them
* Reduce maintenance overhead significantly
### 2. **Multiple Selector Support**
* Save multiple selector strategies for the same element
* Increases test reliability and resilience
### 3. **Element Stores**
* Organize elements into "Stores" (like folders or tags)
* Group elements by page or feature (e.g., "Login Page", "Checkout Page")
* Makes element management scalable and organized
### 4. **AI-Powered Element Detection**
* Use AI to find elements during test creation
* Automatically extract and save selectors
* Supports various selector types (CSS, XPath, text-based)
### 5. **Element Reusability**
* Use saved elements in any test within the same suite
* Consistent element usage across your test suite
* Promotes best practices and standardization
### 6. **Element Merging**
* Combine duplicate elements into a single master element
* Clean up your element library
* Ensure consistency across your test suite
### 7. **Update Existing Elements**
* Modify selectors for saved elements
* Changes propagate automatically to all using tests
* Critical for maintaining tests when UI changes
***
## How Elements Work
1. **Create Element**: Save an element during test creation or manually
2. **Assign to Store**: Organize elements into logical groups
3. **Use in Tests**: Reference saved elements when building test steps
4. **Maintain**: Update selectors when UI changes, affecting all tests automatically
***
## Element Structure
Each element contains:
* **Element ID**: Unique identifier for the element
* **Description**: Human-readable description of the element
* **Prompt**: The original AI prompt used to find the element
* **Selectors**: Array of selector strategies (CSS, XPath, etc.)
* **Store Name**: The store/folder the element belongs to
***
## Use Cases
* **UI Refactoring**: When developers change selectors, update elements once
* **Cross-Test Consistency**: Ensure all tests use the same selectors for the same elements
* **Team Collaboration**: Share element definitions across team members
* **Test Stability**: Use multiple selector strategies for better reliability
* **Maintenance Efficiency**: Reduce time spent fixing broken selectors
***
## Best Practices
* **Save Elements Early**: Save elements as you create tests, not after
* **Use Descriptive Names**: Name elements clearly (e.g., "Login Submit Button" not "Button1")
* **Organize with Stores**: Group related elements into stores by page or feature
* **Regular Updates**: Keep elements updated when UI changes
* **Merge Duplicates**: Periodically review and merge duplicate elements
# Segments
Source: https://documentation.litmuscheck.com/core-concepts/segments
Group reusable steps and selectors to compose larger flows
## What are Segments?
**Segments** are reusable groups of test steps that can be saved and inserted into multiple tests. They function like reusable functions in programming, allowing you to define common test flows once and reuse them across your test suite.
For example, if you have a "Login" flow that consists of multiple steps (navigate to login page, enter username, enter password, click submit), you can save those steps as a segment called "Login Flow" and then insert that entire flow into any test that needs to log in first.
***
## Key Features
### 1. **Step Grouping**
* Select a range of steps from an existing test
* Define start and end steps to create a segment
* Capture complete test flows for reuse
### 2. **Reusability**
* Insert segments into any test within the same suite
* Build complex tests by combining multiple segments
* Reduce test duplication and maintenance overhead
### 3. **Modular Test Design**
* Break down tests into logical, reusable components
* Compose larger test flows from smaller segments
* Promote test organization and maintainability
### 4. **Single Source of Truth**
* Update a segment once to update all tests using it
* Maintain common flows in one place
* Ensure consistency across your test suite
### 5. **Test Composition**
* Combine segments with regular test steps
* Mix and match segments to create different test scenarios
* Build comprehensive test coverage efficiently
***
## How Segments Work
1. **Create Segment**: Select steps from an existing test and save them as a segment
2. **Name Segment**: Give the segment a descriptive name (e.g., "Login Flow", "Add to Cart")
3. **Use in Tests**: Insert the segment into any test using the "Reuse Test" action
4. **Maintain**: Update the segment when the flow changes, affecting all using tests
***
## Segment Structure
Each segment contains:
* **Segment ID**: Unique identifier for the segment
* **Segment Name**: Human-readable name for the segment
* **Source Test**: The test from which the segment was created
* **Start Step**: The first step included in the segment
* **End Step**: The last step included in the segment
***
## Common Use Cases
* **Authentication Flows**: Save login/logout sequences for reuse
* **Navigation Patterns**: Reuse common navigation flows
* **Setup/Teardown**: Standardize test setup and cleanup procedures
* **Common Actions**: Reuse frequently used action sequences (e.g., "Add Item to Cart")
* **Multi-Step Operations**: Break down complex operations into reusable segments
***
## Benefits
* **Reduced Duplication**: Write common flows once, use everywhere
* **Easier Maintenance**: Update flows in one place instead of multiple tests
* **Faster Test Creation**: Build tests by combining existing segments
* **Consistency**: Ensure all tests use the same implementation of common flows
* **Modularity**: Create well-organized, modular test suites
***
## Best Practices
* **Descriptive Names**: Use clear, descriptive names for segments (e.g., "User Login Flow" not "Segment1")
* **Logical Grouping**: Group related steps that form a complete, reusable flow
* **Keep Segments Focused**: Each segment should represent a single, cohesive operation
* **Regular Updates**: Keep segments updated when application flows change
* **Test Segments Independently**: Ensure segments work correctly before reusing them
# Suites
Source: https://documentation.litmuscheck.com/core-concepts/suites
Organize related tests into suites and control execution
## What are Suites?
**Suites** are containers that organize related tests together. They provide a way to group tests at a product level, making it easier to manage, execute, and maintain your test collection. Suites also define shared configuration settings like browser settings, authentication credentials, and environment variables that apply to all tests within the suite.
Think of a suite as a project folder that contains related tests and provides a common execution environment for them.
***
## Key Features
### 1. **Test Organization**
* Group tests that are required to run together
* Organize tests by product for multi-product testing
* Create a clear structure for your test collection
### 2. **Shared Configuration**
* Define browser settings that apply to all suite tests
* Configure multiple environments
### 3. **Suite-Level Execution**
* Run all tests in a suite with a single action
* Track suite execution as a single unit
### 4. **Suite Runs**
* Create suite runs that aggregate results from all test runs
* View overall suite status (total tests, passed, failed, etc.)
* Monitor suite-level metrics and trends
### 6. **Test Relationships**
* Tests belong to exactly one suite
* Suites can contain multiple tests
* Elements and segments are scoped to suites
***
## How Suites Work
1. **Create Suite**: Define a suite with name, description, and configuration
2. **Add Tests**: Create tests into the suite
3. **Configure Settings**: Set browser, authentication, and other shared settings
4. **Execute**: Run individual tests or the entire suite
5. **Monitor**: Track suite runs and test results
***
## Suite Structure
Each suite contains:
* **Suite ID**: Unique identifier for the suite
* **Name**: Descriptive name for the suite
* **Description**: Explanation of what the suite tests
* **Configuration**: Browser and Playwright settings
* **Tests**: Collection of tests belonging to the suite
* **Elements**: Element library scoped to the suite
* **Segments**: Reusable segments available to suite tests
***
## Best Practices
* **Product mapping**: Create a single suite for a product or a high-level product section
* **Clear Naming**: Use descriptive names that indicate what the suite tests
* **Shared Configuration**: Leverage suite-level settings for common configurations
* **Appropriate Size**: Keep suites focused - not too large, not too fragmented
* **Regular Maintenance**: Review and update suite organization as your application evolves
* **Documentation**: Add clear descriptions to explain suite purpose and scope
# Tests
Source: https://documentation.litmuscheck.com/core-concepts/tests
Learn how to write, structure, and execute tests in LitmusCheck
## What are Tests?
**Tests** are the fundamental building blocks of test automation in LitmusCheck. A test represents a single test case that verifies specific functionality or behavior in your application. Each test consists of a sequence of instructions (steps) that interact with your application and validate expected outcomes.
Tests are written using natural language instructions that are translated into executable Playwright scripts. They can be created interactively using Compose mode, where you watch your test execute in real-time, or they can be structured programmatically.
***
## Key Features
### 1. **Natural Language Instructions**
* Write test steps in plain English
* No need to write code manually
* AI-powered translation to executable scripts
### 2. **Step-Based Structure**
* Tests are composed of sequential steps
* Each step performs a specific action (Click, Type, Verify, etc.)
* Steps execute in order to form a complete test flow
### 3. **Multiple Execution Modes**
* **Script Mode**: Execute AI steps using saved Playwright scripts (faster, more stable)
* **AI Mode**: Execute AI steps using AI-powered element detection at run-time (more flexible)
### 4. **Test Metadata**
* **Name**: Descriptive test name
* **Description**: What the test verifies
* **Status**: Current state of the test (draft, active)
### 5. **Data-Driven Support**
* Link CSV files to tests for data-driven execution
* Run tests multiple times with different data sets
* Reference data variables in test steps
### 6. **Element Integration**
* Use saved elements for stable selectors
* Leverage the element library for consistency
* Update elements once to fix all using tests
### 7. **Segment Reusability**
* Insert reusable segments into tests
* Compose complex tests from smaller components
* Reduce duplication and maintenance overhead
### 8. **Export Capability**
* Export tests as Playwright scripts
* Use generated code in external tools
* Integrate with CI/CD pipelines
***
## Test Structure
Each test contains:
* **Test ID**: Unique identifier for the test
* **Name**: Human-readable test name
* **Description**: What the test verifies
* **Instructions**: Sequence of test steps
* **Playwright Scripts**: Generated executable code
* **Suite Association**: The suite the test belongs to
* **Data File**: Optional CSV file for data-driven testing
***
## Test Lifecycle
1. **Create**: Build test using Compose mode or import
2. **Edit**: Modify steps, add instructions, update elements
3. **Save**: Store test for future execution
4. **Run**: Execute test manually or via schedule
5. **Monitor**: Review run results and logs
6. **Maintain**: Update test as application changes
***
## Types of Test Steps
Tests can include various step types:
* **Navigation**: Go to URL, navigate tabs
* **Interaction**: Click, Type, Select, Upload, Key Press
* **Verification**: Verify text, element state, page content
* **Flow Control**: Wait, Scroll
* **Reusability**: Insert segments, reuse test flows
* **Custom**: Run custom scripts for advanced scenarios
***
## Use Cases
* **Functional Testing**: Verify core application functionality
* **Regression Testing**: Ensure existing features still work
* **Integration Testing**: Test interactions between components
* **User Journey Testing**: Validate complete user workflows
* **Smoke Testing**: Quick validation of critical paths
* **Data Validation**: Test with various data combinations
***
## Best Practices
* **Clear Naming**: Use descriptive names that indicate what is being tested
* **Focused Tests**: Each test should verify one specific behavior or flow
* **Use Elements**: Leverage saved elements for stable, maintainable selectors
* **Reuse Segments**: Use segments for common flows to reduce duplication
* **Data-Driven When Appropriate**: Use data-driven testing for testing multiple scenarios
* **Regular Maintenance**: Update tests when application changes
* **Documentation**: Add clear descriptions to explain test purpose
* **Independent Tests**: Design tests to run independently without dependencies
# Variables
Source: https://documentation.litmuscheck.com/core-concepts/variables
Use variables in environment, data files or in-test state
## What are Variables?
**Variables** in LitmusCheck allow you to parameterize your tests by using dynamic values instead of hard-coded data. Variables can be sourced from different places (data files, environments, or test state) and are substituted into test steps at execution time. This makes your tests more flexible, maintainable, and reusable across different environments and data scenarios.
Variables enable you to write tests once and run them with different configurations, data sets, and environments without modifying the test itself.
***
## Key Features
### 1. **Multiple Variable Types**
* **Data-Driven Variables**: Values from CSV files (format: `${variableName}`)
* **Environment Variables**: Values from environment configurations (format: `{{env.variableName}}`)
* **State Variables**: Values set during test execution within the test itself
### 2. **Automatic Substitution**
* Variables are automatically replaced with their values during test execution
* Works in any test step that accepts text input except prompts
* Supports both data-driven and environment variable formats
### 3. **Environment-Specific Values**
* Use different variable values for different environments (dev, staging, prod)
* Switch environments without changing test code
* Maintain environment-specific configurations
### 4. **Data-Driven Integration**
* Reference CSV column values in test steps
* Test executes once per row with different variable values
* Enables comprehensive data scenario testing
### 5. **Runtime State Management**
* Set variables during test execution
* Store values from one step to use in later steps
* Build dynamic test flows based on runtime values
***
## Variable Types
### Data-Driven Variables (`${variableName}`)
Variables loaded from CSV files linked to tests:
* Format: `${COLUMN_NAME}` where `COLUMN_NAME` matches a CSV column header
* Substituted with values from the current CSV row during execution
* Used for testing multiple data scenarios
**Example:**
```javascript theme={null}
// CSV has columns: username, password
// In test step: Type '${username}' into username field
// Executes with: Type 'john@example.com' (value from CSV row)
```
### Environment Variables (`{{env.variableName}}`)
Variables defined in environment configurations:
* Format: `{{env.VARIABLE_NAME}}`
* Substituted with values from the selected environment
* Used for environment-specific values (URLs, API keys, etc.)
**Example:**
```javascript theme={null}
// Environment has: baseUrl = 'https://staging.example.com'
// In test step: Go to '{{env.baseUrl}}/login'
// Executes with: Go to 'https://staging.example.com/login'
```
### State Variables (`${state.variableName}`)
Variables set and used within a single test execution:
* Set using "Set State Variable" action
* Available for subsequent steps in the same test run
* Used for dynamic test flows
**Example:**
```javascript theme={null}
// Step 1: Set state variable 'userId' = '12345',
// or create a run_script step: `state.userId = '12345'`
// Step 2: Verify text contains '${state.userId}'
```
***
## How Variables Work
1. **Define Variables**: Create variables in CSV files or environment configurations
2. **Reference in Tests**: Use variable syntax in test steps
3. **Execution**: Variables are substituted with actual values when test runs
4. **Multiple Values**: For data-driven tests, test runs multiple times with different variable values
***
## Use Cases
* **Environment Management**: Use different URLs, API keys, or credentials per environment
* **Data-Driven Testing**: Test with multiple user accounts, products, or input combinations
* **Dynamic Flows**: Store runtime values (like order IDs) for use in later steps
* **Configuration Management**: Centralize configuration values outside of tests
* **Test Reusability**: Write tests once, run with different data and environments
***
## Variable Substitution
Variables are substituted in:
* **Input Fields**: Text values in Type, Select, and other input actions
* **Verification Values**: Expected values in Verify actions
* **URLs**: Navigation targets
* **Any Text Field**: Anywhere text is accepted in test steps
***
## Best Practices
* **Descriptive Names**: Use clear, descriptive variable names
* **Consistent Naming**: Follow naming conventions (e.g., camelCase or UPPER\_SNAKE\_CASE)
* **Validate Variables**: Ensure variables are defined before using them
* **Environment Separation**: Keep environment-specific variables in environment configs, not in tests
* **Data File Organization**: Organize CSV files logically and use clear column headers
* **State Variable Management**: Use state variables instead of const, var, let to avoid collision
# Create your first test
Source: https://documentation.litmuscheck.com/getting-started/onboard
Learn how to write a basic test
## Create a new suite
**View your suites**\
Once you are logged in, your test suites appear on your homepage.
**Create a suite**\
Click the **New Suite** button at the top of the sidebar.
Enter your `Suite Name`, `URL` and click the **Create** button.
**View suite details**\
Click on the suite name or **View** button on the homepage.
## Create a test
Inside a suite, click the **Add Test** button on the right to launch the Compose View.
### Adding steps
* Enter `saucedemo.com` in the Go to URL input and click **Add**
* Click on **Add** icon and select **Input**
* Enter `standard_user` in **value**, select **New Element**, and enter Username as **prompt**
* Click on **Add** icon and select **Input**
* Enter `secret_sauce` in **value**, select **New Element**, and enter Password as **prompt**
### Live browser view
The browser pane on the right shows your test in action.
* Click **Start Run** to open the session.
* Click **Stop** to end it.
### Adding more steps
When adding more steps while live view is on, the steps continue to execute.
* Click on **Add** icon and select **Click**
* Select **New Element** and enter Login as **prompt**
The live mode will show the execution of the click step.
### Adding goals
Enter a natural-language goal in the bottom input and press **Enter**. The autonomous agent will attempt all available actions to reach your goal. When complete (or if it gets stuck), it will show the sequence of steps it took. You can discard them or add them to your test.
> **Tip:** Keep goals simple for best results.
### Viewing script and selectors
When an instruction runs, its generated script appears in the script box. Click the element description to toggle between available selectors.
### Saving and discarding
* Click **Save** to persist your test (there is no autosave).
* Click **Discard** to throw away unsaved changes.
# Welcome to LitmusCheck
Source: https://documentation.litmuscheck.com/getting-started/welcome
LitmusCheck is now open source — self-host the stack and write AI-powered Playwright tests
LitmusCheck is an **open-source, AI-powered testing platform** built on [Playwright](https://playwright.dev/). Write reliable end-to-end tests in plain English, run them, and let AI triage the failures — all self-hosted on your own infrastructure.
The whole stack is open source and free to run yourself:
The AI QA engine — a Flask backend, a Playwright agent, and a WebSocket gateway.
The Next.js UI where you compose, run, and maintain your tests.
A CLI that triages Playwright failures — ideal for CI/CD pipelines.
## Getting started
Stand up `lc-server` and point `lc-frontend` at it — this is the foundation everything else builds on. Follow the step-by-step guide at [litmuscheck.com/get-started](https://litmuscheck.com/get-started), and see each repository's README for full configuration.
Once your instance is running, [create your first test](/getting-started/onboard) in the Compose view — write steps in plain English and watch them run in a live browser.
Add the [`litmus-agent`](https://www.npmjs.com/package/litmus-agent) CLI to triage Playwright failures from your JSON report and traces — locally or automatically in [CI/CD](/running/cicd). Generate its `LITMUS_API_KEY` from your self-hosted instance.
# AI-Assisted Healing
Source: https://documentation.litmuscheck.com/maintain/ai-assisted-healing
Use AI to suggest and apply fixes to failing tests
## What is AI-Assisted Healing?
AI-Assisted Healing is a two-part process that combines automated diagnosis with AI-powered fixing. It creates a powerful and safe workflow for maintaining your tests.
1. **Part 1: The Diagnosis (AI-Triaging)**
The **AI-Triaging** agent automatically runs after a failed suite, analyzes the failure (logs, screenshots, re-run data), and provides a "Triage Result" (e.g., `Bug`, `Update Test`, or `Successful on Retry`).
2. **Part 2: The Healing (Compose Mode)**
You, the user, use the agent's diagnosis to "heal" the test. The triage data tells you *why* it failed, so you can confidently go into **Compose Mode** and use AI prompts to update the test's logic or locators.
***
## The AI-Assisted Healing Workflow
Here is the step-by-step process for using triage data to fix a broken test.
### 1. Get Your Diagnosis
Start by opening the **"Triage Results"** tab. Look for a test that has been classified as **`Update Test`**.
This classification is the agent's direct recommendation for healing. It means the agent believes the application is working, but your **test script is broken or out-of-date**. The "Reasoning" column will give you the critical clue (e.g., "Element not found" or "Pattern mismatch").
### 2. Go to Compose Mode
Click on the failing test and open it in **Compose Mode**.
### 3. Re-run and Find the Failing Step
Re-run the test in Compose Mode. It will stop at the exact step that the Triage Agent identified as failing.
### 4. Apply the "Healing" (The Fix)
This is where you use the triage data to update the prompt.
1. Hover over the broken step, click the three dots, and select **"Edit"**.
2. You can now apply the fix based on the triage data:
* **If the Triage reason was "Element not found":** This means your selector/prompt is stale. Your fix is to **write a new, more specific AI prompt** using the "New Element" option. (e.g., change your prompt from "Click submit" to "Click the 'Complete Purchase' button").
* **If the Triage reason was a "Pattern mismatch"** (like the `kL` vs. `m³` example): This means your *logic* is brittle. Your fix is to **edit the step** (e.g., a "Run Script" step) and update the logic to be more flexible, such as changing a hardcoded string to a more robust regex.
3. Save the step. Once it passes in Compose Mode, your test is "healed" and ready for the next suite run.
***
## Example: Healing a Broken Locator
1. **Diagnosis:** You check **Triage Results**. A test is marked **`Update Test`**. The reasoning is: "Element not found: unable to find element with prompt 'Click login'."
2. **Action:** You open the test in **Compose Mode** and re-run. It fails on step #3, "Click login."
3. **The Fix:** You "Edit" the step and see the UI has changed—the button text is now "Sign In." You update the "New Element" prompt to **"Click the 'Sign In' button."**
4. **Result:** The step runs successfully. You have used the triage data to safely heal the test.
# AI-Triaging
Source: https://documentation.litmuscheck.com/maintain/ai-triaging
How to use AI-Triage results to maintain your tests
## Using AI-Triaging for Test Maintenance
The AI-Triaging agent is your automated test investigator. When a test fails in a suite run, it automatically re-runs the test and compares the results to tell you *why* it failed.
Your main job is to read the agent's classification. This "Triage Result" tells you exactly what kind of maintenance is required, saving you from investigating the failure manually.
***
## How to Read and Act on Triage Results
After a suite run, go to the **"Triage Results"** tab to see the agent's report. You will see one of the following classifications.
### 1. Category: `successful on retry`
This classification is given when the test failed the first time but **passed** on the agent's re-run.
* **What it means:** You have a **flaky test**. The failure was likely caused by a temporary, transient issue.
* **How to use this:** While you can be confident this failure was not a "real" application bug, you should still investigate *why* it was flaky.
* **Example (from the screenshot):**
This is a perfect example of a **brittle test logic** issue, not a transient bug.
* **The Original Failure:** The agent's reasoning states, "The previous failure was due to the regex expecting 'kL' units while the actual response used 'm³' units, causing a pattern mismatch." This clearly shows the test was **hardcoded** to *only* accept "kL".
* **The "Successful" Retry:** The test passed on the second attempt, but this was likely just due to chance (the data on the re-run happened to be "kL").
* **Action Required:** Do not ignore this. The agent has highlighted a **logic issue** in your test. By seeing this result, you know you need to update your test script to be more robust (e.g., by changing the hardcoded "kL" to a regex that accepts multiple units, like "kL" or "m³").
### 2. Category: `Update Test`
This is the most important classification for test maintenance.
* **What it means:** The agent has determined that the **application is working, but your test script is broken or out-of-date.**
* **How to use this:** This is a direct instruction to perform maintenance. The cause is almost always a **UI change** (like a changed selector) or a new step in a flow. You should go to the test and **update the failing locators or steps**.
### 3. Category: `Bug`
This classification indicates a real problem.
* **What it means:** The agent is confident that your test script is correct and the **application itself is broken.**
* **How to use this:** **Do not "fix" this test.** This is a true failure. You should immediately copy the test results and report this as a bug to your development team.
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.
# Quarantine
Source: https://documentation.litmuscheck.com/maintain/quarantine
Isolate flaky or failing tests to reduce failure 'noise'
## Why Tests Fail
When a test fails, it's almost always for one of these three reasons:
1. **True Failures:** The test found a **real bug** in your application. (Do not quarantine)
2. **Flaky Tests:** The test is unreliable and fails intermittently due to unstable elements or timing. (Quarantine)
3. **Stale Tests:** The application's feature changed, and the test is now out-of-date. (Quarantine)
## The Problem: Test Failure Noise
When flaky or stale tests (types 2 and 3) fail repeatedly, they create "test failure noise." This is dangerous because the high failure count can hide **true bugs** (type 1), allowing them to be missed.
Your goal is to quarantine the "noisy" tests so you can focus on the real bugs.
## How to Quarantine a Test
To quarantine a test, you simply move it from the "Run" state back to the "Draft" state. Schedulers are configured to ignore any test in "Draft."
1. From the test list, select the test you want to quarantine.
2. This will open the test's detail page. On the left of the screen, locate the **Status** section.
3. Click the toggle to move it from **"Run"** to **"Draft"**.
The test is now quarantined. It will be skipped by all scheduled runs, immediately cleaning up your test reports. You can now fix the test in your own time and re-publish it by toggling it back to "Run."
# Updating Locators
Source: https://documentation.litmuscheck.com/maintain/updating-locators
Update selectors safely when the UI changes
## Resolving Failure Due to Flaky/Changed Elements
When your UI changes, a test step can fail because its locator (selector) is flaky or out-of-date. Here is the process to find and fix the broken step.
***
## How to Update a Failing Locator (Simple Fix)
Use this method to quickly fix a single step in a single test.
1. Select the test that is failing and go to **Compose Mode**.
2. Re-run the test. The test will stop at the step that is failing (e.g., "Element not found").
3. Now that you've found the failing step, hover over it. Three dots (the options menu) will appear.
4. Click the three dots and select **"Edit"**.
5. You can now update the locator. You have two choices:
* **Use a New Prompt:** Write a new, more specific AI prompt for the "New Element" option.
* **Use an Existing Element:** Select a different, pre-saved "Existing Element" from the dropdown.
6. Save the step.
***
## How to Update an Existing POM (Saved) Element
When a **saved element** (a POM element) breaks, you want to fix it *once* and have that fix apply everywhere. Here are the two primary methods to do this.
### Method 1: The "Update Existing" Flow (Recommended)
This is the cleanest and most direct method.
1. Go to **Compose Mode** for any test that uses the broken saved element.
2. Hover over the failing step, click the three dots, and select **"Edit"**.
3. Regenerate the step by selecting **"New Element"** and entering a new, working prompt.
4. Once the step runs successfully, click to **"Save to Store"** (just as you did when creating an element).
5. In the "Save to Store" dialog, instead of creating a new element, select the **"Update existing"** option.
6. From the dropdown, choose the old, broken saved element that you want to replace.
7. Saving this will overwrite the old, flaky selector with your new, working one, fixing it across all tests.
### Method 2: The "Save and Merge" Flow
This is a good alternative if you want to be more cautious.
1. Follow steps 1-3 from Method 1.
2. Instead of "Update existing," save the working step as a **brand new element** (e.g., "Login Button V2").
3. Now, go to the main **"Elements"** tab from the navigation.
4. Find your old, broken element (e.g., "Login Button").
5. Select the **"Merge"** option and merge the old, broken element *into* your new, working one ("Login Button V2"). This will update all tests to use the new element.
# Updating Segments
Source: https://documentation.litmuscheck.com/maintain/updating-segments
Refactor and evolve segments without breaking tests
As your application evolves, you will need to update your saved Segments. This could mean changing the steps they include, or even their name.
***
## How to Update a Segment
1. Navigate to the main **Segments** tab.
2. Click the "Edit" button.
3. A pop-up window will appear, allowing you to edit all of the segment's properties:
* **Change the Name:** You can update the **Segment Name** to be more descriptive.
* **Change the Source Test:** You can select a completely different test from the dropdown to act as the new source for the segment.
* **Change the Execution Steps:** You can adjust the **Start Step** and **End Step** dropdowns. For example, you can change the segment to run from Step 3 to Step 6, instead of its original Step 2 to Step 6.
4. Click **"Update Segment"** to save your changes.
Once you save, these changes will be automatically applied to all tests that are currently using this "Reuse Test" segment.
# CI/CD Integration
Source: https://documentation.litmuscheck.com/running/cicd
Trigger tests from pipelines and PRs with GitHub Actions
# Runtime Configuration
Source: https://documentation.litmuscheck.com/running/config
Configure environments, secrets, and test runtime settings
## Add Environment
To add a new environment to your suite, including secrets, variables, and other configuration details:
1. Go to the suite.
2. Click on the **Environments** tab.
3. Click on **+ Add environment**.
4. Enter the environment name.
5. Add variable details, such as variable name and value.
6. Click **Create Environment**.
## Select Environment and Run Test or Suite
To run a test or suite with a specific environment:
1. On the suite page, click the dropdown labeled **No environment** next to the suite name.
2. Select the desired environment from the list.
3. Click **Run** to execute the suite, or run any individual test from the suite page or test page.
# Run a Suite from the Dashboard and Suite Page
Source: https://documentation.litmuscheck.com/running/dashboard
A step-by-step guide to running test suites in LitmusCheck from the dashboard and suite page
## Run from dashboard
1. Go to the dashboard.
2. Hover over the suite name.
3. Click the **Three dots**.
4. Click **Run**.
> **Note:** Tests marked **Draft** will be skipped in suite runs but can be executed individually.
## Run from the suite page (Default Config)
1. Go to the dashboard.
2. Open the suite page.
3. Click **Run**.
## Run from the suite page (Advance Config)
This option lets you customize the environment for your test run by choosing browser, device, OS, and viewport settings.
1. Go to the dashboard and open the suite page.
2. Click the dropdown arrow next to **Run**.
3. Click **Choose config**.
4. Select your desired environment options (browser, device, OS, viewport).
5. Select desired **Tags**.
6. Click **Run Suite**.
***
# Logs & Traces
Source: https://documentation.litmuscheck.com/running/logs-and-traces
Inspect run logs, traces, and artifacts for troubleshooting
## Viewing run logs
### Suite run logs
All suite runs—manual, scheduled, or external—are logged.
1. Go to the suite.
2. Click the **Logs** tab.
3. Select a run to see a summary of its tests.
### Test run logs
All test runs are logged, whether run individually or as part of a suite.
1. Go to the test.
2. Click the **Logs** tab for a run history.
### Debugging and run proofs
* View warnings and errors in the logs.
* See a GIF of each step.
* Click **View Trace** for console logs, network logs, and timestamped screenshots.
# Running Overview
Source: https://documentation.litmuscheck.com/running/overview
Overview of executing tests and managing runs in LitmusCheck
## Running and Monitoring
### 4 ways to run suites
1. Manually from the dashboard
2. Manually from the suite page
3. Scheduling
4. Integrating with the CI/CD pipeline
### 2 ways to run tests
1. Manually from the suite page
2. Manually from the test page
### Monitoring artifacts
Runs create the following artifacts
* Suite run report with pass/fail summary
* Logs for each test run
* Browser traces for every test
* GIF created from screenshots during each test run
## Setting up slack alerts
1. Go to **Home**.
2. Go to **Settings** (top nav bar).
3. Enter your Slack channel webhook URL.
4. Click **Save**.
## Setting up email alerts
1. Open the suite page and select the **Settings** tab. .
2. Enter your email address under **Notification Settings**.
3. Click **Add Email**.
You’ll receive alerts with pass/fail/skip counts and details on failed or skipped tests.
# Reports
Source: https://documentation.litmuscheck.com/running/reports
View execution reports, failures, and performance insights
### Suite run reports
All suite runs—manual, scheduled, or external—are logged.
1. Go to the suite.
2. Click the **Logs** tab.
3. Select a run to see a report of its tests.
4. Click on any test run to view its logs, GIF, and traces.
# Schedules
Source: https://documentation.litmuscheck.com/running/schedules
Create, manage, and automate recurring test runs
## Scheduling suite runs
1. Open the suite and select the **Schedules** tab.
2. Click **Add Schedule**.
3. Choose hourly or daily recurrence.
4. Select the **Environment**, **Tags** and **Config**.
5. Click **Add**.
> **Note:** All schedules for that suite will appear in this view
# Tags
Source: https://documentation.litmuscheck.com/running/tags
Use tags to organize and run specific groups of tests.
## Adding and Using Tags
To add or use tags for your tests:
1. Go to the suite page.
2. Click on the **Add** icon in the **Tags** section.
3. Add a new tag by entering a name and clicking on **Add**.
4. Or, select an existing tag and click **Save**.
After selecting tags, the suite page will display the chosen tags next to the tests. For example:
## Run a Suite Using Tags
To run a suite using tags:
1. On the suite page, click the dropdown arrow next to **Run**.
2. Click on **Choose config**.
3. In the configuration panel, go to the **Tags** section.
4. Select the desired condition from the dropdown (e.g., **Contains any** or **Does not contain any**).
5. Choose the tag(s) you want to use for filtering.
6. Click **Run Suite** to execute the suite with the selected tag filter.
# Run a test
Source: https://documentation.litmuscheck.com/running/test
A guide to executing individual tests in LitmusCheck
## Running a test from the suite page
1. Open the suite.
2. Locate the test you want to run and click the **Run** button next to its name.
## Running a test from the test page (Default Config)
1. Open the suite and open the test.
2. Click **Run**.
## Running a test from the test page (Advance Config)
Use this option to customize how the test runs by selecting specific configuration and environment settings.
1. Open the suite and open the test.
2. Click the dropdown arrow next to **Run**.
3. Click **Choose config**.
4. Choose your desired **Test run configuration** and **Environment** options.
5. Click **Run Test**