Skip to content

Commit 727d904

Browse files
committed
warmup
1 parent 846561e commit 727d904

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

tests/PrompterOne.Web.UITests/Infrastructure/StandaloneAppFixture.Warmup.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,26 @@ private static async Task WarmUpContextPageIfNeededAsync(
8181
}
8282
}
8383

84+
private static async Task WarmUpReturnedPageIfNeededAsync(IPage page)
85+
{
86+
if (!TestEnvironment.IsCiEnvironment)
87+
{
88+
return;
89+
}
90+
91+
var browserErrors = BrowserErrorCollector.Attach(page);
92+
93+
try
94+
{
95+
await WarmUpRouteAsync(page, BrowserTestConstants.Routes.Library, UiTestIds.Library.Page);
96+
await browserErrors.AssertNoCriticalUiErrorsAsync();
97+
}
98+
catch (Exception exception)
99+
{
100+
throw BuildContextWarmupFailure(exception, browserErrors.Describe());
101+
}
102+
}
103+
84104
private static async Task WarmUpRuntimeAsync(IBrowser browser, string baseAddress)
85105
{
86106
var context = await CreateBrowserContextAsync(browser, baseAddress);

tests/PrompterOne.Web.UITests/Infrastructure/StandaloneAppFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private async Task<IPage> CreateAdditionalPageAsync()
8282
{
8383
await WarmUpContextWithSacrificialPageAsync(context);
8484
var page = await CreatePrimedPageAsync(context);
85-
await WarmUpContextPageIfNeededAsync(page, BaseAddress);
85+
await WarmUpReturnedPageIfNeededAsync(page);
8686
return page;
8787
}
8888
catch (PlaywrightException exception) when (attempt < ContextBootstrapAttemptCount && IsBrowserClosedException(exception))

0 commit comments

Comments
 (0)