-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[QA-214] Fix flaky device service history edit flow test #16572
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
nihal467
wants to merge
9
commits into
develop
Choose a base branch
from
fix/device-service-history-edit-flake
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.
+95
−50
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6456c18
test: fix flaky device service history edit flow
nihal467 7dedb17
test: scope edit-sheet interactions to dialog to fix strict-mode viol…
Copilot bd42346
test: wait for Add sheet close and drop hard-coded dialog title
nihal467 13cd444
test: clarify edit-sheet scoping comment
nihal467 3b98c94
test: prevent prescription highlight flake via distinct medicines
nihal467 07a73d6
test: harden cross-user file access test against shared-patient state
nihal467 3f14a6c
test: narrow dialog locators to avoid strict-mode multi-match
nihal467 7fc96bb
Merge branch 'develop' into fix/device-service-history-edit-flake
nihal467 221c36d
test: drop hardcoded timeouts, rely on global config
nihal467 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
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 |
|---|---|---|
|
|
@@ -72,25 +72,38 @@ test.describe("Device Service History", () => { | |
|
|
||
| await expect(page.getByText(notes)).toBeVisible(); | ||
|
|
||
| // Wait for the Add sheet to fully close before opening Edit; otherwise its | ||
| // controls linger in the DOM during the close animation and collide with | ||
| // the edit sheet's controls. | ||
| await expect(page.getByRole("button", { name: "Save" })).toBeHidden(); | ||
|
|
||
| await page | ||
| .locator('[data-slot="card"]') | ||
| .filter({ hasText: notes }) | ||
| .locator("button:has(.lucide-square-pen)") | ||
| .first() | ||
| .click(); | ||
|
|
||
| // With the Add sheet closed, the edit sheet is the only open dialog. Use | ||
| // .last() to target the most recently opened dialog so a still-unmounting | ||
| // sheet can't reintroduce a strict-mode match. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this still be present since you have added the check on line 78? Not a big deal either ways, but still. |
||
| const editSheet = page.getByRole("dialog").last(); | ||
| await expect(editSheet).toBeVisible({ timeout: 10000 }); | ||
|
|
||
| const pastYear = new Date().getFullYear() - 1; | ||
| await page | ||
| await editSheet | ||
| .locator('[data-slot="form-item"]') | ||
| .filter({ hasText: "Service Date" }) | ||
| .locator('[data-slot="popover-trigger"]') | ||
| .click(); | ||
| await page.locator(".rdp-years_dropdown").selectOption(pastYear.toString()); | ||
| await page.locator('[role="gridcell"]:not([data-outside])').first().click(); | ||
|
|
||
| await page.getByRole("textbox", { name: "Notes *" }).fill(updatedNotes); | ||
| await editSheet | ||
| .getByRole("textbox", { name: "Notes *" }) | ||
| .fill(updatedNotes); | ||
|
|
||
| await page.getByRole("button", { name: "Update" }).click(); | ||
| await editSheet.getByRole("button", { name: "Update" }).click(); | ||
|
|
||
| const updatedCard = page | ||
| .locator('[data-slot="card"]') | ||
|
|
@@ -176,21 +189,34 @@ test.describe("Device Service History", () => { | |
|
|
||
| await expect(page.getByText(notes)).toBeVisible(); | ||
|
|
||
| // Wait for the Add sheet to fully close before opening Edit; otherwise its | ||
| // controls linger in the DOM during the close animation and collide with | ||
| // the edit sheet's controls. | ||
| await expect(page.getByRole("button", { name: "Save" })).toBeHidden(); | ||
|
|
||
| await page | ||
| .locator('[data-slot="card"]') | ||
| .filter({ hasText: notes }) | ||
| .locator("button:has(.lucide-square-pen)") | ||
| .first() | ||
| .click(); | ||
|
|
||
| const updateButton = page.getByRole("button", { name: "Update" }); | ||
| // With the Add sheet closed, the edit sheet is the only open dialog. Use | ||
| // .last() to target the most recently opened dialog so a still-unmounting | ||
| // sheet can't reintroduce a strict-mode match. | ||
| const editSheet = page.getByRole("dialog").last(); | ||
| await expect(editSheet).toBeVisible({ timeout: 10000 }); | ||
|
|
||
| const updateButton = editSheet.getByRole("button", { name: "Update" }); | ||
| await expect(updateButton).toBeDisabled(); | ||
|
|
||
| await page.getByRole("textbox", { name: "Notes *" }).fill(updatedNotes); | ||
| await editSheet | ||
| .getByRole("textbox", { name: "Notes *" }) | ||
| .fill(updatedNotes); | ||
|
|
||
| await expect(updateButton).toBeEnabled(); | ||
|
|
||
| await page.getByRole("textbox", { name: "Notes *" }).fill(notes); | ||
| await editSheet.getByRole("textbox", { name: "Notes *" }).fill(notes); | ||
|
|
||
| await expect(updateButton).toBeDisabled(); | ||
| }); | ||
|
|
||
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.