Fix your failing tests faster by getting hints as to the cause of your failing tests with AI assistance. Projektor supports analyzing test failures with OpenAI’s ChatGPT or Anthropic’s Claude to give insights into possible causes of the test failure.
For example, in this failing Cypress browser test:
AssertionError: Timed out retrying after 5000ms: Expected to find element: `[role="dot-duration-8UNFGPZIGCHD"]`, but never found it.
at Context.eval (webpack://functional-test/../cypress-common/support/commands.js:73:7)
at wrapped (http://localhost:8080/__cypress/runner/cypress_runner.js:137189:43)
Clicking the “Analyze Failure” button will analyze the test failure:

The analysis suggests possible causes of the failure and next steps to try. For this failure, it included hints such as:
cy.debug() or cy.log() to get more detailed information about the failureThe error message you're encountering indicates that a test in a Cypress-based test suite has failed due to a timeout when trying to find an element with the specified selector `[role="dot-duration-8UNFGPZIGCHD"]`. Here are some possible reasons why this test may have failed and some suggestions for troubleshooting:
1. **Element Not Present**:
- The most likely reason is that the element with the role `dot-duration-8UNFGPZIGCHD` does not exist in the DOM at the time the test is executed. This could be due to changes in the application’s state that prevent the element from rendering.
2. **Timing Issue**:
- The element may not be present yet because it takes longer than expected to load. This could be due to slow network conditions, slow server response, or heavy client-side processing. Consider increasing the timeout or using `cy.wait()` to pause the test before checking for the element.
3. **State of the Application**:
- Ensure that the application is in the correct state to display the element you’re testing. If this element is dependent on prior actions or specific states, verify they have been completed successfully.
4. **Selector Issues**:
- The selector `[role="dot-duration-8UNFGPZIGCHD"]` might be incorrect. Double-check the role attribute in the rendered application. If the role or any part of the selector is dynamic (changing on each render), your test may need to be updated accordingly.
5. **Visibility of Element**:
- The element might be present but not visible. Make sure that it is not hidden by CSS or conditional rendering.
6. **Test Environment**:
- Verify if the test is running in the correct environment and that all dependencies (like services the application relies on) are functioning.
7. **Error in the Application Code**:
- There might be a bug in the application that is preventing the element from rendering. Check the application logs or run the application manually to ensure there are no runtime errors.
### Suggestions for Resolution
- **Debugging**: Use `cy.debug()` or `cy.log()` to output useful information just before the assertion to understand the current state of the application and what’s in the DOM.
- **Increase Timeout**: If timing is an issue, consider increasing the default timeout for finding the element:
javascript
cy.get('[role="dot-duration-8UNFGPZIGCHD"]', { timeout: 10000 }).should('exist');
- **Add Waiting Mechanisms**: If there are asynchronous operations that load the element, consider using appropriate commands or waiting strategies:
javascript
cy.wait(2000); // For demonstration, not a best practice. Prefer to wait for specific conditions.
By investigating these areas, you should be able to identify why the test failed and take the necessary steps to correct it.
While AI can’t immediately solve all of your failing tests for you, it can help with ideas on next steps.
When several tests fail from the same root cause, you can also analyze the whole group at once with the “Analyze Root Cause” button on the failure clustering summary.
Each failing test also has an “AI Context” tab (Projektor server >=6.2.0) with the failure’s details formatted as Markdown - test name, file, failure message, and stack trace. Click “Copy Markdown for AI” to paste it into the AI assistant of your choice. This works even if AI test failure analysis isn’t configured on your Projektor server.
To let an AI coding assistant like Claude Code fetch failure details from Projektor itself, connect it to Projektor’s MCP server.
Projektor can use either OpenAI or Anthropic for test failure analysis. API keys are base64-encoded.
AI test failure analysis with ChatGPT is available in Projektor server v5.2.0+ with the following environment variable set to your OpenAI API key:
OPENAI_API_KEY=<base64-encoded OpenAI API key>
AI test failure analysis with Claude is available in Projektor server v6.5.0+ with the following environment variables:
AI_PROVIDER=anthropic
ANTHROPIC_API_KEY=<base64-encoded Anthropic API key>
ANTHROPIC_MODEL=<optional - Claude model ID to use, defaults to claude-opus-5-5>
For example, set ANTHROPIC_MODEL=claude-haiku-4-5 for a faster, lower-cost model.
AI_PROVIDER can be openai or anthropic.
AI_PROVIDER is set, Projektor uses that provider. If that provider’s API key isn’t set, test failure analysis
is disabled - Projektor won’t fall back to the other provider.AI_PROVIDER isn’t set, Projektor uses whichever provider has an API key set. If both keys are set, it uses OpenAI.