-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress tests for File Uploads #10774
base: develop
Are you sure you want to change the base?
Cypress tests for File Uploads #10774
Conversation
WalkthroughA new Cypress test suite for patient file management has been added, covering functionalities such as single/multiple file uploads, audio recording, file renaming, and archiving. A new page object class, Changes
Sequence Diagram(s)sequenceDiagram
participant Nurse
participant Cypress
participant FilesPage
participant API
Nurse->>Cypress: Log in and navigate to encounter details
Cypress->>FilesPage: Open patient files tab
FilesPage-->>Cypress: Display file management options
Cypress->>FilesPage: Initiate file upload / audio recording / renaming / archiving
FilesPage->>API: Trigger corresponding API call
API-->>FilesPage: Return success response
FilesPage-->>Cypress: Update UI and verify actions
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (5)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
cypress/e2e/patient_spec/patient_files.cy.ts (2)
88-127
: Consider adding audio content verification.The test case thoroughly covers UI interactions and API calls. However, consider adding verification for:
- Audio file content or size after recording
- Successful download by checking file existence in downloads folder
Apply this diff to add file verification:
.verifySingleFileUploadSuccess(fileUploadSuccessToast) .filterActiveFiles() -.verifyFilesAdded([audioDisplayName]) +.verifyFilesAdded([audioDisplayName]) +// Verify file size is greater than 0 +.then(() => { + cy.readFile(`cypress/downloads/${audioDisplayName}`).should('have.length.gt', 0) +})
169-169
: Track the planned "Convert to PDF" test.The TODO comment aligns with the PR objectives, which mention that the "Convert to PDF" test is planned but not yet completed.
Would you like me to help implement the "Convert to PDF" test case or create an issue to track this task?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
cypress/fixtures/sample_file.xlsx
is excluded by!**/*.xlsx
cypress/fixtures/sample_img1.png
is excluded by!**/*.png
cypress/fixtures/sample_img2.png
is excluded by!**/*.png
📒 Files selected for processing (6)
cypress/e2e/patient_spec/patient_files.cy.ts
(1 hunks)cypress/pageObject/Patients/PatientFiles.ts
(1 hunks)src/components/Files/AudioCaptureDialog.tsx
(4 hunks)src/components/Files/FileUploadDialog.tsx
(1 hunks)src/components/Files/FilesTab.tsx
(5 hunks)src/hooks/useFileUpload.tsx
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- src/components/Files/FileUploadDialog.tsx
- src/hooks/useFileUpload.tsx
- src/components/Files/AudioCaptureDialog.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: cypress-run (1)
🔇 Additional comments (5)
cypress/e2e/patient_spec/patient_files.cy.ts (3)
60-72
: LGTM! Well-structured test case for single file upload.The test case follows good practices by:
- Using page object pattern for maintainability
- Verifying both UI interactions and API calls
- Checking validation errors and success messages
- Confirming file presence in the UI
74-86
: LGTM! Well-structured test case for multiple file uploads.The test case follows good practices by:
- Reusing page object methods for maintainability
- Verifying both UI interactions and API calls
- Checking validation errors and success messages
- Confirming multiple files presence in the UI
129-167
: LGTM! Comprehensive test case for file lifecycle.The test case effectively covers the complete file lifecycle:
- Initial file upload
- File rename operation
- File archive operation
- Archive reason verification
cypress/pageObject/Patients/PatientFiles.ts (1)
1-238
: LGTM! Well-designed page object class.The
PatientFiles
class follows best practices:
- Implements page object pattern for better maintainability
- Uses method chaining for fluent API
- Provides comprehensive coverage of file management operations
- Includes proper error handling and verifications
src/components/Files/FilesTab.tsx (1)
285-285
: LGTM! Good test coverage with data-cy attributes.The added data-cy attributes enhance testability by providing reliable selectors for:
- File options button
- Add files button
- Record audio button
- File rows
Also applies to: 398-398, 441-441, 544-544
all of them running fine in local, but creating duplicate file names when re-run, since it targets same patient every time |
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit