Files
calendar/frontend/e2e/tests/auth.spec.ts
Connor Johnstone 7d00a2dadb
Some checks failed
Integration Tests / e2e-tests (push) Failing after 4s
Integration Tests / unit-tests (push) Failing after 1m1s
Implement comprehensive frontend integration testing with Playwright
- Add Playwright E2E testing framework with cross-browser support (Chrome, Firefox)
- Create authentication helpers for CalDAV server integration
- Implement calendar interaction helpers with event creation, drag-and-drop, and view switching
- Add comprehensive drag-and-drop test suite with event cleanup
- Configure CI/CD integration with Gitea Actions for headless testing
- Support both local development and CI environments with proper dependency management
- Include video recording, screenshots, and HTML reporting for test debugging
- Handle Firefox-specific timing and interaction challenges with force clicks and timeouts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 11:54:40 -04:00

44 lines
1.7 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Authentication', () => {
test('should show login form initially', async ({ page }) => {
await page.goto('/');
// Should redirect to login page
await expect(page).toHaveURL(/.*\/login/);
// Check for login form elements
await expect(page.getByLabel('CalDAV Server URL')).toBeVisible();
await expect(page.getByRole('textbox', { name: 'Username' })).toBeVisible();
await expect(page.getByLabel('Password')).toBeVisible();
await expect(page.getByRole('button', { name: 'Sign In' })).toBeVisible();
});
test('should show validation errors for empty form', async ({ page }) => {
await page.goto('/login');
// Try to submit empty form
await page.getByRole('button', { name: 'Sign In' }).click();
// Should show validation errors
await expect(page.getByText('Please fill in all fields')).toBeVisible();
});
test('should handle invalid credentials', async ({ page }) => {
await page.goto('/login');
// Fill in invalid credentials
await page.getByLabel('CalDAV Server URL').fill('https://invalid-server.com');
await page.getByRole('textbox', { name: 'Username' }).fill('invalid-user');
await page.getByLabel('Password').fill('invalid-password');
// Submit form
await page.getByRole('button', { name: 'Sign In' }).click();
// Should show error message (wait for loading to finish first)
await expect(page.getByRole('button', { name: 'Sign In' })).toBeVisible(); // Wait for loading to finish
// Check for any error message in the error-message div
await expect(page.locator('.error-message')).toBeVisible();
});
});