Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add full attachment download flow to email decryption test (#151)
Leendert de Borsta20d981427e2
diff --git a/src/AliasVault.Client/Main/Components/Email/EmailModal.razor b/src/AliasVault.Client/Main/Components/Email/EmailModal.razorindex 15b01c3ac..dbe05e0f6 100644--- a/src/AliasVault.Client/Main/Components/Email/EmailModal.razor+++ b/src/AliasVault.Client/Main/Components/Email/EmailModal.razor@@ -56,7 +56,7 @@<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"></path></svg><button @onclick="() => DownloadAttachment(attachment)"- class="text-primary hover:underline text-sm truncate">+ class="text-primary hover:underline text-sm truncate attachment-link">(@(Math.Ceiling((double)attachment.Filesize / 1024)) KB) @attachment.Filename</button></div>diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.csindex 9a1bbc6a0..ac1b551d7 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cs@@ -149,6 +149,27 @@ public class EmailDecryptionTests : ClientPlaywrightTestvar anchorTag = await Page.Locator("iframe").First.GetAttributeAsync("srcdoc");Assert.That(anchorTag, Does.Contain("target=\"_blank\""), "Anchor tag in email iframe does not have target=\"_blank\" attribute. Check email decryption logic.");+ // Assert that email attachment metadata is visible in the modal.+ var body = await Page.TextContentAsync("body");+ Assert.That(body, Does.Contain("attachment.txt"), "Attachment metadata not visible in email modal. Check email attachment parse logic.");++ // Assert that clicking on the attachment link downloads it.+ await Page.Locator(".attachment-link").First.ClickAsync();+ var download = await Page.WaitForDownloadAsync();++ // Get the path of the downloaded file+ var downloadedFilePath = await download.PathAsync();++ // Read the content of the downloaded file+ var downloadedContent = await File.ReadAllBytesAsync(downloadedFilePath);++ // Compare with the original attachment content+ var originalContent = Encoding.UTF8.GetBytes("This is an attachment.");+ Assert.That(downloadedContent, Is.EqualTo(originalContent), "Downloaded attachment content does not match the original content.");++ // Clean up: delete the downloaded file+ File.Delete(downloadedFilePath);+// Click the delete button to delete the email.await Page.Locator("id=delete-email").First.ClickAsync();@@ -156,7 +177,7 @@ public class EmailDecryptionTests : ClientPlaywrightTestawait WaitForUrlAsync("emails**", "Email deleted successfully");// Assert that the email is no longer visible on the page.- var body = await Page.TextContentAsync("body");+ body = await Page.TextContentAsync("body");Assert.That(body, Does.Not.Contain(textSubject), "Email not deleted from page after deletion. Check email deletion logic.");}