diff --git a/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs b/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
index 581188ca6..40f51662d 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
@@ -294,6 +294,20 @@ public class ClientPlaywrightTest : PlaywrightTest
Assert.That(pageContent, Does.Not.Contain(itemName), "Item not deleted successfully.");
}
+ ///
+ /// Add a field section to the current item add/edit form via the "+" menu.
+ /// This clicks the add field button and selects the specified option.
+ ///
+ /// The name of the field/section to add (e.g., "Attachments", "Two-Factor Authentication").
+ /// Async task.
+ protected async Task AddFieldSectionAsync(string fieldName)
+ {
+ var addFieldButton = Page.Locator("button.w-full.border-dashed").First;
+ await addFieldButton.ClickAsync();
+ var fieldOption = Page.Locator($"button:has-text('{fieldName}')").First;
+ await fieldOption.ClickAsync();
+ }
+
///
/// Login (again) as current user.
///
diff --git a/apps/server/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs b/apps/server/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
index 85af7188b..db9bb40f9 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
@@ -174,7 +174,7 @@ public abstract class PlaywrightTest
.First
.WaitForAsync(new LocatorWaitForOptions
{
- Timeout = 20000,
+ Timeout = TestDefaults.DefaultTimeout,
State = WaitForSelectorState.Attached,
});
}
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard4/AuthTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard4/AuthTests.cs
index 63f7f218b..3e752d67f 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard4/AuthTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard4/AuthTests.cs
@@ -56,12 +56,13 @@ public class AuthTests : ClientPlaywrightTest
await Logout();
await Login();
- // Wait for the index page to load which should show "Credentials" in the top menu.
- await WaitForUrlAsync("**", "Credentials");
+ // Wait for the page to load after login. After registration without completing the tutorial,
+ // the welcome screen will be shown. Otherwise the items page is shown.
+ await WaitForUrlAsync("**", WelcomeMessage);
// Check if the login was successful by verifying content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(WelcomeMessage), "No index content after logging in.");
+ Assert.That(pageContent, Does.Contain(WelcomeMessage), "No welcome/index content after logging in.");
// Check if login has created an auth log entry.
var authLogEntry = await ApiDbContext.AuthLogs.FirstOrDefaultAsync(x => x.Username == TestUserUsername && x.EventType == AuthEventType.Login);
@@ -119,12 +120,13 @@ public class AuthTests : ClientPlaywrightTest
await Logout();
await Login(rememberMe: true);
- // Wait for the index page to load which should show "Credentials" in the top menu.
- await WaitForUrlAsync("**", "Credentials");
+ // Wait for the page to load after login. After registration without completing the tutorial,
+ // the welcome screen will be shown. Otherwise the items page is shown.
+ await WaitForUrlAsync("**", WelcomeMessage);
// Check if the login was successful by verifying content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(WelcomeMessage), "No index content after logging in.");
+ Assert.That(pageContent, Does.Contain(WelcomeMessage), "No welcome/index content after logging in.");
// Check if login has created an auth log entry.
var authLogEntry = await ApiDbContext.AuthLogs.FirstOrDefaultAsync(x => x.Username == TestUserUsername && x.EventType == AuthEventType.Login);
@@ -219,10 +221,10 @@ public class AuthTests : ClientPlaywrightTest
// Verify we can log in with the new account
await Login();
- await WaitForUrlAsync("**", "Credentials");
+ await WaitForUrlAsync("**", WelcomeMessage);
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(WelcomeMessage), "No welcome message shown after re-registering deleted account.");
+ Assert.That(pageContent, Does.Contain(WelcomeMessage), "No welcome/index content shown after re-registering deleted account.");
// Verify that a new auth log entry was created for the registration
var authLogEntry = await ApiDbContext.AuthLogs.FirstOrDefaultAsync(x => x.Username == TestUserUsername && x.EventType == AuthEventType.Register);
@@ -299,12 +301,13 @@ public class AuthTests : ClientPlaywrightTest
/// Async task.
private async Task VerifySuccessfulLogin()
{
- // Wait for the index page to load which should show "Credentials" in the top menu.
- await WaitForUrlAsync("**", "Credentials");
+ // Wait for the page to load after login. After registration without completing the tutorial,
+ // the welcome screen will be shown. Otherwise the items page is shown.
+ await WaitForUrlAsync("**", WelcomeMessage);
// Check if the login was successful by verifying content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(WelcomeMessage), "No index content after logging in.");
+ Assert.That(pageContent, Does.Contain(WelcomeMessage), "No welcome/index content after logging in.");
// Check if login has created an auth log entry and it contains the expected client header value.
var authLogEntry = await ApiDbContext.AuthLogs.FirstOrDefaultAsync(x => x.EventType == AuthEventType.Login);
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 314efc5de..690c648fc 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs
@@ -32,6 +32,12 @@ public class AttachmentTests : ClientPlaywrightTest
},
async () =>
{
+ // Add the attachments section via the + menu
+ await AddFieldSectionAsync("Attachments");
+
+ // Wait for the file input to appear
+ await Page.WaitForSelectorAsync("input[type='file']");
+
// Upload file.
var fileInput = Page.Locator("input[type='file']");
var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceBytesAsync("AliasVault.E2ETests.TestData.TestAttachment.txt");
@@ -90,6 +96,12 @@ public class AttachmentTests : ClientPlaywrightTest
},
async () =>
{
+ // Add the attachments section via the + menu
+ await AddFieldSectionAsync("Attachments");
+
+ // Wait for the file input to appear
+ await Page.WaitForSelectorAsync("input[type='file']");
+
// Upload file.
var fileInput = Page.Locator("input[type='file']");
var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceBytesAsync("AliasVault.E2ETests.TestData.TestAttachment.txt");
@@ -161,6 +173,12 @@ public class AttachmentTests : ClientPlaywrightTest
},
async () =>
{
+ // Add the attachments section via the + menu
+ await AddFieldSectionAsync("Attachments");
+
+ // Wait for the file input to appear
+ await Page.WaitForSelectorAsync("input[type='file']");
+
// Upload file.
var fileInput = Page.Locator("input[type='file']");
var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceBytesAsync("AliasVault.E2ETests.TestData.TestAttachment.txt");
@@ -222,6 +240,12 @@ public class AttachmentTests : ClientPlaywrightTest
},
async () =>
{
+ // Add the attachments section via the + menu
+ await AddFieldSectionAsync("Attachments");
+
+ // Wait for the file input to appear
+ await Page.WaitForSelectorAsync("input[type='file']");
+
var fileInput = Page.Locator("input[type='file']");
var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceBytesAsync("AliasVault.E2ETests.TestData.TestAttachment.txt");
@@ -285,6 +309,12 @@ public class AttachmentTests : ClientPlaywrightTest
await Page.ClickAsync("text=Edit");
await WaitForUrlAsync("items/**/edit", "Edit the existing item");
+ // Add the attachments section via the + menu
+ await AddFieldSectionAsync("Attachments");
+
+ // Wait for the file input to appear
+ await Page.WaitForSelectorAsync("input[type='file']");
+
var attachmentNames = new[] { "Attachment1.txt", "Attachment2.txt", "Attachment3.txt" };
var fileInput = Page.Locator("input[type='file']");
var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceBytesAsync("AliasVault.E2ETests.TestData.TestAttachment.txt");
@@ -352,6 +382,12 @@ public class AttachmentTests : ClientPlaywrightTest
},
async () =>
{
+ // Add the attachments section via the + menu
+ await AddFieldSectionAsync("Attachments");
+
+ // Wait for the file input to appear
+ await Page.WaitForSelectorAsync("input[type='file']");
+
var fileInput = Page.Locator("input[type='file']");
var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceBytesAsync("AliasVault.E2ETests.TestData.TestAttachment.txt");
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/UserBlockedTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/UserBlockedTests.cs
index 43fb5f9fa..1b3849434 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/UserBlockedTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/UserBlockedTests.cs
@@ -67,8 +67,8 @@ public class UserBlockedTests : ClientPlaywrightTest
await Logout();
await Login();
- // Wait for the index page to load which should show "Credentials" in the top menu.
- await WaitForUrlAsync("**", "Credentials");
+ // Wait for the page to load after login.
+ await WaitForUrlAsync("**", WelcomeMessage);
// First navigate to a test page to verify we're logged in
await NavigateUsingBlazorRouter("test/1");