Files
trackgo-fe/apps/web/e2e/login.spec.ts
T
shancheas 78a1a905d8 feat: update login component with new branding and remove unused assets
- Replaced the login heading from "Login to your account!" to "Sign in to TrackGo" for improved branding consistency.
- Updated the login component to include a new login banner image.
- Removed unused icon components (AndroidIcon, ChromeIcon, GoogleIcon, MicrosoftIcon, IconCircle, and Ring) to streamline the codebase.
- Adjusted language files for English and Indonesian to reflect the new login title and description.

These changes enhance the user experience by aligning the login interface with the updated branding and improving code maintainability.
2026-09-03 14:43:42 +07:00

41 lines
1.7 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { E2E_LOGIN } from './fixtures/credentials';
import { mockBackend } from './fixtures/mock-api';
test.describe('login', () => {
test('renders the login form', async ({ page }) => {
await mockBackend(page);
await page.goto('/auth/login');
await expect(page.getByRole('heading', { name: 'Sign in to TrackGo' })).toBeVisible();
await expect(page.getByLabel('Username')).toBeVisible();
await expect(page.getByLabel('Password')).toBeVisible();
await expect(page.getByRole('button', { name: 'Login' })).toBeVisible();
});
test('signs in with valid credentials and lands in the app', async ({ page }) => {
await mockBackend(page, 'success');
await page.goto('/auth/login');
await page.getByLabel('Username').fill(E2E_LOGIN.username);
await page.getByLabel('Password').fill(E2E_LOGIN.password);
await page.getByRole('button', { name: 'Login' }).click();
await expect(page).toHaveURL(/\/app\/timeline\/index/);
await expect(page.getByPlaceholder('Search activities')).toBeVisible();
});
test('shows an error and stays on login when credentials are rejected', async ({ page }) => {
await mockBackend(page, 'unauthorized');
await page.goto('/auth/login');
await page.getByLabel('Username').fill(E2E_LOGIN.username);
await page.getByLabel('Password').fill(E2E_LOGIN.password);
await page.getByRole('button', { name: 'Login' }).click();
await expect(page.getByText('Invalid username or password')).toBeVisible();
await expect(page).toHaveURL(/\/auth\/login/);
await expect(page.getByRole('heading', { name: 'Sign in to TrackGo' })).toBeVisible();
});
});