Skip to content

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

Update E2E test scaffolding to work with new Item based structure (#1404)

Leendert de Borstd14aeef5203c
diff --git a/apps/server/AliasVault.Api/Controllers/VaultController.cs b/apps/server/AliasVault.Api/Controllers/VaultController.cs
index f3a95567e..1941ba0cc 100644
--- a/apps/server/AliasVault.Api/Controllers/VaultController.cs
+++ b/apps/server/AliasVault.Api/Controllers/VaultController.cs
@@ -96,25 +96,6 @@ public class VaultController(ILogger<VaultController> logger, IAliasServerDbCont
});
}
- // Check if there are no other vaults with the same revision number.
- // If there are, return a merge required status.
- // NOTE: a vault merge is no longer allowed by the API as of 0.20.0, updates with the same revision number are now rejected.
- // So the logic below can be removed later, together with the local merge logic in the WASM client.
- // We do probably want to still keep this until the datamodel has been updated to accomodate improved offline mode which might warrant
- // a new and improved merge logic. So we keep this here for reference purposes for now.
- var duplicateRevisionCount = await context.Vaults
- .Where(x => x.UserId == user.Id && x.RevisionNumber == vault.RevisionNumber)
- .CountAsync();
-
- if (duplicateRevisionCount > 1)
- {
- return Ok(new Shared.Models.WebApi.Vault.VaultGetResponse
- {
- Status = VaultStatus.MergeRequired,
- Vault = null,
- });
- }
-
// Get dynamic list of private email domains from config.
var privateEmailDomainList = config.PrivateEmailDomains;
var hiddenPrivateEmailDomainList = config.HiddenPrivateEmailDomains;
@@ -143,43 +124,6 @@ public class VaultController(ILogger<VaultController> logger, IAliasServerDbCont
});
}
- /// <summary>
- /// Returns a list of vaults that should be merged by the client.
- /// </summary>
- /// <param name="currentRevisionNumber">Current revision number of the local vault.</param>
- /// <returns>List of vaults to merge that are newer than the provided current revision number.</returns>
- [HttpGet("merge")]
- public async Task<IActionResult> GetVaultsToMerge([FromQuery] long currentRevisionNumber)
- {
- await using var context = await dbContextFactory.CreateDbContextAsync();
-
- var user = await GetCurrentUserAsync();
- if (user == null)
- {
- return Unauthorized();
- }
-
- // Logic to retrieve vault for the user.
- var vaultsToMerge = await context.Vaults
- .Where(x => x.UserId == user.Id && x.RevisionNumber > currentRevisionNumber)
- .OrderByDescending(x => x.UpdatedAt)
- .ToListAsync();
-
- return Ok(new Shared.Models.WebApi.Vault.VaultMergeResponse
- {
- Vaults = vaultsToMerge.Select(x => new Shared.Models.WebApi.Vault.Vault
- {
- Username = user.UserName!,
- Blob = x.VaultBlob,
- Version = x.Version,
- CurrentRevisionNumber = x.RevisionNumber,
- CredentialsCount = 0,
- CreatedAt = x.CreatedAt,
- UpdatedAt = x.UpdatedAt,
- }).ToList(),
- });
- }
-
/// <summary>
/// Save a new vault to the database for the current user.
/// </summary>
diff --git a/apps/server/AliasVault.Client/Main/Components/Items/ItemTypeSelector.razor b/apps/server/AliasVault.Client/Main/Components/Items/ItemTypeSelector.razor
index 8c1e0938b..3dad101f8 100644
--- a/apps/server/AliasVault.Client/Main/Components/Items/ItemTypeSelector.razor
+++ b/apps/server/AliasVault.Client/Main/Components/Items/ItemTypeSelector.razor
@@ -46,6 +46,7 @@
@foreach (var itemType in ItemType.All)
{
<button type="button"
+ id="itemTypeSelector_@itemType"
@onclick="() => SelectType(itemType)"
@onclick:preventDefault="true"
class="w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 border-b border-gray-100 dark:border-gray-700 last:border-b-0 @(SelectedType == itemType ? "bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300" : "text-gray-900 dark:text-white")">
diff --git a/apps/server/AliasVault.Client/Main/Pages/Sync/StatusMessages/ErrorVaultMerge.razor b/apps/server/AliasVault.Client/Main/Pages/Sync/StatusMessages/ErrorVaultMerge.razor
deleted file mode 100644
index 8251556fc..000000000
--- a/apps/server/AliasVault.Client/Main/Pages/Sync/StatusMessages/ErrorVaultMerge.razor
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="relative p-6 sm:p-8 bg-white dark:bg-gray-700 rounded-lg sm:shadow-xl max-w-md w-full mx-auto">
- <div class="text-center">
- <h2 class="mt-4 text-xl font-semibold text-gray-900 dark:text-white">Vault merge error.</h2>
- <p class="mt-2 text-sm text-gray-500 dark:text-gray-400">@Message Please try again (later) or contact support.</p>
- </div>
-</div>
-
-@code {
- /// <summary>
- /// The message to display.
- /// </summary>
- [Parameter]
- public string Message { get; set; } = string.Empty;
-}
diff --git a/apps/server/AliasVault.Client/Main/Pages/Sync/StatusMessages/Merging.razor b/apps/server/AliasVault.Client/Main/Pages/Sync/StatusMessages/Merging.razor
deleted file mode 100644
index 282dd67c6..000000000
--- a/apps/server/AliasVault.Client/Main/Pages/Sync/StatusMessages/Merging.razor
+++ /dev/null
@@ -1,72 +0,0 @@
-@inject DbService DbService
-@inject GlobalNotificationService GlobalNotificationService
-
-<div class="relative p-6 sm:p-8 bg-white dark:bg-gray-700 rounded-lg sm:shadow-xl max-w-md w-full mx-auto">
- <div class="text-center">
- <div class="space-y-4">
- <h2 class="text-xl font-semibold text-gray-900 dark:text-white">Vault merge required</h2>
- <p class="text-sm text-gray-500 dark:text-gray-400">
- A merge is required because another client has made changes to the vault since you last synced.
- </p>
-
- <div>
- @if (ErrorMessage.Length > 0)
- {
- <AlertMessageError Message="@ErrorMessage" />
- }
-
- @if (IsMerging)
- {
- <p class="text-sm text-gray-500 dark:text-gray-400 mb-4">
- Please wait while the merge is performed. This process may take a moment.
- </p>
- <BoldLoadingIndicator />
- }
- else
- {
- <p class="text-sm text-gray-500 dark:text-gray-400 mb-4">
- Please click the button below to begin the merge process.
- </p>
- <button @onclick="MergeDatabase" type="button" class="px-4 py-2 text-white bg-primary-600 rounded-lg hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 dark:bg-primary-500 dark:hover:bg-primary-600 dark:focus:ring-primary-800">
- Start vault merge
- </button>
- }
- </div>
- </div>
- </div>
-</div>
-
-@code {
- private bool IsMerging { get; set; } = false;
- private string ErrorMessage { get; set; } = string.Empty;
-
- /// <inheritdoc />
- protected override async Task OnInitializedAsync()
- {
- await base.OnInitializedAsync();
- }
-
- /// <summary>
- /// Merges the databases.
- /// </summary>
- private async Task MergeDatabase()
- {
- // Show loading indicator
- IsMerging = true;
- ErrorMessage = String.Empty;
- StateHasChanged();
-
- try
- {
- await DbService.MergeDatabasesAsync();
- }
- catch (Exception ex)
- {
- ErrorMessage = ex.Message;
- }
-
- // Reset local state
- IsMerging = false;
- StateHasChanged();
- }
-}
diff --git a/apps/server/AliasVault.Client/Main/Pages/Sync/Sync.razor b/apps/server/AliasVault.Client/Main/Pages/Sync/Sync.razor
index 6ea85e58d..eb6477d92 100644
--- a/apps/server/AliasVault.Client/Main/Pages/Sync/Sync.razor
+++ b/apps/server/AliasVault.Client/Main/Pages/Sync/Sync.razor
@@ -27,14 +27,6 @@
{
<PendingMigrations />
}
- else if (CurrentDbState.Status == DbServiceState.DatabaseStatus.MergeFailed)
- {
- <ErrorVaultMerge message="@CurrentDbState.Message" />
- }
- else if (CurrentDbState.Status == DbServiceState.DatabaseStatus.MergeRequired)
- {
- <Merging />
- }
else if (CurrentDbState.Status == DbServiceState.DatabaseStatus.Creating)
{
<Creating />
diff --git a/apps/server/AliasVault.Client/Services/Database/DbService.cs b/apps/server/AliasVault.Client/Services/Database/DbService.cs
index f705a18d5..9d30edf68 100644
--- a/apps/server/AliasVault.Client/Services/Database/DbService.cs
+++ b/apps/server/AliasVault.Client/Services/Database/DbService.cs
@@ -117,116 +117,6 @@ public sealed class DbService : IDisposable
_vaultRevisionNumber = newRevisionNumber;
}
- /// <summary>
- /// Merges two or more databases into one using the Rust WASM merge logic.
- /// </summary>
- /// <returns>Bool which indicates if merging was successful.</returns>
- public async Task<bool> MergeDatabasesAsync()
- {
- try
- {
- var vaultsToMerge = await _httpClient.GetFromJsonAsync<VaultMergeResponse>($"v1/Vault/merge?currentRevisionNumber={_vaultRevisionNumber}");
- if (vaultsToMerge == null || vaultsToMerge.Vaults.Count == 0)
- {
- // No vaults to merge found, set error state.
- _state.UpdateState(DbServiceState.DatabaseStatus.MergeFailed, "No vaults to merge found.");
- return false;
- }
-
- _logger.LogInformation("Merging databases using Rust WASM...");
-
- // Get the list of syncable table names from Rust core.
- var tableNames = await _rustCore.GetSyncableTableNamesAsync();
-
- // Read local tables as JSON.
- var localTables = await ReadTablesAsJsonAsync(_sqlConnection!, tableNames);
- _logger.LogDebug("Read {Count} local tables.", localTables.Count);
-
- // Process each vault to merge.
- foreach (var vault in vaultsToMerge.Vaults)
- {
- // Store username of the loaded vault in memory to send to server as sanity check when updating the vault later.
- _authService.StoreUsername(vault.Username);
-
- var decryptedBase64String = await _jsInteropService.SymmetricDecrypt(vault.Blob, _authService.GetEncryptionKeyAsBase64Async());
- _logger.LogInformation("Decrypted vault {VaultUpdatedAt}.", vault.UpdatedAt);
-
- // Create a temporary in-memory SQLite database for the server vault.
- await using var serverConnection = new SqliteConnection("Data Source=:memory:");
- await serverConnection.OpenAsync();
- await ImportDbContextFromBase64Async(decryptedBase64String, serverConnection);
-
- // Read server tables as JSON.
- var serverTables = await ReadTablesAsJsonAsync(serverConnection, tableNames);
- _logger.LogDebug("Read {Count} server tables.", serverTables.Count);
-
- // Create the merge input.
- var mergeInput = new MergeInput
- {
- LocalTables = localTables,
- ServerTables = serverTables,
- };
-
- // Call Rust WASM merge.
- var mergeOutput = await _rustCore.MergeVaultsAsync(mergeInput);
-
- _logger.LogInformation(
- "Merge completed: {TablesProcessed} tables, {FromLocal} kept local, {FromServer} from server, {Inserted} inserted, {Conflicts} conflicts.",
- mergeOutput.Stats.TablesProcessed,
- mergeOutput.Stats.RecordsFromLocal,
- mergeOutput.Stats.RecordsFromServer,
- mergeOutput.Stats.RecordsInserted,
- mergeOutput.Stats.Conflicts);
-
- // Execute the SQL statements returned by the merge.
- await ExecuteMergeSqlStatementsAsync(mergeOutput.Statements);
-
- // Update local tables for the next merge iteration (if there are multiple vaults).
- localTables = await ReadTablesAsJsonAsync(_sqlConnection!, tableNames);
- }
-
- // Verify foreign key integrity after merge.
- await using (var command = _sqlConnection!.CreateCommand())
- {
- command.CommandText = "PRAGMA foreign_key_check;";
- await using var reader = await command.ExecuteReaderAsync();
- if (await reader.ReadAsync())
- {
- // Foreign key violation detected.
- _state.UpdateState(DbServiceState.DatabaseStatus.MergeFailed, "Foreign key violation detected after merge.");
- return false;
- }
- }
-
- // Update the db context with the new merged database.
- _dbContext = new AliasClientDbContext(_sqlConnection, log => _logger.LogDebug("{Message}", log));
-
- // Update the current vault revision number to the highest revision number in the merged database(s).
- // This is important so the server knows that the local client has successfully merged the databases
- // and should overwrite the existing database on the server with the new merged database.
- var newRevisionNumber = vaultsToMerge.Vaults.Max(v => v.CurrentRevisionNumber);
- StoreVaultRevisionNumber(newRevisionNumber);
-
- _isSuccessfullyInitialized = true;
- await _settingsService.InitializeAsync(this);
- _state.UpdateState(DbServiceState.DatabaseStatus.Ready);
- _logger.LogInformation("Databases merged successfully.");
-
- // Save the newly merged database to the server.
- return await SaveDatabaseAsync();
- }
- catch (Exception ex)
- {
- _globalNotificationService.AddErrorMessage(
- "Unable to save changes: Your vault has been updated elsewhere. " +
- "The automatic merge was unsuccessful, possibly due to a password change or vault upgrade. " +
- "Please log out and log back in to retrieve the latest version of your vault.");
- _logger.LogError(ex, "Error merging databases.");
- _state.UpdateState(DbServiceState.DatabaseStatus.Ready);
- return false;
- }
- }
-
/// <summary>
/// Returns the AliasClientDbContext instance.
/// </summary>
@@ -751,6 +641,109 @@ public sealed class DbService : IDisposable
};
}
+ /// <summary>
+ /// Fetches the latest vault from server, merges with local changes using Rust WASM, and saves the merged result.
+ /// Called when server responds with "Outdated" status, indicating another client has uploaded a newer vault.
+ /// </summary>
+ /// <returns>Bool which indicates if merge and save was successful.</returns>
+ private async Task<bool> MergeWithServerAndSaveAsync()
+ {
+ try
+ {
+ _logger.LogInformation("Local vault is outdated. Fetching latest vault from server for merge...");
+
+ // Fetch the latest vault from server.
+ var response = await _httpClient.GetFromJsonAsync<VaultGetResponse>("v1/Vault");
+ if (response?.Vault == null || string.IsNullOrEmpty(response.Vault.Blob))
+ {
+ _logger.LogError("Failed to fetch vault from server for merge.");
+ _globalNotificationService.AddErrorMessage("Failed to sync vault. Please try again.");
+ return false;
+ }
+
+ var serverVault = response.Vault;
+ _logger.LogInformation("Fetched server vault at revision {Revision}.", serverVault.CurrentRevisionNumber);
+
+ // Store username of the loaded vault in memory to send to server as sanity check when updating the vault later.
+ _authService.StoreUsername(serverVault.Username);
+
+ // Decrypt server vault.
+ var decryptedBase64String = await _jsInteropService.SymmetricDecrypt(serverVault.Blob, _authService.GetEncryptionKeyAsBase64Async());
+
+ // Get the list of syncable table names from Rust core.
+ var tableNames = await _rustCore.GetSyncableTableNamesAsync();
+
+ // Read local tables as JSON.
+ var localTables = await ReadTablesAsJsonAsync(_sqlConnection!, tableNames);
+ _logger.LogDebug("Read {Count} local tables.", localTables.Count);
+
+ // Create a temporary in-memory SQLite database for the server vault.
+ await using var serverConnection = new SqliteConnection("Data Source=:memory:");
+ await serverConnection.OpenAsync();
+ await ImportDbContextFromBase64Async(decryptedBase64String, serverConnection);
+
+ // Read server tables as JSON.
+ var serverTables = await ReadTablesAsJsonAsync(serverConnection, tableNames);
+ _logger.LogDebug("Read {Count} server tables.", serverTables.Count);
+
+ // Create the merge input (local has our pending changes, server has the latest).
+ var mergeInput = new MergeInput
+ {
+ LocalTables = localTables,
+ ServerTables = serverTables,
+ };
+
+ // Call Rust WASM merge (LWW - Last Write Wins based on UpdatedAt).
+ var mergeOutput = await _rustCore.MergeVaultsAsync(mergeInput);
+
+ _logger.LogInformation(
+ "Merge completed: {TablesProcessed} tables, {FromLocal} kept local, {FromServer} from server, {Inserted} inserted, {Conflicts} conflicts.",
+ mergeOutput.Stats.TablesProcessed,
+ mergeOutput.Stats.RecordsFromLocal,
+ mergeOutput.Stats.RecordsFromServer,
+ mergeOutput.Stats.RecordsInserted,
+ mergeOutput.Stats.Conflicts);
+
+ // Execute the SQL statements returned by the merge to update local database.
+ await ExecuteMergeSqlStatementsAsync(mergeOutput.Statements);
+
+ // Verify foreign key integrity after merge.
+ await using (var command = _sqlConnection!.CreateCommand())
+ {
+ command.CommandText = "PRAGMA foreign_key_check;";
+ await using var reader = await command.ExecuteReaderAsync();
+ if (await reader.ReadAsync())
+ {
+ _logger.LogError("Foreign key violation detected after merge.");
+ _globalNotificationService.AddErrorMessage("Merge failed due to data integrity error. Please log out and log back in.");
+ return false;
+ }
+ }
+
+ // Update the db context with the merged database.
+ _dbContext = new AliasClientDbContext(_sqlConnection, log => _logger.LogDebug("{Message}", log));
+
+ // Update the local revision number to the server's revision.
+ // When we upload, server will calculate new revision = this + 1.
+ StoreVaultRevisionNumber(serverVault.CurrentRevisionNumber);
+
+ _logger.LogInformation("Local merge completed. Uploading merged vault to server...");
+
+ // Now save the merged vault to server. This recursive call handles the case where
+ // another client uploaded during our merge (returns Outdated again).
+ return await SaveDatabaseAsync();
+ }
+ catch (Exception ex)
+ {
+ _globalNotificationService.AddErrorMessage(
+ "Unable to save changes: Your vault has been updated elsewhere. " +
+ "The automatic merge was unsuccessful, possibly due to a password change or vault upgrade. " +
+ "Please log out and log back in to retrieve the latest version of your vault.");
+ _logger.LogError(ex, "Error merging with server vault.");
+ return false;
+ }
+ }
+
/// <summary>
/// Checks if there are any pending migrations.
/// </summary>
@@ -787,12 +780,6 @@ public sealed class DbService : IDisposable
var response = await _httpClient.GetFromJsonAsync<VaultGetResponse>("v1/Vault");
if (response is not null)
{
- if (response.Status == VaultStatus.MergeRequired)
- {
- _state.UpdateState(DbServiceState.DatabaseStatus.MergeRequired);
- return false;
- }
-
var vault = response.Vault!;
StoreVaultRevisionNumber(vault.CurrentRevisionNumber);
@@ -870,22 +857,11 @@ public sealed class DbService : IDisposable
if (vaultUpdateResponse != null)
{
- // If the server responds with a merge required status, we need to merge the local database
- // with the one on the server before we can continue.
- if (vaultUpdateResponse.Status == VaultStatus.MergeRequired)
- {
- _state.UpdateState(DbServiceState.DatabaseStatus.MergeRequired);
- return await MergeDatabasesAsync();
- }
- else if (vaultUpdateResponse.Status == VaultStatus.Outdated)
+ if (vaultUpdateResponse.Status == VaultStatus.Outdated)
{
- // If the server responds with "outdated", it means we need to re-fetch the latest vault.
- // Because of how the WASM client works now, it mutates the current database in memory so we need to
- // merge the newly fetched database with the local database. For this we still need the
- // merge databases logic. So for outdated responses, we still call the MergeDatabasesAsync() method.
- // TODO: when changing datamodel and improving offline mode and batched mutations, update this logic and flow as well.
- _state.UpdateState(DbServiceState.DatabaseStatus.MergeRequired);
- return await MergeDatabasesAsync();
+ // Server has a newer vault. Fetch it, merge with our local changes, and re-upload.
+ // The merge uses LWW (Last Write Wins) based on UpdatedAt timestamps.
+ return await MergeWithServerAndSaveAsync();
}
_vaultRevisionNumber = vaultUpdateResponse.NewRevisionNumber;
diff --git a/apps/server/AliasVault.Client/Services/Database/DbServiceState.cs b/apps/server/AliasVault.Client/Services/Database/DbServiceState.cs
index de09e6678..f3182b8b9 100644
--- a/apps/server/AliasVault.Client/Services/Database/DbServiceState.cs
+++ b/apps/server/AliasVault.Client/Services/Database/DbServiceState.cs
@@ -39,17 +39,6 @@ public sealed class DbServiceState
/// </summary>
Creating,
- /// <summary>
- /// Database requires a merge because of multiple vaults with the same revision number.
- /// This happens when multiple clients have made changes to the same vault without syncing in between.
- /// </summary>
- MergeRequired,
-
- /// <summary>
- /// Database merge failed.
- /// </summary>
- MergeFailed,
-
/// <summary>
/// Database failed to decrypt. No data is accessible.
/// </summary>
diff --git a/apps/server/Shared/AliasVault.Shared/Models/Enums/VaultStatus.cs b/apps/server/Shared/AliasVault.Shared/Models/Enums/VaultStatus.cs
index 45b241a69..1f6f30f91 100644
--- a/apps/server/Shared/AliasVault.Shared/Models/Enums/VaultStatus.cs
+++ b/apps/server/Shared/AliasVault.Shared/Models/Enums/VaultStatus.cs
@@ -17,13 +17,9 @@ public enum VaultStatus
/// </summary>
Ok = 0,
- /// <summary>
- /// A client-side merge is required before the vault can be retrieved or updated.
- /// </summary>
- MergeRequired = 1,
-
/// <summary>
/// The local vault is outdated and the client should fetch the latest vault from the server before saving can continue.
+ /// Client should: 1) fetch latest vault, 2) merge locally with its pending changes, 3) upload merged result.
/// </summary>
Outdated = 2,
}
diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/Vault/VaultMergeResponse.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/Vault/VaultMergeResponse.cs
deleted file mode 100644
index ce0e61088..000000000
--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/Vault/VaultMergeResponse.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="VaultMergeResponse.cs" company="aliasvault">
-// Copyright (c) aliasvault. All rights reserved.
-// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace AliasVault.Shared.Models.WebApi.Vault;
-
-/// <summary>
-/// Vault merge response model.
-/// </summary>
-public class VaultMergeResponse
-{
- /// <summary>
- /// Gets or sets the list of vaults that are to be merged.
- /// </summary>
- public List<Vault> Vaults { get; set; } = new();
-}
diff --git a/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs b/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
index 686447eea..581188ca6 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs
@@ -186,23 +186,23 @@ public class ClientPlaywrightTest : PlaywrightTest
}
/// <summary>
- /// Create new credential entry.
+ /// Create new item entry.
/// </summary>
/// <param name="formValues">Dictionary with html element ids and values to input as field value.</param>
/// <param name="customLogic">Optional custom logic to execute after filling input fields.</param>
- /// <param name="checkForSuccess">Whether to check for success message after creating credential entry.</param>
+ /// <param name="checkForSuccess">Whether to check for success message after creating item entry.</param>
/// <returns>Async task.</returns>
- protected async Task CreateCredentialEntry(Dictionary<string, string>? formValues = null, Func<Task>? customLogic = null, bool checkForSuccess = true)
+ protected async Task CreateItemEntry(Dictionary<string, string>? formValues = null, Func<Task>? customLogic = null, bool checkForSuccess = true)
{
- // Advance the time by 1 second to ensure the credential is created with a unique timestamp.
- // This is required for certain tests that check for the latest credential and/or latest vault.
+ // Advance the time by 1 second to ensure the item is created with a unique timestamp.
+ // This is required for certain tests that check for the latest item and/or latest vault.
ApiTimeProvider.AdvanceBy(TimeSpan.FromSeconds(1));
- await NavigateUsingBlazorRouter("credentials/create");
- await WaitForUrlAsync("credentials/create", "Add credentials");
+ await NavigateUsingBlazorRouter("items/create");
+ await WaitForUrlAsync("items/create", "Add Item");
- // Check if a button with text "Generate Random Identity" appears
- var generateButton = Page.Locator("text=Generate Random Identity");
+ // Check if a button with text "Generate Random Alias" appears
+ var generateButton = Page.Locator("text=Generate Random Alias");
Assert.That(generateButton, Is.Not.Null, "Generate button not found.");
// Fill all input fields with specified values and remaining empty fields with random data.
@@ -215,83 +215,83 @@ public class ClientPlaywrightTest : PlaywrightTest
await customLogic();
}
- var submitButton = Page.Locator("text=Save Credential").First;
+ var submitButton = Page.Locator("text=Save Item").First;
await submitButton.ClickAsync();
if (checkForSuccess)
{
- await WaitForUrlAsync("credentials/**", "Credential created successfully");
+ await WaitForUrlAsync("items/**", "Item created successfully");
- // Check if the credential was created
+ // Check if the item was created
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain("View credential"), "Credential not created.");
+ Assert.That(pageContent, Does.Contain("View item"), "Item not created.");
}
}
/// <summary>
- /// Update existing credential entry.
+ /// Update existing item entry.
/// </summary>
- /// <param name="credentialName">Name of the credential to update.</param>
+ /// <param name="itemName">Name of the item to update.</param>
/// <param name="formValues">Dictionary with html element ids and values to input as field value.</param>
/// <returns>Async task.</returns>
- protected async Task UpdateCredentialEntry(string credentialName, Dictionary<string, string>? formValues = null)
+ protected async Task UpdateItemEntry(string itemName, Dictionary<string, string>? formValues = null)
{
- // Advance the time by 1 second to ensure the credential is created with a unique timestamp.
- // This is required for certain tests that check for the latest credential and/or latest vault.
+ // Advance the time by 1 second to ensure the item is created with a unique timestamp.
+ // This is required for certain tests that check for the latest item and/or latest vault.
ApiTimeProvider.AdvanceBy(TimeSpan.FromSeconds(1));
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
- await Page.ClickAsync("text=" + credentialName);
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
+ await Page.ClickAsync("text=" + itemName);
- // Wait for the credential details page to load.
- await WaitForUrlAsync("credentials/**", "Edit");
+ // Wait for the item details page to load.
+ await WaitForUrlAsync("items/**", "Edit");
await Page.ClickAsync("text=Edit");
- // Wait for the edit credential page to load.
- await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential");
+ // Wait for the edit item page to load.
+ await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Fill all input fields with specified values and remaining empty fields with random data.
await InputHelper.FillInputFields(formValues);
- var submitButton = Page.Locator("text=Save Credential").First;
+ var submitButton = Page.Locator("text=Save Item").First;
await submitButton.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Credential updated successfully");
+ await WaitForUrlAsync("items/**", "Item updated successfully");
- // Check if the credential was created
+ // Check if the item was updated
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain("Credential updated successfully"), "Credential not updated successfully.");
+ Assert.That(pageContent, Does.Contain("Item updated successfully"), "Item not updated successfully.");
}
/// <summary>
- /// Update existing credential entry.
+ /// Delete existing item entry.
/// </summary>
- /// <param name="credentialName">Name of the credential to update.</param>
+ /// <param name="itemName">Name of the item to delete.</param>
/// <returns>Async task.</returns>
- protected async Task DeleteCredentialEntry(string credentialName)
+ protected async Task DeleteItemEntry(string itemName)
{
- // Advance the time by 1 second to ensure the credential is created with a unique timestamp.
- // This is required for certain tests that check for the latest credential and/or latest vault.
+ // Advance the time by 1 second to ensure the item is created with a unique timestamp.
+ // This is required for certain tests that check for the latest item and/or latest vault.
ApiTimeProvider.AdvanceBy(TimeSpan.FromSeconds(1));
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
- await Page.ClickAsync("text=" + credentialName);
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
+ await Page.ClickAsync("text=" + itemName);
- // Wait for the credential details page to load.
- await WaitForUrlAsync("credentials/**", "Delete");
+ // Wait for the item details page to load.
+ await WaitForUrlAsync("items/**", "Delete");
await Page.ClickAsync("text=Delete");
- // Wait for the delete credential page to load.
- await WaitForUrlAsync("credentials/**/delete", "You can delete the credential below");
+ // Wait for the delete item page to load.
+ await WaitForUrlAsync("items/**/delete", "You can delete the item below");
var submitButton = Page.Locator("text=Yes, I'm sure").First;
await submitButton.ClickAsync();
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ await WaitForUrlAsync("items", "Find all of your items");
- // Assert that the credential with specified name is no longer found on the page.
+ // Assert that the item with specified name is no longer found on the page.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Not.Contain(credentialName), "Credential not deleted successfully.");
+ Assert.That(pageContent, Does.Not.Contain(itemName), "Item not deleted successfully.");
}
/// <summary>
@@ -410,7 +410,7 @@ public class ClientPlaywrightTest : PlaywrightTest
/// <summary>
/// Complete the tutorial shown after registration. This is required for certain tests that rely on the tutorial being completed
- /// so it shows the empty credential list instead of redirecting to the tutorial welcome page.
+ /// so it shows the empty item list instead of redirecting to the tutorial welcome page.
/// </summary>
/// <returns>Async task.</returns>
protected async Task CompleteTutorial()
@@ -436,7 +436,7 @@ public class ClientPlaywrightTest : PlaywrightTest
var getStartedButton = Page.Locator("text=Get Started");
await getStartedButton.ClickAsync();
- // Wait for "Find all of your credentials below" message to appear.
- await WaitForUrlAsync("welcome**", "Find all of your credentials below");
+ // Wait for "Find all of your items below" message to appear.
+ await WaitForUrlAsync("welcome**", "Find all of your items below");
}
}
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 83d302989..6e5301384 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs
@@ -8,7 +8,7 @@
namespace AliasVault.E2ETests.Tests.Client.Shard1;
/// <summary>
-/// End-to-end tests for the credential management.
+/// End-to-end tests for the item management.
/// </summary>
[TestFixture]
[Category("ClientTests")]
@@ -16,22 +16,22 @@ namespace AliasVault.E2ETests.Tests.Client.Shard1;
public class CredentialTests : ClientPlaywrightTest
{
/// <summary>
- /// Test if the credential listing index page works.
+ /// Test if the item listing index page works.
/// </summary>
/// <returns>Async task.</returns>
[Test]
public async Task CredentialListingTest()
{
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "AliasVault");
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "AliasVault");
// Check if the expected content is present.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain("Find all of your credentials below"), "No index content after logging in.");
+ Assert.That(pageContent, Does.Contain("Find all of your items below"), "No index content after logging in.");
}
/// <summary>
- /// Test if creating a new credential entry works.
+ /// Test if creating a new item entry works.
/// </summary>
/// <returns>Async task.</returns>
[Test]
@@ -39,26 +39,26 @@ public class CredentialTests : ClientPlaywrightTest
{
// Create a new alias with service name = "Test Service".
var serviceName = "Test Service";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
});
// Check that the service name is present in the content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(serviceName), "Created credential service name does not appear on alias page.");
+ Assert.That(pageContent, Does.Contain(serviceName), "Created item service name does not appear on alias page.");
}
/// <summary>
- /// Test if creating a new credential entry works with quick create widget.
+ /// Test if creating a new item entry works with quick create widget.
/// </summary>
/// <returns>Async task.</returns>
[Test]
public async Task CreateCredentialWidgetTest()
{
// Navigate to homepage
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Credentials");
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Vault");
// Create a new alias with service name = "Test Service".
var serviceName = "Test Service Widget";
@@ -75,53 +75,53 @@ public class CredentialTests : ClientPlaywrightTest
var submitButton = Page.Locator("button[id='quickIdentitySubmit']");
await submitButton.ClickAsync();
- await WaitForUrlAsync("credentials/**", "View credential");
+ await WaitForUrlAsync("items/**", "View item");
// Check that the service name is present in the content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(serviceName), "Created credential service name does not appear on alias page.");
+ Assert.That(pageContent, Does.Contain(serviceName), "Created item service name does not appear on alias page.");
}
/// <summary>
- /// Test if editing a created credential entry works.
+ /// Test if editing a created item entry works.
/// </summary>
/// <returns>Async task.</returns>
[Test]
public async Task EditCredentialTest()
{
- var serviceNameBefore = "Credential service before";
- await CreateCredentialEntry(new Dictionary<string, string>
+ var serviceNameBefore = "Item service before";
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceNameBefore },
});
// Check that the service name is present in the content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created credential service name does not appear on login page.");
+ 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 WaitForUrlAsync("edit", "Save Credential");
+ await WaitForUrlAsync("edit", "Save Item");
- var serviceNameAfter = "Credential service after";
+ var serviceNameAfter = "Item service after";
await InputHelper.FillInputFields(
fieldValues: new Dictionary<string, string>
{
{ "service-name", serviceNameAfter },
});
- var submitButton = Page.Locator("text=Save Credential").First;
+ var submitButton = Page.Locator("text=Save Item").First;
await submitButton.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Delete");
+ await WaitForUrlAsync("items/**", "Delete");
pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain("Credential updated"), "Credential update confirmation message not shown.");
- Assert.That(pageContent, Does.Contain(serviceNameAfter), "Credential not updated correctly.");
+ Assert.That(pageContent, Does.Contain("Item updated"), "Item update confirmation message not shown.");
+ Assert.That(pageContent, Does.Contain(serviceNameAfter), "Item not updated correctly.");
}
/// <summary>
- /// Test if generating a new identity on the create new credential screen works.
+ /// Test if generating a new identity on the create new item screen works.
/// </summary>
/// <returns>Async task.</returns>
[Test]
@@ -130,8 +130,19 @@ public class CredentialTests : ClientPlaywrightTest
// Create a new alias with service name = "Test Service".
var serviceName = "Test Service";
- await NavigateUsingBlazorRouter("credentials/create");
- await WaitForUrlAsync("credentials/create", "Add credentials");
+ await NavigateUsingBlazorRouter("items/create");
+ await WaitForUrlAsync("items/create", "Add Item");
+
+ // First, switch item type to "Alias" by clicking the type selector dropdown
+ // The default type is "Login", we need to change it to "Alias" to see the identity fields
+ var typeSelector = Page.Locator("text=Creating Login").First;
+ await typeSelector.ClickAsync();
+ await Task.Delay(100);
+
+ // Select "Alias" from the dropdown
+ var aliasOption = Page.Locator($"id=itemTypeSelector_Alias").First;
+ await aliasOption.ClickAsync();
+ await Task.Delay(200);
await InputHelper.FillInputFields(
fieldValues: new Dictionary<string, string>
@@ -148,9 +159,22 @@ public class CredentialTests : ClientPlaywrightTest
var username = await Page.InputValueAsync("#username");
Assert.That(username, Is.Not.Null.And.Not.Empty, "Username not generated before alias is generated.");
- // 2. Then generate a new identity.
+ // 2. Then generate a new identity using the "Generate Random Alias" button.
+ // Note: When switching to Alias type, an alias is auto-generated, so we may need to clear first
var generateButton = Page.Locator("text=Generate Random Alias");
- Assert.That(generateButton, Is.Not.Null, "Generate button not found.");
+ if (await generateButton.CountAsync() == 0)
+ {
+ // If alias was auto-generated, there's a "Clear Alias Fields" button instead - click it first
+ var clearButton = Page.Locator("text=Clear Alias Fields");
+ if (await clearButton.CountAsync() > 0)
+ {
+ await clearButton.First.ClickAsync();
+ await Task.Delay(100);
+ }
+ }
+
+ generateButton = Page.Locator("text=Generate Random Alias");
+ Assert.That(await generateButton.CountAsync(), Is.GreaterThan(0), "Generate Random Alias button not found.");
await generateButton.First.ClickAsync();
// Wait for the identity fields to be filled.
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cs
index 83cd555a9..0046b22d8 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cs
@@ -58,7 +58,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Create credential which should automatically create claim on server during database sync.
const string serviceName = "Test Service";
const string email = "[email protected]";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
{ "email", email },
@@ -66,7 +66,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Assert that the claim was created on the server.
var claim = await ApiDbContext.UserEmailClaims.Where(x => x.Address == email).FirstOrDefaultAsync();
- Assert.That(claim, Is.Not.Null, "Claim for email address not found in database. Check if credential creation and claim creation are working correctly.");
+ Assert.That(claim, Is.Not.Null, "Claim for email address not found in database. Check if item creation and claim creation are working correctly.");
// Assert that the users public key was created on the server.
var publicKey = await ApiDbContext.UserEncryptionKeys.Where(x => x.UserId == claim.UserId).FirstOrDefaultAsync();
@@ -106,12 +106,12 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Attempt to click on email refresh button to get new emails.
await Page.Locator("id=recent-email-refresh").First.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Subject");
+ await WaitForUrlAsync("items/**", "Subject");
// Check if the email is visible on the page now.
await WaitForUrlAsync("*", textSubject);
var emailContent = await Page.TextContentAsync("body");
- Assert.That(emailContent, Does.Contain(textSubject), "Email not (correctly) decrypted and displayed on the credential page. Check email decryption logic.");
+ Assert.That(emailContent, Does.Contain(textSubject), "Email not (correctly) decrypted and displayed on the item page. Check email decryption logic.");
// Navigate to the email index page and ensure that the decrypted email is also readable there.
await NavigateUsingBlazorRouter("emails");
@@ -123,7 +123,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Attempt to click on the email subject to open the email.
await Page.Locator("div", new PageLocatorOptions { HasTextString = textSubject }).First.ClickAsync();
- await WaitForUrlAsync("emails**", "Credential:");
+ await WaitForUrlAsync("emails**", "Item:");
// Assert that the anchor tag in the email iframe has target="_blank" attribute.
var anchorTag = await Page.Locator("iframe").First.GetAttributeAsync("srcdoc");
@@ -155,7 +155,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Create credential which should automatically create claim on server during database sync.
const string serviceName = "Test Service";
const string email = "[email protected]";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
{ "email", email },
@@ -163,7 +163,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Assert that the claim was created on the server.
var claim = await ApiDbContext.UserEmailClaims.Where(x => x.Address == email).FirstOrDefaultAsync();
- Assert.That(claim, Is.Not.Null, "Claim for email address not found in database. Check if credential creation and claim creation are working correctly.");
+ Assert.That(claim, Is.Not.Null, "Claim for email address not found in database. Check if item creation and claim creation are working correctly.");
// Assert that the users public key was created on the server.
var publicKey = await ApiDbContext.UserEncryptionKeys.Where(x => x.UserId == claim.UserId).FirstOrDefaultAsync();
@@ -223,13 +223,13 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Attempt to click on email refresh button to get new emails.
await Page.Locator("id=recent-email-refresh").First.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Subject");
+ await WaitForUrlAsync("items/**", "Subject");
// Check if the email is visible on the page now.
await WaitForUrlAsync("*", textSubject);
var emailContent = await Page.TextContentAsync("body");
- Assert.That(emailContent, Does.Contain(textSubject), "Email not (correctly) decrypted and displayed on the credential page. Check email decryption logic.");
+ Assert.That(emailContent, Does.Contain(textSubject), "Email not (correctly) decrypted and displayed on the item page. Check email decryption logic.");
// Navigate to the email index page and ensure that the decrypted email is also readable there.
await NavigateUsingBlazorRouter("emails");
@@ -245,7 +245,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Attempt to click on the email subject to open the email.
await Page.Locator("div", new PageLocatorOptions { HasTextString = textSubject }).First.ClickAsync();
- await WaitForUrlAsync("emails**", "Credential:");
+ await WaitForUrlAsync("emails**", "Item:");
// Assert that the anchor tag in the email iframe has target="_blank" attribute.
var anchorTag = await Page.Locator("iframe").First.GetAttributeAsync("srcdoc");
@@ -297,7 +297,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Create credential which should automatically create claim on server during database sync.
const string serviceName = "Test Service";
const string email = "[email protected]";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
{ "email", email },
@@ -320,7 +320,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Create credential which should automatically create claim on server during database sync.
const string serviceName = "Test Service";
const string email = "[email protected]";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
{ "email", email },
@@ -328,13 +328,13 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Assert that the claim was created on the server.
var claim = await ApiDbContext.UserEmailClaims.FirstOrDefaultAsync(x => x.Address == email);
- Assert.That(claim, Is.Not.Null, "Claim for email address not found in database. Check if credential creation and claim creation are working correctly.");
+ Assert.That(claim, Is.Not.Null, "Claim for email address not found in database. Check if item creation and claim creation are working correctly.");
// Login as new user.
await LogoutAndLoginAsNewUser();
// Try to claim the same email address again.
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
{ "email", email },
@@ -362,7 +362,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Create two credential which should automatically create claims on server during database sync.
const string serviceName1 = "Test 1 Service";
const string email1 = "[email protected]";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName1 },
{ "email", email1 },
@@ -371,7 +371,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
// Create credential which should automatically create claim on server during database sync.
const string serviceName2 = "Test 2 Service";
const string email2 = "[email protected]";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName2 },
{ "email", email2 },
@@ -382,8 +382,8 @@ public class EmailDecryptionTests : ClientPlaywrightTest
var claim2 = await ApiDbContext.UserEmailClaims.AsNoTracking().FirstOrDefaultAsync(x => x.Address == email2);
Assert.Multiple(() =>
{
- Assert.That(claim1, Is.Not.Null, "Claim for email address not found in database. Check if credential creation and claim creation are working correctly.");
- Assert.That(claim2, Is.Not.Null, "Claim for email address not found in database. Check if credential creation and claim creation are working correctly.");
+ Assert.That(claim1, Is.Not.Null, "Claim for email address not found in database. Check if item creation and claim creation are working correctly.");
+ Assert.That(claim2, Is.Not.Null, "Claim for email address not found in database. Check if item creation and claim creation are working correctly.");
});
// Assert that both claims are not disabled.
@@ -394,7 +394,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
});
// Delete the first credential.
- await DeleteCredentialEntry(serviceName1);
+ await DeleteItemEntry(serviceName1);
// Assert that the first claim is now disabled, and second still enabled.
claim1 = await ApiDbContext.UserEmailClaims.AsNoTracking().FirstAsync(x => x.Address == email1);
@@ -406,7 +406,7 @@ public class EmailDecryptionTests : ClientPlaywrightTest
});
// Create a new credential with the same email as the one that was disabled.
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName1 },
{ "email", email1 },
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/GeneralSettingsTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/GeneralSettingsTests.cs
index 648f0279f..881764d63 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/GeneralSettingsTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/GeneralSettingsTests.cs
@@ -33,11 +33,11 @@ public class GeneralSettingsTests : ClientPlaywrightTest
var defaultEmailDomainField = Page.Locator("select[id='defaultEmailDomain']");
await defaultEmailDomainField.SelectOptionAsync("example2.tld");
- // Go to new credential create page and assert that the default email domain is visible on the page.
- await NavigateUsingBlazorRouter("credentials/create");
- await WaitForUrlAsync("credentials/create", "Add credentials");
+ // Go to new item create page and assert that the default email domain is visible on the page.
+ await NavigateUsingBlazorRouter("items/create");
+ await WaitForUrlAsync("items/create", "Add Item");
var defaultEmailDomainText = await Page.TextContentAsync("body");
- Assert.That(defaultEmailDomainText, Does.Contain("example2.tld"), "Default email domain not visible on add credentials page.");
+ Assert.That(defaultEmailDomainText, Does.Contain("example2.tld"), "Default email domain not visible on add item page.");
}
}
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/SearchTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/SearchTests.cs
index 81ca30c98..6a88f20e1 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/SearchTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard1/SearchTests.cs
@@ -26,15 +26,15 @@ public class SearchTests : ClientPlaywrightTest
var serviceName1 = "Test Service 1";
var serviceName2 = "Test Service 2";
var serviceName3 = "Entirely different name";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName1 },
});
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName2 },
});
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName3 },
});
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbCleanupTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbCleanupTests.cs
index bb2c8ebf0..f02668b2b 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbCleanupTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbCleanupTests.cs
@@ -23,26 +23,26 @@ public class DbCleanupTests : ClientPlaywrightTest
[Order(1)]
public async Task DbCleanupSoftDeletedRecordsTest()
{
- // Create two credentials. One random and one with a known name.
- await CreateCredentialEntry();
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "CredentialB" } });
+ // Create two items. One random and one with a known name.
+ await CreateItemEntry();
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "ItemB" } });
- // Delete the credential with the known name.
- await DeleteCredentialEntry("CredentialB");
+ // Delete the item with the known name.
+ await DeleteItemEntry("ItemB");
// Verify that the soft delete count is now 1.
await NavigateUsingBlazorRouter("test/cleanup-stats");
// Extract value from input hidden with id soft-deleted-credential-count
- var softDeletedCredentialCount = await Page.EvaluateAsync<int>("document.getElementById('soft-deleted-credential-count').value");
- Assert.That(softDeletedCredentialCount, Is.EqualTo(1), "Soft deleted credential count is not as expected.");
+ var softDeletedItemCount = await Page.EvaluateAsync<int>("document.getElementById('soft-deleted-credential-count').value");
+ Assert.That(softDeletedItemCount, Is.EqualTo(1), "Soft deleted item count is not as expected.");
// Unlock the vault to trigger the cleanup.
await RefreshPageAndUnlockVault();
// Verify that the soft delete count is now 0 as cleanup should have run.
await NavigateUsingBlazorRouter("test/cleanup-stats");
- softDeletedCredentialCount = await Page.EvaluateAsync<int>("document.getElementById('soft-deleted-credential-count').value");
- Assert.That(softDeletedCredentialCount, Is.EqualTo(1), "Soft deleted credential count is not as expected. Cleanup should only run after 7 days.");
+ softDeletedItemCount = await Page.EvaluateAsync<int>("document.getElementById('soft-deleted-credential-count').value");
+ Assert.That(softDeletedItemCount, Is.EqualTo(1), "Soft deleted item count is not as expected. Cleanup should only run after 7 days.");
}
}
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbPersistTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbPersistTests.cs
index d1c0ce4b9..53162cdda 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbPersistTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbPersistTests.cs
@@ -18,7 +18,7 @@ using Microsoft.EntityFrameworkCore;
public class DbPersistTests : ClientPlaywrightTest
{
/// <summary>
- /// Test if a created credential is still present after a hard page refresh which causes
+ /// Test if a created item is still present after a hard page refresh which causes
/// the database to be loaded fresh from the remote server. This is to ensure that the
/// database is correctly persisted and then loaded from the server.
/// </summary>
@@ -27,25 +27,25 @@ public class DbPersistTests : ClientPlaywrightTest
[Order(1)]
public async Task DbPersistCredentialTest()
{
- var serviceNameBefore = "Credential service before";
- await CreateCredentialEntry(new Dictionary<string, string>
+ var serviceNameBefore = "Item service before";
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceNameBefore },
});
// Check that the service name is present in the content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created credential service name does not appear on login page.");
+ Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created item service name does not appear on login page.");
// Refresh page so the database gets dropped then unlock the vault again which will refetch the database from the server.
await RefreshPageAndUnlockVault();
- // Wait for the credentials page to load again.
- await WaitForUrlAsync("credentials/**", serviceNameBefore);
+ // Wait for the items page to load again.
+ await WaitForUrlAsync("items/**", serviceNameBefore);
// Check if the service name is still present in the content.
pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created credential service name does not appear on login page after hard page reload. Check if the database is correctly persisted and then loaded from the server.");
+ Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created item service name does not appear on login page after hard page reload. Check if the database is correctly persisted and then loaded from the server.");
}
/// <summary>
@@ -57,16 +57,16 @@ public class DbPersistTests : ClientPlaywrightTest
public async Task VaultRevisionNumberIncrementTest()
{
// Assert that the vault revision number is 2 in the server database.
- // Account registration will create a new vault with revision number 1, first credential save will increment to 2.
- // Note: for this we expect the previous test to have run first and created a first credential.
+ // Account registration will create a new vault with revision number 1, first item save will increment to 2.
+ // Note: for this we expect the previous test to have run first and created a first item.
var firstUpdateVault = await ApiDbContext.Vaults.OrderByDescending(x => x.RevisionNumber).FirstAsync();
- Assert.That(firstUpdateVault.RevisionNumber, Is.EqualTo(2), "Vault revision number is not at 2 after creating the first credential in a new vault.");
+ Assert.That(firstUpdateVault.RevisionNumber, Is.EqualTo(2), "Vault revision number is not at 2 after creating the first item in a new vault.");
- // Create a new credential which will trigger a vault save to the server.
- await CreateCredentialEntry();
+ // Create a new item which will trigger a vault save to the server.
+ await CreateItemEntry();
// Assert that the vault revision number is now 3 in the server database.
var secondUpdateVault = await ApiDbContext.Vaults.OrderByDescending(x => x.RevisionNumber).FirstAsync();
- Assert.That(secondUpdateVault.RevisionNumber, Is.EqualTo(3), "Vault revision number is not 3 after the second credential save.");
+ Assert.That(secondUpdateVault.RevisionNumber, Is.EqualTo(3), "Vault revision number is not 3 after the second item save.");
}
}
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs
index 4ce2d66c6..9629d2d81 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs
@@ -28,19 +28,19 @@ public class DbSyncTests : ClientPlaywrightTest
{
var baselineVault = await CreateBaselineVault(async () =>
{
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestBaseline1" } });
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestBaseline2" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestBaseline1" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestBaseline2" } });
});
var client1Vault = await SimulateClient(baselineVault, async () =>
{
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestA" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestA" } });
- // Delete a credential to test the delete support during merge.
- await DeleteCredentialEntry("TestBaseline1");
+ // Delete an item to test the delete support during merge.
+ await DeleteItemEntry("TestBaseline1");
});
await SimulateClient(baselineVault, async () =>
@@ -50,15 +50,15 @@ public class DbSyncTests : ClientPlaywrightTest
ApiDbContext.Vaults.Add(client1Vault);
await ApiDbContext.SaveChangesAsync();
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestB" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestB" } });
});
// Assert that the two conflicting vaults have been merged and all service names are found.
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
var pageContent = await Page.TextContentAsync("body");
var expectedServiceNames = new[] { "TestBaseline2", "TestA", "TestB" };
@@ -67,8 +67,8 @@ public class DbSyncTests : ClientPlaywrightTest
Assert.That(pageContent, Does.Contain(serviceName), $"{serviceName} not found in vault after merge.");
}
- // Assert that the deleted credential is not found.
- Assert.That(pageContent, Does.Not.Contain("TestBaseline1"), "Deleted credential found in vault after merge.");
+ // Assert that the deleted item is not found.
+ Assert.That(pageContent, Does.Not.Contain("TestBaseline1"), "Deleted item found in vault after merge.");
}
/// <summary>
@@ -81,15 +81,15 @@ public class DbSyncTests : ClientPlaywrightTest
{
var baselineVault = await CreateBaselineVault(async () =>
{
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestBaseline1" }, { "username", "user1" }, { "email", "email1" }, { "first-name", "firstname1" } });
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestBaseline2" }, { "username", "user2" }, { "email", "email2" }, { "first-name", "firstname2" } });
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestBaseline3" }, { "username", "user3" }, { "email", "email3" }, { "first-name", "firstname3" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestBaseline1" }, { "username", "user1" }, { "email", "email1" }, { "first-name", "firstname1" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestBaseline2" }, { "username", "user2" }, { "email", "email2" }, { "first-name", "firstname2" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestBaseline3" }, { "username", "user3" }, { "email", "email3" }, { "first-name", "firstname3" } });
});
// Client 1 updates the vault first.
var client1Vault = await SimulateClient(baselineVault, async () =>
{
- await UpdateCredentialEntry("TestBaseline2", new Dictionary<string, string> { { "service-name", "TestBaseMutate2" }, { "username", "usermutate2" }, { "email", "emailmutate2" }, { "first-name", "firstnamemutate2" } });
+ await UpdateItemEntry("TestBaseline2", new Dictionary<string, string> { { "service-name", "TestBaseMutate2" }, { "username", "usermutate2" }, { "email", "emailmutate2" }, { "first-name", "firstnamemutate2" } });
});
// Then client 2 updates the same vault causing a conflict and requiring a client-side merge.
@@ -100,7 +100,7 @@ public class DbSyncTests : ClientPlaywrightTest
ApiDbContext.Vaults.Add(client1Vault);
await ApiDbContext.SaveChangesAsync();
- await UpdateCredentialEntry("TestBaseline3", new Dictionary<string, string> { { "service-name", "TestBaseMutate3" }, { "username", "usermutate3" }, { "email", "emailmutate3" } });
+ await UpdateItemEntry("TestBaseline3", new Dictionary<string, string> { { "service-name", "TestBaseMutate3" }, { "username", "usermutate3" }, { "email", "emailmutate3" } });
});
// Then another client updates the client 1 vault again, which should also cause a conflict with the client 2 vault update.
@@ -111,7 +111,7 @@ public class DbSyncTests : ClientPlaywrightTest
ApiDbContext.Vaults.Add(client2Vault);
await ApiDbContext.SaveChangesAsync();
- await UpdateCredentialEntry("TestBaseMutate2", new Dictionary<string, string> { { "service-name", "TestBaseMutate23" }, { "first-name", "firstnamemutate23" } });
+ await UpdateItemEntry("TestBaseMutate2", new Dictionary<string, string> { { "service-name", "TestBaseMutate23" }, { "first-name", "firstnamemutate23" } });
});
// Assert that the two conflicting vaults have been merged and all mutated service names are found.
@@ -123,12 +123,12 @@ public class DbSyncTests : ClientPlaywrightTest
foreach (var serviceName in expectedStrings)
{
- // Navigate to the credential details page.
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ // Navigate to the item details page.
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
await Page.ClickAsync($"text={serviceName.Key}");
- await WaitForUrlAsync($"credentials/**", "View credential");
+ await WaitForUrlAsync($"items/**", "View item");
foreach (var property in serviceName.Value)
{
// Check if any input on the page has the expected value
@@ -136,7 +136,7 @@ public class DbSyncTests : ClientPlaywrightTest
Array.from(document.querySelectorAll('input, textarea'))
.some(el => el.value === '{property}')");
- Assert.That(inputWithValue, Is.True, $"No input found with value '{property}' in {serviceName.Key} credential page after merge.");
+ Assert.That(inputWithValue, Is.True, $"No input found with value '{property}' in {serviceName.Key} item page after merge.");
}
}
}
@@ -151,15 +151,15 @@ public class DbSyncTests : ClientPlaywrightTest
{
var baselineVault = await CreateBaselineVault(async () =>
{
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestBaseline" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestBaseline" } });
});
var client1Vault = await SimulateClient(baselineVault, async () =>
{
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestA" } });
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestA" } });
// Attempt to change password.
await NavigateUsingBlazorRouter("settings/security/change-password");
@@ -194,10 +194,10 @@ public class DbSyncTests : ClientPlaywrightTest
ApiDbContext.Vaults.Add(client1Vault);
await ApiDbContext.SaveChangesAsync();
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
- await CreateCredentialEntry(new Dictionary<string, string> { { "service-name", "TestB" } }, null, false);
+ await CreateItemEntry(new Dictionary<string, string> { { "service-name", "TestB" } }, null, false);
// Wait for 1 second to ensure the page is loaded.
await Task.Delay(1000);
@@ -241,7 +241,7 @@ public class DbSyncTests : ClientPlaywrightTest
// Simulate new client.
await Logout();
await Login();
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ await WaitForUrlAsync("items", "Find all of your items");
// Execute custom client actions.
await clientActions();
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbUpgradeTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbUpgradeTests.cs
index 2917e6ab5..05e8cb790 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbUpgradeTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbUpgradeTests.cs
@@ -62,39 +62,39 @@ public class DbUpgradeTests : ClientPlaywrightTest
await Logout();
await Login();
- // Wait for two things: either the homepage to show with credentials OR the
+ // Wait for two things: either the homepage to show with items OR the
// vault upgrade step to show.
await WaitForUrlAsync("sync", "Vault needs to be upgraded");
var submitButton = Page.Locator("text=Start upgrade process").First;
await submitButton.ClickAsync();
- // Soft navigate to credentials.
- await NavigateUsingBlazorRouter("credentials");
+ // Soft navigate to items.
+ await NavigateUsingBlazorRouter("items");
await WaitForUrlAsync(string.Empty, "Test credential 1");
- // Wait for all credential cards on the page to have fully rendered.
+ // Wait for all item cards on the page to have fully rendered.
await Task.Delay(500);
// Check if the expected service names still appear on the index page and are still accessible.
var pageContent = await Page.TextContentAsync("body");
foreach (var serviceName in expectedServiceNamesInVault)
{
- Assert.That(pageContent, Does.Contain(serviceName), $"Credential name '{serviceName}' which existed in 1.0.0 encrypted vault does not appear on index page after database upgrade. Check client DB migration logic for potential data loss.");
+ Assert.That(pageContent, Does.Contain(serviceName), $"Item name '{serviceName}' which existed in 1.0.0 encrypted vault does not appear on index page after database upgrade. Check client DB migration logic for potential data loss.");
// Find the clickable div with class "credential-card" containing the service name
var credentialCard = await Page.WaitForSelectorAsync($".credential-card:has-text('{serviceName}')");
- Assert.That(credentialCard, Is.Not.Null, $"Could not find credential card for service '{serviceName}'");
+ Assert.That(credentialCard, Is.Not.Null, $"Could not find item card for service '{serviceName}'");
- // Click on the credential card
+ // Click on the item card
await credentialCard.ClickAsync();
// Wait for navigation to complete
- await WaitForUrlAsync("credentials/**");
+ await WaitForUrlAsync("items/**");
// Check if the service name appears in the body of the new page
- var credentialPageContent = await Page.TextContentAsync("body");
- Assert.That(credentialPageContent, Does.Contain(serviceName), $"Service name '{serviceName}' not found on the credential details page");
+ var itemPageContent = await Page.TextContentAsync("body");
+ Assert.That(itemPageContent, Does.Contain(serviceName), $"Service name '{serviceName}' not found on the item details page");
// Navigate back to the index page for the next iteration
await Page.GoBackAsync();
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/ImportTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/ImportTests.cs
index 086d70e4e..e52a3a0eb 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/ImportTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard3/ImportTests.cs
@@ -8,7 +8,7 @@
namespace AliasVault.E2ETests.Tests.Client.Shard3;
/// <summary>
-/// End-to-end tests for importing credentials from various password managers.
+/// End-to-end tests for importing items from various password managers.
/// </summary>
[Parallelizable(ParallelScope.Self)]
[Category("ClientTests")]
@@ -16,7 +16,7 @@ namespace AliasVault.E2ETests.Tests.Client.Shard3;
public class ImportTests : ClientPlaywrightTest
{
/// <summary>
- /// Test that importing credentials from Bitwarden CSV works correctly.
+ /// Test that importing items from Bitwarden CSV works correctly.
/// </summary>
/// <returns>Async task.</returns>
[Test]
@@ -51,20 +51,20 @@ public class ImportTests : ClientPlaywrightTest
// Wait for Import button to be visible.
await Page.WaitForSelectorAsync("button:has-text('Import')");
- // Click Import button to import the credentials.
+ // Click Import button to import the items.
await Page.ClickAsync("button:has-text('Import')");
await Page.WaitForSelectorAsync("text=Successfully imported");
- // Navigate to credentials page to verify imported credentials.
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Find all of your credentials");
+ // Navigate to items page to verify imported items.
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Find all of your items");
- // Verify that expected credentials from the Bitwarden CSV are present.
+ // Verify that expected items from the Bitwarden CSV are present.
var pageContent = await Page.TextContentAsync("body");
Assert.Multiple(() =>
{
- Assert.That(pageContent, Does.Contain("TutaNota"), "TutaNota credential not imported");
- Assert.That(pageContent, Does.Contain("Aliasvault.net"), "Aliasvault.net credential not imported");
+ Assert.That(pageContent, Does.Contain("TutaNota"), "TutaNota item not imported");
+ Assert.That(pageContent, Does.Contain("Aliasvault.net"), "Aliasvault.net item not imported");
});
}
}
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard4/WelcomeScreenTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard4/WelcomeScreenTests.cs
index 5dc3a4b19..175d221e4 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard4/WelcomeScreenTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard4/WelcomeScreenTests.cs
@@ -41,13 +41,13 @@ public class WelcomeScreenTests : ClientPlaywrightTest
var getStartedButton = await WaitForAndGetElement("button:has-text('Get started')");
await getStartedButton.ClickAsync();
- // Wait for the credentials page to load with the placeholder text.
- await WaitForUrlAsync("credentials", "No credentials yet");
+ // Wait for the items page to load with the placeholder text.
+ await WaitForUrlAsync("items", "No items yet");
- // Verify that after hard reloading the page, the credentials page is still loaded with the placeholder text
+ // Verify that after hard reloading the page, the items page is still loaded with the placeholder text
// and the tutorial is no longer shown.
await RefreshPageAndUnlockVault();
- await WaitForUrlAsync("credentials", "No credentials yet");
+ await WaitForUrlAsync("items", "No items yet");
// Verify that the welcome screen is no longer shown.
var pageContent = await Page.TextContentAsync("body");
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 485f0962f..314efc5de 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AttachmentTests.cs
@@ -25,7 +25,7 @@ public class AttachmentTests : ClientPlaywrightTest
{
// Create a new alias with service name = "Test Service".
var serviceName = "Test Service";
- await CreateCredentialEntry(
+ await CreateItemEntry(
new Dictionary<string, string>
{
{ "service-name", serviceName },
@@ -82,7 +82,7 @@ public class AttachmentTests : ClientPlaywrightTest
// Create a new alias with service name = "Test Service".
var serviceName = "Test Service";
var initialUsername = "initialuser";
- await CreateCredentialEntry(
+ await CreateItemEntry(
new Dictionary<string, string>
{
{ "service-name", serviceName },
@@ -112,7 +112,7 @@ public class AttachmentTests : ClientPlaywrightTest
// Update the credential
var updatedUsername = "updateduser";
- await UpdateCredentialEntry(serviceName, new Dictionary<string, string>
+ await UpdateItemEntry(serviceName, new Dictionary<string, string>
{
{ "username", updatedUsername },
});
@@ -154,7 +154,7 @@ public class AttachmentTests : ClientPlaywrightTest
{
// Create a new alias with service name = "Test Service for Deletion".
var serviceName = "Test Service for Deletion";
- await CreateCredentialEntry(
+ await CreateItemEntry(
new Dictionary<string, string>
{
{ "service-name", serviceName },
@@ -183,7 +183,7 @@ public class AttachmentTests : ClientPlaywrightTest
// Click the edit button
await Page.ClickAsync("text=Edit");
- await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential");
+ await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Find and click the delete button for the attachment
var deleteButton = Page.Locator("button:has-text('Delete')").First;
@@ -194,9 +194,9 @@ 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 Credential").First;
+ var saveButton = Page.Locator("text=Save Item").First;
await saveButton.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Credential updated successfully");
+ await WaitForUrlAsync("items/**", "Item updated successfully");
// Check that the attachment name does not appear on the view page
pageContent = await Page.TextContentAsync("body");
@@ -215,7 +215,7 @@ public class AttachmentTests : ClientPlaywrightTest
var serviceName = "Test Service Multiple Attachments";
var attachmentNames = new[] { "Attachment1.txt", "Attachment2.txt", "Attachment3.txt" };
- await CreateCredentialEntry(
+ await CreateItemEntry(
new Dictionary<string, string>
{
{ "service-name", serviceName },
@@ -275,7 +275,7 @@ public class AttachmentTests : ClientPlaywrightTest
{
// Create a new empty alias with service name = "Test Service Add Multiple Attachments".
var serviceName = "Test Service Add Multiple Attachments";
- await CreateCredentialEntry(
+ await CreateItemEntry(
new Dictionary<string, string>
{
{ "service-name", serviceName },
@@ -283,7 +283,7 @@ public class AttachmentTests : ClientPlaywrightTest
// Edit the credential
await Page.ClickAsync("text=Edit");
- await WaitForUrlAsync("credentials/**/edit", "Edit the existing credential");
+ await WaitForUrlAsync("items/**/edit", "Edit the existing item");
var attachmentNames = new[] { "Attachment1.txt", "Attachment2.txt", "Attachment3.txt" };
var fileInput = Page.Locator("input[type='file']");
@@ -305,9 +305,9 @@ public class AttachmentTests : ClientPlaywrightTest
}
// Save the updated credential
- var saveButton = Page.Locator("text=Save Credential").First;
+ var saveButton = Page.Locator("text=Save Item").First;
await saveButton.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Credential updated successfully");
+ await WaitForUrlAsync("items/**", "Item updated successfully");
// Check that all attachment names appear on the alias page.
var pageContent = await Page.TextContentAsync("body");
@@ -345,7 +345,7 @@ public class AttachmentTests : ClientPlaywrightTest
var serviceName = "Test Service Multiple Attachments Simultaneous";
var attachmentNames = new[] { "Attachment1.txt", "Attachment2.txt", "Attachment3.txt" };
- await CreateCredentialEntry(
+ await CreateItemEntry(
new Dictionary<string, string>
{
{ "service-name", serviceName },
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AuthPasswordChangeTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AuthPasswordChangeTests.cs
index 1d41f0a66..bb66da8f8 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AuthPasswordChangeTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AuthPasswordChangeTests.cs
@@ -27,15 +27,15 @@ public class AuthPasswordChangeTests : ClientPlaywrightTest
// Advance time by 1 second manually to ensure the new vault is created in the future.
ApiTimeProvider.AdvanceBy(TimeSpan.FromSeconds(1));
- var serviceNameBefore = "Credential service before";
- await CreateCredentialEntry(new Dictionary<string, string>
+ var serviceNameBefore = "Item service before";
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceNameBefore },
});
// Check that the service name is present in the content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created credential service name does not appear on login page.");
+ Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created item service name does not appear on login page.");
// Attempt to change password.
await NavigateUsingBlazorRouter("settings/security/change-password");
@@ -73,11 +73,11 @@ public class AuthPasswordChangeTests : ClientPlaywrightTest
await Logout();
await Login();
- // Wait for the credentials page to load again.
- await WaitForUrlAsync("credentials**", serviceNameBefore);
+ // Wait for the items page to load again.
+ await WaitForUrlAsync("items**", serviceNameBefore);
// Check if the service name is still present in the content.
pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created credential service name does not appear on login page after hard page reload. Check if the database is correctly persisted and then loaded from the server.");
+ Assert.That(pageContent, Does.Contain(serviceNameBefore), "Created item service name does not appear on login page after hard page reload. Check if the database is correctly persisted and then loaded from the server.");
}
}
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/ResetVaultTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/ResetVaultTests.cs
index 5943e01c5..0f4377edd 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/ResetVaultTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/ResetVaultTests.cs
@@ -28,21 +28,21 @@ public class ResetVaultTests : ClientPlaywrightTest
{
await CompleteTutorial();
- // Create three random credential entries.
+ // Create three random item entries.
for (var i = 0; i < 3; i++)
{
// Advance time by 1 second manually to ensure the new vault is created in the future.
ApiTimeProvider.AdvanceBy(TimeSpan.FromSeconds(1));
- var randomServiceName = $"Credential service {i}";
- await CreateCredentialEntry(new Dictionary<string, string>
+ var randomServiceName = $"Item service {i}";
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", randomServiceName },
});
// Check that the service names are present in the content.
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(randomServiceName), "Created credential service name does not appear after creation.");
+ Assert.That(pageContent, Does.Contain(randomServiceName), "Created item service name does not appear after creation.");
}
// Attempt to reset vault.
@@ -69,24 +69,24 @@ public class ResetVaultTests : ClientPlaywrightTest
await resetVaultButton.ClickAsync();
// Wait for success message.
- await WaitForUrlAsync("credentials", "successfully reset");
+ await WaitForUrlAsync("items", "successfully reset");
- // Check API that the latest vault has no credentials.
+ // Check API that the latest vault has no items.
var latestVault = await ApiDbContext.Vaults.Where(x => x.User.UserName == TestUserUsername).OrderByDescending(x => x.CreatedAt).FirstAsync();
- Assert.That(latestVault.CredentialsCount, Is.EqualTo(0), "Latest vault should have no credentials after reset.");
+ Assert.That(latestVault.CredentialsCount, Is.EqualTo(0), "Latest vault should have no items after reset.");
- // Create a new credential entry.
- var serviceName = "Credential service after reset";
- await CreateCredentialEntry(new Dictionary<string, string>
+ // Create a new item entry.
+ var serviceName = "Item service after reset";
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
});
- // Check that the now latest vault has one credential, and only one active claimed alias.
+ // Check that the now latest vault has one item, and only one active claimed alias.
latestVault = await ApiDbContext.Vaults.Where(x => x.User.UserName == TestUserUsername).OrderByDescending(x => x.CreatedAt).FirstAsync();
Assert.Multiple(() =>
{
- Assert.That(latestVault.CredentialsCount, Is.EqualTo(1), "Latest vault should have one credential after reset.");
+ Assert.That(latestVault.CredentialsCount, Is.EqualTo(1), "Latest vault should have one item after reset.");
Assert.That(latestVault.EmailClaimsCount, Is.EqualTo(1), "Latest vault should have (only) one active claimed alias after reset.");
});
}
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 31b98b551..74c2064e6 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Client/Shard5/TotpTests.cs
@@ -23,9 +23,9 @@ public class TotpTests : ClientPlaywrightTest
[Order(1)]
public async Task AddAndVerifyTotpCode()
{
- // Create a new credential with service name = "Test Service TOTP"
+ // Create a new item with service name = "Test Service TOTP"
var serviceName = "Test Service TOTP";
- await CreateCredentialEntry(
+ await CreateItemEntry(
new Dictionary<string, string>
{
{ "service-name", serviceName },
@@ -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 credential");
+ await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Click the "Add TOTP Code" button
var addButton = Page.Locator("button[id='add-totp-code'], a[id='add-totp-code']");
@@ -50,11 +50,11 @@ public class TotpTests : ClientPlaywrightTest
var saveButton = Page.Locator("button[id='save-totp-code']");
await saveButton.ClickAsync();
- // Save the credential
- var submitButton = Page.Locator("text=Save Credential").First;
+ // Save the item
+ var submitButton = Page.Locator("text=Save Item").First;
await submitButton.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Credential updated successfully");
+ await WaitForUrlAsync("items/**", "Item updated successfully");
// Verify that the TOTP code appears in the list
var pageContent = await Page.TextContentAsync("body");
@@ -74,9 +74,9 @@ public class TotpTests : ClientPlaywrightTest
[Order(2)]
public async Task DeleteTotpCode()
{
- // Create a new credential with service name = "Test Service TOTP Delete"
+ // Create a new item with service name = "Test Service TOTP Delete"
var serviceName = "Test Service TOTP Delete";
- await CreateCredentialEntry(
+ await CreateItemEntry(
new Dictionary<string, string>
{
{ "service-name", serviceName },
@@ -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 credential");
+ await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Add a TOTP code
var addButton = Page.Locator("button[id='add-totp-code'], a[id='add-totp-code']");
@@ -95,11 +95,11 @@ public class TotpTests : ClientPlaywrightTest
await Page.Locator("button[id='save-totp-code']").ClickAsync();
- // Save the credential
- var submitButton = Page.Locator("text=Save Credential").First;
+ // Save the item
+ var submitButton = Page.Locator("text=Save Item").First;
await submitButton.ClickAsync();
- await WaitForUrlAsync("credentials/**", "Credential updated successfully");
+ await WaitForUrlAsync("items/**", "Item updated successfully");
// Verify the TOTP code was added
var pageContent = await Page.TextContentAsync("body");
@@ -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 credential");
+ await WaitForUrlAsync("items/**/edit", "Edit the existing item");
// Click the delete button for the TOTP code
var deleteButton = Page.Locator("button.delete-totp-code").First;
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Extensions/ChromeExtensionTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Extensions/ChromeExtensionTests.cs
index b0e9751b2..56e8988ca 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Extensions/ChromeExtensionTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Extensions/ChromeExtensionTests.cs
@@ -27,7 +27,7 @@ public class ChromeExtensionTests : BrowserExtensionPlaywrightTest
{
// Create a new alias with service name = "Test Service".
var serviceName = "Test Service";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
});
@@ -52,7 +52,7 @@ public class ChromeExtensionTests : BrowserExtensionPlaywrightTest
{
// Step 1: Create a credential via the client app
var serviceName = "Offline Test Credential";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
});
@@ -234,8 +234,8 @@ public class ChromeExtensionTests : BrowserExtensionPlaywrightTest
// Refresh the vault via the refresh button to get the latest vault that browser extension just uploaded
await Page.ClickAsync("button[id='vault-refresh-btn']");
- // Navigate to the credentials page explicitly in case we were stuck on the welcome screen.
- await Page.ClickAsync("a[href='/credentials']");
+ // Navigate to the items page explicitly in case we were stuck on the welcome screen.
+ await Page.ClickAsync("a[href='/items']");
// Wait for credentials page to load and verify the new credential appears
await Page.WaitForSelectorAsync("text=" + serviceName);
@@ -368,7 +368,7 @@ public class ChromeExtensionTests : BrowserExtensionPlaywrightTest
{
// Create a credential to display
var serviceName = "Test Popup Display";
- await CreateCredentialEntry(new Dictionary<string, string>
+ await CreateItemEntry(new Dictionary<string, string>
{
{ "service-name", serviceName },
});
diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Extensions/TestVaultGeneratorTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Extensions/TestVaultGeneratorTests.cs
index 9323a7c2e..f797f07b9 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Extensions/TestVaultGeneratorTests.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Extensions/TestVaultGeneratorTests.cs
@@ -101,20 +101,20 @@ public class TestVaultGeneratorTests : BrowserExtensionPlaywrightTest
// Create each credential entry
foreach (var credential in testCredentials)
{
- await CreateCredentialEntry(credential);
+ await CreateItemEntry(credential);
}
- // Verify all credentials were created
+ // Verify all items were created
await Page.BringToFrontAsync();
- await NavigateUsingBlazorRouter("credentials");
- await WaitForUrlAsync("credentials", "Credentials");
+ await NavigateUsingBlazorRouter("items");
+ await WaitForUrlAsync("items", "Vault");
foreach (var credential in testCredentials)
{
var serviceName = credential["service-name"];
await Page.WaitForSelectorAsync($"text={serviceName}");
var pageContent = await Page.TextContentAsync("body");
- Assert.That(pageContent, Does.Contain(serviceName), $"Created credential '{serviceName}' not found in vault");
+ Assert.That(pageContent, Does.Contain(serviceName), $"Created item '{serviceName}' not found in vault");
}
// Get the user's vault from the database