Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

1.1 KB
Raw Blame
import { expect, test } from '@playwright/test';
import { logout, umamiUser } from './helpers';

test.describe('Login tests', () => {
  test.beforeEach(async ({ page }) => {
    await page.goto('/login');
  });

  test('logs user in with correct credentials and logs user out', async ({ page }) => {
    await page.getByTestId('input-username').locator('input').fill(umamiUser.username);
    await page.getByTestId('input-password').locator('input').fill(umamiUser.password);
    await page.getByTestId('button-submit').click();

    await expect(page).toHaveURL(/\/dashboard$/);

    await logout(page);
  });

  test('shows validation for blank inputs or incorrect credentials', async ({ page }) => {
    await page.getByTestId('button-submit').click();
    await expect(page.getByText(/Required/i)).toBeVisible();

    await page.getByTestId('input-username').locator('input').fill(umamiUser.username);
    await page.getByTestId('input-password').locator('input').fill('wrongpassword');
    await page.getByTestId('button-submit').click();

    await expect(page.getByText(/Incorrect username and\/or password./i)).toBeVisible();
  });
});