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

Modified the cypress file structure docs #9925

Merged
merged 16 commits into from
Jan 13, 2025
Merged

Conversation

nihal467
Copy link
Member

@nihal467 nihal467 commented Jan 13, 2025

Proposed Changes

  • Fixes #issue_number
  • Change 1
  • Change 2
  • More?

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

  • Documentation

    • Updated Cypress testing best practices documentation.
    • Added comprehensive Testing Checklist with key verification points.
    • Enhanced file structure and organization guidelines, including naming conventions and storage management.
  • New Features

    • Improved facility search method with API request interception and response verification.
  • Bug Fixes

    • Added guidance to prevent common testing pitfalls, including API verification and handling loading states.
  • Chores

    • Changed default delay for typing command from 50 milliseconds to 0 milliseconds for immediate input.

@nihal467 nihal467 requested a review from a team as a code owner January 13, 2025 07:07
Copy link
Contributor

coderabbitai bot commented Jan 13, 2025

Walkthrough

This pull request introduces comprehensive updates to Cypress testing documentation and page object implementation. The changes focus on enhancing best practices documentation, clarifying file structure guidelines, and improving the FacilityCreation page object's search functionality. The updates provide more detailed guidance on testing methodologies, including API interception, loading state handling, and network request verification.

Changes

File Change Summary
cypress/docs/best-practices.md Added new "Testing Checklist" section with comprehensive test verification guidelines, including handling loading states and verifying API calls.
cypress/docs/file-structure.md Enhanced documentation on project directory structure, module organization, and file naming conventions, including descriptions for support files.
cypress/pageObject/facility/FacilityCreation.ts Updated searchFacility method to include API request interception and response status verification, improving functionality.
cypress/support/commands.ts Modified typeIntoField command to change default delay from 50 to 0 milliseconds for immediate typing.

Possibly related PRs

Suggested labels

needs review, tested

Suggested reviewers

  • rithviknishad

Poem

🐰 Hop, hop, through Cypress code we go,
Testing best practices, watch them grow!
API calls intercepted with care,
Loading states checked everywhere,
A rabbit's guide to testing flair! 🧪

Finishing Touches

  • 📝 Generate Docstrings (Beta)

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

netlify bot commented Jan 13, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit bf5514a
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6784bb9ee4a00300082e32d5
😎 Deploy Preview https://deploy-preview-9925--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

cloudflare-workers-and-pages bot commented Jan 13, 2025

Deploying care-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a80534
Status: ✅  Deploy successful!
Preview URL: https://5cc0f778.care-fe.pages.dev
Branch Preview URL: https://cypres-patch-2.care-fe.pages.dev

View logs

Copy link

netlify bot commented Jan 13, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 9a80534
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6784db1cce6fc80009d81a6a
😎 Deploy Preview https://deploy-preview-9925--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

cypress bot commented Jan 13, 2025

CARE    Run #4288

Run Properties:  status check passed Passed #4288  •  git commit 9a8053421d: Modified the cypress file structure docs
Project CARE
Branch Review cypres-patch-2
Run status status check passed Passed #4288
Run duration 01m 46s
Commit git commit 9a8053421d: Modified the cypress file structure docs
Committer Mohammed Nihal
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
View all changes introduced in this branch ↗︎

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: 2

🧹 Nitpick comments (3)
cypress/docs/file-structure.md (1)

Line range hint 4-24: Add examples for each directory's contents.

The directory structure is well-organized, but would benefit from examples of what goes into each directory.

Consider adding example files under each directory:

 cypress/
 ├── docs/
 │   ├── README.md
 │   ├── file-structure.md
 │   ├── patterns.md
 │   └── best-practices.md
 ├── e2e/                    # Test files grouped by modules
 │   ├── patient/
+│   │   ├── patient-registration.cy.ts
+│   │   └── patient-search.cy.ts
 │   ├── facility/
+│   │   ├── facility-creation.cy.ts
+│   │   └── facility-search.cy.ts
 │   └── user/
 ├── fixtures/
+│   ├── patient-data.json
+│   └── facility-data.json
 ├── pageObject/            # Page Objects grouped by modules
 │   ├── patient/
+│   │   └── PatientRegistrationPage.ts
 │   ├── facility/
+│   │   └── FacilityCreationPage.ts
 │   └── user/
 ├── utils/                 # Utility functions and helpers
 │   ├── facilityData.ts   # Facility-related utility functions
 │   └── commonUtils.ts    # Shared utility functions
 └── support/
🧰 Tools
🪛 LanguageTool

[uncategorized] ~44-~44: Loose punctuation mark.
Context: ...json ## Support Files -commands.ts: Custom Cypress commands - e2e.ts`: e2e...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~51-~51: Possible missing preposition found.
Context: ...torage() and cy.restoreLocalStorage() - Manage test data cleanup

(AI_HYDRA_LEO_MISSING_TO)

cypress/docs/best-practices.md (2)

20-20: Add examples for loading state verification.

The loading state verification guideline needs concrete examples.

Add example code:

 - Always verify loading states before and after interactions
+
+Example:
+```typescript
+// Bad: No loading state verification
+cy.get('button').click();
+cy.get('table').should('be.visible');
+
+// Good: Verify loading states
+cy.get('button').click();
+cy.get('[data-cy="loading-spinner"]').should('be.visible');
+cy.get('[data-cy="loading-spinner"]').should('not.exist');
+cy.get('table').should('be.visible');
+```

43-52: Enhance testing checklist with examples.

The testing checklist is valuable but would benefit from examples for each item.

Add examples for each checklist item:

 ## Testing Checklist
 
 Before submitting your test, verify:
 
 - [ ] All API calls are intercepted and verified
+      Example:
+      ```typescript
+      cy.intercept('GET', '/api/users').as('getUsers');
+      cy.wait('@getUsers').its('response.statusCode').should('eq', 200);
+      ```
 - [ ] Loading states are handled properly
+      Example: See loading state verification example above
 - [ ] Success/error states are verified
+      Example:
+      ```typescript
+      cy.get('[data-cy="success-message"]').should('be.visible');
+      cy.get('[data-cy="error-message"]').should('not.exist');
+      ```
 - [ ] No arbitrary timeouts used
+      Example: Use `cy.wait('@apiAlias')` instead of `cy.wait(5000)`
 - [ ] Search operations include debounce handling
+      Example:
+      ```typescript
+      cy.intercept('GET', '/api/search?q=*').as('search');
+      cy.get('input').type('test');
+      cy.wait('@search');
+      ```
 - [ ] Form submissions verify both request and response
+      Example:
+      ```typescript
+      cy.intercept('POST', '/api/submit').as('submit');
+      cy.get('form').submit();
+      cy.wait('@submit').then(interception => {
+        expect(interception.request.body).to.deep.equal(expectedData);
+        expect(interception.response.statusCode).to.equal(200);
+      });
+      ```
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2ab5ee and 8604028.

📒 Files selected for processing (3)
  • cypress/docs/best-practices.md (1 hunks)
  • cypress/docs/file-structure.md (2 hunks)
  • cypress/pageObject/facility/FacilityCreation.ts (1 hunks)
🧰 Additional context used
📓 Learnings (1)
cypress/pageObject/facility/FacilityCreation.ts (1)
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#9145
File: cypress/e2e/facility_spec/FacilityCreation.cy.ts:177-180
Timestamp: 2024-11-18T10:44:30.303Z
Learning: In `cypress/e2e/facility_spec/FacilityCreation.cy.ts`, when testing bed and staff capacity individually for additional error verification, we prefer to use separate method calls to handle bed and staff capacity, rather than using `facilityPage.createNewFacility(testFacilityData)` which also handles bed management.
🪛 LanguageTool
cypress/docs/file-structure.md

[uncategorized] ~44-~44: Loose punctuation mark.
Context: ...json ## Support Files -commands.ts: Custom Cypress commands - e2e.ts`: e2e...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~51-~51: Possible missing preposition found.
Context: ...torage() and cy.restoreLocalStorage() - Manage test data cleanup

(AI_HYDRA_LEO_MISSING_TO)

cypress/docs/best-practices.md

[uncategorized] ~25-~25: You might be missing the article “the” here.
Context: ...Keep tests focused and concise - Follow AAA pattern (Arrange, Act, Assert) - Use me...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: cypress-run (1)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: Cloudflare Pages: care-fe

Comment on lines 98 to 100
cy.intercept("GET", `**/api/v1/facility/**`).as("searchFacility");
cy.typeIntoField('[data-cy="search-facility"]', facilityName);
cy.wait("@searchFacility").its("response.statusCode").should("eq", 200);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve API interception and search handling.

While adding API verification is good, there are a few improvements needed:

  1. The API intercept pattern **/api/v1/facility/** is too broad and could catch unintended requests
  2. Missing loading state verification
  3. Missing debounce handling for search operations

Consider this implementation:

  searchFacility(facilityName: string) {
-   cy.intercept("GET", `**/api/v1/facility/**`).as("searchFacility");
+   cy.intercept("GET", `**/api/v1/facility/search?name=${facilityName}`).as("searchFacility");
    cy.typeIntoField('[data-cy="search-facility"]', facilityName);
+   cy.get('[data-cy="search-loading"]').should('be.visible');
    cy.wait("@searchFacility").its("response.statusCode").should("eq", 200);
+   cy.get('[data-cy="search-loading"]').should('not.exist');
+   // Verify search results are displayed
+   cy.get('[data-cy="facility-cards"]').should('be.visible');
  }

Committable suggestion skipped: line range outside the PR's diff.

cypress/docs/file-structure.md Outdated Show resolved Hide resolved
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: 1

♻️ Duplicate comments (1)
cypress/pageObject/facility/FacilityCreation.ts (1)

98-102: 🛠️ Refactor suggestion

Add loading state and search results verification.

The current implementation doesn't verify the loading state or search results visibility. This could lead to false positives if the UI doesn't update properly.

     cy.intercept("GET", `**/api/v1/facility/?**`).as("searchFacility");
     cy.typeIntoField('[data-cy="search-facility"]', facilityName, {
       delay: 100,
     });
+    cy.get('[data-cy="search-loading"]').should('be.visible');
     cy.wait("@searchFacility").its("response.statusCode").should("eq", 200);
+    cy.get('[data-cy="search-loading"]').should('not.exist');
+    cy.get('[data-cy="facility-cards"]').should('be.visible');
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8604028 and 2623699.

📒 Files selected for processing (2)
  • cypress/pageObject/facility/FacilityCreation.ts (1 hunks)
  • cypress/support/commands.ts (1 hunks)
🧰 Additional context used
📓 Learnings (1)
cypress/pageObject/facility/FacilityCreation.ts (2)
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#9145
File: cypress/e2e/facility_spec/FacilityCreation.cy.ts:177-180
Timestamp: 2024-11-18T10:44:30.303Z
Learning: In `cypress/e2e/facility_spec/FacilityCreation.cy.ts`, when testing bed and staff capacity individually for additional error verification, we prefer to use separate method calls to handle bed and staff capacity, rather than using `facilityPage.createNewFacility(testFacilityData)` which also handles bed management.
Learnt from: nihal467
PR: ohcnetwork/care_fe#9846
File: cypress/pageObject/facility/FacilityCreation.ts:14-47
Timestamp: 2025-01-09T05:37:17.121Z
Learning: In the care_fe project's Cypress tests, facility test data is managed through the facilityData.ts utility which provides pre-validated data through the FacilityTestData interface, making additional validation in the FacilityCreation page object unnecessary.
🔇 Additional comments (2)
cypress/support/commands.ts (1)

247-247: Consider the impact of removing the default typing delay.

Changing the default delay from 50ms to 0ms could potentially:

  1. Impact test stability across the entire test suite
  2. Cause race conditions in tests that rely on the default delay
  3. Lead to flaky tests, especially in components that have debounce or throttle mechanisms

Consider keeping a small default delay (e.g., 50ms) and explicitly set it to 0ms only where needed.

Let's verify the impact of this change:

✅ Verification successful

Removing the default typing delay is safe

The codebase analysis shows that:

  • All inputs are standard form fields without complex async behavior
  • Critical fields like phone and search already have custom delay configurations
  • No evidence of debounce/throttle mechanisms that would require the delay
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find all usages of typeIntoField to assess the impact
rg -A 2 "typeIntoField" --type ts

Length of output: 3032


Error: No shell scripts found


Script:

#!/bin/bash
# Search for input field implementations
rg -B2 -A2 'data-cy="(facility|patient)' --type tsx

Length of output: 81


Script:

#!/bin/bash
# Search for input field implementations
rg -B2 -A2 'data-cy="(facility|patient)' --type ts

Length of output: 10405

cypress/pageObject/facility/FacilityCreation.ts (1)

98-98: 🛠️ Refactor suggestion

Use a more specific API interception pattern.

The current pattern **/api/v1/facility/?** is too broad and could catch unintended requests. Consider using a more specific pattern that matches the actual search endpoint.

-    cy.intercept("GET", `**/api/v1/facility/?**`).as("searchFacility");
+    cy.intercept("GET", `**/api/v1/facility/search?name=*`).as("searchFacility");

Likely invalid or redundant comment.

cypress/pageObject/facility/FacilityCreation.ts Outdated Show resolved Hide resolved
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: 1

♻️ Duplicate comments (2)
cypress/pageObject/facility/FacilityCreation.ts (2)

98-98: 🛠️ Refactor suggestion

Use a more specific API interception pattern.

The current pattern **/api/v1/facility/?** is too broad and could intercept unintended requests.

-    cy.intercept("GET", `**/api/v1/facility/?**`).as("searchFacility");
+    cy.intercept("GET", `**/api/v1/facility/search?name=${facilityName}`).as("searchFacility");

119-122: 🛠️ Refactor suggestion

Add comprehensive search verification.

The current implementation lacks loading state verification and search results validation.

     cy.get('[data-cy="search-facility"]').should("have.value", facilityName);
 
+    // Verify loading state
+    cy.get('[data-cy="search-loading"]').should('be.visible');
+
     cy.wait("@searchFacility").its("response.statusCode").should("eq", 200);
+
+    // Verify loading state is removed
+    cy.get('[data-cy="search-loading"]').should('not.exist');
+
+    // Verify search results
+    cy.get('[data-cy="facility-cards"]')
+      .should('be.visible')
+      .should('not.be.empty');
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13fd331 and 8275679.

📒 Files selected for processing (1)
  • cypress/pageObject/facility/FacilityCreation.ts (1 hunks)
🧰 Additional context used
📓 Learnings (1)
cypress/pageObject/facility/FacilityCreation.ts (1)
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#9145
File: cypress/e2e/facility_spec/FacilityCreation.cy.ts:177-180
Timestamp: 2024-11-18T10:44:30.303Z
Learning: In `cypress/e2e/facility_spec/FacilityCreation.cy.ts`, when testing bed and staff capacity individually for additional error verification, we prefer to use separate method calls to handle bed and staff capacity, rather than using `facilityPage.createNewFacility(testFacilityData)` which also handles bed management.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: cypress-run (1)

cypress/pageObject/facility/FacilityCreation.ts Outdated Show resolved Hide resolved
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

♻️ Duplicate comments (1)
cypress/pageObject/facility/FacilityCreation.ts (1)

98-98: 🛠️ Refactor suggestion

Use a more specific API intercept pattern.

The current pattern **/api/v1/facility/?** is too broad and could catch unintended requests. Use a more specific pattern that matches the search endpoint.

-    cy.intercept("GET", `**/api/v1/facility/?**`).as("searchFacility");
+    cy.intercept("GET", `**/api/v1/facility/search?name=${facilityName}`).as("searchFacility");
🧹 Nitpick comments (1)
cypress/pageObject/facility/FacilityCreation.ts (1)

98-104: Consider implementing error handling for failed searches.

The current implementation doesn't handle API errors or no results scenarios. Consider adding error handling and empty results verification.

     cy.intercept("GET", `**/api/v1/facility/search?name=${facilityName}`).as("searchFacility");

     cy.get('[data-cy="search-facility"]')
       .should('be.visible')
       .should('be.enabled')
       .type(facilityName, { delay: 500 })
       .should('have.value', facilityName);

     cy.get('[data-cy="search-loading"]').should('be.visible');
-    cy.wait("@searchFacility").its("response.statusCode").should("eq", 200);
+    cy.wait("@searchFacility").then((interception) => {
+      if (interception.response?.statusCode === 200) {
+        if (interception.response.body.length === 0) {
+          cy.get('[data-cy="no-results"]').should('be.visible');
+        } else {
+          cy.get('[data-cy="facility-cards"]').should('be.visible');
+        }
+      } else {
+        cy.get('[data-cy="search-error"]').should('be.visible');
+      }
+    });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8275679 and 9a80534.

📒 Files selected for processing (1)
  • cypress/pageObject/facility/FacilityCreation.ts (1 hunks)
🧰 Additional context used
📓 Learnings (1)
cypress/pageObject/facility/FacilityCreation.ts (2)
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#9145
File: cypress/e2e/facility_spec/FacilityCreation.cy.ts:177-180
Timestamp: 2024-11-18T10:44:30.303Z
Learning: In `cypress/e2e/facility_spec/FacilityCreation.cy.ts`, when testing bed and staff capacity individually for additional error verification, we prefer to use separate method calls to handle bed and staff capacity, rather than using `facilityPage.createNewFacility(testFacilityData)` which also handles bed management.
Learnt from: nihal467
PR: ohcnetwork/care_fe#9846
File: cypress/pageObject/facility/FacilityCreation.ts:14-47
Timestamp: 2025-01-09T05:37:17.121Z
Learning: In the care_fe project's Cypress tests, facility test data is managed through the facilityData.ts utility which provides pre-validated data through the FacilityTestData interface, making additional validation in the FacilityCreation page object unnecessary.
🔇 Additional comments (2)
cypress/pageObject/facility/FacilityCreation.ts (2)

104-104: 🛠️ Refactor suggestion

Add loading state and search results verification.

The implementation should verify the loading state and ensure search results are displayed after the API call completes.

+    cy.get('[data-cy="search-loading"]').should('be.visible');
     cy.wait("@searchFacility").its("response.statusCode").should("eq", 200);
+    cy.get('[data-cy="search-loading"]').should('not.exist');
+    cy.get('[data-cy="facility-cards"]').should('be.visible');

Likely invalid or redundant comment.


100-102: 🛠️ Refactor suggestion

Avoid using force option and implement proper debounce handling.

The force: true option bypasses Cypress's actionability checks which could mask potential issues. Additionally, the implementation should handle debounce timing.

     cy.get('[data-cy="search-facility"]')
-      .focus()
-      .type(facilityName, { force: true });
+      .should('be.visible')
+      .should('be.enabled')
+      .type(facilityName, { delay: 500 }) // Match the debounce timing
+      .should('have.value', facilityName);

Likely invalid or redundant comment.

@rithviknishad rithviknishad merged commit 554054b into develop Jan 13, 2025
25 checks passed
@rithviknishad rithviknishad deleted the cypres-patch-2 branch January 13, 2025 09:26
Copy link

@nihal467 Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

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