Skip to content

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

Update tests to work with changed notifications (#481)

Leendert de Borst1e7b7b172a74
diff --git a/src/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs b/src/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
index 8b1848f37..f2b0be4a5 100644
--- a/src/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
+++ b/src/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
@@ -182,8 +182,9 @@ public class ClientPlaywrightTest : PlaywrightTest
/// </summary>
/// <param name="formValues">Dictionary with html element ids and values to input as field value.</param>
/// <param name="customLogic">Optional custom logic to execute after filling input fields.</param>
+ /// <param name="checkForSuccess">Whether to check for success message after creating credential entry.</param>
/// <returns>Async task.</returns>
- protected async Task CreateCredentialEntry(Dictionary<string, string>? formValues = null, Func<Task>? customLogic = null)
+ protected async Task CreateCredentialEntry(Dictionary<string, string>? formValues = null, Func<Task>? customLogic = null, bool checkForSuccess = true)
{
// Advance the time by 1 second to ensure the credential is created with a unique timestamp.
// This is required for certain tests that check for the latest credential and/or latest vault.
@@ -208,11 +209,15 @@ public class ClientPlaywrightTest : PlaywrightTest
var submitButton = Page.Locator("text=Save Credentials").First;
await submitButton.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Credential created successfully");
- // Check if the credential was created
- var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain("View credentials entry"), "Credential not created.");
+ if (checkForSuccess)
+ {
+ await WaitForUrlAsync("credentials/**", "Credential created successfully");
+
+ // Check if the credential was created
+ var pageContent = await Page.TextContentAsync("body");
+ Assert.That(pageContent, Does.Contain("View credentials entry"), "Credential not created.");
+ }
}
/// <summary>
diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs
index b0bd1015e..e2ae3431d 100644
--- a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs
+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs
@@ -197,7 +197,10 @@ public class DbSyncTests : ClientPlaywrightTest
await NavigateUsingBlazorRouter("credentials");
await WaitForUrlAsync("credentials", "Find all of your credentials");
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestB" } });
+ await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestB" } }, null, false);
+
+ // Wait for 1 second to ensure the page is loaded.
+ await Task.Delay(1000);
});
// Assert that merge failed error message is shown.