Updating game data to mid season patch and made card gallery nicer
This commit is contained in:
@@ -9,9 +9,6 @@ namespace Tests;
|
||||
[TestFixture]
|
||||
public class PasskeyTests : PageTest
|
||||
{
|
||||
private const string BaseUrl = "http://localhost:5256";
|
||||
private LoginPage _loginPage = null!;
|
||||
|
||||
[SetUp]
|
||||
public async Task SetUp()
|
||||
{
|
||||
@@ -30,26 +27,35 @@ public class PasskeyTests : PageTest
|
||||
await Page.Context.ClearCookiesAsync();
|
||||
}
|
||||
|
||||
private const string BaseUrl = "http://localhost:5256";
|
||||
private LoginPage _loginPage = null!;
|
||||
|
||||
[Test]
|
||||
public async Task LoginPage_WhenNoCredentials_ShowsEnrollButton()
|
||||
{
|
||||
await _loginPage.GotoAsync();
|
||||
await _loginPage.WaitForInteractiveAsync();
|
||||
|
||||
await Expect(_loginPage.EnrollButton).ToBeVisibleAsync(new() { Timeout = 10_000 });
|
||||
await Expect(_loginPage.EnrollButton)
|
||||
.ToBeVisibleAsync(new LocatorAssertionsToBeVisibleOptions { Timeout = 10_000 });
|
||||
await Expect(_loginPage.SignInButton).Not.ToBeVisibleAsync();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task EnrollPasskey_CompletesSuccessfully_AndRedirectsHome()
|
||||
{
|
||||
var authenticatorId = await Page.Context.AddVirtualAuthenticatorAsync(new VirtualAuthenticatorOptions
|
||||
var cdp = await Page.Context.NewCDPSessionAsync(Page);
|
||||
await cdp.SendAsync("WebAuthn.enable");
|
||||
await cdp.SendAsync("WebAuthn.addVirtualAuthenticator", new Dictionary<string, object>
|
||||
{
|
||||
Protocol = "ctap2",
|
||||
Transport = "internal",
|
||||
HasResidentKey = true,
|
||||
HasUserVerification = true,
|
||||
IsUserVerified = true,
|
||||
["options"] = new Dictionary<string, object>
|
||||
{
|
||||
["protocol"] = "ctap2",
|
||||
["transport"] = "internal",
|
||||
["hasResidentKey"] = true,
|
||||
["hasUserVerification"] = true,
|
||||
["isUserVerified"] = true
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
@@ -57,28 +63,35 @@ public class PasskeyTests : PageTest
|
||||
await _loginPage.GotoAsync();
|
||||
await _loginPage.WaitForInteractiveAsync();
|
||||
|
||||
await Expect(_loginPage.EnrollButton).ToBeVisibleAsync(new() { Timeout = 10_000 });
|
||||
await Expect(_loginPage.EnrollButton)
|
||||
.ToBeVisibleAsync(new LocatorAssertionsToBeVisibleOptions { Timeout = 10_000 });
|
||||
await _loginPage.EnrollButton.ClickAsync();
|
||||
|
||||
// After enrollment + auto sign-in, redirects away from /login
|
||||
await Page.WaitForURLAsync(new Regex(@"^http://localhost:5256(?!/login)"), new() { Timeout = 20_000 });
|
||||
await Page.WaitForURLAsync(new Regex(@"^http://localhost:5256(?!/login)"),
|
||||
new PageWaitForURLOptions { Timeout = 20_000 });
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Page.Context.RemoveVirtualAuthenticatorAsync(authenticatorId);
|
||||
await cdp.SendAsync("WebAuthn.disable");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task LoginPage_AfterEnrollment_ShowsSignInButton()
|
||||
{
|
||||
var authenticatorId = await Page.Context.AddVirtualAuthenticatorAsync(new VirtualAuthenticatorOptions
|
||||
var cdp = await Page.Context.NewCDPSessionAsync(Page);
|
||||
await cdp.SendAsync("WebAuthn.enable");
|
||||
await cdp.SendAsync("WebAuthn.addVirtualAuthenticator", new Dictionary<string, object>
|
||||
{
|
||||
Protocol = "ctap2",
|
||||
Transport = "internal",
|
||||
HasResidentKey = true,
|
||||
HasUserVerification = true,
|
||||
IsUserVerified = true,
|
||||
["options"] = new Dictionary<string, object>
|
||||
{
|
||||
["protocol"] = "ctap2",
|
||||
["transport"] = "internal",
|
||||
["hasResidentKey"] = true,
|
||||
["hasUserVerification"] = true,
|
||||
["isUserVerified"] = true
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
@@ -87,7 +100,8 @@ public class PasskeyTests : PageTest
|
||||
await _loginPage.GotoAsync();
|
||||
await _loginPage.WaitForInteractiveAsync();
|
||||
await _loginPage.EnrollButton.ClickAsync();
|
||||
await Page.WaitForURLAsync(new Regex(@"^http://localhost:5256(?!/login)"), new() { Timeout = 20_000 });
|
||||
await Page.WaitForURLAsync(new Regex(@"^http://localhost:5256(?!/login)"),
|
||||
new PageWaitForURLOptions { Timeout = 20_000 });
|
||||
|
||||
// Clear the auth cookie and navigate back to /login
|
||||
await Page.Context.ClearCookiesAsync();
|
||||
@@ -95,24 +109,30 @@ public class PasskeyTests : PageTest
|
||||
await _loginPage.WaitForInteractiveAsync();
|
||||
|
||||
// Should show Sign In button (credential is enrolled)
|
||||
await Expect(_loginPage.SignInButton).ToBeVisibleAsync(new() { Timeout = 10_000 });
|
||||
await Expect(_loginPage.SignInButton)
|
||||
.ToBeVisibleAsync(new LocatorAssertionsToBeVisibleOptions { Timeout = 10_000 });
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Page.Context.RemoveVirtualAuthenticatorAsync(authenticatorId);
|
||||
await cdp.SendAsync("WebAuthn.disable");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SignInWithPasskey_AfterEnrollment_AuthenticatesSuccessfully()
|
||||
{
|
||||
var authenticatorId = await Page.Context.AddVirtualAuthenticatorAsync(new VirtualAuthenticatorOptions
|
||||
var cdp = await Page.Context.NewCDPSessionAsync(Page);
|
||||
await cdp.SendAsync("WebAuthn.enable");
|
||||
await cdp.SendAsync("WebAuthn.addVirtualAuthenticator", new Dictionary<string, object>
|
||||
{
|
||||
Protocol = "ctap2",
|
||||
Transport = "internal",
|
||||
HasResidentKey = true,
|
||||
HasUserVerification = true,
|
||||
IsUserVerified = true,
|
||||
["options"] = new Dictionary<string, object>
|
||||
{
|
||||
["protocol"] = "ctap2",
|
||||
["transport"] = "internal",
|
||||
["hasResidentKey"] = true,
|
||||
["hasUserVerification"] = true,
|
||||
["isUserVerified"] = true
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
@@ -121,22 +141,25 @@ public class PasskeyTests : PageTest
|
||||
await _loginPage.GotoAsync();
|
||||
await _loginPage.WaitForInteractiveAsync();
|
||||
await _loginPage.EnrollButton.ClickAsync();
|
||||
await Page.WaitForURLAsync(new Regex(@"^http://localhost:5256(?!/login)"), new() { Timeout = 20_000 });
|
||||
await Page.WaitForURLAsync(new Regex(@"^http://localhost:5256(?!/login)"),
|
||||
new PageWaitForURLOptions { Timeout = 20_000 });
|
||||
|
||||
// Sign out (clear cookie) and return to login
|
||||
await Page.Context.ClearCookiesAsync();
|
||||
await _loginPage.GotoAsync();
|
||||
await _loginPage.WaitForInteractiveAsync();
|
||||
|
||||
await Expect(_loginPage.SignInButton).ToBeVisibleAsync(new() { Timeout = 10_000 });
|
||||
await Expect(_loginPage.SignInButton)
|
||||
.ToBeVisibleAsync(new LocatorAssertionsToBeVisibleOptions { Timeout = 10_000 });
|
||||
await _loginPage.SignInButton.ClickAsync();
|
||||
|
||||
// After sign-in, redirects away from /login
|
||||
await Page.WaitForURLAsync(new Regex(@"^http://localhost:5256(?!/login)"), new() { Timeout = 20_000 });
|
||||
await Page.WaitForURLAsync(new Regex(@"^http://localhost:5256(?!/login)"),
|
||||
new PageWaitForURLOptions { Timeout = 20_000 });
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Page.Context.RemoveVirtualAuthenticatorAsync(authenticatorId);
|
||||
await cdp.SendAsync("WebAuthn.disable");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user