Skip to content

Commit 90020dc

Browse files
authored
Merge pull request #70 from fjordllc/feature/edit-docs
ドキュメント変更
2 parents 0ff2740 + 4e365cb commit 90020dc

17 files changed

+2336
-165
lines changed

e2e/docs/[id]/page.e2e.test.ts

-61
This file was deleted.

e2e/docs/new/page.e2e.test.ts

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { describe } from "node:test";
2+
import { expect } from "@playwright/test";
3+
import { withSupawright } from "supawright";
4+
import type { Database } from "@/lib/database.types";
5+
import { E2E_CONFIG } from "../../constants";
6+
7+
const test = withSupawright<Database, "public">(["public"]);
8+
9+
describe("test to create new document", () => {
10+
let validEmail: string | undefined;
11+
const password = "e2e_password";
12+
test.beforeEach(async ({ supawright }) => {
13+
const attributes = {
14+
password: password,
15+
email_confirm: true,
16+
};
17+
const user = await supawright.createUser(attributes);
18+
validEmail = user.email;
19+
});
20+
21+
describe("crate a new document", () => {
22+
test("should display test docs in detail screen", async ({ page }) => {
23+
await page.goto(E2E_CONFIG.BASE_URL);
24+
await page.getByRole("link", { name: "ログイン" }).click();
25+
await page.getByPlaceholder("[email protected]").fill(validEmail ?? "");
26+
await page.getByLabel("Password").fill(password);
27+
await page.getByRole("button", { name: "ログイン" }).click();
28+
29+
await page.getByRole("link", { name: "Docs" }).click();
30+
await page.waitForLoadState("networkidle");
31+
await expect(page.getByText("Doc作成")).toBeVisible();
32+
await page.getByText("Doc作成").click();
33+
await page.waitForLoadState("networkidle");
34+
35+
await page
36+
.getByPlaceholder("Enter title")
37+
.fill(`this is test title with ${validEmail}`);
38+
await page.getByPlaceholder("Enter body").fill("this is test body");
39+
await page.getByRole("button", { name: "Docを公開" }).click();
40+
41+
await page
42+
.getByText(`this is test title with ${validEmail}`, { exact: true })
43+
.click();
44+
45+
page.once("dialog", async (dialog) => {
46+
console.log(`Dialog message: ${dialog.message()}`);
47+
await dialog.accept();
48+
});
49+
50+
await page.getByRole("button", { name: "削除する" }).click();
51+
52+
await expect(
53+
page.getByText(`this is test title with ${validEmail}`),
54+
).not.toBeVisible();
55+
});
56+
});
57+
});

0 commit comments

Comments
 (0)