Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

test(e2e): add login tests

QAComet163bf6a0cc98
diff --git a/e2e/tests/public/login.spec.ts b/e2e/tests/public/login.spec.ts
new file mode 100644
index 00000000..d39b34f9
--- /dev/null
+++ b/e2e/tests/public/login.spec.ts
@@ -0,0 +1,32 @@
+import { expect, test } from "../../index"
+
+test("Logging in without credentials displays an error", async ({ loginPage }) => {
+ await loginPage.submitLoginButton.click()
+ const toast = await loginPage.getLatestToast()
+ await expect(toast.locator).toBeVisible()
+ await expect(toast.locator).toHaveAttribute("data-type", "error")
+})
+
+test("Logging in with an erroneous password displays an error", async ({ loginPage }) => {
+ await loginPage.usernameInput.fill(process.env['TEST_USERNAME'] || "")
+ await loginPage.passwordInput.fill("NOT_MY_PASSWORD_DNE_ERROR")
+ await loginPage.submitLoginButton.click()
+ const toast = await loginPage.getLatestToast()
+ await expect(toast.locator).toBeVisible()
+ await expect(toast.locator).toHaveAttribute("data-type", "error")
+})
+
+test("Logging in without valid credentials displays an error", async ({ loginPage }) => {
+ await loginPage.submitLoginButton.click()
+ const toast = await loginPage.getLatestToast()
+ await expect(toast.locator).toBeVisible()
+ await expect(toast.locator).toHaveAttribute("data-type", "error")
+})
+
+test("Logging in with a valid username and password works as expected", async ({ page, loginPage, dashboardPage }) => {
+ await loginPage.usernameInput.fill(process.env['TEST_USERNAME'] || "")
+ await loginPage.passwordInput.fill(process.env['TEST_PASSWORD'] || "")
+ await loginPage.submitLoginButton.click()
+ await expect(loginPage.loginForm).not.toBeVisible()
+ await expect(dashboardPage.container).toBeVisible()
+})
\ No newline at end of file