Skip to content

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

Update web app responsive buttons and tests

Leendert de Borst9016d35ba302
diff --git a/apps/server/AliasVault.Client/Main/Pages/Items/View.razor b/apps/server/AliasVault.Client/Main/Pages/Items/View.razor
index 47b6a362c..14167f8ad 100644
--- a/apps/server/AliasVault.Client/Main/Pages/Items/View.razor
+++ b/apps/server/AliasVault.Client/Main/Pages/Items/View.razor
@@ -27,9 +27,9 @@ else
Text="@Localizer["EditButtonDesktop"]"
Href="@($"/items/{Id}/edit")"
Color="primary" />
- <button type="button" @onclick="OpenDeleteModal" class="space-x-3 @ButtonStyles.BaseClasses @ButtonStyles.GetColorClasses("danger")">
- <span class="hidden md:inline ms-1">@Localizer["DeleteButtonMobile"]</span>
- <span class="md:hidden">@Localizer["DeleteButtonDesktop"]</span>
+ <button type="button" @onclick="OpenDeleteModal" class="@ButtonStyles.BaseClasses @ButtonStyles.GetColorClasses("danger")">
+ <span class="md:hidden">@Localizer["DeleteButtonMobile"]</span>
+ <span class="hidden md:inline">@Localizer["DeleteButtonDesktop"]</span>
</button>
</CustomActions>
</PageHeader>
diff --git a/apps/server/Shared/AliasVault.RazorComponents/Buttons/LinkButton.razor b/apps/server/Shared/AliasVault.RazorComponents/Buttons/LinkButton.razor
index 3361c87f7..a2be367b7 100644
--- a/apps/server/Shared/AliasVault.RazorComponents/Buttons/LinkButton.razor
+++ b/apps/server/Shared/AliasVault.RazorComponents/Buttons/LinkButton.razor
@@ -1,7 +1,7 @@
-<a href="@Href" class="space-x-3 @GetButtonClasses()">
+<a href="@Href" class="@GetButtonClasses()">
@if (SmallText.Length > 0) {
- <span class="hidden md:inline ms-1">@SmallText</span>
- <span class="md:hidden">@Text</span>
+ <span class="md:hidden">@SmallText</span>
+ <span class="hidden md:inline">@Text</span>
}
else {
@Text
diff --git a/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs b/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
index 9a103e8d2..2a7ac2574 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
@@ -336,7 +336,7 @@ public abstract class ClientPlaywrightTest : PlaywrightTest
// Wait for the item details page to load.
await WaitForUrlAsync("items/**", "Edit");
- await Page.ClickAsync("text=Edit");
+ await ClickItemEditButtonAsync();
// Wait for the edit item page to load.
await WaitForUrlAsync("items/**/edit", "Edit the existing item");
@@ -401,7 +401,7 @@ public abstract class ClientPlaywrightTest : PlaywrightTest
// Wait for the item details page to load.
await WaitForUrlAsync("items/**", "Delete");
- await Page.ClickAsync("text=Delete");
+ await ClickItemDeleteButtonAsync();
// Wait for the delete confirmation modal to appear on the item view page.
await Page.GetByText("Are you sure you want to delete this item?", new PageGetByTextOptions { Exact = false })
@@ -435,6 +435,28 @@ public abstract class ClientPlaywrightTest : PlaywrightTest
await fieldOption.ClickAsync();
}
+ /// <summary>
+ /// Click the Edit button in the action area of the item view page. Resilient to the
+ /// responsive label change between "Edit" (mobile) and "Edit Item" (desktop).
+ /// </summary>
+ /// <returns>Async task.</returns>
+ protected async Task ClickItemEditButtonAsync()
+ {
+ var editButton = Page.Locator("a[href$='/edit']").First;
+ await editButton.ClickAsync();
+ }
+
+ /// <summary>
+ /// Click the Delete button in the action area of the item view page. Resilient to the
+ /// responsive label change between "Delete" (mobile) and "Delete Item" (desktop).
+ /// </summary>
+ /// <returns>Async task.</returns>
+ protected async Task ClickItemDeleteButtonAsync()
+ {
+ var deleteButton = Page.Locator("button:has-text('Delete')").First;
+ await deleteButton.ClickAsync();
+ }
+
/// <summary>
/// Login (again) as current user.
/// </summary>
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs
index 5123707d5..cf4139cd1 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs
@@ -105,8 +105,7 @@ public class CredentialTests : ClientPlaywrightTest
Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created item service name does not appear on login page.");
// Click the edit button.
- var editButton = Page.Locator("text=Edit").First;
- await editButton.ClickAsync();
+ await ClickItemEditButtonAsync();
await WaitForUrlAsync("edit", "Save Item");
var serviceNameAfter = "Item service after";
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs
index e20b85971..f7cc80ae1 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs
@@ -200,7 +200,7 @@ public class AttachmentTests : ClientPlaywrightTest
Assert.That(pageContent, Does.Contain("TestAttachment.txt"), "Uploaded attachment name does not appear on alias page.");
// Click the edit button
- await Page.ClickAsync("text=Edit");
+ await ClickItemEditButtonAsync();
await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Find and click the delete button for the attachment
@@ -306,7 +306,7 @@ public class AttachmentTests : ClientPlaywrightTest
});
// Edit the credential
- await Page.ClickAsync("text=Edit");
+ await ClickItemEditButtonAsync();
await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Add the attachments section via the + menu
@@ -488,7 +488,7 @@ public class AttachmentTests : ClientPlaywrightTest
Assert.That(pageContent, Does.Contain("TestAttachmentCancel.txt"), "Uploaded attachment name does not appear on view page.");
// Click the edit button
- await Page.ClickAsync("text=Edit");
+ await ClickItemEditButtonAsync();
await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Verify attachment appears on edit page
@@ -518,7 +518,7 @@ public class AttachmentTests : ClientPlaywrightTest
Assert.That(pageContent, Does.Contain("TestAttachmentCancel.txt"), "Attachment was deleted despite canceling the edit. Deletions should only persist on save.");
// Edit the item again to double-check the attachment is still there
- await Page.ClickAsync("text=Edit");
+ await ClickItemEditButtonAsync();
await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Verify attachment still appears on edit page
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs
index 7ed93f306..a0e37ac5a 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs
@@ -89,8 +89,8 @@ public class TotpTests : ClientPlaywrightTest
var pageContent = await Page.TextContentAsync("body");
Assert.That(pageContent, Does.Contain("TOTP to Delete"), "TOTP code was not added successfully");
- // Open the edit page again by clicking the button that contains the text "Edit"
- await Page.ClickAsync("text=Edit");
+ // Open the edit page again by clicking the edit button
+ await ClickItemEditButtonAsync();
await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Click the delete button for the TOTP code