Skip to content

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

Add asserts to test (#74)

Leendert de Borstcc10bcdfb833
diff --git a/src/AliasVault.WebApp/Main/Components/Credentials/CredentialCard.razor b/src/AliasVault.WebApp/Main/Components/Credentials/CredentialCard.razor
index f3f6c8658..29f1737eb 100644
--- a/src/AliasVault.WebApp/Main/Components/Credentials/CredentialCard.razor
+++ b/src/AliasVault.WebApp/Main/Components/Credentials/CredentialCard.razor
@@ -1,6 +1,6 @@
@inject NavigationManager NavigationManager
-<div @onclick="ShowDetails" class="p-4 space-y-2 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700
+<div @onclick="ShowDetails" class="credential-card p-4 space-y-2 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700
dark:bg-gray-800 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200">
<div class="px-4 py-2 text-gray-400 rounded text-center flex flex-col items-center">
<DisplayFavicon faviconBytes="@Obj.Logo"></DisplayFavicon>
diff --git a/src/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs b/src/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
index 51647112d..496a9e330 100644
--- a/src/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
+++ b/src/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
@@ -285,11 +285,11 @@ public class PlaywrightTest
// Start WebAPI in-memory.
_apiFactory.HostUrl = "http://localhost:" + apiPort;
- var apiClient = _apiFactory.CreateDefaultClient();
+ _apiFactory.CreateDefaultClient();
// Start Blazor WASM app out-of-process.
_wasmFactory.HostUrl = "http://localhost:" + appPort;
- var wasmClient = _wasmFactory.CreateDefaultClient();
+ _wasmFactory.CreateDefaultClient();
// Set Playwright headless mode true if not in debug mode.
bool isDebugMode = System.Diagnostics.Debugger.IsAttached;
diff --git a/src/Tests/AliasVault.E2ETests/Tests/DbUpgradeTest.cs b/src/Tests/AliasVault.E2ETests/Tests/DbUpgradeTest.cs
index d041ceda8..2322f06b3 100644
--- a/src/Tests/AliasVault.E2ETests/Tests/DbUpgradeTest.cs
+++ b/src/Tests/AliasVault.E2ETests/Tests/DbUpgradeTest.cs
@@ -33,6 +33,13 @@ public class DbUpgradeTest : PlaywrightTest
[Test]
public async Task DbUpgrade100Test()
{
+ // Define service names that are stored in the vault and expected to be shown after upgrade.
+ List<string> expectedServiceNamesInVault =
+ [
+ "Test credential 1",
+ "Test credential 2",
+ ];
+
// Update salt and verifier for the test user so the key derivation is deterministic.
var user = ApiDbContext.Users.First();
user.Salt = "1a73a8ef3a1c6dd891674c415962d87246450f8ca5004ecca24be770a4d7b1f7";
@@ -63,5 +70,29 @@ public class DbUpgradeTest : PlaywrightTest
await submitButton.ClickAsync();
await WaitForURLAsync("**/", "Test credential 1");
+
+ // Check if the expected service names still appear on the index page and are still accessible.
+ var pageContent = await Page.TextContentAsync("body");
+ foreach (var serviceName in expectedServiceNamesInVault)
+ {
+ Assert.That(pageContent, Does.Contain(serviceName), $"Credential name '{serviceName}' which existed in 1.0.0 encrypted vault does not appear on index page after database upgrade. Check client DB migration logic for potential data loss.");
+
+ // Find the clickable div with class "credential-card" containing the service name
+ var credentialCard = await Page.WaitForSelectorAsync($".credential-card:has-text('{serviceName}')");
+ Assert.That(credentialCard, Is.Not.Null, $"Could not find credential card for service '{serviceName}'");
+
+ // Click on the credential card
+ await credentialCard.ClickAsync();
+
+ // Wait for navigation to complete
+ await WaitForURLAsync("**/credentials/**");
+
+ // Check if the service name appears in the body of the new page
+ var credentialPageContent = await Page.TextContentAsync("body");
+ Assert.That(credentialPageContent, Does.Contain(serviceName), $"Service name '{serviceName}' not found on the credential details page");
+
+ // Navigate back to the index page for the next iteration
+ await Page.GoBackAsync();
+ }
}
}