From a4977690cfae31e51cf1b899af6b020561acf5c1 Mon Sep 17 00:00:00 2001 From: Malcolm Smith <20709258+msmithNI@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:36:09 -0500 Subject: [PATCH] Only save traces for dialog test for now --- .../AcceptanceTestsBase.cs | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs b/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs index 443da7bb73..2429eb3189 100644 --- a/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs +++ b/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs @@ -27,7 +27,7 @@ await browserContext.Tracing.StartAsync(new() }); await NavigateToPageAsync(page, route); await WaitForComponentsInitializationAsync(page); - return new AsyncDisposablePage(page, browserContext); + return new AsyncDisposablePage(page, browserContext, route); } private async Task NavigateToPageAsync(IPage page, string route) @@ -47,20 +47,30 @@ protected sealed class AsyncDisposablePage : IAsyncDisposable private readonly IBrowserContext _browserContext; private readonly string _traceName = string.Empty; - public AsyncDisposablePage(IPage page, IBrowserContext context) + public AsyncDisposablePage(IPage page, IBrowserContext context, string route) { Page = page; _browserContext = context; // _traceName = Uri.EscapeDataString(route.Replace("/", "_")) + "_" + pageCount; - _traceName = "failing-test"; + if (route.Contains("InteractiveServer/DialogOpenAndClose")) + { + _traceName = "failing-test"; + } } public async ValueTask DisposeAsync() { - await _browserContext.Tracing.StopAsync(new() + if (!string.IsNullOrEmpty(_traceName)) + { + await _browserContext.Tracing.StopAsync(new() + { + Path = _traceName + ".zip" + }); + } + else { - Path = _traceName + ".zip" - }); + await _browserContext.Tracing.StopAsync(); + } await Page.CloseAsync(); } }