Skip to content

Add E2E test for department selector infinite scroll#16293

Open
nihal467 wants to merge 2 commits intoENG-22-add-infinite-scroll-to-department-selectorfrom
ENG-22-e2e-test-infinite-scroll-department-selector
Open

Add E2E test for department selector infinite scroll#16293
nihal467 wants to merge 2 commits intoENG-22-add-infinite-scroll-to-department-selectorfrom
ENG-22-e2e-test-infinite-scroll-department-selector

Conversation

@nihal467
Copy link
Copy Markdown
Member

Description

Adds an E2E Playwright test that verifies infinite scroll works correctly in the department selector dropdown (FacilityOrganizationSelector).

What the test does

  1. Creates 25 departments via API in beforeAll — exceeds PAGE_LIMIT (20) to ensure pagination is triggered
  2. Navigates to Users → See Details → Departments → Link Department
  3. Switches to the All Organizations tab, opens the combobox dropdown
  4. Verifies first page of departments loads (items visible as role="option")
  5. Scrolls the command list to the bottom to trigger the intersection observer sentinel
  6. Waits for the paginated API request (/organizations/ with offset= param, status 200) — proves fetchNextPage was actually called
  7. Verifies more items rendered after the response — proves the data was processed into the UI

Other changes

  • Enables dotenv in playwright.config.ts so REACT_CARE_API_URL is available in test beforeAll hooks

Note

The department creation via direct API calls in beforeAll is a temporary hack until the backend fixtures are updated to include enough departments for pagination testing. Once fixtures provide 20+ departments out of the box, the API creation logic can be removed.

@nihal467 nihal467 requested a review from a team as a code owner April 17, 2026 08:33
Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: dec7c9a8-65f4-4e74-a3a9-5d5aa5dc9661

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ENG-22-e2e-test-infinite-scroll-department-selector

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 17, 2026

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9b03e34
Status: ✅  Deploy successful!
Preview URL: https://461159e2.care-preview-a7w.pages.dev
Branch Preview URL: https://eng-22-e2e-test-infinite-scr.care-preview-a7w.pages.dev

View logs

- Test creates 25 departments via API (exceeding PAGE_LIMIT of 20)
- Navigates to Users → See Details → Departments tab → Link Department
- Switches to All Organizations tab, opens combobox dropdown
- Verifies first page of departments loads as role='option' items
- Scrolls command list to bottom, verifies more items load via infinite scroll
- Enable dotenv in playwright.config.ts for API URL access in tests
- Creates 25 departments via API in beforeAll (exceeding PAGE_LIMIT of 20)
- Navigates to Users > See Details > Departments > Link Department
- Switches to All Organizations, opens combobox dropdown
- Verifies first page of departments loads
- Scrolls to bottom, waits for paginated API request (offset param)
- Verifies more items render after the response
- Enables dotenv in playwright.config.ts for API URL access
@nihal467 nihal467 force-pushed the ENG-22-e2e-test-infinite-scroll-department-selector branch from 8e9469f to 9b03e34 Compare April 17, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant