Skip to content

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

Update E2E test for email delete button (#171)

Leendert de Borst8dc4bcb06f70
diff --git a/src/AliasVault.Client/Main/Components/Email/EmailModal.razor b/src/AliasVault.Client/Main/Components/Email/EmailModal.razor
index 6347a3037..7a3acf778 100644
--- a/src/AliasVault.Client/Main/Components/Email/EmailModal.razor
+++ b/src/AliasVault.Client/Main/Components/Email/EmailModal.razor
@@ -36,8 +36,8 @@
</div>
</div>
<div class="mt-6 flex justify-end space-x-4">
- <button @onclick="DeleteEmail" class="px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600">Delete</button>
- <button @onclick="Close" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">Close</button>
+ <button id="delete-email" @onclick="DeleteEmail" class="px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600">Delete</button>
+ <button id="close-email-modal" @onclick="Close" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">Close</button>
</div>
</div>
</div>
diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/EmailDecryptionTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/EmailDecryptionTests.cs
index 6909cfddc..1da33a210 100644
--- a/src/Tests/AliasVault.E2ETests/Tests/Client/EmailDecryptionTests.cs
+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/EmailDecryptionTests.cs
@@ -46,12 +46,13 @@ public class EmailDecryptionTests : ClientPlaywrightTest
}
/// <summary>
- /// Test if received email encrypted by server can be successfully decrypted by client.
+ /// Test if received email encrypted by server can be successfully decrypted by client
+ /// and then be deleted by client.
/// </summary>
/// <returns>Async task.</returns>
[Test]
[Order(1)]
- public async Task EmailEncryptionDecryptionTest()
+ public async Task EmailEncryptionDecryptionDeleteTest()
{
// Create credential which should automatically create claim on server during database sync.
const string serviceName = "Test Service";
@@ -103,6 +104,20 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Check if the email is visible on the page now.
emailContent = await Page.TextContentAsync("body");
Assert.That(emailContent, Does.Contain(textSubject), "Email not (correctly) decrypted and displayed on the emails page. Check email decryption logic.");
+
+ // Attempt to click on the email subject to open the modal.
+ await Page.Locator("text=" + textSubject).First.ClickAsync();
+ await WaitForUrlAsync("emails**", "Delete");
+
+ // Click the delete button to delete the email.
+ await Page.Locator("id=delete-email").First.ClickAsync();
+
+ // Wait for the email delete confirm message to show up.
+ await WaitForUrlAsync("emails**", "Email deleted successfully");
+
+ // Assert that the email is no longer visible on the page.
+ var body = await Page.TextContentAsync("body");
+ Assert.That(body, Does.Not.Contain(textSubject), "Email not deleted from page after deletion. Check email deletion logic.");
}
/// <summary>