Skip to content

Add E2E test for AI Workspace#2210

Open
Induwara04 wants to merge 5 commits into
wso2:mainfrom
Induwara04:sl-work-2
Open

Add E2E test for AI Workspace#2210
Induwara04 wants to merge 5 commits into
wso2:mainfrom
Induwara04:sl-work-2

Conversation

@Induwara04

@Induwara04 Induwara04 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces comprehensive Cypress end-to-end (E2E) testing support to the ai-workspace portal. 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

  • Added Cypress configuration (cypress.config.js) with sensible defaults, environment variables, and browser launch options for local and containerized runs. Test artifacts (videos, screenshots) are output to the reports/ directory.
  • Implemented E2E test suites for:
    • Basic login flow (001-basic-login.cy.js)
    • OpenAI provider and proxy lifecycle (001-provider-and-proxy.cy.js)
    • MCP proxy sample URL flow (002-mcp-proxy-sample-url.cy.js)
    • AI gateway lifecycle (003-ai-gateway.cy.js)
    • GenAI application lifecycle (004-genai-application.cy.js)

Developer Tooling and Documentation

  • Updated Makefile to add e2e-deps, e2e-test, and e2e-open targets for installing Cypress, running tests headlessly in Docker, and launching the Cypress UI, respectively. [1] [2]
  • Documented E2E testing setup and usage in README.md, including quickstart instructions, test credentials, and command references.

Project Structure and Output

  • Updated .gitignore to exclude the new reports directory used for Cypress artifacts.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Induwara04, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 685692f4-7c03-4a34-9fb3-33205ee74bd0

📥 Commits

Reviewing files that changed from the base of the PR and between f4d8baa and 8697f46.

📒 Files selected for processing (2)
  • .github/workflows/ai-workspace-pr-check.yml
  • portals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.cy.js
📝 Walkthrough

Walkthrough

A Cypress E2E test suite is added to the portals/ai-workspace portal. The infrastructure includes cypress.config.js (baseUrl, artifact paths, timeouts, Chromium launch args, test env), Makefile targets (e2e-deps, e2e-test, e2e-open), updated package.json scripts, Cypress 13.17.0 pinned as a dependency, and reports/ excluded from git. A GitHub Actions workflow runs the suite on PRs targeting main. Shared visitWorkspace and login Cypress commands are added. data-cy/data-cyid attributes are added to login, sidebar, project creation, LLM proxy creation, and service provider UI elements. Five spec suites cover basic login, OpenAI provider/proxy lifecycle, MCP proxy lifecycle, AI gateway lifecycle, and GenAI application lifecycle. README documents the setup and default credentials.

Suggested Reviewers

  • RakhithaRR
  • Tharsanan1
  • VirajSalaka
  • tharindu1st
  • malinthaprasan
  • AnuGayan
  • chamilaadhi
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change—adding E2E tests for the AI Workspace portal—and aligns with the substantial test suite additions throughout the changeset.
Description check ✅ Passed The description comprehensively covers the changes and aligns well with the template structure, addressing purpose, goals, approach, and documentation; however, it does not explicitly cover all template sections such as user stories, automation tests details, security checks, samples, and test environment specifications.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread portals/ai-workspace/Makefile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Resolve inconsistent test selector naming: data-cy vs data-cyid across the UI component layer.

The test selector additions follow two different naming conventions:

  • BasicAuthLoginPage.tsx uses data-cy
  • All other component files (AppSidebar.tsx, AddNewProject.tsx, LLMProxyNew.tsx, ServiceProviderOverview.tsx) use data-cyid

This 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 all data-cy attributes to data-cyid to 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 the login command.

The current selectors rely on UI copy (placeholder, button text, sidebar labels), making tests brittle to text changes and localization updates. Use the data-cy and data-cyid attributes already defined in the UI components:

  • Login form: Replace input[placeholder="username"], input[type="password"], and cy.contains('button', 'Sign In') with cy.get('[data-cy="login-username"]'), cy.get('[data-cy="login-password"]'), and cy.get('[data-cy="login-submit"]') (available in BasicAuthLoginPage.tsx)
  • Sidebar items: Replace cy.contains('Projects') with cy.get('[data-cyid="nav-projects"]') (available in AppSidebar.tsx)
  • Quick Start: Replace cy.contains('Quick Start') with a dedicated test attribute selector (add data-cyid="nav-quick-start" or equivalent to the Quick Start sidebar item in AppSidebar.tsx if 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0de6a75 and d101ed1.

⛔ Files ignored due to path filters (1)
  • portals/ai-workspace/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • portals/ai-workspace/.gitignore
  • portals/ai-workspace/Makefile
  • portals/ai-workspace/README.md
  • portals/ai-workspace/cypress.config.js
  • portals/ai-workspace/cypress/e2e/000-smoke/001-basic-login.cy.js
  • portals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.cy.js
  • portals/ai-workspace/cypress/e2e/003-mcp-proxies/003-mcp-proxy-sample-url.cy.js
  • portals/ai-workspace/cypress/e2e/004-gateways/004-ai-gateway.cy.js
  • portals/ai-workspace/cypress/e2e/005-applications/005-genai-application.cy.js
  • portals/ai-workspace/cypress/support/commands.js
  • portals/ai-workspace/cypress/support/e2e.js
  • portals/ai-workspace/package.json
  • portals/ai-workspace/src/pages/appShell/AppSidebar.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/projects/AddNewProject.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyNew.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverview.tsx
  • portals/ai-workspace/src/pages/login/BasicAuthLoginPage.tsx

Comment thread portals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.cy.js Outdated
Comment thread portals/ai-workspace/package.json Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d101ed1 and f4d8baa.

⛔ Files ignored due to path filters (1)
  • portals/ai-workspace/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • .github/workflows/ai-workspace-pr-check.yml
  • portals/ai-workspace/Makefile
  • portals/ai-workspace/README.md
  • portals/ai-workspace/cypress.config.js
  • portals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.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
  • portals/ai-workspace/cypress/e2e/004-applications/004-genai-application.cy.js
  • portals/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

Comment thread .github/workflows/ai-workspace-pr-check.yml Outdated
Comment thread portals/ai-workspace/cypress/e2e/001-providers/001-provider-and-proxy.cy.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants