Skip to content

Commit

Permalink
Only save traces for dialog test for now
Browse files Browse the repository at this point in the history
  • Loading branch information
msmithNI committed Oct 29, 2024
1 parent 10ccdd3 commit a497769
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();
}
}
Expand Down

0 comments on commit a497769

Please sign in to comment.