diff --git a/playwright-tests/tests/announcements.spec.js b/playwright-tests/tests/announcements.spec.js index d4ef6d74f..dd46c5f6a 100644 --- a/playwright-tests/tests/announcements.spec.js +++ b/playwright-tests/tests/announcements.spec.js @@ -92,7 +92,7 @@ test.describe("Admin wallet is connected", () => { await page.goto( "/devhub.near/widget/app?page=community&handle=devhub-test" ); - const postLocator = page.locator(".post"); + const postLocator = page.locator(".post").first(); await postLocator.focus(); }); diff --git a/playwright-tests/tests/create.spec.js b/playwright-tests/tests/create.spec.js index fa808cc7c..0d0e69c1e 100644 --- a/playwright-tests/tests/create.spec.js +++ b/playwright-tests/tests/create.spec.js @@ -173,6 +173,41 @@ test.describe("Wallet is connected", () => { ); expect(newToken).toBeTruthy(); }); + test("should create idea post", async ({ page }) => { + await page.goto("/devhub.near/widget/app?page=create"); + await page.click('button:has-text("Idea")'); + await page.getByTestId("name-editor").fill("A test idea"); + + await page + .frameLocator("iframe") + .locator(".CodeMirror textarea") + .fill("My description of the idea"); + + const labelsInput = await page.locator(".rbt-input-multi"); + await labelsInput.focus(); + await labelsInput.pressSequentially("ai", { delay: 100 }); + await labelsInput.press("Tab"); + await labelsInput.pressSequentially("webassemblymus", { delay: 100 }); + await labelsInput.press("Tab"); + + await page.getByTestId("submit-create-post").click(); + await expect(page.locator("div.modal-body code")).toHaveText( + JSON.stringify( + { + parent_id: null, + labels: ["ai", "webassemblymusic"], + body: { + name: "A test idea", + description: "My description of the idea", + idea_version: "V1", + post_type: "Idea", + }, + }, + null, + 1 + ) + ); + }); }); test.describe("Admin is connected", () => { diff --git a/playwright-tests/tests/feed.spec.js b/playwright-tests/tests/feed.spec.js index 6eea19dc3..1e53acce2 100644 --- a/playwright-tests/tests/feed.spec.js +++ b/playwright-tests/tests/feed.spec.js @@ -1,4 +1,4 @@ -import { test } from "@playwright/test"; +import { expect, test } from "@playwright/test"; test("should show post history for posts in the feed", async ({ page }) => { await page.goto("/devhub.near/widget/app?page=feed"); @@ -127,4 +127,45 @@ test.describe("Wallet is connected", () => { state: "hidden", }); }); + test("should reply to a post in the feed with a comment", async ({ + page, + }) => { + await page.goto("/devhub.near/widget/app?page=feed"); + const authorSearchInput = await page.getByPlaceholder("Search by author"); + await authorSearchInput.fill("petersalomonsen.near"); + await authorSearchInput.press("Tab"); + const tagSearchInput = await page.getByPlaceholder("Search by tag"); + await tagSearchInput.fill("webassemblymusi"); + await tagSearchInput.press("Tab"); + await page.getByRole("button", { name: "Reply" }).last().click(); + await page.getByRole("button", { name: "Comment" }).click(); + await page + .frameLocator("iframe") + .locator(".CodeMirror textarea") + .fill("The comment to the idea"); + + const labelsInput = await page.locator(".rbt-input-multi"); + await labelsInput.focus(); + await labelsInput.pressSequentially("ai", { delay: 100 }); + await labelsInput.press("Tab"); + await labelsInput.pressSequentially("webassemblymus", { delay: 100 }); + await labelsInput.press("Tab"); + + await page.getByTestId("submit-create-post").click(); + await expect(page.locator("div.modal-body code")).toHaveText( + JSON.stringify( + { + parent_id: 2489, + labels: ["ai", "webassemblymusic"], + body: { + description: "The comment to the idea", + comment_version: "V2", + post_type: "Comment", + }, + }, + null, + 1 + ) + ); + }); });