diff --git a/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs b/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs index 2657f48a84..6615fd406d 100644 --- a/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs +++ b/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs @@ -33,9 +33,6 @@ private async Task NavigateToPageAsync(IPage page, string route) private async Task WaitForComponentsInitializationAsync(IPage page) { await page.WaitForFunctionAsync(ComponentLibraryInitializationTestJavaScript); - // Have encountered some test intermittency when interacting with the components immediately - // after the JS scripts report ready. Added an extra wait here to mitigate. - await Task.Delay(150); } protected sealed class AsyncDisposablePage : IAsyncDisposable diff --git a/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Pages.InteractiveServer/WaferMapRenderTest.razor b/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Pages.InteractiveServer/WaferMapRenderTest.razor index 2ddf180356..615b6af65e 100644 --- a/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Pages.InteractiveServer/WaferMapRenderTest.razor +++ b/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Pages.InteractiveServer/WaferMapRenderTest.razor @@ -18,11 +18,15 @@ @bind-ColorScale="ColorScale" @bind-HighlightedTags="HighlightedTags"> +
Get Validity Async - + +
+ @code { public NimbleWaferMap? _waferMap; private string? TextFieldText { get; set; } + private string? RenderTextField { get; set; } [NotNull] public IEnumerable Dies { get; set; } = Enumerable.Empty(); [NotNull] @@ -85,6 +89,11 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { await _waferMap!.SetDataAsync(Dies); + if (firstRender) + { + RenderTextField = "RenderComplete"; + StateHasChanged(); + } await base.OnAfterRenderAsync(firstRender); } diff --git a/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Pages.InteractiveServer/WaferMapRenderTestExperimental.razor b/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Pages.InteractiveServer/WaferMapRenderTestExperimental.razor index 0e220dadf6..6fdf75b755 100644 --- a/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Pages.InteractiveServer/WaferMapRenderTestExperimental.razor +++ b/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Pages.InteractiveServer/WaferMapRenderTestExperimental.razor @@ -20,8 +20,10 @@ @bind-ColorScale="ColorScale" @bind-HighlightedTags="HighlightedTags"> +
Get Validity Async +
@code { public NimbleWaferMap? _waferMap; @@ -108,6 +110,11 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { await _waferMap!.SetDataAsync(DiesTable); + if (firstRender) + { + RenderTextField = "RenderComplete"; + StateHasChanged(); + } await base.OnAfterRenderAsync(firstRender); } diff --git a/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Tests.InteractiveServer/WaferMapTests.cs b/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Tests.InteractiveServer/WaferMapTests.cs index 27ad754b22..6ec9b01291 100644 --- a/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Tests.InteractiveServer/WaferMapTests.cs +++ b/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Tests.InteractiveServer/WaferMapTests.cs @@ -10,6 +10,11 @@ public WaferMapTests(PlaywrightFixture playwrightFixture, NimbleBlazorWebHostSer : base(playwrightFixture, blazorServerClassFixture) { } + private async Task WaitForWaferMapRenderCompleteAsync(IPage page) + { + await Assertions.Expect(page.Locator(".render-text-field")).ToHaveAttributeAsync("current-value", "RenderComplete"); + } + [Fact] public async Task WaferMap_WithDiesAndColorScale_RendersColorsAsync() { @@ -18,6 +23,7 @@ public async Task WaferMap_WithDiesAndColorScale_RendersColorsAsync() var wafer = page.Locator("nimble-wafer-map"); var canvas = page.Locator(".main-wafer"); + await WaitForWaferMapRenderCompleteAsync(page); await Assertions.Expect(wafer).ToBeVisibleAsync(); await Assertions.Expect(canvas).ToBeVisibleAsync(); var color = await page.EvaluateAsync( @@ -33,8 +39,9 @@ public async Task WaferMap_WithGridDimensions_IsValidAsync() var page = pageWrapper.Page; var wafer = page.Locator("nimble-wafer-map"); var validButton = page.Locator("nimble-button"); - var textField = page.Locator("nimble-text-field"); + var textField = page.Locator(".test-text-field"); + await WaitForWaferMapRenderCompleteAsync(page); await Assertions.Expect(wafer).ToBeVisibleAsync(); await validButton.ClickAsync(); @@ -47,8 +54,9 @@ public async Task WaferMap_WithHoverEvent_TriggersDieChangeEventAsync() await using var pageWrapper = await NewPageForRouteAsync("InteractiveServer/WaferMapRenderTest"); var page = pageWrapper.Page; var wafer = page.Locator("nimble-wafer-map"); - var textField = page.Locator("nimble-text-field"); + var textField = page.Locator(".test-text-field"); + await WaitForWaferMapRenderCompleteAsync(page); await Assertions.Expect(wafer).ToBeVisibleAsync(); await wafer.HoverAsync(); diff --git a/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Tests.InteractiveServer/WaferMapTestsExperimental.cs b/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Tests.InteractiveServer/WaferMapTestsExperimental.cs index 0c427af4b3..6aed4ce97d 100644 --- a/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Tests.InteractiveServer/WaferMapTestsExperimental.cs +++ b/packages/blazor-workspace/Tests/NimbleBlazor.Tests.Acceptance/Tests.InteractiveServer/WaferMapTestsExperimental.cs @@ -10,6 +10,11 @@ public WaferMapTestsExperimental(PlaywrightFixture playwrightFixture, NimbleBlaz : base(playwrightFixture, blazorServerClassFixture) { } + private async Task WaitForWaferMapRenderCompleteAsync(IPage page) + { + await Assertions.Expect(page.Locator(".render-text-field")).ToHaveAttributeAsync("current-value", "RenderComplete"); + } + [Fact] public async Task WaferMap_WithGridDimensions_IsValidAsync() { @@ -17,9 +22,9 @@ public async Task WaferMap_WithGridDimensions_IsValidAsync() var page = pageWrapper.Page; var wafer = page.Locator("nimble-wafer-map"); var validButton = page.Locator("nimble-button"); - var renderTextField = page.Locator(".render-text-field"); var textField = page.Locator(".test-text-field"); + await WaitForWaferMapRenderCompleteAsync(page); await Assertions.Expect(wafer).ToBeVisibleAsync(); await validButton.ClickAsync(); @@ -32,9 +37,9 @@ public async Task WaferMap_WithHoverEvent_TriggersDieChangeEventAsync() await using var pageWrapper = await NewPageForRouteAsync("InteractiveServer/WaferMapRenderTestExperimental"); var page = pageWrapper.Page; var wafer = page.Locator("nimble-wafer-map"); - var renderTextField = page.Locator(".render-text-field"); var textField = page.Locator(".test-text-field"); + await WaitForWaferMapRenderCompleteAsync(page); await Assertions.Expect(wafer).ToBeVisibleAsync(); await wafer.HoverAsync();