Skip to content

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

1.1 KB
Raw Blame
/**
 * Category 11: Authentication Flow (Requires API)
 *
 * These tests verify login/authentication works correctly.
 * They require an API server to be running at localhost:5100.
 */
import { test, expect, TestClient } from '../fixtures';

test.describe.serial('11. Authentication Flow', () => {
  let client: TestClient;

  test.afterAll(async () => {
    await client?.cleanup();
  });

  test('11.1 should display error for invalid credentials', async ({ context, extensionId, apiUrl }) => {
    client = await TestClient.fromContext(context, extensionId);
    await client.configureApiUrl(apiUrl);

    await client
      .attemptLogin('[email protected]', 'wrongpassword')
      .then((c) => c.screenshot('11.1-login-failed.png'));

    await expect(client.popup.locator('text=Invalid username or password')).toBeVisible({ timeout: 10000 });

    await client.clearLoginForm();
  });

  test('11.2 should successfully login with valid credentials', async ({ testUser }) => {
    await client
      .fillLoginForm(testUser.username, testUser.password)
      .then((c) => c.submitLogin())
      .then((c) => c.screenshot('11.2-login-success.png'));
  });
});