-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[ENG-749] feat: add search functionality for facilities and other in Dashboard and Facility Switcher #16566
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
Open
abhimanyurajeesh
wants to merge
5
commits into
develop
Choose a base branch
from
ENG-749
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+213
−23
Open
[ENG-749] feat: add search functionality for facilities and other in Dashboard and Facility Switcher #16566
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3bb4251
[ENG-749] feat: add search functionality for facilities in Dashboard …
abhimanyurajeesh 7d08316
feat: implement search functionality for facilities in Sidebar and Da…
abhimanyurajeesh 6de2604
Merge branch 'develop' into ENG-749
abhimanyurajeesh 1a8879d
Merge branch 'develop' into ENG-749
abhimanyurajeesh 9bd46be
feat: refactor facility search functionality in UserDashboard and add…
abhimanyurajeesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import { faker } from "@faker-js/faker"; | ||
| import { expect, test } from "@playwright/test"; | ||
|
|
||
| test.use({ storageState: "tests/.auth/user.json" }); | ||
|
|
||
| test.describe("Dashboard - Search", () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await page.goto(`/`); | ||
| }); | ||
|
|
||
| test("should filter facilities in the Dashboard", async ({ page }) => { | ||
| await expect(page.getByRole("tab", { name: "Facilities" })).toBeVisible(); | ||
|
|
||
| const panel = page.getByRole("tabpanel"); | ||
| const searchInput = panel.getByPlaceholder("Search"); | ||
|
|
||
| const isSearchVisible = await searchInput.isVisible().catch(() => false); | ||
| if (!isSearchVisible) { | ||
| test.skip(); | ||
| return; | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| await test.step("Search for a facility FACILITY WITH PATIENTS", async () => { | ||
| const facilityName = "FACILITY WITH PATIENTS"; | ||
|
|
||
| await searchInput.fill(facilityName); | ||
|
|
||
| // Verify matching facility is still visible | ||
| await expect( | ||
| panel.getByRole("link").filter({ hasText: facilityName }), | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step("Show empty state for non-matching search", async () => { | ||
| await searchInput.fill("zzz_nonexistent_facility_xyz"); | ||
| await expect(panel.getByText(/no results found/i)).toBeVisible(); | ||
|
|
||
| // Ensure more than one facility link is shown after clearing search | ||
| await searchInput.clear(); | ||
| const facilities = await panel.getByRole("link").all(); | ||
| expect(facilities.length).toBeGreaterThan(1); | ||
| }); | ||
| }); | ||
|
|
||
| test("should filter responsibilities in the Dashboard", async ({ page }) => { | ||
| const responsibilitiesTab = page.getByRole("tab", { | ||
| name: "Responsibilities", | ||
| }); | ||
| await expect(responsibilitiesTab).toBeVisible(); | ||
| await responsibilitiesTab.click(); | ||
|
|
||
| const panel = page.getByRole("tabpanel"); | ||
| const searchInput = panel.getByPlaceholder("Search"); | ||
|
|
||
| const isSearchVisible = await searchInput.isVisible().catch(() => false); | ||
| if (!isSearchVisible) { | ||
| test.skip(); | ||
| return; | ||
| } | ||
|
|
||
| await test.step("Search for a random responsibility", async () => { | ||
| const responsibility = faker.helpers.arrayElement(["Doctor", "Staff"]); | ||
|
|
||
| await searchInput.fill(responsibility); | ||
|
|
||
| await expect( | ||
| panel.getByRole("link").filter({ hasText: responsibility }), | ||
| ).toBeVisible(); | ||
| await expect(panel.getByRole("link")).toHaveCount(1); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| }); | ||
|
|
||
| await test.step("Show empty state for non-matching search", async () => { | ||
| await searchInput.fill("zzz_nonexistent_responsibility_xyz"); | ||
| await expect(panel.getByText(/no results found/i)).toBeVisible(); | ||
|
|
||
| // Ensure more than one responsibility link is shown after clearing search | ||
| await searchInput.clear(); | ||
| const responsibilities = await panel.getByRole("link").all(); | ||
| expect(responsibilities.length).toBeGreaterThan(1); | ||
| }); | ||
| }); | ||
| }); | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { getFacilityId } from "tests/support/facilityId"; | ||
|
|
||
| test.use({ storageState: "tests/.auth/user.json" }); | ||
|
|
||
| test.describe("Sidebar Facility Switcher - Search", () => { | ||
| test("should filter facilities in the switcher dropdown", async ({ | ||
| page, | ||
| }) => { | ||
| await page.goto(`/facility/${getFacilityId()}/overview`); | ||
|
|
||
| //switcher | ||
| await page.getByRole("button", { name: "Select Facility" }).click(); | ||
| await expect(page.getByText(/view dashboard/i)).toBeVisible(); | ||
| await expect(page.getByText(/Facilities/i)).toBeVisible(); | ||
|
|
||
| const searchInput = page.getByPlaceholder(/search/i); | ||
|
|
||
|
abhimanyurajeesh marked this conversation as resolved.
|
||
| const isSearchVisible = await searchInput.isVisible().catch(() => false); | ||
| if (!isSearchVisible) { | ||
| test.skip(); | ||
| return; | ||
| } | ||
|
Comment on lines
+19
to
+23
|
||
|
|
||
| await test.step("Search for a facility FACILITY WITH PATIENTS", async () => { | ||
| const facilityName = "FACILITY WITH PATIENTS"; | ||
|
|
||
| await searchInput.fill(facilityName); | ||
|
|
||
| // Verify matching facility is still visible | ||
| await expect( | ||
| page.getByRole("menuitem").filter({ hasText: facilityName }), | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step("Show empty state for non-matching search", async () => { | ||
| await searchInput.fill("zzz_nonexistent_facility_xyz"); | ||
| await expect(page.getByText(/no facilities found/i)).toBeVisible(); | ||
|
|
||
| // Ensure more than one facility menuitem is shown after clearing search | ||
| await searchInput.clear(); | ||
| const facilities = await page.getByRole("menuitem").all(); | ||
| expect(facilities.length).toBeGreaterThan(1); | ||
|
Comment on lines
+40
to
+43
|
||
| }); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.