Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Press submit button in 2FA login tests (#2100)

Leendert de Borst2019275da163
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/CodeLockoutTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/CodeLockoutTests.cs
index b4ddb9ae2..2bd20e3ed 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/CodeLockoutTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/CodeLockoutTests.cs
@@ -51,16 +51,17 @@ public class CodeLockoutTests : TwoFactorAuthBase
// Fill in wrong code 11 times. After 11 times, the account should be locked.
// Note: the actual lockout happens on the 10th wrong attempt, but the lockout message is only displayed
// on the next attempt, so we need to try 11 times to see the lockout message.
+ var twoFactorSubmitButton = Page.Locator("form[name='login-with-2fa'] button[type='submit']");
for (var i = 0; i < 11; i++)
{
await Page.Locator("input[id='two-factor-code']").FillAsync("000000");
+ await twoFactorSubmitButton.ClickAsync();
if (i == 10)
{
break;
}
- // Form should auto-submit after entering the code.
await WaitForUrlAsync("user/login**", "Invalid authenticator code.");
// Clear the input field for the next attempt.
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/TwoFactorAuthTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/TwoFactorAuthTests.cs
index 352922706..8c1558b74 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/TwoFactorAuthTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/TwoFactorAuthTests.cs
@@ -56,11 +56,12 @@ public class TwoFactorAuthTests : TwoFactorAuthBase
var prompt = await Page.TextContentAsync("label:has-text('Authenticator code')");
Assert.That(prompt, Does.Contain("Authenticator code"), "No 2FA code prompt displayed.");
- // Fill in the 2FA code.
+ // Fill in the 2FA code and submit the form.
var totpField = await WaitForAndGetElement("input[id='two-factor-code']");
await totpField.FillAsync(totpCode);
- // Form should auto-submit after filling in the 6-digit code.
+ var twoFactorSubmitButton = Page.Locator("form[name='login-with-2fa'] button[type='submit']");
+ await twoFactorSubmitButton.ClickAsync();
// Check if we get redirected to the index page.
await WaitForUrlAsync("welcome**", WelcomeMessage);