76 lines
2.6 KiB
TypeScript
76 lines
2.6 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('App navigation', () => {
|
|
test('loads and redirects to /notes', async ({ page }) => {
|
|
await page.goto('/');
|
|
await expect(page).toHaveURL(/\/notes/);
|
|
await expect(page.locator('button').filter({ hasText: 'New Note' })).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
test('sidebar navigates between modules', async ({ page }) => {
|
|
await page.goto('/');
|
|
|
|
const sidebar = page.locator('aside');
|
|
await sidebar.getByTitle('Tasks').click();
|
|
await expect(page).toHaveURL(/\/tasks/);
|
|
await expect(page.getByText('Tasks')).toBeVisible();
|
|
|
|
await sidebar.getByTitle('Calendar').click();
|
|
await expect(page).toHaveURL(/\/calendar/);
|
|
|
|
await sidebar.getByTitle('Notes').click();
|
|
await expect(page).toHaveURL(/\/notes/);
|
|
});
|
|
});
|
|
|
|
test.describe('Notes module', () => {
|
|
test('displays create note button', async ({ page }) => {
|
|
await page.goto('/notes');
|
|
const newNoteButton = page.getByRole('button', { name: /New Note/ });
|
|
await expect(newNoteButton).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
test('creates a new note', async ({ page }) => {
|
|
await page.goto('/notes');
|
|
await page.getByRole('button', { name: /New Note/ }).click();
|
|
const editor = page.locator('.ProseMirror');
|
|
await expect(editor).toBeVisible({ timeout: 10000 });
|
|
});
|
|
});
|
|
|
|
test.describe('Tasks module', () => {
|
|
test('displays task views', async ({ page }) => {
|
|
await page.goto('/tasks');
|
|
await expect(page.getByText('Inbox')).toBeVisible({ timeout: 10000 });
|
|
await expect(page.getByText('Today')).toBeVisible();
|
|
await expect(page.getByText('Upcoming')).toBeVisible();
|
|
await expect(page.getByText('Projects')).toBeVisible();
|
|
await expect(page.getByText('Completed')).toBeVisible();
|
|
});
|
|
|
|
test('adds a task', async ({ page }) => {
|
|
await page.goto('/tasks');
|
|
const input = page.getByPlaceholder(/Add a task/);
|
|
await expect(input).toBeVisible({ timeout: 10000 });
|
|
await input.fill('Test E2E task !1');
|
|
await page.keyboard.press('Enter');
|
|
await expect(page.getByText('Test E2E task')).toBeVisible({ timeout: 5000 });
|
|
});
|
|
});
|
|
|
|
test.describe('Calendar module', () => {
|
|
test('displays calendar views', async ({ page }) => {
|
|
await page.goto('/calendar');
|
|
await expect(page.getByText('Today')).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
test('switches calendar views', async ({ page }) => {
|
|
await page.goto('/calendar');
|
|
const dayButton = page.getByText('Day');
|
|
if (await dayButton.isVisible()) {
|
|
await dayButton.click();
|
|
await page.waitForTimeout(300);
|
|
}
|
|
});
|
|
});
|