Update E2E test for email delete button (#171)

This commit is contained in:
Leendert de Borst
2024-08-31 17:51:45 +02:00
parent 466c181ad1
commit 8dc4bcb06f
2 changed files with 19 additions and 4 deletions

View File

@@ -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>

View File

@@ -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>