Project Organization feature cypress tests with improvements/bug fixes#844
Open
gingerknight wants to merge 11 commits intodevelopfrom
Open
Project Organization feature cypress tests with improvements/bug fixes#844gingerknight wants to merge 11 commits intodevelopfrom
gingerknight wants to merge 11 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
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-testidattributes to React components and migrates alldata-cyselectors todata-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-cy → data-testid |
ActivatedUserComponents.tsx |
Migrate data-cy → data-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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data-cy/data-testidtodata-testidonlycy.wait()calls in helper files with deterministic API intercepts and DOM assertionsChanges
New Project Smoke Tests
project.shared.spec.ts: 18 tests covering view toggle, CRUD, session assignment/removalprojectHelpers.ts: Helper functions for project creation, rename, delete, and view switchingsmoke/support/commands.ts: Added project and session API stubs with in-memory stateTest Selector Standardization
data-testidattributes to 6 React components (Chat, ChatPromptInput, RagOptions, BaseModelConfig, Sessions, ProjectsSection)data-testidwith fallback to old selectorsdata-cy→data-testidin React components and Cypress testsHardcoded Wait Removal
cy.wait(ms)calls across 6 helper files with:cy.intercept+cy.wait('@alias')) for delete operationsaria-pressed, element visibility, content checks) for UI state changesTests
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.