Files
smoothschedule/frontend/tests/e2e/navigation.spec.ts
poduck 2e111364a2 Initial commit: SmoothSchedule multi-tenant scheduling platform
This commit includes:
- Django backend with multi-tenancy (django-tenants)
- React + TypeScript frontend with Vite
- Platform administration API with role-based access control
- Authentication system with token-based auth
- Quick login dev tools for testing different user roles
- CORS and CSRF configuration for local development
- Docker development environment setup

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 01:43:20 -05:00

78 lines
2.4 KiB
TypeScript

/**
* Navigation Test
* Tests that all menu items navigate to the correct pages
*/
import { test, expect } from '@playwright/test';
test.describe('Platform Navigation', () => {
test.beforeEach(async ({ page }) => {
// Login as platform user
await page.goto('http://platform.lvh.me:5173/');
await page.fill('input[name="username"]', 'poduck');
await page.fill('input[name="password"]', 'starry12');
await page.click('button[type="submit"]');
// Wait for login to complete
await page.waitForTimeout(2000);
});
test('should navigate to Platform Dashboard', async ({ page }) => {
// Should be on dashboard after login
expect(page.url()).toContain('/platform/dashboard');
// Verify dashboard content loads
await page.waitForTimeout(1000);
const hasContent = await page.locator('body').count();
expect(hasContent).toBeGreaterThan(0);
});
test('should navigate to all platform menu items', async ({ page }) => {
// Navigate to Businesses
await page.click('a[href="/platform/businesses"]');
await page.waitForTimeout(1000);
expect(page.url()).toContain('/platform/businesses');
// Navigate to Users
await page.click('a[href="/platform/users"]');
await page.waitForTimeout(1000);
expect(page.url()).toContain('/platform/users');
// Navigate to Support
await page.click('a[href="/platform/support"]');
await page.waitForTimeout(1000);
expect(page.url()).toContain('/platform/support');
// Navigate back to Dashboard
await page.click('a[href="/platform/dashboard"]');
await page.waitForTimeout(1000);
expect(page.url()).toContain('/platform/dashboard');
});
test('should reload and stay on current page', async ({ page }) => {
// Navigate to businesses
await page.click('a[href="/platform/businesses"]');
await page.waitForTimeout(1000);
const urlBeforeReload = page.url();
// Reload page
await page.reload();
await page.waitForTimeout(2000);
// Should still be on businesses page
expect(page.url()).toBe(urlBeforeReload);
// Should NOT see login form
const hasLoginForm = await page.locator('input[name="username"]').count();
expect(hasLoginForm).toBe(0);
});
});
test.describe('Business Navigation (with test business)', () => {
test.skip('should navigate to business pages', async ({ page }) => {
// This test requires a business user to be set up
// Skipping for now until test data is available
});
});