From 4af158b35db6743785b982bfb546c37e1dfb2f13 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Thu, 3 Apr 2025 12:55:15 +0200 Subject: [PATCH] Update tests (#760) --- .../Main/Pages/Credentials/AddEdit.razor | 2 +- .../AliasVault.E2ETests/Common/ClientPlaywrightTest.cs | 10 +++++----- .../Tests/Client/Shard1/CredentialTests.cs | 6 +++--- .../Tests/Client/Shard2/DbSyncTests.cs | 2 +- .../Tests/Client/Shard5/AttachmentTests.cs | 8 ++++---- .../Tests/Client/Shard5/TotpTests.cs | 10 +++++----- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/AliasVault.Client/Main/Pages/Credentials/AddEdit.razor b/src/AliasVault.Client/Main/Pages/Credentials/AddEdit.razor index 2adc5dcb7..61961f8e9 100644 --- a/src/AliasVault.Client/Main/Pages/Credentials/AddEdit.razor +++ b/src/AliasVault.Client/Main/Pages/Credentials/AddEdit.razor @@ -125,7 +125,7 @@ else - + } diff --git a/src/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs b/src/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs index 6d4094d89..ec34f870d 100644 --- a/src/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs +++ b/src/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs @@ -213,7 +213,7 @@ public class ClientPlaywrightTest : PlaywrightTest await customLogic(); } - var submitButton = Page.Locator("text=Save Credentials").First; + var submitButton = Page.Locator("text=Save Credential").First; await submitButton.ClickAsync(); if (checkForSuccess) @@ -222,7 +222,7 @@ public class ClientPlaywrightTest : PlaywrightTest // Check if the credential was created var pageContent = await Page.TextContentAsync("body"); - Assert.That(pageContent, Does.Contain("View credentials entry"), "Credential not created."); + Assert.That(pageContent, Does.Contain("View credential"), "Credential not created."); } } @@ -247,12 +247,12 @@ public class ClientPlaywrightTest : PlaywrightTest await Page.ClickAsync("text=Edit"); // Wait for the edit credential page to load. - await WaitForUrlAsync("credentials/**/edit", "Edit the existing credentials"); + await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential"); // Fill all input fields with specified values and remaining empty fields with random data. await InputHelper.FillInputFields(formValues); - var submitButton = Page.Locator("text=Save Credentials").First; + var submitButton = Page.Locator("text=Save Credential").First; await submitButton.ClickAsync(); await WaitForUrlAsync("credentials/**", "Credential updated successfully"); @@ -281,7 +281,7 @@ public class ClientPlaywrightTest : PlaywrightTest await Page.ClickAsync("text=Delete"); // Wait for the delete credential page to load. - await WaitForUrlAsync("credentials/**/delete", "You can delete a credentials entry below"); + await WaitForUrlAsync("credentials/**/delete", "You can delete the credential below"); var submitButton = Page.Locator("text=Yes, I'm sure").First; await submitButton.ClickAsync(); diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs index 0b0b149a7..7c5b32465 100644 --- a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs +++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs @@ -75,7 +75,7 @@ public class CredentialTests : ClientPlaywrightTest var submitButton = Page.Locator("button[id='quickIdentitySubmit']"); await submitButton.ClickAsync(); - await WaitForUrlAsync("credentials/**", "View credentials entry"); + await WaitForUrlAsync("credentials/**", "View credential"); // Check that the service name is present in the content. var pageContent = await Page.TextContentAsync("body"); @@ -102,7 +102,7 @@ public class CredentialTests : ClientPlaywrightTest // Click the edit button. var editButton = Page.Locator("text=Edit").First; await editButton.ClickAsync(); - await WaitForUrlAsync("edit", "Save Credentials"); + await WaitForUrlAsync("edit", "Save Credential"); var serviceNameAfter = "Credential service after"; await InputHelper.FillInputFields( @@ -111,7 +111,7 @@ public class CredentialTests : ClientPlaywrightTest { "service-name", serviceNameAfter }, }); - var submitButton = Page.Locator("text=Save Credentials").First; + var submitButton = Page.Locator("text=Save Credential").First; await submitButton.ClickAsync(); await WaitForUrlAsync("credentials/**", "Delete"); diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs index 18278542b..506668a9d 100644 --- a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs +++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs @@ -128,7 +128,7 @@ public class DbSyncTests : ClientPlaywrightTest await WaitForUrlAsync("credentials", "Find all of your credentials"); await Page.ClickAsync($"text={serviceName.Key}"); - await WaitForUrlAsync($"credentials/**", "View credentials entry"); + await WaitForUrlAsync($"credentials/**", "View credential"); foreach (var property in serviceName.Value) { // Check if any input on the page has the expected value diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs index 463dd9efc..ad73dd4be 100644 --- a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs +++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs @@ -183,7 +183,7 @@ public class AttachmentTests : ClientPlaywrightTest // Click the edit button await Page.ClickAsync("text=Edit"); - await WaitForUrlAsync("credentials/**/edit", "Edit the existing credentials"); + await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential"); // Find and click the delete button for the attachment var deleteButton = Page.Locator("button:has-text('Delete')").First; @@ -194,7 +194,7 @@ public class AttachmentTests : ClientPlaywrightTest Assert.That(pageContent, Does.Not.Contain("TestAttachment.txt"), "Deleted attachment name still appears on edit page."); // Save the credential - var saveButton = Page.Locator("text=Save Credentials").First; + var saveButton = Page.Locator("text=Save Credential").First; await saveButton.ClickAsync(); await WaitForUrlAsync("credentials/**", "Credential updated successfully"); @@ -283,7 +283,7 @@ public class AttachmentTests : ClientPlaywrightTest // Edit the credential await Page.ClickAsync("text=Edit"); - await WaitForUrlAsync("credentials/**/edit", "Edit the existing credentials"); + await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential"); var attachmentNames = new[] { "Attachment1.txt", "Attachment2.txt", "Attachment3.txt" }; var fileInput = Page.Locator("input[type='file']"); @@ -305,7 +305,7 @@ public class AttachmentTests : ClientPlaywrightTest } // Save the updated credential - var saveButton = Page.Locator("text=Save Credentials").First; + var saveButton = Page.Locator("text=Save Credential").First; await saveButton.ClickAsync(); await WaitForUrlAsync("credentials/**", "Credential updated successfully"); diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs index 4d32beee6..75e2e3eab 100644 --- a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs +++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs @@ -33,7 +33,7 @@ public class TotpTests : ClientPlaywrightTest // Open the edit page again by clicking the button that contains the text "Edit" await Page.ClickAsync("text=Edit"); - await WaitForUrlAsync("credentials/**/edit", "Edit the existing credentials"); + await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential"); // Click the "Add TOTP Code" button var addButton = Page.Locator("button[id='add-totp-code'], a[id='add-totp-code']"); @@ -51,7 +51,7 @@ public class TotpTests : ClientPlaywrightTest await saveButton.ClickAsync(); // Save the credential - var submitButton = Page.Locator("text=Save Credentials").First; + var submitButton = Page.Locator("text=Save Credential").First; await submitButton.ClickAsync(); await WaitForUrlAsync("credentials/**", "Credential updated successfully"); @@ -84,7 +84,7 @@ public class TotpTests : ClientPlaywrightTest // Open the edit page again by clicking the button that contains the text "Edit" await Page.ClickAsync("text=Edit"); - await WaitForUrlAsync("credentials/**/edit", "Edit the existing credentials"); + await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential"); // Add a TOTP code var addButton = Page.Locator("button[id='add-totp-code'], a[id='add-totp-code']"); @@ -96,7 +96,7 @@ public class TotpTests : ClientPlaywrightTest await Page.Locator("button[id='save-totp-code']").ClickAsync(); // Save the credential - var submitButton = Page.Locator("text=Save Credentials").First; + var submitButton = Page.Locator("text=Save Credential").First; await submitButton.ClickAsync(); await WaitForUrlAsync("credentials/**", "Credential updated successfully"); @@ -107,7 +107,7 @@ public class TotpTests : ClientPlaywrightTest // Open the edit page again by clicking the button that contains the text "Edit" await Page.ClickAsync("text=Edit"); - await WaitForUrlAsync("credentials/**/edit", "Edit the existing credentials"); + await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential"); // Click the delete button for the TOTP code var deleteButton = Page.Locator("button.delete-totp-code").First;