galaxis-po/frontend/e2e/portfolio.spec.ts

56 lines
1.8 KiB
TypeScript
Raw Permalink Normal View History

import { test, expect } from "@playwright/test";
test.describe("Portfolio", () => {
test.beforeEach(async ({ page }) => {
// Mock login - in real tests, use proper authentication
await page.addInitScript(() => {
localStorage.setItem("token", "test-token");
});
});
test("should show portfolio list page", async ({ page }) => {
await page.goto("/portfolio");
// Check page title
await expect(page.locator("h1")).toContainText("포트폴리오");
});
test("should have create portfolio button", async ({ page }) => {
await page.goto("/portfolio");
// Look for create button or link
const createButton = page.locator('a[href="/portfolio/new"], button:has-text("생성"), button:has-text("새")');
await expect(createButton.first()).toBeVisible();
});
test("should navigate to new portfolio page", async ({ page }) => {
await page.goto("/portfolio/new");
// Check for form elements
await expect(page.locator('input[name="name"], input[placeholder*="이름"]').first()).toBeVisible();
});
test("should navigate to portfolio detail page", async ({ page }) => {
// Assuming portfolio with ID 1 exists
await page.goto("/portfolio/1");
// Should show portfolio content or redirect
// The exact behavior depends on whether the portfolio exists
await expect(page.locator("body")).toBeVisible();
});
test("should navigate to history page", async ({ page }) => {
await page.goto("/portfolio/1/history");
// Should show history page or error
await expect(page.locator("body")).toBeVisible();
});
test("should navigate to rebalance page", async ({ page }) => {
await page.goto("/portfolio/1/rebalance");
// Should show rebalance page or error
await expect(page.locator("body")).toBeVisible();
});
});