Add E2E test for AI Workspace#2210
Conversation
|
Warning Review limit reached
More reviews will be available in 33 minutes and 10 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA Cypress E2E test suite is added to the Suggested Reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
portals/ai-workspace/src/pages/login/BasicAuthLoginPage.tsx (1)
187-223:⚠️ Potential issue | 🟠 Major | ⚡ Quick winResolve inconsistent test selector naming:
data-cyvsdata-cyidacross the UI component layer.The test selector additions follow two different naming conventions:
BasicAuthLoginPage.tsxusesdata-cy- All other component files (
AppSidebar.tsx,AddNewProject.tsx,LLMProxyNew.tsx,ServiceProviderOverview.tsx) usedata-cyidThis inconsistency will cause E2E test specs to fail if they rely on a unified selector strategy. If tests query
[data-cyid="login-username"]they will not find the login elements; if they query[data-cy="login-username"]they will not find elements in other components.Root cause: BasicAuthLoginPage was implemented with a different attribute naming convention than the rest of the codebase.
portals/ai-workspace/src/pages/login/BasicAuthLoginPage.tsx#L187-L223: Rename alldata-cyattributes todata-cyidto match the codebase pattern established in the other four component files.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@portals/ai-workspace/src/pages/login/BasicAuthLoginPage.tsx` around lines 187 - 223, The test selector naming in the BasicAuthLoginPage component uses the data-cy attribute naming convention while the rest of the codebase uses data-cyid, creating an inconsistency that will cause E2E test failures. Replace all occurrences of the data-cy attribute with data-cyid in the login form fields and button elements (specifically the inputProps and data-cy properties with values like login-username, login-password, and login-submit) to match the naming pattern established in the other component files throughout the codebase.
🧹 Nitpick comments (1)
portals/ai-workspace/cypress/support/commands.js (1)
35-45: Replace text-based selectors with dedicated test attributes in thelogincommand.The current selectors rely on UI copy (
placeholder, button text, sidebar labels), making tests brittle to text changes and localization updates. Use thedata-cyanddata-cyidattributes already defined in the UI components:
- Login form: Replace
input[placeholder="username"],input[type="password"], andcy.contains('button', 'Sign In')withcy.get('[data-cy="login-username"]'),cy.get('[data-cy="login-password"]'), andcy.get('[data-cy="login-submit"]')(available inBasicAuthLoginPage.tsx)- Sidebar items: Replace
cy.contains('Projects')withcy.get('[data-cyid="nav-projects"]')(available inAppSidebar.tsx)- Quick Start: Replace
cy.contains('Quick Start')with a dedicated test attribute selector (adddata-cyid="nav-quick-start"or equivalent to the Quick Start sidebar item inAppSidebar.tsxif not present)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@portals/ai-workspace/cypress/support/commands.js` around lines 35 - 45, The login command in the Cypress support file uses brittle text-based selectors that break with UI text changes or localization. Replace the text-based selectors with dedicated test attributes: change input[placeholder="username"] to cy.get('[data-cy="login-username"]'), input[type="password"] to cy.get('[data-cy="login-password"]'), and cy.contains('button', 'Sign In') to cy.get('[data-cy="login-submit"]') (all available in BasicAuthLoginPage.tsx). Additionally, replace cy.contains('Projects') with cy.get('[data-cyid="nav-projects"]') and cy.contains('Quick Start') with a dedicated test attribute selector using cy.get('[data-cyid="nav-quick-start"]') (both in AppSidebar.tsx), adding the data-cyid attribute to the Quick Start sidebar item if it does not already exist.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@portals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.cy.js`:
- Around line 86-89: The route assertion in the cy.location pathname check
hardcodes 'ap-org' instead of using the environment variable for the
organization handle, which causes the test to fail in environments with
different ORG_HANDLE values. Replace the hardcoded 'ap-org' string in the
pathname with a dynamic reference to Cypress.env('ORG_HANDLE') to match the
org-route contract established in the support commands, ensuring the test works
across all environments.
In `@portals/ai-workspace/package.json`:
- Around line 11-13: The test:e2e command uses host.docker.internal which is not
consistently available across Linux environments, causing headless E2E runs to
fail. In the test:e2e script within package.json, add an explicit --add-host
host-gateway mapping to the docker run command to ensure the Docker container
can properly resolve the host gateway regardless of the operating system. Apply
the same host-gateway mapping change to the test:e2e target in
portals/ai-workspace/Makefile and update any related README documentation to
reflect this improvement for cross-platform compatibility.
---
Outside diff comments:
In `@portals/ai-workspace/src/pages/login/BasicAuthLoginPage.tsx`:
- Around line 187-223: The test selector naming in the BasicAuthLoginPage
component uses the data-cy attribute naming convention while the rest of the
codebase uses data-cyid, creating an inconsistency that will cause E2E test
failures. Replace all occurrences of the data-cy attribute with data-cyid in the
login form fields and button elements (specifically the inputProps and data-cy
properties with values like login-username, login-password, and login-submit) to
match the naming pattern established in the other component files throughout the
codebase.
---
Nitpick comments:
In `@portals/ai-workspace/cypress/support/commands.js`:
- Around line 35-45: The login command in the Cypress support file uses brittle
text-based selectors that break with UI text changes or localization. Replace
the text-based selectors with dedicated test attributes: change
input[placeholder="username"] to cy.get('[data-cy="login-username"]'),
input[type="password"] to cy.get('[data-cy="login-password"]'), and
cy.contains('button', 'Sign In') to cy.get('[data-cy="login-submit"]') (all
available in BasicAuthLoginPage.tsx). Additionally, replace
cy.contains('Projects') with cy.get('[data-cyid="nav-projects"]') and
cy.contains('Quick Start') with a dedicated test attribute selector using
cy.get('[data-cyid="nav-quick-start"]') (both in AppSidebar.tsx), adding the
data-cyid attribute to the Quick Start sidebar item if it does not already
exist.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0fa21e24-a247-4b5b-a067-3b36e2e442fe
⛔ Files ignored due to path filters (1)
portals/ai-workspace/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (17)
portals/ai-workspace/.gitignoreportals/ai-workspace/Makefileportals/ai-workspace/README.mdportals/ai-workspace/cypress.config.jsportals/ai-workspace/cypress/e2e/000-smoke/001-basic-login.cy.jsportals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.cy.jsportals/ai-workspace/cypress/e2e/003-mcp-proxies/003-mcp-proxy-sample-url.cy.jsportals/ai-workspace/cypress/e2e/004-gateways/004-ai-gateway.cy.jsportals/ai-workspace/cypress/e2e/005-applications/005-genai-application.cy.jsportals/ai-workspace/cypress/support/commands.jsportals/ai-workspace/cypress/support/e2e.jsportals/ai-workspace/package.jsonportals/ai-workspace/src/pages/appShell/AppSidebar.tsxportals/ai-workspace/src/pages/appShell/appShellPages/projects/AddNewProject.tsxportals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyNew.tsxportals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverview.tsxportals/ai-workspace/src/pages/login/BasicAuthLoginPage.tsx
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ai-workspace-pr-check.yml:
- Around line 22-26: The workflow uses mutable floating action tags
(actions/checkout@v4 and actions/setup-node@v4) which are vulnerable to supply
chain attacks. Pin both actions to their full commit SHAs instead of version
tags to ensure reproducibility and security. Additionally, the actions/checkout
action should have persist-credentials set to false since this is a read-only
workflow that does not require repository credentials to persist beyond the
checkout step.
In `@portals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.cy.js`:
- Around line 173-208: The cleanup code that deletes the LLM provider and
project using the DELETE requests for the llm-providers and projects endpoints
is currently embedded within the test body, which means it won't execute if the
test fails before reaching that point. Move both cy.request DELETE calls (for
deleting the provider and the project) into an afterEach hook to ensure cleanup
runs after every test execution regardless of pass or fail status. Ensure the
afterEach hook has access to the necessary variables like createdProviderId,
organizationId, authToken, and projectName by either storing them in appropriate
scope or passing them through the hook context.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 294791c4-5bd2-44c4-8bb3-aae239af3cdb
⛔ Files ignored due to path filters (1)
portals/ai-workspace/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (9)
.github/workflows/ai-workspace-pr-check.ymlportals/ai-workspace/Makefileportals/ai-workspace/README.mdportals/ai-workspace/cypress.config.jsportals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.cy.jsportals/ai-workspace/cypress/e2e/002-mcp-proxies/002-mcp-proxy-sample-url.cy.jsportals/ai-workspace/cypress/e2e/003-gateways/003-ai-gateway.cy.jsportals/ai-workspace/cypress/e2e/004-applications/004-genai-application.cy.jsportals/ai-workspace/package.json
💤 Files with no reviewable changes (3)
- portals/ai-workspace/cypress/e2e/004-applications/004-genai-application.cy.js
- portals/ai-workspace/cypress/e2e/002-mcp-proxies/002-mcp-proxy-sample-url.cy.js
- portals/ai-workspace/cypress/e2e/003-gateways/003-ai-gateway.cy.js
✅ Files skipped from review due to trivial changes (1)
- portals/ai-workspace/README.md
🚧 Files skipped from review as they are similar to previous changes (3)
- portals/ai-workspace/cypress.config.js
- portals/ai-workspace/Makefile
- portals/ai-workspace/package.json
This pull request introduces comprehensive Cypress end-to-end (E2E) testing support to the
ai-workspaceportal. It adds new E2E test suites covering critical UI flows, updates documentation and developer tooling to support E2E testing, and configures Cypress output directories. The changes ensure that major user journeys—like login, provider/proxy management, AI gateways, and GenAI applications—are now automatically tested for regressions.E2E Testing Framework Integration and Coverage
cypress.config.js) with sensible defaults, environment variables, and browser launch options for local and containerized runs. Test artifacts (videos, screenshots) are output to thereports/directory.001-basic-login.cy.js)001-provider-and-proxy.cy.js)002-mcp-proxy-sample-url.cy.js)003-ai-gateway.cy.js)004-genai-application.cy.js)Developer Tooling and Documentation
Makefileto adde2e-deps,e2e-test, ande2e-opentargets for installing Cypress, running tests headlessly in Docker, and launching the Cypress UI, respectively. [1] [2]README.md, including quickstart instructions, test credentials, and command references.Project Structure and Output
.gitignoreto exclude the newreportsdirectory used for Cypress artifacts.