Repository navigation
Fix Dashboard Playwright tab-navigation race in DesktopNavMenu and ResourcePane tests - #21480
Conversation
A tab click changes the browser URL before the server renders the destination. Until that render arrives, the strip on the page is the one keyed to the previous location, and ResourcesLayout deliberately ignores its change events. A second click in that window is dropped, which made DesktopNavMenuTests.MainNavigation and ResourcePaneInteractionTests.AllResourcesRow flaky. Wait for the old strip element to detach before continuing. Co-authored-by: Copilot <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21480Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21480" |
Tests selector0 / 100 PR test projects · 1 PR job, from 3 changed files. Selected PR test projects (0 / 100)none — no PR-gated .NET test projects run for this change. Selected PR jobs (1)
How these were chosen — grouped by what changedJob reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the test-only resource-tab synchronization changes.
No open issues 🎉
What changed in this PR
This test-only PR addresses resource-tab navigation races in Dashboard Playwright tests introduced or changed by #21412. It synchronizes subsequent interactions with server rendering while leaving product behavior unchanged.
Changes:
- Adds a shared helper that clicks a resource tab and waits for the previous tab strip to detach.
- Uses the helper in desktop navigation and resource-pane tests, preserving existing assertions without adding sleeps or retries.
| File | Description |
|---|---|
| tests/Aspire.Dashboard.Playwright.Tests/Integration/Playwright/ResourcePaneInteractionTests.cs | Waits for the Console logs tab render before continuing. |
| tests/Aspire.Dashboard.Playwright.Tests/Integration/Playwright/Infrastructure/PlaywrightTestsBase.cs | Adds the shared tab-click and render-wait helper. |
| tests/Aspire.Dashboard.Playwright.Tests/Integration/Playwright/DesktopNavMenuTests.cs | Waits for tab-strip replacement after navigation clicks. |
Review effort: Balanced
## Description Make the dashboard resource pane's **Select all** action discoverable without hovering. The existing localized label is now visible beside the icon. Remove toggle-button semantics: clicking this action always returns to all resources; it never clears selection. The existing selected styling and tooltip continue to indicate when all resources are selected. At the supported 200px pane minimum, the kind/action toolbar wraps so the complete action stays inside the pane. Covers **UX-01** from the dashboard UX backlog. This is one independent item, not a combined PR. Base: `9f0961d0c7173732f45ce88d571c8b53f8059934` from freshly fetched `upstream/main`. Public context: [AspiriFridays discussion at 02:13:22](https://www.youtube.com/watch?v=azL0fCMFqG4&t=8002s). ### User-facing usage Select a resource in the sidebar, then click the visible **Select all** action above the scrolling list to return to all resources. Clicking it again keeps all resources selected. Keyboard users can activate the native button with Enter or Space. ### Validation Passed (4 cases): `dotnet test --project tests\Aspire.Dashboard.Components.Tests\Aspire.Dashboard.Components.Tests.csproj --no-launch-profile -- --filter-method '*.SelectAll_IsLabeledActionAndAlwaysSelectsEverything' --filter-method '*.Landing_WithoutRememberedSelection_KeepsAllResourcesSelected' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` Passed (81 cases): `dotnet test --project tests\Aspire.Dashboard.Components.Tests\Aspire.Dashboard.Components.Tests.csproj --no-launch-profile -- --filter-class '*.ResourcesLayoutTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` Passed (3 browser cases, desktop 1280px at default and minimum 200px pane widths, plus mobile 640px): `.\.dotnet\dotnet.exe test --project tests\Aspire.Dashboard.Playwright.Tests\Aspire.Dashboard.Playwright.Tests.csproj --no-launch-profile '-p:ArtifactsDir=D:\GitHub\copilot-worktrees\aspire\ievangelist-turbo-potato\artifacts\ux01-minimum-pane\' -- --filter-method '*.SelectAll_VisibleLabelAndKeyboardActivationRestoreAllResources' --filter-not-trait 'quarantined=true'` The new minimum-width case uses the real splitter's Home key and checks that the complete action is inside the pane. Before the wrapping correction, this case failed while the two existing desktop/mobile controls passed; after the correction, all three passed with no skips. Additional actual 1440x900/768x1024/390x844 captures were inspected locally: the desktop pane was resized to 200px, while tablet/mobile used their existing full-width drawers. Failed (1 broader existing browser case): `dotnet test --project tests\Aspire.Dashboard.Playwright.Tests\Aspire.Dashboard.Playwright.Tests.csproj --no-launch-profile -- --filter-method '*.AllResourcesRow_ClearsSelectionAndListsResourcesInOverview' --filter-not-trait 'quarantined=true'`. Its subsequent tab-navigation assertion timed out. A control run restoring the original button markup and original test expectations also failed, but earlier at the initial resource-title assertion, so that control does not establish an identical root cause. The known tab-render navigation race has a separate proposed fix in #21480; this PR does not import it or weaken the navigation assertions. `git diff --check` passed. Rendered-DOM and focused browser coverage check the visible label, non-toggle semantics, minimum-pane containment, selection restoration and repeated keyboard activation. No usability-study outcome or all-green CI result is claimed. ### Screenshots / Recordings Existing responsive browser renders using the repository dashboard test host and its running sample resource. At all three sizes, the complete **Select all** action was visible within the viewport, one resource was selected, and activating the action restored the **All resources** scope. At mobile and tablet widths the existing resource drawer was opened before capturing the affected action. These hosted images show the original standard-width states, not the additional 200px regression capture described above. Images were inspected for clipping; they are not resized desktop copies. Other themes have not been captured. **Mobile — 390x844**  **Tablet — 768x1024**  **Desktop — 1440x900**  <!-- Add screenshots/recordings here --> Fixes # (issue) ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - If yes, did you have an API Review for it? - [ ] Yes - [ ] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [ ] No - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [ ] No - [x] No --------- Co-authored-by: David Pine <[email protected]> Co-authored-by: Copilot App <[email protected]>
|
✅ No documentation update needed. docs_optional → test_only. No signals triggered. All 3 changed files match |
Description
Fixes a flaky race in two Dashboard Playwright outerloop tests added or changed by #21412:
DesktopNavMenuTests.MainNavigation_NavigatesBetweenSectionsAndMarksActiveItemResourcePaneInteractionTests.AllResourcesRow_ClearsSelectionAndListsResourcesInOverviewRoot cause
A resource tab click changes the URL in the browser right away, before the server renders the destination. Until that render batch reaches the browser, the tab strip on the page is still the one rendered for the previous location. The
FluentTabsinResourcesLayoutis@keyed byrenderedLocation, andOnTabChangeddeliberately ignores change events from a strip rendered for an earlier location. The comment inResourcesLayout.razorexplains that this guard stops queued native change events from a torn-down strip from looking like new user navigations.Both tests click a second tab as soon as the URL or
aria-selectedchanges. Both of those update on the client, so neither proves the server has rendered the new strip. When the second click lands in that window, it is dropped by design and the test times out waiting for a navigation that never happens.Server-side tracing (temporary logging, not in this PR) confirmed the sequence locally:
OnParametersSetAsyncruns for/consolelogs(t=.956)./resources.renderedLocation=/resourceswhile_lastLocation=/consolelogs, and is ignored.Fix (test-only)
Add
PlaywrightTestsBase.ClickResourceTabAndWaitForRenderAsync. It takes a handle to the current.resources-tab-headerelement, clicks, and waits until that element is detached. Because the strip is keyed by location, detachment means the server's render for the new location has been applied. The tests then make the same assertions as before. No sleeps or retries are added and no assertion is weakened.AssertActiveItemAsyncnow checks the server-rendered active tab rather than only the client's optimistic selection.The product guard is intentional, so it is unchanged.
Evidence
CI (outerloop,
outerloop_tests / Dashboard.Playwright; these tests only run intests-outerloop.yml):MainNavigation:Assert.NotNull() Failurefor the next tab's bounding box.AllResourcesRow:Page URL expected to match regex '/resources$' But was: '.../consolelogs'.DesktopNavMenuTestsfailed 0/28 jobs in the 14 scheduled main runs from Oct 16–30, before Modernize the dashboard experience #21412.ResourcePaneInteractionTestsdidn't exist yet.Local (Linux, 2 cores):
MainNavigation, idleMainNavigation, CPU stress (2×yes)AllResourcesRow, idle and stressAllResourcesRowwith deterministic repro harness ¹But was: .../consolelogs)Aspire.Dashboard.Playwright.Tests¹ Repro harness (not committed): an init script delays every server-to-browser Blazor WebSocket message by 300 ms, in order, after the Console logs click. This widens the window between the client URL change and the server render:
² The only failure is
TerminalTests.HeaderMetadata_LiveUpdatesAndFallbackPreserveFocusAndCopyCurrentValues. It's a local culture artifact ('42 %'vs'42%') in a test that doesn't use the new helper and isn't touched by this PR.Checklist
🤖 Posted by AspireAgent (AI Agent)