Skip to content

Commit 931d63e

Browse files
csharpfritzCopilot
andcommitted
fix(tests): stabilize 2 flaky integration tests for CI
- ListView EditButton: replace fixed 500ms wait with WaitForSelectorAsync for Update button (Blazor re-render timing varies on CI) - LoginControls Orientation: add WaitForSelectorAsync for inputs after hydration, use broader input selector (InputText may not have type=text during SSR phase) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 39913f2 commit 931d63e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

samples/AfterBlazorServerSide.Tests/InteractiveComponentTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,11 +2655,10 @@ public async Task ListView_CrudOperations_EditButton_ShowsEditMode()
26552655
// Click the first Edit button
26562656
var editButton = page.Locator("button:has-text('Edit')").First;
26572657
await editButton.ClickAsync();
2658-
await page.WaitForTimeoutAsync(500);
26592658

2660-
// Verify edit mode activated — Update and Cancel buttons should appear
2659+
// Wait for Blazor re-render — Update button appears when edit mode activates
26612660
var updateButton = page.Locator("button:has-text('Update')");
2662-
Assert.True(await updateButton.IsVisibleAsync(), "Update button should be visible in edit mode");
2661+
await updateButton.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = 10000 });
26632662

26642663
var cancelButton = page.Locator("button:has-text('Cancel')");
26652664
Assert.True(await cancelButton.IsVisibleAsync(), "Cancel button should be visible in edit mode");
@@ -2868,7 +2867,9 @@ public async Task LoginControls_Orientation_RendersAllLayouts()
28682867
Assert.True(await horizontalTop.First.IsVisibleAsync(), "Horizontal/TextOnTop layout should be rendered");
28692868

28702869
// Verify Login forms render username/password inputs (4 Login forms = 4 username inputs)
2871-
var usernameInputs = await page.Locator("input[type='text']").AllAsync();
2870+
// Wait for Blazor hydration — InputText components render after interactive circuit connects
2871+
await page.WaitForSelectorAsync("input", new PageWaitForSelectorOptions { Timeout = 10000 });
2872+
var usernameInputs = await page.Locator("input:not([type='password']):not([type='submit']):not([type='image']):not([type='hidden']):not([type='checkbox'])").AllAsync();
28722873
Assert.True(usernameInputs.Count >= 4, $"Expected at least 4 username inputs (one per Login), found {usernameInputs.Count}");
28732874

28742875
Assert.Empty(consoleErrors);

0 commit comments

Comments
 (0)