Skip to content
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

Cu 86bznyre9 settings end to end testing #293

Open
wants to merge 10 commits into
base: CU-86bznypcf_Notifications-End-To-End-Testing
Choose a base branch
from

Conversation

NyashaMuusha
Copy link
Collaborator

@NyashaMuusha NyashaMuusha commented Aug 7, 2024

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive end-to-end tests for the following features: Browse Records, Dashboard, Notifications, and Settings pages, enhancing overall application reliability.
    • Added Cypress configuration file to streamline testing setup.
  • Improvements

    • Enhanced accessibility and testability across various components by adding data-testid attributes and IDs.
    • Updated date picker fields for better UI consistency.
    • Removed the /browse-records API route, shifting focus to more specific record retrieval.
  • Bug Fixes

    • Improved overall component functionality without altering the core logic.
  • Documentation

    • Enhanced TypeScript configurations for improved type-checking and file inclusion during compilation.
  • Chores

    • Updated dependencies in package.json for better compatibility and support.

@rcrichton
Copy link
Member

Task linked: CU-86bznyre9 Settings-End-To-End-Testing

Copy link
Contributor

coderabbitai bot commented Aug 7, 2024

Walkthrough

The recent updates significantly enhance the testing capabilities of the JeMPI_UI project by integrating Cypress for both end-to-end and component testing. New configuration files streamline the testing setup, while various test files cover essential application features like notifications, settings, and dashboards. Improvements to UI components enhance accessibility and usability, fostering a more effective testing environment. Collectively, these changes promote robust and maintainable testing practices throughout the application.

Changes

File(s) Change Summary
cypress.config.ts New configuration file for Cypress, defining setups for e2e and component testing.
cypress/e2e/*.cy.ts New e2e test files for Browse Records, Dashboard, Notifications, and Settings, covering various functionalities.
cypress/fixtures/*.json New JSON fixture files for notifications and search responses, providing mock data for tests.
cypress/support/*.ts New support files for custom commands and component mounting, enhancing testing flexibility.
package.json Updated scripts and dependencies, including Cypress for improved testing capabilities.
src/components/*.tsx Modifications for accessibility and usability, adding IDs and improving event handling in several components.
tsconfig.json Updated TypeScript configuration to include Cypress types and refine compilation settings.
devops/linux/docker/data-config/*.json Removed the "/browse-records" route from the API configuration, indicating a shift in functionality.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant Cypress

    User->>Cypress: Start Tests
    Cypress->>App: Load App Components
    App->>Cypress: Render UI
    Cypress->>App: Trigger User Interactions
    App->>Cypress: Return UI State
    User->>Cypress: View Test Results
Loading

🐰 In the meadow where bunnies play,
New tests hop in, brightening the day.
With configurations set just right,
We leap through features, a joyful sight.
So let’s dance and twirl with glee,
Testing's now fun as can be! 🌼✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Outside diff range, codebase verification and nitpick comments (2)
JeMPI_Apps/JeMPI_UI/src/pages/settings/blocking/Blocking.tsx (2)

3-3: Remove unnecessary space in import statement.

The space between React, {useState } should be consistent.

- import React, {useState } from 'react'
+ import React, { useState } from 'react'

14-14: Remove trailing comma in destructuring assignment.

The trailing comma in the destructuring assignment of useConfiguration is unnecessary.

- const { configuration,} = useConfiguration()
+ const { configuration } = useConfiguration()
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 75abfa4 and e75568f.

Files ignored due to path filters (2)
  • JeMPI_Apps/JeMPI_UI/package-lock.json is excluded by !**/package-lock.json
  • JeMPI_Apps/JeMPI_UI/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (23)
  • JeMPI_Apps/JeMPI_UI/cypress.config.ts (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/e2e/browseRecords.cy.ts (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/e2e/dashboard.cy.ts (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/e2e/notifications.cy.ts (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/e2e/settings.cy.ts (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/fixtures/configuration.json (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/fixtures/notifications.json (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/fixtures/searchResponse.json (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/support/commands.ts (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/support/component-index.html (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/support/component.ts (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/support/e2e.ts (1 hunks)
  • JeMPI_Apps/JeMPI_UI/cypress/ts.config.json (1 hunks)
  • JeMPI_Apps/JeMPI_UI/package.json (3 hunks)
  • JeMPI_Apps/JeMPI_UI/src/components/browseRecords/BrowseRecords.tsx (4 hunks)
  • JeMPI_Apps/JeMPI_UI/src/components/dashboard/Dashboard.tsx (1 hunks)
  • JeMPI_Apps/JeMPI_UI/src/components/notificationWorklist/NotificationWorklist.tsx (2 hunks)
  • JeMPI_Apps/JeMPI_UI/src/components/shell/PageHeader.tsx (1 hunks)
  • JeMPI_Apps/JeMPI_UI/src/pages/settings/blocking/Blocking.tsx (1 hunks)
  • JeMPI_Apps/JeMPI_UI/src/pages/settings/blocking/BlockingContent.tsx (4 hunks)
  • JeMPI_Apps/JeMPI_UI/src/pages/settings/deterministic/DeterministicContent.tsx (2 hunks)
  • JeMPI_Apps/JeMPI_UI/src/pages/settings/deterministic/SourceView.tsx (1 hunks)
  • JeMPI_Apps/JeMPI_UI/tsconfig.json (1 hunks)
Files skipped from review due to trivial changes (8)
  • JeMPI_Apps/JeMPI_UI/cypress/fixtures/configuration.json
  • JeMPI_Apps/JeMPI_UI/cypress/support/commands.ts
  • JeMPI_Apps/JeMPI_UI/cypress/support/component-index.html
  • JeMPI_Apps/JeMPI_UI/cypress/support/e2e.ts
  • JeMPI_Apps/JeMPI_UI/cypress/ts.config.json
  • JeMPI_Apps/JeMPI_UI/src/components/dashboard/Dashboard.tsx
  • JeMPI_Apps/JeMPI_UI/src/components/shell/PageHeader.tsx
  • JeMPI_Apps/JeMPI_UI/src/pages/settings/deterministic/SourceView.tsx
Additional comments not posted (62)
JeMPI_Apps/JeMPI_UI/cypress.config.ts (3)

1-4: LGTM! Import statement and project ID configuration.

The import statement and project ID configuration are correctly set up.


5-11: LGTM! End-to-end testing configuration.

The base URL, default command timeout, and node event listeners are correctly set up.


13-18: LGTM! Component testing configuration.

The dev server configuration with create-react-app and webpack is correctly set up for component testing.

JeMPI_Apps/JeMPI_UI/tsconfig.json (4)

22-22: LGTM! Paths modification.

The new entry for Cypress in the paths section is correctly set up.


29-29: LGTM! Types modification.

The new entries for Cypress and Node in the types section are correctly set up.


30-30: LGTM! Include modification.

The broadened include section to encompass all TypeScript files is correctly set up.


31-36: LGTM! Exclude modification.

The new entries for test files, Cypress configuration file, and the Cypress directory in the exclude section are correctly set up.

JeMPI_Apps/JeMPI_UI/cypress/support/component.ts (4)

1-14: LGTM! File header comments.

The comments explaining the purpose and configuration of the support file are clear and informative.


16-23: LGTM! Import statements.

The import statements for commands and the mount function are correctly set up.


24-34: LGTM! Cypress namespace augmentation.

The augmentation of the Cypress namespace to include type definitions for the custom mount command is correctly set up.


36-36: LGTM! Custom mount command.

The custom mount command is correctly set up.

JeMPI_Apps/JeMPI_UI/src/pages/settings/blocking/Blocking.tsx (2)

1-6: LGTM!

The import statements are correct and necessary for the component's functionality.


Line range hint 7-46:
LGTM!

The changes streamline the component by removing unnecessary props and simplifying configuration handling.

JeMPI_Apps/JeMPI_UI/cypress/e2e/notifications.cy.ts (5)

1-4: LGTM!

The initial setup for the Notifications test block is correct, visiting the notifications page before each test.


6-10: LGTM!

The Page Header describe block correctly verifies the presence of the page header.


12-44: LGTM!

The Filters describe block correctly verifies the presence and functionality of the filters.


47-55: LGTM!

The Data Grid describe block correctly verifies the presence of the data grid and pagination.


57-74: LGTM!

The API Calls describe block correctly verifies the API calls and mock responses.

JeMPI_Apps/JeMPI_UI/cypress/e2e/dashboard.cy.ts (7)

1-4: LGTM!

The initial setup for the Dashboard Component test block is correct, visiting the dashboard page before each test.


6-8: LGTM!

The test correctly verifies the visibility of the dashboard tabs.


10-24: LGTM!

The test correctly verifies the navigation through different tabs on the dashboard.


26-33: LGTM!

The test correctly verifies the visibility of widgets in the Confusion Matrix tab.


35-40: LGTM!

The test correctly verifies the visibility of the M & U widget in the M & U Values tab.


42-62: LGTM!

The test correctly verifies the rendering of the dashboard with no data.


64-83: LGTM!

The tests correctly verify the loading state and error handling of the dashboard component.

JeMPI_Apps/JeMPI_UI/package.json (3)

19-19: Approved: Consistent formatting.

The reformatting of the mock:enviroments script improves readability and consistency.


20-20: Approved: Added Cypress script.

The addition of the cypress script enhances the project's testing capabilities by enabling Cypress for end-to-end testing.


64-72: Approved: Dependency updates.

Updating @testing-library/jest-dom and @types/jest, and adding cypress to devDependencies ensures compatibility and enhances testing capabilities.

JeMPI_Apps/JeMPI_UI/cypress/e2e/browseRecords.cy.ts (6)

3-8: Approved: Setup for "Browse Records".

The setup for the "Browse Records" feature includes visiting a specific URL before each test, which is appropriate for end-to-end testing.


14-18: Approved: Test for page header.

The test verifies that the page header contains the text "Browse Patients", which is a valid check.


20-51: Approved: Tests for filters.

The tests verify the visibility and functionality of the filter accordion, start date filter, end date filter, and interactions switch, which are valid checks.


54-63: Approved: Tests for search results.

The tests verify the visibility of the data grid, the presence of search results, and navigation to the record details page, which are valid checks.


65-109: Approved: Tests for record details page.

The tests verify navigation to the record details page, visibility of tables, enabling of buttons, and discarding changes, which are valid checks.


112-124: Approved: Test for API calls.

The test intercepts a POST request and verifies the search results in the data grid, which is a valid check.

JeMPI_Apps/JeMPI_UI/src/components/notificationWorklist/NotificationWorklist.tsx (2)

143-145: Approved: Added id attribute to Box component.

Adding an id attribute to the Box component facilitates targeting the component with CSS or JavaScript, improving accessibility or functionality.


218-221: Approved: Exported CustomTextField function.

Exporting the CustomTextField function increases its accessibility across the application, allowing it to be imported and utilized in other modules.

JeMPI_Apps/JeMPI_UI/src/components/browseRecords/BrowseRecords.tsx (4)

51-51: New import statement looks good.

The import statement for CustomTextField is appropriate and aligns with the changes in the code.


233-236: DateTimePicker component update looks good.

The slots property with CustomTextField simplifies the structure and improves UI consistency.


242-245: DateTimePicker component update looks good.

The slots property with CustomTextField simplifies the structure and improves UI consistency.


260-260: Addition of id attribute to the interactions switch looks good.

The id attribute improves accessibility and interaction tracking.

JeMPI_Apps/JeMPI_UI/src/pages/settings/deterministic/DeterministicContent.tsx (4)

345-345: Modification of InputLabel looks good.

Removing the dynamic id simplifies identification and does not affect functionality.


353-356: Addition of data-testid attribute to Select component looks good.

The data-testid attribute improves testability without affecting functionality.


364-364: Addition of unique id attributes to MenuItem components looks good.

The unique id attributes improve identification during testing and interaction.


387-390: Addition of unique id attributes to MenuItem components looks good.

The unique id attributes improve identification during testing and interaction.

JeMPI_Apps/JeMPI_UI/cypress/fixtures/notifications.json (1)

1-351: New fixture data for notifications looks good.

The data structure is correct, and the data is relevant and useful for testing.

JeMPI_Apps/JeMPI_UI/src/pages/settings/blocking/BlockingContent.tsx (4)

373-373: LGTM! Enhances testability.

The addition of SelectDisplayProps with data-testid improves the testability of the field selection component.


401-401: LGTM! Enhances testability.

The addition of SelectDisplayProps with data-testid improves the testability of the comparator selection component.


431-431: LGTM! Enhances accessibility.

The addition of id="add-row-button" to the IconButton improves accessibility and testability.


461-461: LGTM! Enhances accessibility.

The addition of id="close-button" to the Button improves accessibility and testability.

JeMPI_Apps/JeMPI_UI/cypress/e2e/settings.cy.ts (12)

1-2: LGTM! Correct reference to Cypress types.

The reference to Cypress types ensures proper type checking and autocompletion in the test file.


8-21: LGTM! Comprehensive tab rendering test.

The test correctly verifies the presence and content of all tabs on the settings page.


23-41: LGTM! Correct tab switching test.

The test correctly verifies the functionality of switching between different tabs and displaying the correct content.


43-54: LGTM! Proper save configuration test.

The test correctly verifies the save functionality and the success message.


56-69: LGTM! Proper row edit and save test in Common Settings.

The test correctly verifies the functionality of editing and saving a row in Common Settings.


71-91: LGTM! Correct cancel edit test.

The test correctly verifies that the original value is retained when editing is cancelled.


92-121: LGTM! Proper Unique to Golden Record End-to-End Tests.

The tests correctly verify the functionality of editing, saving, and cancelling rows in the Unique to Golden Record tab.


124-154: LGTM! Proper UniqueToInteraction Tab End-to-End Tests.

The tests correctly verify the functionality of editing, saving, and cancelling rows in the UniqueToInteraction tab.


157-192: LGTM! Proper Golden Record Lists End-to-End Tests.

The tests correctly verify the functionality of editing, saving, and cancelling rows in the Golden Record Lists tab.


196-261: LGTM! Comprehensive Deterministic End-to-End Tests.

The tests correctly verify various functionalities in the Deterministic tab, including rendering, tab switching, adding rules, and deleting rows.


270-385: LGTM! Comprehensive Blocking End-to-End Tests.

The tests correctly verify various functionalities in the Blocking tab, including switching views, adding rules, and deleting rows.


388-461: LGTM! Comprehensive Probabilistic End-to-End Tests.

The tests correctly verify various functionalities in the Probabilistic tab, including rendering fields, saving configuration, and updating threshold values.

JeMPI_Apps/JeMPI_UI/cypress/fixtures/searchResponse.json (1)

1-963: LGTM! Correct JSON structure and data.

The JSON structure is correct, and the data appears to be complete and accurate.

@NyashaMuusha NyashaMuusha changed the base branch from dev to CU-86bznypcf_Notifications-End-To-End-Testing August 8, 2024 06:39
@rcrichton
Copy link
Member

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e75568f and 81dbdac.

Files selected for processing (1)
  • devops/linux/docker/data-config/config-reference-link-dp-api.json (1 hunks)
Additional comments not posted (1)
devops/linux/docker/data-config/config-reference-link-dp-api.json (1)

Line range hint 1-1:
Verify the impact of removing /browse-records route.

The /browse-records route has been removed from several fields. Ensure that this change does not affect other parts of the application that might rely on this route for functionality.

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.

4 participants