마이페이지, 리포트, 메일인증
This commit is contained in:
@@ -227,6 +227,55 @@ test("프로젝트 목록에서 '폼 제출 내역' 링크를 클릭하면 해
|
||||
await expect(page.getByText("message: 안녕하세요")).toBeVisible();
|
||||
});
|
||||
|
||||
test("이메일 미인증 사용자는 프로젝트 목록에서 퍼블릭 페이지 열기 링크를 볼 수 없어야 한다", async ({ page }) => {
|
||||
await page.route("**/api/auth/me", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ id: "user-unverified", email: "unverified@example.com", tokenVersion: 1, emailVerified: false }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.route("**/api/projects", async (route) => {
|
||||
const request = route.request();
|
||||
const url = new URL(request.url());
|
||||
const method = request.method();
|
||||
|
||||
if (url.pathname === "/api/projects" && method === "GET") {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify([
|
||||
{
|
||||
id: "1",
|
||||
title: "테스트 프로젝트 A",
|
||||
slug: "test-project-a",
|
||||
status: "DRAFT",
|
||||
createdAt: new Date("2025-01-01T00:00:00.000Z").toISOString(),
|
||||
updatedAt: new Date("2025-01-01T00:00:00.000Z").toISOString(),
|
||||
},
|
||||
]),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill({
|
||||
status: 404,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ message: "Not implemented in E2E mock" }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/projects");
|
||||
|
||||
// 프로젝트 행은 보여야 한다.
|
||||
await expect(page.getByText("테스트 프로젝트 A")).toBeVisible();
|
||||
await expect(page.getByText("test-project-a")).toBeVisible();
|
||||
|
||||
// 이메일 미인증 상태에서는 'Open public page' 링크가 보이지 않아야 한다.
|
||||
await expect(page.getByRole("link", { name: "Open public page" })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("프로젝트 목록 헤더에서 대시보드로 이동할 수 있어야 한다", async ({ page }) => {
|
||||
await page.route("**/api/auth/me", async (route) => {
|
||||
await route.fulfill({
|
||||
@@ -329,3 +378,31 @@ test("전체 제출 내역 페이지에서 공통 GNB와 메뉴가 보여야 한
|
||||
await menuButton.click();
|
||||
await expect(page.getByRole("button", { name: "Log out" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("Projects GNB 메뉴에서 My page 로 이동할 수 있어야 한다", async ({ page }) => {
|
||||
await page.route("**/api/projects", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify([]),
|
||||
});
|
||||
});
|
||||
|
||||
await page.route("**/api/auth/me", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ id: "user-mypage", email: "mypage@example.com", tokenVersion: 1 }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/projects");
|
||||
|
||||
const menuButton = page.getByRole("button", { name: "Menu" });
|
||||
await menuButton.click();
|
||||
|
||||
await page.getByRole("button", { name: "My page" }).click();
|
||||
|
||||
await expect(page).toHaveURL(/\/mypage/);
|
||||
await expect(page.getByRole("heading", { name: "My page" })).toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user