Skip to content

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

Add E2E test for quick create widget (#142)

Leendert de Borstc33399b91d7b
diff --git a/src/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor b/src/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
index ac13174d1..577601d4c 100644
--- a/src/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
+++ b/src/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
@@ -25,7 +25,7 @@
<ValidationMessage For="() => Model.ServiceUrl"/>
</div>
<div class="flex justify-between items-center">
- <button type="submit" class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded">
+ <button id="quickIdentitySubmit" type="submit" class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded">
Create
</button>
</div>
diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/CredentialTest.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/CredentialTest.cs
index 789e2a56a..773734192 100644
--- a/src/Tests/AliasVault.E2ETests/Tests/Client/CredentialTest.cs
+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/CredentialTest.cs
@@ -49,6 +49,35 @@ public class CredentialTest : ClientPlaywrightTest
Assert.That(pageContent, Does.Contain(serviceName), "Created credential service name does not appear on alias page.");
}
+ /// <summary>
+ /// Test if creating a new credential entry works with quick create widget.
+ /// </summary>
+ /// <returns>Async task.</returns>
+ [Test]
+ public async Task CreateCredentialWidgetTest()
+ {
+ // Create a new alias with service name = "Test Service".
+ var serviceName = "Test Service Widget";
+
+ var widgetButton = Page.Locator("button[id='quickIdentityButton']");
+ Assert.That(widgetButton, Is.Not.Null, "Create new identity widget button not found.");
+ await widgetButton.ClickAsync();
+
+ await InputHelper.FillInputFields(new Dictionary<string, string>
+ {
+ { "serviceName", serviceName },
+ });
+
+ var submitButton = Page.Locator("button[id='quickIdentitySubmit']");
+ await submitButton.ClickAsync();
+
+ await WaitForUrlAsync("credentials/**", "View credentials entry");
+
+ // 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.");
+ }
+
/// <summary>
/// Test if editing a created credential entry works.
/// </summary>