Skip to content

Project Organization feature cypress tests with improvements/bug fixes#844

Open
gingerknight wants to merge 11 commits intodevelopfrom
project-cypress
Open

Project Organization feature cypress tests with improvements/bug fixes#844
gingerknight wants to merge 11 commits intodevelopfrom
project-cypress

Conversation

@gingerknight
Copy link
Contributor

@gingerknight gingerknight commented Mar 13, 2026

Summary

  • Add 18 new smoke tests for the Project Organization feature (12 → 30 total)
  • Standardize all test selectors from mixed data-cy/data-testid to data-testid only
  • Replace all hardcoded cy.wait() calls in helper files with deterministic API intercepts and DOM assertions
  • Fix e2e login flow to handle both single-page and two-step Cognito auth
  • Fix e2e test failures in bedrock-model-workflow and chat specs (7 failing → 0 failing)

Changes

  • ~55% faster e2e runtime
  • ~9% faster on shared smoke specs

New Project Smoke Tests

  • project.shared.spec.ts: 18 tests covering view toggle, CRUD, session assignment/removal
  • projectHelpers.ts: Helper functions for project creation, rename, delete, and view switching
  • Smoke fixtures for project and session API stubs with stateful mock data
  • smoke/support/commands.ts: Added project and session API stubs with in-memory state

Test Selector Standardization

  • Added data-testid attributes to 6 React components (Chat, ChatPromptInput, RagOptions, BaseModelConfig, Sessions, ProjectsSection)
  • Updated all Cypress helper selectors to use data-testid with fallback to old selectors
  • Migrated all 10 data-cydata-testid in React components and Cypress tests

Hardcoded Wait Removal

  • Replaced 9 cy.wait(ms) calls across 6 helper files with:
    • API intercepts (cy.intercept + cy.wait('@alias')) for delete operations
    • DOM assertions (aria-pressed, element visibility, content checks) for UI state changes

Tests

  • All 30 smoke tests passing in CI
  • No regressions on existing smoke tests
  • E2e test run against deployed environment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@gingerknight gingerknight marked this pull request as ready for review March 16, 2026 15:57
@jmharold jmharold requested a review from Copilot March 16, 2026 21:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds 18 new Cypress smoke tests for the Project Organization feature, standardizes test selectors from data-cy to data-testid, replaces hardcoded cy.wait() calls with deterministic API intercepts/DOM assertions, fixes the e2e login flow for two-step Cognito auth, and fixes failing bedrock-model-workflow and chat specs.

Changes:

  • Adds data-testid attributes to React components and migrates all data-cy selectors to data-testid, with corresponding Cypress selector updates using fallback patterns
  • Introduces stateful mock stubs for projects and sessions in smoke tests, plus new shared test suite (project.shared.spec.ts) and helper functions (projectHelpers.ts)
  • Replaces hardcoded cy.wait(ms) calls with API intercepts (cy.wait('@alias')) and DOM assertions across helper files, and fixes e2e login to handle both single-page and two-step Cognito flows

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
confirmation-modal.tsx Remove data-cy (covered by existing data-testid)
BaseModelConfig.tsx Add data-testid to model ID/name inputs
ConfigurationComponent.tsx Migrate data-cydata-testid
ActivatedUserComponents.tsx Migrate data-cydata-testid
Sessions.tsx Add data-testid to segmented control and session items
RagOptions.tsx Add data-testid to RAG autosuggest inputs
ProjectsSection.tsx Add data-testid to modal buttons and inputs
ChatPromptInput.tsx Add data-testid to prompt textarea
Chat.tsx Add data-testid to model selection autosuggest
repositoryHelpers.ts Replace cy.wait(ms) with DOM assertions; refactor KB selection to handle empty state
promptTemplateHelpers.ts Replace cy.wait(ms) with content assertion
projectHelpers.ts New helper file for project CRUD operations
modelFormHelpers.ts Replace cy.wait(ms) with API intercepts; update selectors
collectionHelpers.ts Replace cy.wait(ms) with DOM assertions; update selectors
chatHelpers.ts Update selectors; replace cy.wait(ms) with DOM assertion
smoke/support/commands.ts Add stateful project/session stubs
project.smoke.spec.ts New smoke test spec for projects
project.shared.spec.ts New shared test suite for project feature
bedrock-model-workflow.shared.spec.ts Fix duplicate tests, handle missing KBs, fix template API response parsing
e2e/support/commands.ts Fix login for two-step Cognito; add project API intercept
session.json Add projectId to fixture sessions
project.json New fixture for project mock data
configuration.json Enable projectOrganization in fixture config
user.shared.spec.ts Add options parameter for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +159 to +168
// Stub all static API endpoints
API_STUBS.forEach(({ endpoint, alias }) => {
cy.intercept('GET', `**${apiBase}/${endpoint}*`, { fixture: `${endpoint}.json` }).as(alias);
});

// Setup stateful project stubs
setupProjectStubs(apiBase);

// Setup stateful session stubs
setupSessionStubs(apiBase);
Comment on lines +35 to +53
// Stateful mock data for projects
let mockProjects: Array<{
projectId: string;
name: string;
createTime: string;
lastUpdated: string;
}> = [];

// Stateful mock data for sessions
let mockSessions: Array<{
sessionId: string;
name: string | null;
firstHumanMessage: string;
startTime: string;
createTime: string;
lastUpdated: string;
projectId?: string;
isEncrypted: boolean;
}> = [];
Comment on lines +62 to +63
cy.get('a[aria-label="AI Assistant"]')
.eq(2)
Comment on lines +46 to +47
SESSION_ITEM: '[data-testid="session-item"]',
SESSION_ITEM_ACTIVE: '[data-testid="session-item"]',
>
<FormField label='Project Name'>
<Input
data-testid='input-placeholder'
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.

2 participants