Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,25 @@ await Task.WhenAll(
await page.FillAsync("[name=\"Input.Email\"]", userName);
await page.FillAsync("[name=\"Input.Password\"]", password);

var shouldSignal = persistenceOutcome is "Failure" or "DatabaseFailure";
string redisplayedPage = null;
if (shouldSignal)
{
await page.RouteAsync(url => new Uri(url).AbsolutePath == "/Account/PasskeyUpgrade", async route =>
{
if (route.Request.Method != "POST" || redisplayedPage is not null)
{
await route.ContinueAsync();
return;
}

await using var response = await route.FetchAsync(new() { MaxRedirects = 0 });
// Retain the HTML before delivering it since it automatically submits the continuation form.
redisplayedPage = await response.TextAsync();
await route.FulfillAsync(new() { Response = response });
});
}

var upgradeRequests = new List<IRequest>();
page.Request += (_, request) =>
{
Expand Down Expand Up @@ -274,7 +293,6 @@ await Task.WhenAll(
Assert.Empty(passkeys);
}

var shouldSignal = persistenceOutcome is "Failure" or "DatabaseFailure";
var signals = await page.EvaluateAsync<JsonElement>("JSON.parse(sessionStorage.getItem('upgrade-signals') ?? '[]')");
if (shouldSignal && signalOutcome is not "Unsupported")
{
Expand All @@ -295,7 +313,7 @@ await Task.WhenAll(
if (shouldSignal)
{
Assert.Equal(200, upgradeResponse.Status);
var redisplayedPage = await upgradeResponse.TextAsync();
Assert.NotNull(redisplayedPage);
Assert.Contains("unknown-credential-signal-options=", redisplayedPage);
Assert.DoesNotContain("creation-options=", redisplayedPage);
Assert.Contains("_handler=passkey-upgrade", upgradeRequests[1].PostData);
Expand Down
Loading