Backend (pytest): - Auth flow tests (login, token, protected routes) - Portfolio CRUD and transaction tests - Strategy endpoint tests - Backtest flow tests - Snapshot and returns tests Frontend (Playwright): - Auth page tests - Portfolio navigation tests - Strategy page tests - Backtest page tests - Playwright configuration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
|
|
test.describe("Authentication", () => {
|
|
test("should show login page", async ({ page }) => {
|
|
await page.goto("/login");
|
|
|
|
await expect(page.locator("h1")).toContainText("로그인");
|
|
await expect(page.locator('input[name="username"]')).toBeVisible();
|
|
await expect(page.locator('input[name="password"]')).toBeVisible();
|
|
await expect(page.locator('button[type="submit"]')).toBeVisible();
|
|
});
|
|
|
|
test("should show error on invalid login", async ({ page }) => {
|
|
await page.goto("/login");
|
|
|
|
await page.fill('input[name="username"]', "invaliduser");
|
|
await page.fill('input[name="password"]', "invalidpassword");
|
|
await page.click('button[type="submit"]');
|
|
|
|
// Wait for error message
|
|
await expect(page.locator(".text-red-700, .text-red-600")).toBeVisible({
|
|
timeout: 5000,
|
|
});
|
|
});
|
|
|
|
test("should redirect to login when accessing protected page", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/portfolio");
|
|
|
|
// Should redirect to login
|
|
await expect(page).toHaveURL(/\/login/);
|
|
});
|
|
});
|