Skip to content

Commit 3e239da

Browse files
committed
fix: resolve FileUpload route conflict and fix Sprint 3 integration tests
- Remove duplicate Pages/ControlSamples/FileUpload/Default.razor that conflicted with Components/Pages/ControlSamples/FileUpload/Index.razor (same @page route caused System.InvalidOperationException: ambiguous routes on every page load) - Fix PasswordRecovery integration tests: InputText in .NET 10 renders without explicit type=text attribute; use ID-based selectors instead - Fix DetailsView EditButton test: use exact role match to avoid matching sidebar links; use Locator.WaitForAsync for Blazor interactive DOM updates
1 parent 5844fc6 commit 3e239da

2 files changed

Lines changed: 12 additions & 61 deletions

File tree

samples/AfterBlazorServerSide.Tests/InteractiveComponentTests.cs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,15 +1072,14 @@ public async Task DetailsView_EditButton_SwitchesMode()
10721072
Timeout = 30000
10731073
});
10741074

1075-
// Find the Edit link/button in the editable DetailsView section
1076-
var editLink = page.Locator("a:has-text('Edit'), button:has-text('Edit')").First;
1075+
// Find the Edit link/button in the editable DetailsView section (exact match to avoid sidebar links)
1076+
var editLink = page.GetByRole(AriaRole.Link, new() { Name = "Edit", Exact = true }).First;
10771077
await editLink.WaitForAsync(new() { Timeout = 5000 });
10781078
await editLink.ClickAsync();
1079-
await page.WaitForTimeoutAsync(500);
10801079

1081-
// Verify mode changed — status message should update
1082-
var statusText = await page.ContentAsync();
1083-
Assert.Contains("Mode changing", statusText);
1080+
// Verify mode changed — wait for status message to appear in DOM
1081+
var statusLocator = page.Locator("text=Mode changing");
1082+
await statusLocator.WaitForAsync(new() { Timeout = 10000 });
10841083

10851084
// In edit mode, Update and Cancel links should appear
10861085
var updateLink = await page.Locator("a:has-text('Update'), button:has-text('Update')").AllAsync();
@@ -1121,8 +1120,8 @@ public async Task PasswordRecovery_Step1Form_RendersUsernameInput()
11211120
Timeout = 30000
11221121
});
11231122

1124-
// Assert — Step 1: Username input is present
1125-
var textInputs = await page.Locator("input[type='text']").AllAsync();
1123+
// Assert — Step 1: Username input is present (InputText renders without explicit type attribute)
1124+
var textInputs = await page.Locator("input[id$='_UserName']").AllAsync();
11261125
Assert.NotEmpty(textInputs);
11271126

11281127
// Assert — Submit button is present
@@ -1162,18 +1161,17 @@ public async Task PasswordRecovery_UsernameSubmit_TransitionsToQuestionStep()
11621161
Timeout = 30000
11631162
});
11641163

1165-
// Fill in a username on the first PasswordRecovery instance
1166-
var usernameInput = page.Locator("input[type='text']").First;
1164+
// Fill in a username on the first PasswordRecovery instance (InputText renders without explicit type attribute)
1165+
var usernameInput = page.Locator("input[id$='_UserName']").First;
11671166
await usernameInput.FillAsync("testuser");
11681167

11691168
// Click the submit button to advance to the question step
1170-
var submitButton = page.Locator("button, input[type='submit']").First;
1169+
var submitButton = page.Locator("input[id$='_SubmitButton']").First;
11711170
await submitButton.ClickAsync();
1172-
await page.WaitForTimeoutAsync(500);
11731171

11741172
// Assert — Status message updated (verifying user handler fired)
1175-
var pageContent = await page.ContentAsync();
1176-
Assert.Contains("User verified", pageContent);
1173+
var statusLocator = page.Locator("text=User verified");
1174+
await statusLocator.WaitForAsync(new() { Timeout = 5000 });
11771175

11781176
// Assert no console errors
11791177
Assert.Empty(consoleErrors);

samples/AfterBlazorServerSide/Pages/ControlSamples/FileUpload/Default.razor

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)