From 7c1ed5830c3473cefc7fc9a313de31e2297bfb44 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Thu, 22 Feb 2024 19:14:25 +0900 Subject: [PATCH 01/31] add account and myIntegrations tests --- web/e2e/settings/account.spec.ts | 90 ++++++++++++++++++++ web/e2e/settings/myIntegrations.spec.ts | 108 ++++++++++++++++++++++++ 2 files changed, 198 insertions(+) create mode 100644 web/e2e/settings/account.spec.ts create mode 100644 web/e2e/settings/myIntegrations.spec.ts diff --git a/web/e2e/settings/account.spec.ts b/web/e2e/settings/account.spec.ts new file mode 100644 index 0000000000..8fa4605748 --- /dev/null +++ b/web/e2e/settings/account.spec.ts @@ -0,0 +1,90 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("name and email has updated", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByText("Account").click(); + + const username = await page.getByLabel("Account Name").inputValue(); + await page.getByLabel("Account Name").click(); + await page.getByLabel("Account Name").fill("new name"); + const email = await page.getByLabel("Your Email").inputValue(); + await page.getByLabel("Your Email").click(); + await page.getByLabel("Your Email").fill("test@test.com"); + await page + .locator("form") + .filter({ hasText: "Account NameThis is your ID" }) + .getByRole("button") + .click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated user!"); + + await page.getByLabel("Account Name").click(); + await page.getByLabel("Account Name").fill(username); + await page.getByLabel("Your Email").click(); + await page.getByLabel("Your Email").fill(email); + await page + .locator("form") + .filter({ hasText: "Account NameThis is your ID" }) + .getByRole("button") + .click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated user!"); +}); + +test("language has updated from English to Japanese", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByText("Account").click(); + + await page + .locator("div") + .filter({ hasText: /^English$/ }) + .nth(3) + .click(); + await page.getByTitle("日本語").click(); + await page + .locator("form") + .filter({ hasText: "Service Language日本語日本語This" }) + .getByRole("button") + .click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); + await expect(page.locator("#root")).toContainText("ホーム"); + await page + .locator("div") + .filter({ hasText: /^日本語UIの言語設定を変更します。$/ }) + .locator("div") + .nth(3) + .click(); + await page.getByTitle("English").click(); + await page + .locator("form") + .filter({ hasText: "利用言語EnglishEnglishUI" }) + .getByRole("button") + .click(); + await expect(page.getByRole("alert").last()).toContainText("言語設定の更新に成功しました。"); +}); + +test("language has updated from Auto to English", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByText("Account").click(); + + await page + .locator("div") + .filter({ hasText: /^AutoThis will change the UI language$/ }) + .locator("div") + .nth(3) + .click(); + await page.getByTitle("English").click(); + await page.locator("form").filter({ hasText: "Service" }).getByRole("button").click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); + await page + .locator("div") + .filter({ hasText: /^EnglishThis will change the UI language$/ }) + .locator("div") + .nth(3) + .click(); + await page.getByTitle("Auto").click(); + await page + .locator("form") + .filter({ hasText: "Service LanguageAutoAutoThis" }) + .getByRole("button") + .click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); +}); diff --git a/web/e2e/settings/myIntegrations.spec.ts b/web/e2e/settings/myIntegrations.spec.ts new file mode 100644 index 0000000000..004484cb53 --- /dev/null +++ b/web/e2e/settings/myIntegrations.spec.ts @@ -0,0 +1,108 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("myIntegration CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByText("My Integrations").click(); + + await page.locator("div").filter({ hasText: "Create new integration" }).nth(4).click(); + await page.getByLabel("Integration Name").click(); + await page.getByLabel("Integration Name").fill("name"); + await page.getByLabel("Description").click(); + await page.getByLabel("Description").fill("description"); + await page.getByRole("button", { name: "Create" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created integration!"); + + await page.getByText("namedescription", { exact: true }).click(); + await page.getByLabel("Integration Name").click(); + await page.getByLabel("Integration Name").fill("newName"); + await page.getByLabel("Description").click(); + await page.getByLabel("Description").fill("newDescription"); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated integration!"); + + await expect(page.locator("#root")).toContainText("newName"); + await page.getByLabel("Back").click(); + await expect(page.getByRole("main")).toContainText("newNamenewDescription"); + await page.getByText("newNamenewDescription").click(); + await page.getByRole("button", { name: "Remove Integration" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted integration!"); + await expect(page.getByRole("main")).not.toContainText("newNamenewDescription"); +}); + +test("webhook CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByText("My Integrations").click(); + + await page.locator("div").filter({ hasText: "Create new integration" }).nth(4).click(); + await page.getByLabel("Integration Name").click(); + await page.getByLabel("Integration Name").fill("name"); + await page.getByLabel("Description").click(); + await page.getByLabel("Description").fill("description"); + await page.getByRole("button", { name: "Create" }).click(); + await page.getByText("namedescription", { exact: true }).click(); + + await page.getByRole("tab", { name: "Webhook" }).click(); + await page + .locator("div") + .filter({ hasText: /^New Webhook$/ }) + .getByRole("button") + .click(); + await page.getByLabel("Webhook").locator("#name").click(); + await page.getByLabel("Webhook").locator("#name").fill("webhook name"); + await page.getByLabel("Url").click(); + await page.getByLabel("Url").fill("http://test.com"); + await page.getByLabel("Secret").click(); + await page.getByLabel("Secret").fill("secret"); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created webhook!"); + await expect(page.getByLabel("Webhook")).toContainText("webhook name"); + await expect(page.getByLabel("Webhook")).toContainText("http://test.com"); + + await page.getByLabel("Webhook").getByLabel("setting").locator("svg").click(); + await page.getByLabel("Webhook").locator("#name").click(); + await page.getByLabel("Webhook").locator("#name").fill("new webhook name"); + await page.getByLabel("Url").click(); + await page.getByLabel("Url").fill("http://new.com"); + await page.getByLabel("Secret").click(); + await page.getByLabel("Secret").fill("new secret"); + await page.getByLabel("Create").check(); + await expect(page.getByLabel("Create")).toBeChecked(); + await page.getByLabel("Upload").check(); + await expect(page.getByLabel("Upload")).toBeChecked(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated webhook!"); + await expect(page.getByLabel("Webhook")).toContainText("new webhook name"); + await expect(page.getByLabel("Webhook")).toContainText("http://new.com"); + await page.getByLabel("Webhook").getByLabel("setting").locator("svg").click(); + await expect(page.getByLabel("Secret")).toHaveValue("new secret"); + await expect(page.getByLabel("Create")).toBeChecked(); + await expect(page.getByLabel("Upload")).toBeChecked(); + await page.getByLabel("Webhook").locator("svg").click(); + await page.getByRole("switch", { name: "OFF" }).click(); + await expect(page.getByRole("switch")).toContainText("ON"); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated webhook!"); + await page.getByLabel("delete").locator("svg").click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted webhook!"); + await expect(page.getByLabel("Webhook")).not.toContainText("new webhook name"); + + await page + .locator("p") + .filter({ hasText: "Create a new New Webhook" }) + .getByRole("button") + .click(); + await page.getByLabel("Webhook").locator("#name").click(); + await page.getByLabel("Webhook").locator("#name").fill("webhook name"); + await page.getByLabel("Url").click(); + await page.getByLabel("Url").fill("http://test.com"); + await page.getByLabel("Secret").click(); + await page.getByLabel("Secret").fill("secret"); + await page.getByRole("button", { name: "Save" }).click(); + await page.getByLabel("delete").locator("svg").click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted webhook!"); + + await page.getByRole("tab", { name: "General" }).click(); + await page.getByRole("button", { name: "Remove Integration" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted integration!"); +}); From 27c3b4266dba1fa78a54d9356573f43035363a93 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 10:25:02 +0900 Subject: [PATCH 02/31] add: logout test --- web/e2e/general/auth.spec.ts | 8 ++++++++ web/e2e/settings/account.spec.ts | 6 +++--- web/e2e/settings/myIntegrations.spec.ts | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 web/e2e/general/auth.spec.ts diff --git a/web/e2e/general/auth.spec.ts b/web/e2e/general/auth.spec.ts new file mode 100644 index 0000000000..f302a1cfcf --- /dev/null +++ b/web/e2e/general/auth.spec.ts @@ -0,0 +1,8 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("Logout has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.locator("a").nth(1).click(); + await page.getByText("Logout").click(); + await expect(page.getByLabel("Log In").locator("span")).toContainText("Log In"); +}); diff --git a/web/e2e/settings/account.spec.ts b/web/e2e/settings/account.spec.ts index 8fa4605748..75d912e932 100644 --- a/web/e2e/settings/account.spec.ts +++ b/web/e2e/settings/account.spec.ts @@ -1,6 +1,6 @@ import { expect, test } from "@reearth-cms/e2e/utils"; -test("name and email has updated", async ({ reearth, page }) => { +test("Name and email has updated", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); await page.getByText("Account").click(); @@ -29,7 +29,7 @@ test("name and email has updated", async ({ reearth, page }) => { await expect(page.getByRole("alert").last()).toContainText("Successfully updated user!"); }); -test("language has updated from English to Japanese", async ({ reearth, page }) => { +test("Language has updated from English to Japanese", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); await page.getByText("Account").click(); @@ -61,7 +61,7 @@ test("language has updated from English to Japanese", async ({ reearth, page }) await expect(page.getByRole("alert").last()).toContainText("言語設定の更新に成功しました。"); }); -test("language has updated from Auto to English", async ({ reearth, page }) => { +test("Language has updated from Auto to English", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); await page.getByText("Account").click(); diff --git a/web/e2e/settings/myIntegrations.spec.ts b/web/e2e/settings/myIntegrations.spec.ts index 004484cb53..1aa1649bd8 100644 --- a/web/e2e/settings/myIntegrations.spec.ts +++ b/web/e2e/settings/myIntegrations.spec.ts @@ -1,6 +1,6 @@ import { expect, test } from "@reearth-cms/e2e/utils"; -test("myIntegration CRUD has succeeded", async ({ reearth, page }) => { +test("MyIntegration CRUD has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); await page.getByText("My Integrations").click(); @@ -30,7 +30,7 @@ test("myIntegration CRUD has succeeded", async ({ reearth, page }) => { await expect(page.getByRole("main")).not.toContainText("newNamenewDescription"); }); -test("webhook CRUD has succeeded", async ({ reearth, page }) => { +test("Webhook CRUD has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); await page.getByText("My Integrations").click(); From c2f6523f3f239c82bc641b799409f26eb29c9b86 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 10:49:56 +0900 Subject: [PATCH 03/31] add: integrations test --- web/e2e/settings/integrations.spec.ts | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 web/e2e/settings/integrations.spec.ts diff --git a/web/e2e/settings/integrations.spec.ts b/web/e2e/settings/integrations.spec.ts new file mode 100644 index 0000000000..8047196a70 --- /dev/null +++ b/web/e2e/settings/integrations.spec.ts @@ -0,0 +1,62 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("Integration CRUD and searching has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByText("My Integrations").click(); + + await page.locator("div").filter({ hasText: "Create new integration" }).nth(4).click(); + await page.getByLabel("Integration Name").click(); + await page.getByLabel("Integration Name").fill("name"); + await page.getByLabel("Description").click(); + await page.getByLabel("Description").fill("description"); + await page.getByRole("button", { name: "Create" }).click(); + await page.getByText("Integrations", { exact: true }).click(); + await page.getByRole("button", { name: "api Connect Integration" }).click(); + await page + .locator("div") + .filter({ hasText: /^name$/ }) + .click(); + await page.getByRole("button", { name: "Connect", exact: true }).click(); + await expect(page.getByRole("alert").last()).toContainText( + "Successfully connected integration to the workspace!", + ); + await expect(page.getByRole("cell", { name: "name", exact: true })).toBeVisible(); + await page + .getByRole("row", { name: "name READER kazuma setting" }) + .getByRole("cell") + .nth(4) + .click(); + await page.getByRole("row", { name: "name READER kazuma setting" }).locator("svg").click(); + await page + .locator("div") + .filter({ hasText: /^Reader$/ }) + .nth(4) + .click(); + await page.getByTitle("Writer").click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText( + "Successfully updated workspace integration!", + ); + await expect(page.getByRole("cell", { name: "WRITER" }).nth(1)).toBeVisible(); + await page.getByPlaceholder("Please enter").click(); + await page.getByPlaceholder("Please enter").fill("namee"); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByRole("cell", { name: "name", exact: true })).not.toBeVisible(); + await page.getByPlaceholder("Please enter").click(); + await page.getByPlaceholder("Please enter").fill("name"); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByRole("cell", { name: "name", exact: true })).toBeVisible(); + await page + .getByRole("row", { name: "name WRITER kazuma setting" }) + .getByLabel("", { exact: true }) + .check(); + await page.getByText("Remove").click(); + await page.locator("a").nth(3).click(); + await expect(page.getByRole("alert").last()).toContainText( + "One or more integrations were successfully deleted!", + ); + await page.getByText("My Integrations").click(); + await page.getByText("namedescription").click(); + await page.getByRole("button", { name: "Remove Integration" }).click(); + await page.getByRole("button", { name: "OK" }).click(); +}); From 43eada01e9ce3d42bd1fdb6125fc4f1c55c248a7 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 11:40:13 +0900 Subject: [PATCH 04/31] small fix --- web/e2e/general/auth.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/e2e/general/auth.spec.ts b/web/e2e/general/auth.spec.ts index f302a1cfcf..44545f71fe 100644 --- a/web/e2e/general/auth.spec.ts +++ b/web/e2e/general/auth.spec.ts @@ -4,5 +4,5 @@ test("Logout has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); await page.locator("a").nth(1).click(); await page.getByText("Logout").click(); - await expect(page.getByLabel("Log In").locator("span")).toContainText("Log In"); + await expect(page.getByLabel("Log In")).toBeVisible(); }); From f0ac1e5d696555a4fd87ae1b100464068dd4db74 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 13:35:32 +0900 Subject: [PATCH 05/31] add: terrain test --- web/e2e/settings/settings.spec.ts | 124 ++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 web/e2e/settings/settings.spec.ts diff --git a/web/e2e/settings/settings.spec.ts b/web/e2e/settings/settings.spec.ts new file mode 100644 index 0000000000..66544ca69c --- /dev/null +++ b/web/e2e/settings/settings.spec.ts @@ -0,0 +1,124 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("Tiles CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByText("Settings").click(); + + await page.getByRole("button", { name: "plus Add new Tiles option" }).click(); + await page + .locator("div") + .filter({ hasText: /^Default$/ }) + .nth(4) + .click(); + await page.getByTitle("Labelled").click(); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated"); + await page + .locator("div:last-child > .ant-card-actions > li:nth-child(2) > span > .anticon") + .click(); + await expect(page.getByText("Labelled", { exact: true })).toBeVisible(); + await page + .locator("div") + .filter({ hasText: /^Labelled$/ }) + .nth(4) + .click(); + await page.getByTitle("URL").locator("div").click(); + await page.getByLabel("Name").click(); + await page.getByLabel("Name").fill("url"); + await page.getByRole("textbox", { name: "URL :", exact: true }).click(); + await page.getByRole("textbox", { name: "URL :", exact: true }).fill("http://url.com"); + await page.getByLabel("Image URL").click(); + await page.getByLabel("Image URL").fill("http://image.com"); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated"); + await expect(page.getByText("url", { exact: true })).toBeVisible(); + await expect(page.locator("img")).toBeVisible(); + await page + .locator("div:last-child > .ant-card-actions > li:nth-child(2) > span > .anticon") + .click(); + await expect(page.locator("form")).toContainText("URL"); + await expect(page.getByLabel("Name")).toHaveValue("url"); + await expect(page.getByLabel("URL", { exact: true })).toHaveValue("http://url.com"); + await expect(page.getByLabel("Image URL")).toHaveValue("http://image.com"); + await page.getByLabel("Close", { exact: true }).click(); + await page + .locator("div:last-child > .ant-card-actions > li:nth-child(1) > span > .anticon") + .click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated"); + await expect(page.getByText("url", { exact: true })).not.toBeVisible(); +}); + +test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByText("Settings").click(); + + await expect(page.getByRole("switch")).toBeEnabled(); + await page.getByRole("switch").click(); + await expect(page.getByRole("button", { name: "plus Add new Terrain option" })).toBeVisible(); + await page.getByRole("button", { name: "plus Add new Terrain option" }).click(); + await page + .locator("div") + .filter({ hasText: /^Cesium World Terrain$/ }) + .nth(4) + .click(); + await page.getByTitle("ArcGIS Terrain").click(); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + + await page + .locator( + "div:nth-child(9) > .css-1o8fsgp > div:last-child > .ant-card-actions > li:nth-child(2) > span > .anticon", + ) + .click(); + await expect(page.locator("form")).toContainText("ArcGIS Terrain"); + await page + .locator("div") + .filter({ hasText: /^ArcGIS Terrain$/ }) + .nth(4) + .click(); + await page.getByTitle("Cesium Ion").click(); + await page.getByLabel("Name").click(); + await page.getByLabel("Name").fill("name"); + await page.getByLabel("Terrain Cesium Ion asset ID").click(); + await page.getByLabel("Terrain Cesium Ion asset ID").fill("id"); + await page.getByLabel("Terrain Cesium Ion access").click(); + await page.getByLabel("Terrain Cesium Ion access").fill("token"); + await page.getByLabel("Terrain URL").click(); + await page.getByLabel("Terrain URL").fill("http://terrain.com"); + await page.getByLabel("Image URL").click(); + await page.getByLabel("Image URL").fill("http://image.com"); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await expect(page.getByText("name", { exact: true })).toBeVisible(); + await page + .locator( + "div:nth-child(9) > .css-1o8fsgp > div:last-child > .ant-card-actions > li:nth-child(2) > span > .anticon", + ) + .click(); + await expect(page.locator("form")).toContainText("Cesium Ion"); + await expect(page.getByLabel("Name")).toHaveValue("name"); + await expect(page.getByLabel("Terrain Cesium Ion asset ID")).toHaveValue("id"); + await expect(page.getByLabel("Terrain Cesium Ion access")).toHaveValue("token"); + await expect(page.getByLabel("Terrain URL")).toHaveValue("http://terrain.com"); + await expect(page.getByLabel("Image URL")).toHaveValue("http://image.com"); + await page.getByLabel("Close", { exact: true }).click(); + + await page + .locator( + "div:nth-child(9) > .css-1o8fsgp > div:last-child > .ant-card-actions > li:nth-child(1) > span > .anticon", + ) + .click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await expect(page.getByText("name", { exact: true })).not.toBeVisible(); + + await page.getByRole("switch").click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await expect(page.getByRole("button", { name: "plus Add new Terrain option" })).not.toBeVisible(); +}); From 4f929d166df4075eb874a6e1d0818887c44b2785 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 15:53:07 +0900 Subject: [PATCH 06/31] add: member test --- web/e2e/settings/member.spec.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 web/e2e/settings/member.spec.ts diff --git a/web/e2e/settings/member.spec.ts b/web/e2e/settings/member.spec.ts new file mode 100644 index 0000000000..3099c07443 --- /dev/null +++ b/web/e2e/settings/member.spec.ts @@ -0,0 +1,21 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("Searching current members has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByRole("button", { name: "Create a Workspace" }).click(); + await page.getByLabel("Workspace name").click(); + await page.getByLabel("Workspace name").fill("test workspace"); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByText("Member").click(); + await expect(page.getByRole("cell", { name: "OWNER" })).toBeVisible(); + await page.getByPlaceholder("search for a member").click(); + await page.getByPlaceholder("search for a member").fill("no member"); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByRole("cell", { name: "OWNER" })).not.toBeVisible(); + await page.getByRole("button", { name: "close-circle" }).click(); + await expect(page.getByRole("cell", { name: "OWNER" })).toBeVisible(); + await page.getByText("Workspace", { exact: true }).click(); + await page.getByRole("button", { name: "Remove Workspace" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); +}); From 676425ef3c1c2846c15284a148158b1c89017583 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 16:04:02 +0900 Subject: [PATCH 07/31] add: workspace test --- web/e2e/general/workspace.spec.ts | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 web/e2e/general/workspace.spec.ts diff --git a/web/e2e/general/workspace.spec.ts b/web/e2e/general/workspace.spec.ts new file mode 100644 index 0000000000..3123cfc405 --- /dev/null +++ b/web/e2e/general/workspace.spec.ts @@ -0,0 +1,39 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("Workspace CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByRole("button", { name: "Create a Workspace" }).click(); + await page.getByLabel("Workspace name").click(); + await page.getByLabel("Workspace name").fill("workspace name"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created workspace!"); + + await page.getByText("Workspace", { exact: true }).click(); + await page.getByLabel("Workspace Name").click(); + await page.getByLabel("Workspace Name").fill("new workspace name"); + await page.getByRole("button", { name: "Save changes" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + + await expect(page.locator("header")).toContainText("new workspace name"); + await page.getByRole("button", { name: "Remove Workspace" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); + + await page.locator("a").first().click(); + await expect(page.getByText("new workspace name")).not.toBeVisible(); +}); + +test("Workspace Creating from tab has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.locator("a").first().click(); + await page.getByText("Create Workspace").click(); + await page.getByLabel("Workspace name").click(); + await page.getByLabel("Workspace name").fill("workspace name"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created workspace!"); + + await page.getByText("Workspace", { exact: true }).click(); + await page.getByRole("button", { name: "Remove Workspace" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); +}); From 3b99bf5b7e0a902d9916dc49fa59983c498e947e Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 16:26:05 +0900 Subject: [PATCH 08/31] add: project test --- web/e2e/general/project.spec.ts | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 web/e2e/general/project.spec.ts diff --git a/web/e2e/general/project.spec.ts b/web/e2e/general/project.spec.ts new file mode 100644 index 0000000000..e0ff529397 --- /dev/null +++ b/web/e2e/general/project.spec.ts @@ -0,0 +1,57 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("Project CRUD and searching has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByRole("button", { name: "plus New Project" }).click(); + await page.getByLabel("Project name").click(); + await page.getByLabel("Project name").fill("project name"); + await page.getByLabel("Project alias").click(); + await page.getByLabel("Project alias").fill("project alias"); + await page.getByLabel("Project description").click(); + await page.getByLabel("Project description").fill("project description"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("input: createProject invalid alias"); + await page.getByLabel("Project alias").click(); + await page.getByLabel("Project alias").fill("project-alias"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created project!"); + + await expect(page.getByText("project name", { exact: true })).toBeVisible(); + await expect(page.getByText("project description", { exact: true })).toBeVisible(); + await page.locator(".ant-input-affix-wrapper").click(); + await page.getByPlaceholder("search projects").fill("no project"); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByText("project name", { exact: true })).not.toBeVisible(); + await page.getByRole("button", { name: "close-circle" }).click(); + await expect(page.getByText("project name", { exact: true })).toBeVisible(); + await page.getByText("project name", { exact: true }).click(); + await expect(page.getByText("project name").nth(1)).toBeVisible(); + await expect(page.getByText("project description")).toBeVisible(); + + await page.getByText("Settings").click(); + await page.getByLabel("Name").click(); + await page.getByLabel("Name").fill("new project name"); + await page.getByLabel("Description").click(); + await page.getByLabel("Description").fill("new project description"); + await page.locator("form").getByRole("button", { name: "Save changes" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated project!"); + + await expect(page.locator("#root")).toContainText("Project Settings / new project name"); + await expect(page.locator("header")).toContainText("new project name"); + await page.getByRole("row", { name: "Owner" }).getByRole("switch").click(); + await page.getByRole("button", { name: "Save changes" }).nth(1).click(); + await expect(page.getByRole("row", { name: "Owner" }).getByRole("switch")).toHaveAttribute( + "aria-checked", + "false", + ); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated request roles!"); + + await page.getByText("Overview").click(); + await expect(page.locator("#root")).toContainText("new project name"); + await expect(page.locator("#root")).toContainText("new project description"); + await page.getByText("Settings").click(); + await page.getByRole("button", { name: "Delete Project" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); + await expect(page.getByText("new project name", { exact: true })).not.toBeVisible(); +}); From d26f7b347941b5c3cf04e0b22245761f11aade0f Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 16:26:18 +0900 Subject: [PATCH 09/31] fix: terrain swtich test --- web/e2e/settings/settings.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/e2e/settings/settings.spec.ts b/web/e2e/settings/settings.spec.ts index 66544ca69c..9104d2c845 100644 --- a/web/e2e/settings/settings.spec.ts +++ b/web/e2e/settings/settings.spec.ts @@ -57,6 +57,7 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await expect(page.getByRole("switch")).toBeEnabled(); await page.getByRole("switch").click(); + await expect(page.getByRole("switch")).toHaveAttribute("aria-checked", "true"); await expect(page.getByRole("button", { name: "plus Add new Terrain option" })).toBeVisible(); await page.getByRole("button", { name: "plus Add new Terrain option" }).click(); await page @@ -120,5 +121,6 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("switch").click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await expect(page.getByRole("switch")).toHaveAttribute("aria-checked", "false"); await expect(page.getByRole("button", { name: "plus Add new Terrain option" })).not.toBeVisible(); }); From 702db0b387971274f0b80980c4abcec970019c3e Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 16:51:30 +0900 Subject: [PATCH 10/31] add: overview test --- web/e2e/project/overview.spec.ts | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 web/e2e/project/overview.spec.ts diff --git a/web/e2e/project/overview.spec.ts b/web/e2e/project/overview.spec.ts new file mode 100644 index 0000000000..6808a509c6 --- /dev/null +++ b/web/e2e/project/overview.spec.ts @@ -0,0 +1,52 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("Model CRUD on Overview page has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByRole("button", { name: "plus New Project" }).click(); + await page.getByLabel("Project name").click(); + await page.getByLabel("Project name").fill("e2e project name"); + await page.getByLabel("Project alias").click(); + await page.getByLabel("Project alias").fill("e2e-project-alias"); + await page.getByLabel("Project description").click(); + await page.getByLabel("Project description").fill("e2e project description"); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByText("e2e project name", { exact: true }).click(); + await page.getByRole("button", { name: "plus New Model" }).click(); + await page.getByLabel("Model name").click(); + await page.getByLabel("Model name").fill("model name"); + await page.getByLabel("Model description").click(); + await page.getByLabel("Model description").fill("model description"); + await page.getByLabel("Model key").click(); + await page.getByLabel("Model key").fill("model key"); + await expect(page.getByRole("button", { name: "Ok" })).not.toBeEnabled(); + await page.getByLabel("Model key").click(); + await page.getByLabel("Model key").fill("model-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created model!"); + await expect(page.getByTitle("model name")).toBeVisible(); + await expect(page.getByText("#model-key")).toBeVisible(); + await expect(page.getByRole("menuitem", { name: "model name" }).locator("span")).toBeVisible(); + await page.getByText("Overview").click(); + await page.getByRole("list").locator("a").click(); + await page.getByText("Edit", { exact: true }).click(); + await page.getByLabel("Model name").click(); + await page.getByLabel("Model name").fill("new model name"); + await page.getByLabel("Model description").click(); + await page.getByLabel("Model description").fill("new model description"); + await page.getByLabel("Model key").click(); + await page.getByLabel("Model key").fill("new-model-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated model!"); + await expect(page.locator("#root")).toContainText("new model name"); + await expect(page.locator("#root")).toContainText("new model description"); + await page.getByRole("list").locator("a").click(); + await page.getByText("Delete").click(); + await page.getByRole("button", { name: "Delete Model" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted model!"); + await expect(page.locator("#root")).not.toContainText("new model name"); + + await page.getByText("Settings").click(); + await page.getByRole("button", { name: "Delete Project" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); +}); From 05baab19cbbd9ada606d3c37d114f5d7099370a8 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 17:04:10 +0900 Subject: [PATCH 11/31] add: accesibility test --- web/e2e/project/accessibility.spec.ts | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 web/e2e/project/accessibility.spec.ts diff --git a/web/e2e/project/accessibility.spec.ts b/web/e2e/project/accessibility.spec.ts new file mode 100644 index 0000000000..bfc782cd98 --- /dev/null +++ b/web/e2e/project/accessibility.spec.ts @@ -0,0 +1,36 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +test("Workspace CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await page.getByRole("button", { name: "plus New Project" }).click(); + await page.getByLabel("Project name").click(); + await page.getByLabel("Project name").fill("e2e project name"); + await page.getByLabel("Project alias").click(); + await page.getByLabel("Project alias").fill("e2e-project-alias"); + await page.getByLabel("Project description").click(); + await page.getByLabel("Project description").fill("e2e project description"); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByText("e2e project name", { exact: true }).click(); + + await page.getByText("Accessibility").click(); + await page.getByText("Private").click(); + await page.getByText("Public", { exact: true }).click(); + await page.getByRole("textbox").click(); + await page.getByRole("textbox").fill("new-e2e-project-alias"); + await page.getByRole("switch").click(); + await page.getByRole("button", { name: "Save changes" }).click(); + await expect(page.getByRole("alert").last()).toContainText( + "Successfully updated publication settings!", + ); + await expect(page.locator("form")).toContainText("Public"); + await expect(page.getByRole("textbox")).toHaveValue("new-e2e-project-alias"); + await expect(page.getByRole("switch")).toHaveAttribute("aria-checked", "true"); + await expect(page.locator("tbody")).toContainText( + "http://localhost:8080/api/p/new-e2e-project-alias/assets", + ); + + await page.getByText("Settings").first().click(); + await page.getByRole("button", { name: "Delete Project" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); +}); From c1d6d30c9b14aa914018eccdedaf796c1da99452 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 26 Feb 2024 18:31:51 +0900 Subject: [PATCH 12/31] add: asset test --- web/e2e/project/accessibility.spec.ts | 19 ++--- web/e2e/project/asset.spec.ts | 105 ++++++++++++++++++++++++++ web/e2e/project/overview.spec.ts | 18 ++--- web/e2e/project/utils.ts | 51 +++++++++++++ 4 files changed, 166 insertions(+), 27 deletions(-) create mode 100644 web/e2e/project/asset.spec.ts create mode 100644 web/e2e/project/utils.ts diff --git a/web/e2e/project/accessibility.spec.ts b/web/e2e/project/accessibility.spec.ts index bfc782cd98..10f557e527 100644 --- a/web/e2e/project/accessibility.spec.ts +++ b/web/e2e/project/accessibility.spec.ts @@ -1,16 +1,10 @@ import { expect, test } from "@reearth-cms/e2e/utils"; -test("Workspace CRUD has succeeded", async ({ reearth, page }) => { +import { createProject, deleteProject } from "./utils"; + +test("Update settings on Accesibility page has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); - await page.getByRole("button", { name: "plus New Project" }).click(); - await page.getByLabel("Project name").click(); - await page.getByLabel("Project name").fill("e2e project name"); - await page.getByLabel("Project alias").click(); - await page.getByLabel("Project alias").fill("e2e-project-alias"); - await page.getByLabel("Project description").click(); - await page.getByLabel("Project description").fill("e2e project description"); - await page.getByRole("button", { name: "OK" }).click(); - await page.getByText("e2e project name", { exact: true }).click(); + await createProject(page); await page.getByText("Accessibility").click(); await page.getByText("Private").click(); @@ -29,8 +23,5 @@ test("Workspace CRUD has succeeded", async ({ reearth, page }) => { "http://localhost:8080/api/p/new-e2e-project-alias/assets", ); - await page.getByText("Settings").first().click(); - await page.getByRole("button", { name: "Delete Project" }).click(); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); + await deleteProject(page); }); diff --git a/web/e2e/project/asset.spec.ts b/web/e2e/project/asset.spec.ts new file mode 100644 index 0000000000..4ee531f5b0 --- /dev/null +++ b/web/e2e/project/asset.spec.ts @@ -0,0 +1,105 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +import { createProject, deleteProject, crudComment } from "./utils"; + +const uploadFileUrl = + "https://assets.cms.plateau.reearth.io/assets/11/6d05db-ed47-4f88-b565-9eb385b1ebb0/13100_tokyo23-ku_2022_3dtiles%20_1_1_op_bldg_13101_chiyoda-ku_lod1/tileset.json"; +const uploadFileName = "tileset.json"; + +test("Asset CRUD and Searching has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + + await page.getByText("Asset").click(); + await page.getByRole("button", { name: "upload Upload Asset" }).click(); + await page.getByRole("tab", { name: "URL" }).click(); + await page.getByPlaceholder("Please input a valid URL").click(); + await page.getByPlaceholder("Please input a valid URL").fill(uploadFileUrl); + await page.getByRole("button", { name: "Upload", exact: true }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); + await expect(page.getByText(uploadFileName)).toBeVisible(); + await page.getByPlaceholder("Please enter").click(); + await page.getByPlaceholder("Please enter").fill("no asset"); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByText(uploadFileName)).not.toBeVisible(); + await page.getByPlaceholder("Please enter").click(); + await page.getByPlaceholder("Please enter").fill(""); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByText(uploadFileName)).toBeVisible(); + await page.getByLabel("edit").locator("svg").click(); + await page + .locator("div") + .filter({ hasText: /^Unknown Type$/ }) + .nth(1) + .click(); + await page.getByText("GEOJSON/KML/CZML").click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Asset was successfully updated!"); + await page.getByLabel("Back").click(); + await page.getByLabel("", { exact: true }).check(); + await page.getByText("Delete").click(); + await expect(page.getByText(uploadFileName)).not.toBeVisible(); + await expect(page.getByRole("alert").last()).toContainText( + "One or more assets were successfully deleted!", + ); + + await deleteProject(page); +}); + +test("Donwloading asset has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + + await page.getByText("Asset").click(); + await page.getByRole("button", { name: "upload Upload Asset" }).click(); + await page.getByRole("tab", { name: "URL" }).click(); + await page.getByPlaceholder("Please input a valid URL").click(); + await page.getByPlaceholder("Please input a valid URL").fill(uploadFileUrl); + await page.getByRole("button", { name: "Upload", exact: true }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); + await expect(page.getByText(uploadFileName)).toBeVisible(); + + await page.getByLabel("", { exact: true }).check(); + const downloadPromise = page.waitForEvent("download"); + await page.getByRole("button", { name: "download Download" }).click(); + const download = await downloadPromise; + expect(download.suggestedFilename()).toEqual(uploadFileName); + + await page.getByLabel("edit").locator("svg").click(); + const download1Promise = page.waitForEvent("download"); + await page.getByRole("button", { name: "download Download" }).click(); + const download1 = await download1Promise; + expect(download1.suggestedFilename()).toEqual(uploadFileName); + + await page.getByLabel("Back").click(); + await page.getByLabel("", { exact: true }).check(); + await page.getByText("Delete").click(); + await expect(page.getByRole("alert").last()).toContainText( + "One or more assets were successfully deleted!", + ); + await deleteProject(page); +}); + +test("Comment CRUD on Asset page has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + + await page.getByText("Asset").click(); + await page.getByRole("button", { name: "upload Upload Asset" }).click(); + await page.getByRole("tab", { name: "URL" }).click(); + await page.getByPlaceholder("Please input a valid URL").click(); + await page.getByPlaceholder("Please input a valid URL").fill(uploadFileUrl); + await page.getByRole("button", { name: "Upload", exact: true }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); + await expect(page.getByText(uploadFileName)).toBeVisible(); + + await page.getByRole("button", { name: "0" }).click(); + await expect(page.getByText("CommentsNo comments.Comment")).toBeVisible(); + await deleteProject(page); + + await page.getByRole("cell", { name: "edit" }).locator("svg").click(); + await page.getByLabel("message").click(); + await expect(page.getByText("CommentsComment")).toBeVisible(); + await crudComment(page); + await deleteProject(page); +}); diff --git a/web/e2e/project/overview.spec.ts b/web/e2e/project/overview.spec.ts index 6808a509c6..a03b73367b 100644 --- a/web/e2e/project/overview.spec.ts +++ b/web/e2e/project/overview.spec.ts @@ -1,16 +1,11 @@ import { expect, test } from "@reearth-cms/e2e/utils"; +import { createProject, deleteProject } from "./utils"; + test("Model CRUD on Overview page has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); - await page.getByRole("button", { name: "plus New Project" }).click(); - await page.getByLabel("Project name").click(); - await page.getByLabel("Project name").fill("e2e project name"); - await page.getByLabel("Project alias").click(); - await page.getByLabel("Project alias").fill("e2e-project-alias"); - await page.getByLabel("Project description").click(); - await page.getByLabel("Project description").fill("e2e project description"); - await page.getByRole("button", { name: "OK" }).click(); - await page.getByText("e2e project name", { exact: true }).click(); + await createProject(page); + await page.getByRole("button", { name: "plus New Model" }).click(); await page.getByLabel("Model name").click(); await page.getByLabel("Model name").fill("model name"); @@ -45,8 +40,5 @@ test("Model CRUD on Overview page has succeeded", async ({ reearth, page }) => { await expect(page.getByRole("alert").last()).toContainText("Successfully deleted model!"); await expect(page.locator("#root")).not.toContainText("new model name"); - await page.getByText("Settings").click(); - await page.getByRole("button", { name: "Delete Project" }).click(); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); + await deleteProject(page); }); diff --git a/web/e2e/project/utils.ts b/web/e2e/project/utils.ts new file mode 100644 index 0000000000..3cab317872 --- /dev/null +++ b/web/e2e/project/utils.ts @@ -0,0 +1,51 @@ +import { Page } from "@playwright/test"; + +import { expect } from "@reearth-cms/e2e/utils"; + +export async function createProject(page: Page) { + await page.getByRole("button", { name: "plus New Project" }).click(); + await page.getByLabel("Project name").click(); + await page.getByLabel("Project name").fill("e2e project name"); + await page.getByLabel("Project alias").click(); + await page.getByLabel("Project alias").fill("e2e-project-alias"); + await page.getByLabel("Project description").click(); + await page.getByLabel("Project description").fill("e2e project description"); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByText("e2e project name", { exact: true }).click(); +} + +export async function deleteProject(page: Page) { + await page.getByText("Settings").first().click(); + await page.getByRole("button", { name: "Delete Project" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); +} + +async function createComment(page: Page) { + await page.locator("#content").click(); + await page.locator("#content").fill("comment"); + await page.getByRole("button", { name: "Comment" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created comment!"); + await expect(page.getByRole("main")).toContainText("comment"); +} + +async function updateComment(page: Page) { + await page.getByRole("main").getByRole("complementary").getByLabel("edit").locator("svg").click(); + await page.locator("textarea").filter({ hasText: "comment" }).click(); + await page.locator("textarea").filter({ hasText: "comment" }).fill("new comment"); + await page.getByLabel("check").locator("svg").first().click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated comment!"); + await expect(page.getByRole("main")).toContainText("new comment"); +} + +async function deleteComment(page: Page) { + await page.getByLabel("delete").locator("svg").click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted comment!"); + await expect(page.getByRole("main")).not.toContainText("new comment"); +} + +export async function crudComment(page: Page) { + await createComment(page); + await updateComment(page); + await deleteComment(page); +} From f89844cd1b786f87a2435d05df127b155597718c Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 16:42:15 +0900 Subject: [PATCH 13/31] add: request test --- web/e2e/project/request.spec.ts | 175 ++++++++++++++++++++++++++++++++ web/e2e/project/utils.ts | 31 +++++- 2 files changed, 203 insertions(+), 3 deletions(-) create mode 100644 web/e2e/project/request.spec.ts diff --git a/web/e2e/project/request.spec.ts b/web/e2e/project/request.spec.ts new file mode 100644 index 0000000000..7f49a3fa1d --- /dev/null +++ b/web/e2e/project/request.spec.ts @@ -0,0 +1,175 @@ +import { Page } from "@playwright/test"; + +import { expect, test } from "@reearth-cms/e2e/utils"; + +import { + createWorkspace, + deleteWorkspace, + createProject, + deleteProject, + createModel, + crudComment, +} from "./utils"; + +const requestTitle = "title"; + +async function createRequest(page: Page, reviewerName: string) { + await page.getByText("Content").click(); + await page.getByRole("button", { name: "plus New Item" }).click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await page.getByRole("button", { name: "New Request" }).click(); + await page.getByLabel("Title").click(); + await page.getByLabel("Title").fill(requestTitle); + await page.locator(".ant-select-selection-overflow").click(); + + await page.getByTitle(reviewerName).locator("div").click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created request!"); +} + +test("Request creating, searching, updating reviewer, and approving has succeeded", async ({ + reearth, + page, +}) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + const username = await page.locator("a").nth(1).locator("div").nth(2).locator("p").innerText(); + + await createWorkspace(page); + await createProject(page); + await createModel(page); + await createRequest(page, username); + + await page.getByText("Request", { exact: true }).click(); + await expect(page.getByText(requestTitle, { exact: true })).toBeVisible(); + await expect(page.getByText("WAITING")).toBeVisible(); + await page.getByPlaceholder("Please enter").click(); + await page.getByPlaceholder("Please enter").fill("no request"); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByText(requestTitle, { exact: true })).not.toBeVisible(); + await expect(page.getByText("WAITING")).not.toBeVisible(); + await page.getByPlaceholder("Please enter").fill(""); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByText(requestTitle, { exact: true })).toBeVisible(); + await expect(page.getByText("WAITING")).toBeVisible(); + + await page.getByRole("button", { name: "edit" }).click(); + await page.getByRole("button", { name: "Assign to" }).click(); + await page.getByLabel("close-circle").locator("svg").click(); + await page.locator(".ant-select-selection-overflow").click(); + await page.getByText(username).nth(3).click(); + await page.getByRole("heading", { name: "Reviewer" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated request!"); + await page.getByRole("button", { name: "Approve" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully approved request!"); + await expect(page.getByText(requestTitle, { exact: true })).not.toBeVisible(); + await page.getByRole("cell", { name: "State filter" }).getByRole("button").click(); + await page.getByRole("menuitem", { name: "WAITING" }).getByLabel("").uncheck(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByText("title", { exact: true })).toBeVisible(); + await expect(page.locator("tbody").getByText("APPROVED")).toBeVisible(); + + await deleteProject(page); + await deleteWorkspace(page); +}); + +test("Request closing and reopening has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + const username = await page.locator("a").nth(1).locator("div").nth(2).locator("p").innerText(); + + await createWorkspace(page); + await createProject(page); + await createModel(page); + await createRequest(page, username); + + await page.getByText("Request", { exact: true }).click(); + await expect(page.getByText(requestTitle, { exact: true })).toBeVisible(); + await expect(page.getByText("WAITING")).toBeVisible(); + await page.getByRole("button", { name: "edit" }).click(); + + await page.getByRole("button", { name: "Close" }).click(); + await expect(page.getByRole("alert").last()).toContainText( + "One or more requests were successfully closed!", + ); + await expect(page.getByText(requestTitle, { exact: true })).not.toBeVisible(); + await expect(page.getByText("WAITING")).not.toBeVisible(); + + await page.getByRole("cell", { name: "State filter" }).getByRole("button").click(); + await page.getByRole("menuitem", { name: "WAITING" }).getByLabel("").uncheck(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.locator("tbody").getByText("CLOSED")).toBeVisible(); + await page.getByRole("button", { name: "edit" }).click(); + await expect(page.getByText("CLOSED", { exact: true })).toBeVisible(); + await expect(page.getByText("Closed", { exact: true })).toBeVisible(); + await page.getByRole("button", { name: "Reopen" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated request!"); + await page.getByLabel("Back").click(); + await expect(page.getByText("title", { exact: true })).toBeVisible(); + await expect(page.getByText("WAITING")).toBeVisible(); + await page.getByLabel("", { exact: true }).check(); + await page.getByText("Close").click(); + await expect(page.getByRole("alert").last()).toContainText( + "One or more requests were successfully closed!", + ); + await page.getByRole("cell", { name: "State filter" }).getByRole("button").click(); + await page.getByRole("menuitem", { name: "WAITING" }).getByLabel("").uncheck(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.locator("tbody").getByText("CLOSED")).toBeVisible(); + await page.getByRole("button", { name: "edit" }).click(); + await expect(page.getByText("CLOSED", { exact: true })).toBeVisible(); + + await deleteProject(page); + await deleteWorkspace(page); +}); + +test("Comment CRUD on edit page has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + const username = await page.locator("a").nth(1).locator("div").nth(2).locator("p").innerText(); + + await createWorkspace(page); + await createProject(page); + await createModel(page); + await createRequest(page, username); + + await page.getByText("Request", { exact: true }).click(); + await expect(page.getByText(requestTitle, { exact: true })).toBeVisible(); + await expect(page.getByText("WAITING")).toBeVisible(); + await page.getByRole("button", { name: "edit" }).click(); + + await page.locator("#content").click(); + await page.locator("#content").fill("comment"); + await page.getByRole("button", { name: "Comment" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created comment!"); + await expect(page.getByText("comment").nth(1)).toBeVisible(); + await page.getByLabel("edit").locator("svg").click(); + await page.locator("textarea").filter({ hasText: "comment" }).click(); + await page.locator("textarea").filter({ hasText: "comment" }).fill("new comment"); + await page.getByLabel("check").locator("svg").first().click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated comment!"); + await expect(page.getByText("new comment").nth(1)).toBeVisible(); + await page.getByLabel("delete").locator("svg").click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted comment!"); + await expect(page.getByText("new comment").nth(1)).not.toBeVisible(); + + await deleteProject(page); + await deleteWorkspace(page); +}); + +test("Comment CRUD on Request page has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + const username = await page.locator("a").nth(1).locator("div").nth(2).locator("p").innerText(); + + await createWorkspace(page); + await createProject(page); + await createModel(page); + await createRequest(page, username); + + await page.getByText("Request", { exact: true }).click(); + await page.getByRole("button", { name: "0" }).click(); + await expect(page.getByText("CommentsNo comments.Comment")).toBeVisible(); + + await crudComment(page); + + await deleteProject(page); + await deleteWorkspace(page); +}); diff --git a/web/e2e/project/utils.ts b/web/e2e/project/utils.ts index 3cab317872..c716d41b81 100644 --- a/web/e2e/project/utils.ts +++ b/web/e2e/project/utils.ts @@ -2,10 +2,25 @@ import { Page } from "@playwright/test"; import { expect } from "@reearth-cms/e2e/utils"; +export async function createWorkspace(page: Page) { + await page.getByRole("button", { name: "Create a Workspace" }).click(); + await page.getByLabel("Workspace name").click(); + await page.getByLabel("Workspace name").fill("e2e workspace name"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created workspace!"); +} + +export async function deleteWorkspace(page: Page) { + await page.getByText("Workspace", { exact: true }).click(); + await page.getByRole("button", { name: "Remove Workspace" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); +} + export async function createProject(page: Page) { - await page.getByRole("button", { name: "plus New Project" }).click(); - await page.getByLabel("Project name").click(); - await page.getByLabel("Project name").fill("e2e project name"); + await page.getByRole("button", { name: "plus New Project" }).first().click(); + await page.getByRole("dialog").locator("#name").click(); + await page.getByRole("dialog").locator("#name").fill("e2e project name"); await page.getByLabel("Project alias").click(); await page.getByLabel("Project alias").fill("e2e-project-alias"); await page.getByLabel("Project description").click(); @@ -21,6 +36,16 @@ export async function deleteProject(page: Page) { await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); } +export async function createModel(page: Page) { + await page.getByText("Schema").click(); + await page.getByRole("button", { name: "plus Add" }).first().click(); + await page.getByLabel("Model name").click(); + await page.getByLabel("Model name").fill("e2e model name"); + await page.getByLabel("Model key").click(); + await page.getByLabel("Model key").fill("e2e-model-key"); + await page.getByRole("button", { name: "OK" }).click(); +} + async function createComment(page: Page) { await page.locator("#content").click(); await page.locator("#content").fill("comment"); From 8e9f21740c317c291993b7deeaef6aa43df6c258 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 16:42:37 +0900 Subject: [PATCH 14/31] fix: comment on Asset test --- web/e2e/project/asset.spec.ts | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/web/e2e/project/asset.spec.ts b/web/e2e/project/asset.spec.ts index 4ee531f5b0..39783954cd 100644 --- a/web/e2e/project/asset.spec.ts +++ b/web/e2e/project/asset.spec.ts @@ -80,7 +80,7 @@ test("Donwloading asset has succeeded", async ({ reearth, page }) => { await deleteProject(page); }); -test("Comment CRUD on Asset page has succeeded", async ({ reearth, page }) => { +test("Comment CRUD on edit page has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); await createProject(page); @@ -93,13 +93,28 @@ test("Comment CRUD on Asset page has succeeded", async ({ reearth, page }) => { await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); await expect(page.getByText(uploadFileName)).toBeVisible(); - await page.getByRole("button", { name: "0" }).click(); - await expect(page.getByText("CommentsNo comments.Comment")).toBeVisible(); - await deleteProject(page); - await page.getByRole("cell", { name: "edit" }).locator("svg").click(); await page.getByLabel("message").click(); await expect(page.getByText("CommentsComment")).toBeVisible(); await crudComment(page); await deleteProject(page); }); + +test("Comment CRUD on Asset page has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + + await page.getByText("Asset").click(); + await page.getByRole("button", { name: "upload Upload Asset" }).click(); + await page.getByRole("tab", { name: "URL" }).click(); + await page.getByPlaceholder("Please input a valid URL").click(); + await page.getByPlaceholder("Please input a valid URL").fill(uploadFileUrl); + await page.getByRole("button", { name: "Upload", exact: true }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); + await expect(page.getByText(uploadFileName)).toBeVisible(); + + await page.getByRole("button", { name: "0" }).click(); + await expect(page.getByText("CommentsNo comments.Comment")).toBeVisible(); + await crudComment(page); + await deleteProject(page); +}); From 6844aa1159edb6bdc3e9b62e00d830ba5c1d856b Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 17:38:32 +0900 Subject: [PATCH 15/31] add: schema test --- web/e2e/project/schema.spec.ts | 55 +++++++++++++++++++++++ web/e2e/project/utils.ts | 80 ++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 web/e2e/project/schema.spec.ts diff --git a/web/e2e/project/schema.spec.ts b/web/e2e/project/schema.spec.ts new file mode 100644 index 0000000000..e8f2d0eb3d --- /dev/null +++ b/web/e2e/project/schema.spec.ts @@ -0,0 +1,55 @@ +import { Page } from "@playwright/test"; + +import { expect, test } from "@reearth-cms/e2e/utils"; + +import { createProject, deleteProject, createModel, crudModel, crudGroup } from "./utils"; + +async function handleFieldForm(page: Page, name: string, key = name) { + await page.getByLabel("Display name").click(); + await page.getByLabel("Display name").fill(name); + await page.getByLabel("Settings").locator("#key").click(); + await page.getByLabel("Settings").locator("#key").fill(key); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByText(`${name} #${key}`)).toBeVisible(); +} + +async function deleteField(page: Page, name: string, key = name) { + await page.getByLabel("delete").locator("svg").click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.locator("body")).toContainText("Successfully deleted field!"); + await expect(page.getByText(`${name} #${key}`)).not.toBeVisible(); +} + +test("Model CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + await crudModel(page); + await deleteProject(page); +}); + +test("Group CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + await crudGroup(page); + await deleteProject(page); +}); + +test("Text field CRUD has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + await createModel(page); + await page + .locator("li") + .filter({ hasText: "TextHeading and titles, one-" }) + .locator("div") + .first() + .click(); + await handleFieldForm(page, "text"); + await expect(page.getByRole("alert").last()).toContainText("Successfully created field!"); + await page.getByRole("img", { name: "ellipsis" }).locator("svg").click(); + await handleFieldForm(page, "new text", "new-text"); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated field!"); + await deleteField(page, "new text", "new-text"); + + await deleteProject(page); +}); diff --git a/web/e2e/project/utils.ts b/web/e2e/project/utils.ts index c716d41b81..34d3a1da9a 100644 --- a/web/e2e/project/utils.ts +++ b/web/e2e/project/utils.ts @@ -44,6 +44,86 @@ export async function createModel(page: Page) { await page.getByLabel("Model key").click(); await page.getByLabel("Model key").fill("e2e-model-key"); await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created model!"); + await expect(page.getByTitle("e2e model name")).toBeVisible(); + await expect(page.getByText("#e2e-model-key")).toBeVisible(); + await expect( + page.getByRole("menuitem", { name: "e2e model name" }).locator("span"), + ).toBeVisible(); +} + +const updateModelName = "new e2e model name"; + +async function updateModel(page: Page) { + await page.getByRole("button", { name: "more" }).hover(); + await page.getByText("Edit", { exact: true }).click(); + await page.getByLabel("Update Model").locator("#name").click(); + await page.getByLabel("Update Model").locator("#name").fill(updateModelName); + await page.getByLabel("Update Model").locator("#key").click(); + await page.getByLabel("Update Model").locator("#key").fill("new-e2e-model-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated model!"); + await expect(page.getByTitle(updateModelName)).toBeVisible(); + await expect(page.getByText("#new-e2e-model-key")).toBeVisible(); + await expect(page.getByRole("menuitem", { name: updateModelName }).locator("span")).toBeVisible(); +} + +async function deleteModel(page: Page) { + await page.getByRole("button", { name: "more" }).hover(); + await page.getByText("Delete").click(); + await page.getByRole("button", { name: "Delete Model" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted model!"); + await expect(page.getByTitle(updateModelName)).not.toBeVisible(); +} + +export async function crudModel(page: Page) { + await createModel(page); + await updateModel(page); + await deleteModel(page); +} + +async function createGroup(page: Page) { + await page.getByText("Schema").click(); + await page.getByRole("button", { name: "plus Add" }).last().click(); + await page.getByLabel("Group name").click(); + await page.getByLabel("Group name").fill("e2e group name"); + await page.getByLabel("Group key").click(); + await page.getByLabel("Group key").fill("e2e-group-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created group!"); + await page.getByText("e2e group name").click(); + await expect(page.getByTitle("e2e group name")).toBeVisible(); + await expect(page.getByText("#e2e-group-key")).toBeVisible(); +} + +const updateGroupName = "new e2e group name"; + +async function updateGroup(page: Page) { + await page.getByRole("button", { name: "more" }).hover(); + await page.getByText("Edit", { exact: true }).click(); + await page.getByLabel("Update Group").locator("#name").click(); + await page.getByLabel("Update Group").locator("#name").fill(updateGroupName); + await page.getByLabel("Update Group").locator("#key").click(); + await page.getByLabel("Update Group").locator("#key").fill("new-e2e-group-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated group!"); + await expect(page.getByTitle(updateGroupName)).toBeVisible(); + await expect(page.getByText("#new-e2e-group-key")).toBeVisible(); + await expect(page.getByRole("menuitem", { name: updateGroupName }).locator("span")).toBeVisible(); +} + +async function deleteGroup(page: Page) { + await page.getByRole("button", { name: "more" }).hover(); + await page.getByText("Delete").click(); + await page.getByRole("button", { name: "Delete Group" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted group!"); + await expect(page.getByTitle(updateGroupName)).not.toBeVisible(); +} + +export async function crudGroup(page: Page) { + await createGroup(page); + await updateGroup(page); + await deleteGroup(page); } async function createComment(page: Page) { From 0c4aeca849810e5d4383857c4db3d273d9d6190c Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 17:42:46 +0900 Subject: [PATCH 16/31] move utils for workspace --- web/e2e/project/request.spec.ts | 10 ++-------- web/e2e/project/utils.ts | 15 --------------- web/e2e/project/utils/workspace.ts | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 23 deletions(-) create mode 100644 web/e2e/project/utils/workspace.ts diff --git a/web/e2e/project/request.spec.ts b/web/e2e/project/request.spec.ts index 7f49a3fa1d..2c65575e66 100644 --- a/web/e2e/project/request.spec.ts +++ b/web/e2e/project/request.spec.ts @@ -2,14 +2,8 @@ import { Page } from "@playwright/test"; import { expect, test } from "@reearth-cms/e2e/utils"; -import { - createWorkspace, - deleteWorkspace, - createProject, - deleteProject, - createModel, - crudComment, -} from "./utils"; +import { createProject, deleteProject, createModel, crudComment } from "./utils"; +import { createWorkspace, deleteWorkspace } from "./utils/workspace"; const requestTitle = "title"; diff --git a/web/e2e/project/utils.ts b/web/e2e/project/utils.ts index 34d3a1da9a..c9cfe48840 100644 --- a/web/e2e/project/utils.ts +++ b/web/e2e/project/utils.ts @@ -2,21 +2,6 @@ import { Page } from "@playwright/test"; import { expect } from "@reearth-cms/e2e/utils"; -export async function createWorkspace(page: Page) { - await page.getByRole("button", { name: "Create a Workspace" }).click(); - await page.getByLabel("Workspace name").click(); - await page.getByLabel("Workspace name").fill("e2e workspace name"); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully created workspace!"); -} - -export async function deleteWorkspace(page: Page) { - await page.getByText("Workspace", { exact: true }).click(); - await page.getByRole("button", { name: "Remove Workspace" }).click(); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); -} - export async function createProject(page: Page) { await page.getByRole("button", { name: "plus New Project" }).first().click(); await page.getByRole("dialog").locator("#name").click(); diff --git a/web/e2e/project/utils/workspace.ts b/web/e2e/project/utils/workspace.ts new file mode 100644 index 0000000000..d8c4e4e3ec --- /dev/null +++ b/web/e2e/project/utils/workspace.ts @@ -0,0 +1,16 @@ +import { Page } from "@playwright/test"; + +export async function createWorkspace(page: Page) { + await page.getByRole("button", { name: "Create a Workspace" }).click(); + await page.getByLabel("Workspace name").click(); + await page.getByLabel("Workspace name").fill("e2e workspace name"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created workspace!"); +} + +export async function deleteWorkspace(page: Page) { + await page.getByText("Workspace", { exact: true }).click(); + await page.getByRole("button", { name: "Remove Workspace" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); +} From f02ccb16ccfb48dde5e50317eba48ce7bea8b9b8 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 17:45:18 +0900 Subject: [PATCH 17/31] move utils for project --- web/e2e/project/accessibility.spec.ts | 2 +- web/e2e/project/asset.spec.ts | 3 ++- web/e2e/project/overview.spec.ts | 2 +- web/e2e/project/request.spec.ts | 3 ++- web/e2e/project/schema.spec.ts | 3 ++- web/e2e/project/utils.ts | 19 ------------------- web/e2e/project/utils/project.ts | 20 ++++++++++++++++++++ 7 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 web/e2e/project/utils/project.ts diff --git a/web/e2e/project/accessibility.spec.ts b/web/e2e/project/accessibility.spec.ts index 10f557e527..51cb604678 100644 --- a/web/e2e/project/accessibility.spec.ts +++ b/web/e2e/project/accessibility.spec.ts @@ -1,6 +1,6 @@ import { expect, test } from "@reearth-cms/e2e/utils"; -import { createProject, deleteProject } from "./utils"; +import { createProject, deleteProject } from "./utils/project"; test("Update settings on Accesibility page has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); diff --git a/web/e2e/project/asset.spec.ts b/web/e2e/project/asset.spec.ts index 39783954cd..3b4e788f19 100644 --- a/web/e2e/project/asset.spec.ts +++ b/web/e2e/project/asset.spec.ts @@ -1,6 +1,7 @@ import { expect, test } from "@reearth-cms/e2e/utils"; -import { createProject, deleteProject, crudComment } from "./utils"; +import { crudComment } from "./utils"; +import { createProject, deleteProject } from "./utils/project"; const uploadFileUrl = "https://assets.cms.plateau.reearth.io/assets/11/6d05db-ed47-4f88-b565-9eb385b1ebb0/13100_tokyo23-ku_2022_3dtiles%20_1_1_op_bldg_13101_chiyoda-ku_lod1/tileset.json"; diff --git a/web/e2e/project/overview.spec.ts b/web/e2e/project/overview.spec.ts index a03b73367b..fa18a03311 100644 --- a/web/e2e/project/overview.spec.ts +++ b/web/e2e/project/overview.spec.ts @@ -1,6 +1,6 @@ import { expect, test } from "@reearth-cms/e2e/utils"; -import { createProject, deleteProject } from "./utils"; +import { createProject, deleteProject } from "./utils/project"; test("Model CRUD on Overview page has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); diff --git a/web/e2e/project/request.spec.ts b/web/e2e/project/request.spec.ts index 2c65575e66..87dfaad636 100644 --- a/web/e2e/project/request.spec.ts +++ b/web/e2e/project/request.spec.ts @@ -2,7 +2,8 @@ import { Page } from "@playwright/test"; import { expect, test } from "@reearth-cms/e2e/utils"; -import { createProject, deleteProject, createModel, crudComment } from "./utils"; +import { createModel, crudComment } from "./utils"; +import { createProject, deleteProject } from "./utils/project"; import { createWorkspace, deleteWorkspace } from "./utils/workspace"; const requestTitle = "title"; diff --git a/web/e2e/project/schema.spec.ts b/web/e2e/project/schema.spec.ts index e8f2d0eb3d..e2186266a1 100644 --- a/web/e2e/project/schema.spec.ts +++ b/web/e2e/project/schema.spec.ts @@ -2,7 +2,8 @@ import { Page } from "@playwright/test"; import { expect, test } from "@reearth-cms/e2e/utils"; -import { createProject, deleteProject, createModel, crudModel, crudGroup } from "./utils"; +import { createModel, crudModel, crudGroup } from "./utils"; +import { createProject, deleteProject } from "./utils/project"; async function handleFieldForm(page: Page, name: string, key = name) { await page.getByLabel("Display name").click(); diff --git a/web/e2e/project/utils.ts b/web/e2e/project/utils.ts index c9cfe48840..c273a07a20 100644 --- a/web/e2e/project/utils.ts +++ b/web/e2e/project/utils.ts @@ -2,25 +2,6 @@ import { Page } from "@playwright/test"; import { expect } from "@reearth-cms/e2e/utils"; -export async function createProject(page: Page) { - await page.getByRole("button", { name: "plus New Project" }).first().click(); - await page.getByRole("dialog").locator("#name").click(); - await page.getByRole("dialog").locator("#name").fill("e2e project name"); - await page.getByLabel("Project alias").click(); - await page.getByLabel("Project alias").fill("e2e-project-alias"); - await page.getByLabel("Project description").click(); - await page.getByLabel("Project description").fill("e2e project description"); - await page.getByRole("button", { name: "OK" }).click(); - await page.getByText("e2e project name", { exact: true }).click(); -} - -export async function deleteProject(page: Page) { - await page.getByText("Settings").first().click(); - await page.getByRole("button", { name: "Delete Project" }).click(); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); -} - export async function createModel(page: Page) { await page.getByText("Schema").click(); await page.getByRole("button", { name: "plus Add" }).first().click(); diff --git a/web/e2e/project/utils/project.ts b/web/e2e/project/utils/project.ts new file mode 100644 index 0000000000..5b27b175ca --- /dev/null +++ b/web/e2e/project/utils/project.ts @@ -0,0 +1,20 @@ +import { Page } from "@playwright/test"; + +export async function createProject(page: Page) { + await page.getByRole("button", { name: "plus New Project" }).first().click(); + await page.getByRole("dialog").locator("#name").click(); + await page.getByRole("dialog").locator("#name").fill("e2e project name"); + await page.getByLabel("Project alias").click(); + await page.getByLabel("Project alias").fill("e2e-project-alias"); + await page.getByLabel("Project description").click(); + await page.getByLabel("Project description").fill("e2e project description"); + await page.getByRole("button", { name: "OK" }).click(); + await page.getByText("e2e project name", { exact: true }).click(); +} + +export async function deleteProject(page: Page) { + await page.getByText("Settings").first().click(); + await page.getByRole("button", { name: "Delete Project" }).click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); +} From 1c8426a493413ef2d588aa178f63319a591167ff Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 17:47:10 +0900 Subject: [PATCH 18/31] move utils for model --- web/e2e/project/request.spec.ts | 3 +- web/e2e/project/schema.spec.ts | 3 +- web/e2e/project/utils.ts | 46 ------------------------------- web/e2e/project/utils/model.ts | 49 +++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 48 deletions(-) create mode 100644 web/e2e/project/utils/model.ts diff --git a/web/e2e/project/request.spec.ts b/web/e2e/project/request.spec.ts index 87dfaad636..120c58aff2 100644 --- a/web/e2e/project/request.spec.ts +++ b/web/e2e/project/request.spec.ts @@ -2,7 +2,8 @@ import { Page } from "@playwright/test"; import { expect, test } from "@reearth-cms/e2e/utils"; -import { createModel, crudComment } from "./utils"; +import { crudComment } from "./utils"; +import { createModel } from "./utils/model"; import { createProject, deleteProject } from "./utils/project"; import { createWorkspace, deleteWorkspace } from "./utils/workspace"; diff --git a/web/e2e/project/schema.spec.ts b/web/e2e/project/schema.spec.ts index e2186266a1..e631f959b1 100644 --- a/web/e2e/project/schema.spec.ts +++ b/web/e2e/project/schema.spec.ts @@ -2,7 +2,8 @@ import { Page } from "@playwright/test"; import { expect, test } from "@reearth-cms/e2e/utils"; -import { createModel, crudModel, crudGroup } from "./utils"; +import { crudGroup } from "./utils"; +import { createModel, crudModel } from "./utils/model"; import { createProject, deleteProject } from "./utils/project"; async function handleFieldForm(page: Page, name: string, key = name) { diff --git a/web/e2e/project/utils.ts b/web/e2e/project/utils.ts index c273a07a20..15363b3f0c 100644 --- a/web/e2e/project/utils.ts +++ b/web/e2e/project/utils.ts @@ -2,52 +2,6 @@ import { Page } from "@playwright/test"; import { expect } from "@reearth-cms/e2e/utils"; -export async function createModel(page: Page) { - await page.getByText("Schema").click(); - await page.getByRole("button", { name: "plus Add" }).first().click(); - await page.getByLabel("Model name").click(); - await page.getByLabel("Model name").fill("e2e model name"); - await page.getByLabel("Model key").click(); - await page.getByLabel("Model key").fill("e2e-model-key"); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully created model!"); - await expect(page.getByTitle("e2e model name")).toBeVisible(); - await expect(page.getByText("#e2e-model-key")).toBeVisible(); - await expect( - page.getByRole("menuitem", { name: "e2e model name" }).locator("span"), - ).toBeVisible(); -} - -const updateModelName = "new e2e model name"; - -async function updateModel(page: Page) { - await page.getByRole("button", { name: "more" }).hover(); - await page.getByText("Edit", { exact: true }).click(); - await page.getByLabel("Update Model").locator("#name").click(); - await page.getByLabel("Update Model").locator("#name").fill(updateModelName); - await page.getByLabel("Update Model").locator("#key").click(); - await page.getByLabel("Update Model").locator("#key").fill("new-e2e-model-key"); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully updated model!"); - await expect(page.getByTitle(updateModelName)).toBeVisible(); - await expect(page.getByText("#new-e2e-model-key")).toBeVisible(); - await expect(page.getByRole("menuitem", { name: updateModelName }).locator("span")).toBeVisible(); -} - -async function deleteModel(page: Page) { - await page.getByRole("button", { name: "more" }).hover(); - await page.getByText("Delete").click(); - await page.getByRole("button", { name: "Delete Model" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully deleted model!"); - await expect(page.getByTitle(updateModelName)).not.toBeVisible(); -} - -export async function crudModel(page: Page) { - await createModel(page); - await updateModel(page); - await deleteModel(page); -} - async function createGroup(page: Page) { await page.getByText("Schema").click(); await page.getByRole("button", { name: "plus Add" }).last().click(); diff --git a/web/e2e/project/utils/model.ts b/web/e2e/project/utils/model.ts new file mode 100644 index 0000000000..6ccefc8b1b --- /dev/null +++ b/web/e2e/project/utils/model.ts @@ -0,0 +1,49 @@ +import { Page } from "@playwright/test"; + +import { expect } from "@reearth-cms/e2e/utils"; + +export async function createModel(page: Page) { + await page.getByText("Schema").click(); + await page.getByRole("button", { name: "plus Add" }).first().click(); + await page.getByLabel("Model name").click(); + await page.getByLabel("Model name").fill("e2e model name"); + await page.getByLabel("Model key").click(); + await page.getByLabel("Model key").fill("e2e-model-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created model!"); + await expect(page.getByTitle("e2e model name")).toBeVisible(); + await expect(page.getByText("#e2e-model-key")).toBeVisible(); + await expect( + page.getByRole("menuitem", { name: "e2e model name" }).locator("span"), + ).toBeVisible(); +} + +const updateModelName = "new e2e model name"; + +async function updateModel(page: Page) { + await page.getByRole("button", { name: "more" }).hover(); + await page.getByText("Edit", { exact: true }).click(); + await page.getByLabel("Update Model").locator("#name").click(); + await page.getByLabel("Update Model").locator("#name").fill(updateModelName); + await page.getByLabel("Update Model").locator("#key").click(); + await page.getByLabel("Update Model").locator("#key").fill("new-e2e-model-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated model!"); + await expect(page.getByTitle(updateModelName)).toBeVisible(); + await expect(page.getByText("#new-e2e-model-key")).toBeVisible(); + await expect(page.getByRole("menuitem", { name: updateModelName }).locator("span")).toBeVisible(); +} + +async function deleteModel(page: Page) { + await page.getByRole("button", { name: "more" }).hover(); + await page.getByText("Delete").click(); + await page.getByRole("button", { name: "Delete Model" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted model!"); + await expect(page.getByTitle(updateModelName)).not.toBeVisible(); +} + +export async function crudModel(page: Page) { + await createModel(page); + await updateModel(page); + await deleteModel(page); +} From 37acbbef3680a6c15498d5ed2828aeaac53a104e Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 17:49:02 +0900 Subject: [PATCH 19/31] move utils for group --- web/e2e/project/schema.spec.ts | 2 +- web/e2e/project/utils.ts | 44 ------------------------------- web/e2e/project/utils/group.ts | 47 ++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 45 deletions(-) create mode 100644 web/e2e/project/utils/group.ts diff --git a/web/e2e/project/schema.spec.ts b/web/e2e/project/schema.spec.ts index e631f959b1..1d78d19f68 100644 --- a/web/e2e/project/schema.spec.ts +++ b/web/e2e/project/schema.spec.ts @@ -2,7 +2,7 @@ import { Page } from "@playwright/test"; import { expect, test } from "@reearth-cms/e2e/utils"; -import { crudGroup } from "./utils"; +import { crudGroup } from "./utils/group"; import { createModel, crudModel } from "./utils/model"; import { createProject, deleteProject } from "./utils/project"; diff --git a/web/e2e/project/utils.ts b/web/e2e/project/utils.ts index 15363b3f0c..9c8d23df44 100644 --- a/web/e2e/project/utils.ts +++ b/web/e2e/project/utils.ts @@ -2,50 +2,6 @@ import { Page } from "@playwright/test"; import { expect } from "@reearth-cms/e2e/utils"; -async function createGroup(page: Page) { - await page.getByText("Schema").click(); - await page.getByRole("button", { name: "plus Add" }).last().click(); - await page.getByLabel("Group name").click(); - await page.getByLabel("Group name").fill("e2e group name"); - await page.getByLabel("Group key").click(); - await page.getByLabel("Group key").fill("e2e-group-key"); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully created group!"); - await page.getByText("e2e group name").click(); - await expect(page.getByTitle("e2e group name")).toBeVisible(); - await expect(page.getByText("#e2e-group-key")).toBeVisible(); -} - -const updateGroupName = "new e2e group name"; - -async function updateGroup(page: Page) { - await page.getByRole("button", { name: "more" }).hover(); - await page.getByText("Edit", { exact: true }).click(); - await page.getByLabel("Update Group").locator("#name").click(); - await page.getByLabel("Update Group").locator("#name").fill(updateGroupName); - await page.getByLabel("Update Group").locator("#key").click(); - await page.getByLabel("Update Group").locator("#key").fill("new-e2e-group-key"); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully updated group!"); - await expect(page.getByTitle(updateGroupName)).toBeVisible(); - await expect(page.getByText("#new-e2e-group-key")).toBeVisible(); - await expect(page.getByRole("menuitem", { name: updateGroupName }).locator("span")).toBeVisible(); -} - -async function deleteGroup(page: Page) { - await page.getByRole("button", { name: "more" }).hover(); - await page.getByText("Delete").click(); - await page.getByRole("button", { name: "Delete Group" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully deleted group!"); - await expect(page.getByTitle(updateGroupName)).not.toBeVisible(); -} - -export async function crudGroup(page: Page) { - await createGroup(page); - await updateGroup(page); - await deleteGroup(page); -} - async function createComment(page: Page) { await page.locator("#content").click(); await page.locator("#content").fill("comment"); diff --git a/web/e2e/project/utils/group.ts b/web/e2e/project/utils/group.ts new file mode 100644 index 0000000000..fa90885acd --- /dev/null +++ b/web/e2e/project/utils/group.ts @@ -0,0 +1,47 @@ +import { Page } from "@playwright/test"; + +import { expect } from "@reearth-cms/e2e/utils"; + +async function createGroup(page: Page) { + await page.getByText("Schema").click(); + await page.getByRole("button", { name: "plus Add" }).last().click(); + await page.getByLabel("Group name").click(); + await page.getByLabel("Group name").fill("e2e group name"); + await page.getByLabel("Group key").click(); + await page.getByLabel("Group key").fill("e2e-group-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created group!"); + await page.getByText("e2e group name").click(); + await expect(page.getByTitle("e2e group name")).toBeVisible(); + await expect(page.getByText("#e2e-group-key")).toBeVisible(); +} + +const updateGroupName = "new e2e group name"; + +async function updateGroup(page: Page) { + await page.getByRole("button", { name: "more" }).hover(); + await page.getByText("Edit", { exact: true }).click(); + await page.getByLabel("Update Group").locator("#name").click(); + await page.getByLabel("Update Group").locator("#name").fill(updateGroupName); + await page.getByLabel("Update Group").locator("#key").click(); + await page.getByLabel("Update Group").locator("#key").fill("new-e2e-group-key"); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated group!"); + await expect(page.getByTitle(updateGroupName)).toBeVisible(); + await expect(page.getByText("#new-e2e-group-key")).toBeVisible(); + await expect(page.getByRole("menuitem", { name: updateGroupName }).locator("span")).toBeVisible(); +} + +async function deleteGroup(page: Page) { + await page.getByRole("button", { name: "more" }).hover(); + await page.getByText("Delete").click(); + await page.getByRole("button", { name: "Delete Group" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully deleted group!"); + await expect(page.getByTitle(updateGroupName)).not.toBeVisible(); +} + +export async function crudGroup(page: Page) { + await createGroup(page); + await updateGroup(page); + await deleteGroup(page); +} From 92c85cca75b1714ca355ceb5ed48a95bcaa44267 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 17:49:52 +0900 Subject: [PATCH 20/31] move utils for comment --- web/e2e/project/asset.spec.ts | 2 +- web/e2e/project/request.spec.ts | 2 +- web/e2e/project/{utils.ts => utils/comment.ts} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename web/e2e/project/{utils.ts => utils/comment.ts} (100%) diff --git a/web/e2e/project/asset.spec.ts b/web/e2e/project/asset.spec.ts index 3b4e788f19..ffbdc70832 100644 --- a/web/e2e/project/asset.spec.ts +++ b/web/e2e/project/asset.spec.ts @@ -1,6 +1,6 @@ import { expect, test } from "@reearth-cms/e2e/utils"; -import { crudComment } from "./utils"; +import { crudComment } from "./utils/comment"; import { createProject, deleteProject } from "./utils/project"; const uploadFileUrl = diff --git a/web/e2e/project/request.spec.ts b/web/e2e/project/request.spec.ts index 120c58aff2..f8c5fc98f1 100644 --- a/web/e2e/project/request.spec.ts +++ b/web/e2e/project/request.spec.ts @@ -2,7 +2,7 @@ import { Page } from "@playwright/test"; import { expect, test } from "@reearth-cms/e2e/utils"; -import { crudComment } from "./utils"; +import { crudComment } from "./utils/comment"; import { createModel } from "./utils/model"; import { createProject, deleteProject } from "./utils/project"; import { createWorkspace, deleteWorkspace } from "./utils/workspace"; diff --git a/web/e2e/project/utils.ts b/web/e2e/project/utils/comment.ts similarity index 100% rename from web/e2e/project/utils.ts rename to web/e2e/project/utils/comment.ts From 371c56d6d7354db0a943e5375c6499262a7faa09 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 18:05:43 +0900 Subject: [PATCH 21/31] fix: missing import --- web/e2e/project/utils/project.ts | 2 ++ web/e2e/project/utils/workspace.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/web/e2e/project/utils/project.ts b/web/e2e/project/utils/project.ts index 5b27b175ca..d3e2608188 100644 --- a/web/e2e/project/utils/project.ts +++ b/web/e2e/project/utils/project.ts @@ -1,5 +1,7 @@ import { Page } from "@playwright/test"; +import { expect } from "@reearth-cms/e2e/utils"; + export async function createProject(page: Page) { await page.getByRole("button", { name: "plus New Project" }).first().click(); await page.getByRole("dialog").locator("#name").click(); diff --git a/web/e2e/project/utils/workspace.ts b/web/e2e/project/utils/workspace.ts index d8c4e4e3ec..b5c512c5c7 100644 --- a/web/e2e/project/utils/workspace.ts +++ b/web/e2e/project/utils/workspace.ts @@ -1,5 +1,7 @@ import { Page } from "@playwright/test"; +import { expect } from "@reearth-cms/e2e/utils"; + export async function createWorkspace(page: Page) { await page.getByRole("button", { name: "Create a Workspace" }).click(); await page.getByLabel("Workspace name").click(); From 545707c6b0790c883e616e09c1f4c82ff12f9ecc Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 18:06:21 +0900 Subject: [PATCH 22/31] move handleFieldForm --- web/e2e/project/schema.spec.ts | 10 +--------- web/e2e/project/utils/field.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 web/e2e/project/utils/field.ts diff --git a/web/e2e/project/schema.spec.ts b/web/e2e/project/schema.spec.ts index 1d78d19f68..1f65658d55 100644 --- a/web/e2e/project/schema.spec.ts +++ b/web/e2e/project/schema.spec.ts @@ -2,19 +2,11 @@ import { Page } from "@playwright/test"; import { expect, test } from "@reearth-cms/e2e/utils"; +import { handleFieldForm } from "./utils/field"; import { crudGroup } from "./utils/group"; import { createModel, crudModel } from "./utils/model"; import { createProject, deleteProject } from "./utils/project"; -async function handleFieldForm(page: Page, name: string, key = name) { - await page.getByLabel("Display name").click(); - await page.getByLabel("Display name").fill(name); - await page.getByLabel("Settings").locator("#key").click(); - await page.getByLabel("Settings").locator("#key").fill(key); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByText(`${name} #${key}`)).toBeVisible(); -} - async function deleteField(page: Page, name: string, key = name) { await page.getByLabel("delete").locator("svg").click(); await page.getByRole("button", { name: "OK" }).click(); diff --git a/web/e2e/project/utils/field.ts b/web/e2e/project/utils/field.ts new file mode 100644 index 0000000000..fa26705754 --- /dev/null +++ b/web/e2e/project/utils/field.ts @@ -0,0 +1,12 @@ +import { Page } from "@playwright/test"; + +import { expect } from "@reearth-cms/e2e/utils"; + +export async function handleFieldForm(page: Page, name: string, key = name) { + await page.getByLabel("Display name").click(); + await page.getByLabel("Display name").fill(name); + await page.getByLabel("Settings").locator("#key").click(); + await page.getByLabel("Settings").locator("#key").fill(key); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByText(`${name} #${key}`)).toBeVisible(); +} From 26f72bc2641f1ad5b7883bbfb8d14937664d061d Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 18:52:17 +0900 Subject: [PATCH 23/31] move createRequest func --- web/e2e/project/request.spec.ts | 28 ++++++---------------------- web/e2e/project/utils/item.ts | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 web/e2e/project/utils/item.ts diff --git a/web/e2e/project/request.spec.ts b/web/e2e/project/request.spec.ts index f8c5fc98f1..a4c127c257 100644 --- a/web/e2e/project/request.spec.ts +++ b/web/e2e/project/request.spec.ts @@ -1,29 +1,13 @@ -import { Page } from "@playwright/test"; - import { expect, test } from "@reearth-cms/e2e/utils"; import { crudComment } from "./utils/comment"; +import { createRequest } from "./utils/item"; import { createModel } from "./utils/model"; import { createProject, deleteProject } from "./utils/project"; import { createWorkspace, deleteWorkspace } from "./utils/workspace"; const requestTitle = "title"; -async function createRequest(page: Page, reviewerName: string) { - await page.getByText("Content").click(); - await page.getByRole("button", { name: "plus New Item" }).click(); - await page.getByRole("button", { name: "Save" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); - await page.getByRole("button", { name: "New Request" }).click(); - await page.getByLabel("Title").click(); - await page.getByLabel("Title").fill(requestTitle); - await page.locator(".ant-select-selection-overflow").click(); - - await page.getByTitle(reviewerName).locator("div").click(); - await page.getByRole("button", { name: "OK" }).click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully created request!"); -} - test("Request creating, searching, updating reviewer, and approving has succeeded", async ({ reearth, page, @@ -34,7 +18,7 @@ test("Request creating, searching, updating reviewer, and approving has succeede await createWorkspace(page); await createProject(page); await createModel(page); - await createRequest(page, username); + await createRequest(page, username, requestTitle); await page.getByText("Request", { exact: true }).click(); await expect(page.getByText(requestTitle, { exact: true })).toBeVisible(); @@ -53,7 +37,7 @@ test("Request creating, searching, updating reviewer, and approving has succeede await page.getByRole("button", { name: "Assign to" }).click(); await page.getByLabel("close-circle").locator("svg").click(); await page.locator(".ant-select-selection-overflow").click(); - await page.getByText(username).nth(3).click(); + await page.locator(".ant-select-item").click(); await page.getByRole("heading", { name: "Reviewer" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated request!"); await page.getByRole("button", { name: "Approve" }).click(); @@ -76,7 +60,7 @@ test("Request closing and reopening has succeeded", async ({ reearth, page }) => await createWorkspace(page); await createProject(page); await createModel(page); - await createRequest(page, username); + await createRequest(page, username, requestTitle); await page.getByText("Request", { exact: true }).click(); await expect(page.getByText(requestTitle, { exact: true })).toBeVisible(); @@ -125,7 +109,7 @@ test("Comment CRUD on edit page has succeeded", async ({ reearth, page }) => { await createWorkspace(page); await createProject(page); await createModel(page); - await createRequest(page, username); + await createRequest(page, username, requestTitle); await page.getByText("Request", { exact: true }).click(); await expect(page.getByText(requestTitle, { exact: true })).toBeVisible(); @@ -158,7 +142,7 @@ test("Comment CRUD on Request page has succeeded", async ({ reearth, page }) => await createWorkspace(page); await createProject(page); await createModel(page); - await createRequest(page, username); + await createRequest(page, username, requestTitle); await page.getByText("Request", { exact: true }).click(); await page.getByRole("button", { name: "0" }).click(); diff --git a/web/e2e/project/utils/item.ts b/web/e2e/project/utils/item.ts new file mode 100644 index 0000000000..333b3804d2 --- /dev/null +++ b/web/e2e/project/utils/item.ts @@ -0,0 +1,18 @@ +import { Page } from "@playwright/test"; + +import { expect } from "@reearth-cms/e2e/utils"; + +export async function createRequest(page: Page, reviewerName: string, title: string) { + await page.getByText("Content").click(); + await page.getByRole("button", { name: "plus New Item" }).click(); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await page.getByRole("button", { name: "New Request" }).click(); + await page.getByLabel("Title").click(); + await page.getByLabel("Title").fill(title); + await page.locator(".ant-select-selection-overflow").click(); + + await page.getByTitle(reviewerName).locator("div").click(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created request!"); +} From adf3e19b82a5978af70434c0374f700d65ccc5ad Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 18:52:24 +0900 Subject: [PATCH 24/31] add: content test --- web/e2e/project/content.spec.ts | 165 ++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 web/e2e/project/content.spec.ts diff --git a/web/e2e/project/content.spec.ts b/web/e2e/project/content.spec.ts new file mode 100644 index 0000000000..de5a502f5d --- /dev/null +++ b/web/e2e/project/content.spec.ts @@ -0,0 +1,165 @@ +import { expect, test } from "@reearth-cms/e2e/utils"; + +import { crudComment } from "./utils/comment"; +import { handleFieldForm } from "./utils/field"; +import { createRequest } from "./utils/item"; +import { createModel } from "./utils/model"; +import { createProject, deleteProject } from "./utils/project"; +import { createWorkspace, deleteWorkspace } from "./utils/workspace"; + +test("Item CRUD and searching has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + await createModel(page); + await page + .locator("li") + .filter({ hasText: "TextHeading and titles, one-" }) + .locator("div") + .first() + .click(); + await handleFieldForm(page, "text"); + await page.getByText("Content").click(); + await page.getByRole("button", { name: "plus New Item" }).click(); + await page.getByLabel("text").click(); + await page.getByLabel("text").fill("text"); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await page.getByLabel("Back").click(); + await expect(page.getByRole("cell", { name: "text", exact: true })).toBeVisible(); + await page.getByPlaceholder("Please enter").click(); + await page.getByPlaceholder("Please enter").fill("no field"); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByRole("cell", { name: "text", exact: true })).not.toBeVisible(); + await page.getByPlaceholder("Please enter").fill(""); + await page.getByRole("button", { name: "search" }).click(); + await expect(page.getByRole("cell", { name: "text", exact: true })).toBeVisible(); + await page.getByRole("link", { name: "edit", exact: true }).click(); + await page.getByLabel("text").click(); + + await page.getByLabel("text").click(); + await page.getByLabel("text").press("Home"); + await page.getByLabel("text").fill("new text"); + await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated Item!"); + await page.getByLabel("Back").click(); + await expect(page.getByRole("cell", { name: "new text" })).toBeVisible(); + await page.getByLabel("", { exact: true }).check(); + await page.getByText("Delete").click(); + await expect(page.getByRole("alert").last()).toContainText( + "One or more items were successfully deleted!", + ); + await expect(page.getByRole("cell", { name: "new text" })).not.toBeVisible(); + await deleteProject(page); +}); + +test("Publishing and Unpublishing item has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + await createModel(page); + await page + .locator("li") + .filter({ hasText: "TextHeading and titles, one-" }) + .locator("div") + .first() + .click(); + await handleFieldForm(page, "text"); + await page.getByText("Content").click(); + await page.getByRole("button", { name: "plus New Item" }).click(); + await page.getByLabel("text").click(); + await page.getByLabel("text").fill("text"); + await page.getByRole("button", { name: "Save" }).click(); + await page.getByRole("button", { name: "Publish" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully published items!"); + await expect(page.getByText("PUBLIC")).toBeVisible(); + await page.getByLabel("Back").click(); + await expect(page.getByText("PUBLIC")).toBeVisible(); + await page.getByLabel("", { exact: true }).check(); + await page.getByText("Unpublish").click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully unpublished items!"); + await expect(page.getByText("DRAFT")).toBeVisible(); + await page.getByRole("link", { name: "edit", exact: true }).click(); + await expect(page.getByText("DRAFT")).toBeVisible(); + await page.getByRole("button", { name: "Publish" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully published items!"); + await expect(page.getByText("PUBLIC")).toBeVisible(); + await page.getByRole("button", { name: "ellipsis" }).click(); + await page.getByText("Unpublish").click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully unpublished items!"); + await expect(page.getByText("DRAFT")).toBeVisible(); + await page.getByLabel("Back").click(); + await expect(page.getByText("DRAFT")).toBeVisible(); + await deleteProject(page); +}); + +const requestTitle = "title"; + +test("Creating a new request and adding to request has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + const username = await page.locator("a").nth(1).locator("div").nth(2).locator("p").innerText(); + await createWorkspace(page); + await createProject(page); + await createModel(page); + await createRequest(page, username, requestTitle); + await page.getByLabel("Back").click(); + await page.getByRole("button", { name: "plus New Item" }).click(); + await page.getByRole("button", { name: "Save" }).click(); + await page.getByRole("button", { name: "ellipsis" }).click(); + await page.getByText("Add to Request").click(); + await page.getByLabel("", { exact: true }).check(); + await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated Request!"); + await page.getByText("Request", { exact: true }).click(); + await page.getByRole("button", { name: "edit" }).click(); + await expect(page.getByRole("button", { name: "right e2e model name" }).first()).toBeVisible(); + await expect(page.getByRole("button", { name: "right e2e model name" }).nth(1)).toBeVisible(); + await deleteProject(page); + await deleteWorkspace(page); +}); + +test("Comment CRUD on Content page has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + await createModel(page); + await page + .locator("li") + .filter({ hasText: "TextHeading and titles, one-" }) + .locator("div") + .first() + .click(); + await handleFieldForm(page, "text"); + await page.getByText("Content").click(); + await page.getByRole("button", { name: "plus New Item" }).click(); + await page.getByLabel("text").click(); + await page.getByLabel("text").fill("text"); + await page.getByRole("button", { name: "Save" }).click(); + + await page.getByLabel("Back").click(); + + await page.getByRole("button", { name: "0" }).click(); + await expect(page.getByText("CommentsNo comments.Comment")).toBeVisible(); + await crudComment(page); + + await deleteProject(page); +}); + +test("Comment CRUD on edit page has succeeded", async ({ reearth, page }) => { + await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createProject(page); + await createModel(page); + await page + .locator("li") + .filter({ hasText: "TextHeading and titles, one-" }) + .locator("div") + .first() + .click(); + await handleFieldForm(page, "text"); + await page.getByText("Content").click(); + await page.getByRole("button", { name: "plus New Item" }).click(); + await page.getByLabel("text").click(); + await page.getByLabel("text").fill("text"); + await page.getByRole("button", { name: "Save" }).click(); + await page.getByLabel("message").click(); + await expect(page.getByText("CommentsComment")).toBeVisible(); + await crudComment(page); + await deleteProject(page); +}); From fa1f2041a6bb1280002c10306850326dc284ce19 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 19:37:17 +0900 Subject: [PATCH 25/31] fix some codes --- web/e2e/settings/account.spec.ts | 24 ++++++++-------- web/e2e/settings/integrations.spec.ts | 41 +++++++++++++-------------- web/e2e/settings/settings.spec.ts | 25 ++++++---------- 3 files changed, 40 insertions(+), 50 deletions(-) diff --git a/web/e2e/settings/account.spec.ts b/web/e2e/settings/account.spec.ts index 75d912e932..afb4e731e2 100644 --- a/web/e2e/settings/account.spec.ts +++ b/web/e2e/settings/account.spec.ts @@ -44,7 +44,7 @@ test("Language has updated from English to Japanese", async ({ reearth, page }) .filter({ hasText: "Service Language日本語日本語This" }) .getByRole("button") .click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); + await expect(page.getByRole("alert").last()).toContainText("言語設定の更新に成功しました。"); await expect(page.locator("#root")).toContainText("ホーム"); await page .locator("div") @@ -58,22 +58,13 @@ test("Language has updated from English to Japanese", async ({ reearth, page }) .filter({ hasText: "利用言語EnglishEnglishUI" }) .getByRole("button") .click(); - await expect(page.getByRole("alert").last()).toContainText("言語設定の更新に成功しました。"); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); }); -test("Language has updated from Auto to English", async ({ reearth, page }) => { +test("Language has updated from English to Auto", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); await page.getByText("Account").click(); - await page - .locator("div") - .filter({ hasText: /^AutoThis will change the UI language$/ }) - .locator("div") - .nth(3) - .click(); - await page.getByTitle("English").click(); - await page.locator("form").filter({ hasText: "Service" }).getByRole("button").click(); - await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); await page .locator("div") .filter({ hasText: /^EnglishThis will change the UI language$/ }) @@ -87,4 +78,13 @@ test("Language has updated from Auto to English", async ({ reearth, page }) => { .getByRole("button") .click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); + await page + .locator("div") + .filter({ hasText: /^AutoThis will change the UI language$/ }) + .locator("div") + .nth(3) + .click(); + await page.getByTitle("English").click(); + await page.locator("form").filter({ hasText: "Service" }).getByRole("button").click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); }); diff --git a/web/e2e/settings/integrations.spec.ts b/web/e2e/settings/integrations.spec.ts index 8047196a70..09175292b1 100644 --- a/web/e2e/settings/integrations.spec.ts +++ b/web/e2e/settings/integrations.spec.ts @@ -6,27 +6,27 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = await page.locator("div").filter({ hasText: "Create new integration" }).nth(4).click(); await page.getByLabel("Integration Name").click(); - await page.getByLabel("Integration Name").fill("name"); + await page.getByLabel("Integration Name").fill("e2e integration name"); await page.getByLabel("Description").click(); - await page.getByLabel("Description").fill("description"); + await page.getByLabel("Description").fill("e2e integration description"); await page.getByRole("button", { name: "Create" }).click(); + await page.locator("a").nth(3).click(); await page.getByText("Integrations", { exact: true }).click(); await page.getByRole("button", { name: "api Connect Integration" }).click(); await page .locator("div") - .filter({ hasText: /^name$/ }) + .filter({ hasText: /^e2e integration name$/ }) .click(); await page.getByRole("button", { name: "Connect", exact: true }).click(); await expect(page.getByRole("alert").last()).toContainText( "Successfully connected integration to the workspace!", ); - await expect(page.getByRole("cell", { name: "name", exact: true })).toBeVisible(); - await page - .getByRole("row", { name: "name READER kazuma setting" }) - .getByRole("cell") - .nth(4) - .click(); - await page.getByRole("row", { name: "name READER kazuma setting" }).locator("svg").click(); + await page.locator("a").nth(3).click(); + await expect(page.getByRole("cell", { name: "e2e integration name", exact: true })).toBeVisible(); + await page.getByPlaceholder("Please enter").click(); + await page.getByPlaceholder("Please enter").fill("e2e integration name"); + await page.getByRole("button", { name: "search" }).click(); + await page.getByRole("cell", { name: "setting" }).locator("svg").click(); await page .locator("div") .filter({ hasText: /^Reader$/ }) @@ -37,26 +37,25 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = await expect(page.getByRole("alert").last()).toContainText( "Successfully updated workspace integration!", ); - await expect(page.getByRole("cell", { name: "WRITER" }).nth(1)).toBeVisible(); + await page.locator("a").nth(3).click(); + await expect(page.getByRole("cell", { name: "WRITER" })).toBeVisible(); await page.getByPlaceholder("Please enter").click(); - await page.getByPlaceholder("Please enter").fill("namee"); + await page.getByPlaceholder("Please enter").fill("no integration"); await page.getByRole("button", { name: "search" }).click(); - await expect(page.getByRole("cell", { name: "name", exact: true })).not.toBeVisible(); + await expect( + page.getByRole("cell", { name: "e2e integration name", exact: true }), + ).not.toBeVisible(); await page.getByPlaceholder("Please enter").click(); - await page.getByPlaceholder("Please enter").fill("name"); + await page.getByPlaceholder("Please enter").fill("e2e integration name"); await page.getByRole("button", { name: "search" }).click(); - await expect(page.getByRole("cell", { name: "name", exact: true })).toBeVisible(); - await page - .getByRole("row", { name: "name WRITER kazuma setting" }) - .getByLabel("", { exact: true }) - .check(); + await expect(page.getByRole("cell", { name: "e2e integration name", exact: true })).toBeVisible(); + await page.getByLabel("", { exact: true }).check(); await page.getByText("Remove").click(); - await page.locator("a").nth(3).click(); await expect(page.getByRole("alert").last()).toContainText( "One or more integrations were successfully deleted!", ); await page.getByText("My Integrations").click(); - await page.getByText("namedescription").click(); + await page.getByText("e2e integration namee2e").click(); await page.getByRole("button", { name: "Remove Integration" }).click(); await page.getByRole("button", { name: "OK" }).click(); }); diff --git a/web/e2e/settings/settings.spec.ts b/web/e2e/settings/settings.spec.ts index 9104d2c845..8c59182305 100644 --- a/web/e2e/settings/settings.spec.ts +++ b/web/e2e/settings/settings.spec.ts @@ -1,7 +1,9 @@ +import { createWorkspace, deleteWorkspace } from "@reearth-cms/e2e/project/utils/workspace"; import { expect, test } from "@reearth-cms/e2e/utils"; test("Tiles CRUD has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createWorkspace(page); await page.getByText("Settings").click(); await page.getByRole("button", { name: "plus Add new Tiles option" }).click(); @@ -49,10 +51,12 @@ test("Tiles CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated"); await expect(page.getByText("url", { exact: true })).not.toBeVisible(); + await deleteWorkspace(page); }); test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await reearth.goto("/", { waitUntil: "domcontentloaded" }); + await createWorkspace(page); await page.getByText("Settings").click(); await expect(page.getByRole("switch")).toBeEnabled(); @@ -69,12 +73,7 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "OK" }).click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); - - await page - .locator( - "div:nth-child(9) > .css-1o8fsgp > div:last-child > .ant-card-actions > li:nth-child(2) > span > .anticon", - ) - .click(); + await page.getByLabel("edit").locator("svg").click(); await expect(page.locator("form")).toContainText("ArcGIS Terrain"); await page .locator("div") @@ -96,11 +95,7 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); await expect(page.getByText("name", { exact: true })).toBeVisible(); - await page - .locator( - "div:nth-child(9) > .css-1o8fsgp > div:last-child > .ant-card-actions > li:nth-child(2) > span > .anticon", - ) - .click(); + await page.getByLabel("edit").locator("svg").click(); await expect(page.locator("form")).toContainText("Cesium Ion"); await expect(page.getByLabel("Name")).toHaveValue("name"); await expect(page.getByLabel("Terrain Cesium Ion asset ID")).toHaveValue("id"); @@ -108,12 +103,7 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await expect(page.getByLabel("Terrain URL")).toHaveValue("http://terrain.com"); await expect(page.getByLabel("Image URL")).toHaveValue("http://image.com"); await page.getByLabel("Close", { exact: true }).click(); - - await page - .locator( - "div:nth-child(9) > .css-1o8fsgp > div:last-child > .ant-card-actions > li:nth-child(1) > span > .anticon", - ) - .click(); + await page.getByLabel("delete").locator("svg").click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); await expect(page.getByText("name", { exact: true })).not.toBeVisible(); @@ -123,4 +113,5 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); await expect(page.getByRole("switch")).toHaveAttribute("aria-checked", "false"); await expect(page.getByRole("button", { name: "plus Add new Terrain option" })).not.toBeVisible(); + await deleteWorkspace(page); }); From 95d8cc7b7f3fc6b2772bf7242dbef23610010cc8 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Tue, 27 Feb 2024 19:49:53 +0900 Subject: [PATCH 26/31] Revert "fix: synchronize account name with personal workspace name when updating account name" This reverts commit 388e67b5135da458c4bcc2ba20b12f56c551dc5c. --- web/src/components/molecules/Common/Header/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/components/molecules/Common/Header/index.tsx b/web/src/components/molecules/Common/Header/index.tsx index e1f33c7ab4..8d884ed761 100644 --- a/web/src/components/molecules/Common/Header/index.tsx +++ b/web/src/components/molecules/Common/Header/index.tsx @@ -130,7 +130,11 @@ const HeaderMolecule: React.FC = ({ {t("Re:Earth CMS")} )} - + {currentProject?.name && ( / From 57f108724bb962b3d473d5144bd336d3e3b83fb0 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Wed, 28 Feb 2024 11:12:21 +0900 Subject: [PATCH 27/31] fix: request state --- .../components/organisms/Project/Request/RequestDetails/hooks.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/web/src/components/organisms/Project/Request/RequestDetails/hooks.ts b/web/src/components/organisms/Project/Request/RequestDetails/hooks.ts index e76d87c971..256928c5f5 100644 --- a/web/src/components/organisms/Project/Request/RequestDetails/hooks.ts +++ b/web/src/components/organisms/Project/Request/RequestDetails/hooks.ts @@ -29,6 +29,7 @@ export default () => { const { data: rawRequest, loading: requestLoading } = useGetRequestQuery({ variables: { requestId: requestId ?? "" }, skip: !requestId, + fetchPolicy: "cache-and-network", }); const me: User | undefined = useMemo(() => { From 70d9b31c84f537f553aa9ac7d1e8bbfc8e1a505b Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Wed, 28 Feb 2024 11:57:15 +0900 Subject: [PATCH 28/31] add: notification closing --- web/e2e/common/notification.ts | 9 +++++++++ web/e2e/general/project.spec.ts | 6 ++++++ web/e2e/general/workspace.spec.ts | 6 ++++++ web/e2e/project/accessibility.spec.ts | 2 ++ web/e2e/project/asset.spec.ts | 8 ++++++++ web/e2e/project/content.spec.ts | 22 +++++++++++++++++++++- web/e2e/project/overview.spec.ts | 4 ++++ web/e2e/project/request.spec.ts | 9 +++++++++ web/e2e/project/schema.spec.ts | 4 ++++ web/e2e/project/utils/comment.ts | 4 ++++ web/e2e/project/utils/group.ts | 4 ++++ web/e2e/project/utils/item.ts | 3 +++ web/e2e/project/utils/model.ts | 4 ++++ web/e2e/project/utils/project.ts | 4 ++++ web/e2e/project/utils/workspace.ts | 3 +++ web/e2e/settings/account.spec.ts | 7 +++++++ web/e2e/settings/integrations.spec.ts | 4 ++++ web/e2e/settings/member.spec.ts | 2 ++ web/e2e/settings/myIntegrations.spec.ts | 10 ++++++++++ web/e2e/settings/settings.spec.ts | 8 ++++++++ 20 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 web/e2e/common/notification.ts diff --git a/web/e2e/common/notification.ts b/web/e2e/common/notification.ts new file mode 100644 index 0000000000..e5c229e1f7 --- /dev/null +++ b/web/e2e/common/notification.ts @@ -0,0 +1,9 @@ +import { Page } from "@playwright/test"; + +export async function closeNotification(page: Page) { + await page + .locator(".ant-notification-notice") + .last() + .locator(".ant-notification-notice-close") + .click(); +} diff --git a/web/e2e/general/project.spec.ts b/web/e2e/general/project.spec.ts index e0ff529397..d7ae81eaff 100644 --- a/web/e2e/general/project.spec.ts +++ b/web/e2e/general/project.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; test("Project CRUD and searching has succeeded", async ({ reearth, page }) => { @@ -11,10 +12,12 @@ test("Project CRUD and searching has succeeded", async ({ reearth, page }) => { await page.getByLabel("Project description").fill("project description"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("input: createProject invalid alias"); + await closeNotification(page); await page.getByLabel("Project alias").click(); await page.getByLabel("Project alias").fill("project-alias"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created project!"); + await closeNotification(page); await expect(page.getByText("project name", { exact: true })).toBeVisible(); await expect(page.getByText("project description", { exact: true })).toBeVisible(); @@ -35,6 +38,7 @@ test("Project CRUD and searching has succeeded", async ({ reearth, page }) => { await page.getByLabel("Description").fill("new project description"); await page.locator("form").getByRole("button", { name: "Save changes" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated project!"); + await closeNotification(page); await expect(page.locator("#root")).toContainText("Project Settings / new project name"); await expect(page.locator("header")).toContainText("new project name"); @@ -45,6 +49,7 @@ test("Project CRUD and searching has succeeded", async ({ reearth, page }) => { "false", ); await expect(page.getByRole("alert").last()).toContainText("Successfully updated request roles!"); + await closeNotification(page); await page.getByText("Overview").click(); await expect(page.locator("#root")).toContainText("new project name"); @@ -53,5 +58,6 @@ test("Project CRUD and searching has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "Delete Project" }).click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); + await closeNotification(page); await expect(page.getByText("new project name", { exact: true })).not.toBeVisible(); }); diff --git a/web/e2e/general/workspace.spec.ts b/web/e2e/general/workspace.spec.ts index 3123cfc405..4fd3f5fbd2 100644 --- a/web/e2e/general/workspace.spec.ts +++ b/web/e2e/general/workspace.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; test("Workspace CRUD has succeeded", async ({ reearth, page }) => { @@ -7,17 +8,20 @@ test("Workspace CRUD has succeeded", async ({ reearth, page }) => { await page.getByLabel("Workspace name").fill("workspace name"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created workspace!"); + await closeNotification(page); await page.getByText("Workspace", { exact: true }).click(); await page.getByLabel("Workspace Name").click(); await page.getByLabel("Workspace Name").fill("new workspace name"); await page.getByRole("button", { name: "Save changes" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await closeNotification(page); await expect(page.locator("header")).toContainText("new workspace name"); await page.getByRole("button", { name: "Remove Workspace" }).click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); + await closeNotification(page); await page.locator("a").first().click(); await expect(page.getByText("new workspace name")).not.toBeVisible(); @@ -31,9 +35,11 @@ test("Workspace Creating from tab has succeeded", async ({ reearth, page }) => { await page.getByLabel("Workspace name").fill("workspace name"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created workspace!"); + await closeNotification(page); await page.getByText("Workspace", { exact: true }).click(); await page.getByRole("button", { name: "Remove Workspace" }).click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); + await closeNotification(page); }); diff --git a/web/e2e/project/accessibility.spec.ts b/web/e2e/project/accessibility.spec.ts index 51cb604678..51fd9f80db 100644 --- a/web/e2e/project/accessibility.spec.ts +++ b/web/e2e/project/accessibility.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; import { createProject, deleteProject } from "./utils/project"; @@ -16,6 +17,7 @@ test("Update settings on Accesibility page has succeeded", async ({ reearth, pag await expect(page.getByRole("alert").last()).toContainText( "Successfully updated publication settings!", ); + await closeNotification(page); await expect(page.locator("form")).toContainText("Public"); await expect(page.getByRole("textbox")).toHaveValue("new-e2e-project-alias"); await expect(page.getByRole("switch")).toHaveAttribute("aria-checked", "true"); diff --git a/web/e2e/project/asset.spec.ts b/web/e2e/project/asset.spec.ts index ffbdc70832..c3006c2d32 100644 --- a/web/e2e/project/asset.spec.ts +++ b/web/e2e/project/asset.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; import { crudComment } from "./utils/comment"; @@ -18,6 +19,7 @@ test("Asset CRUD and Searching has succeeded", async ({ reearth, page }) => { await page.getByPlaceholder("Please input a valid URL").fill(uploadFileUrl); await page.getByRole("button", { name: "Upload", exact: true }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); + await closeNotification(page); await expect(page.getByText(uploadFileName)).toBeVisible(); await page.getByPlaceholder("Please enter").click(); await page.getByPlaceholder("Please enter").fill("no asset"); @@ -36,6 +38,7 @@ test("Asset CRUD and Searching has succeeded", async ({ reearth, page }) => { await page.getByText("GEOJSON/KML/CZML").click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Asset was successfully updated!"); + await closeNotification(page); await page.getByLabel("Back").click(); await page.getByLabel("", { exact: true }).check(); await page.getByText("Delete").click(); @@ -43,6 +46,7 @@ test("Asset CRUD and Searching has succeeded", async ({ reearth, page }) => { await expect(page.getByRole("alert").last()).toContainText( "One or more assets were successfully deleted!", ); + await closeNotification(page); await deleteProject(page); }); @@ -58,6 +62,7 @@ test("Donwloading asset has succeeded", async ({ reearth, page }) => { await page.getByPlaceholder("Please input a valid URL").fill(uploadFileUrl); await page.getByRole("button", { name: "Upload", exact: true }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); + await closeNotification(page); await expect(page.getByText(uploadFileName)).toBeVisible(); await page.getByLabel("", { exact: true }).check(); @@ -78,6 +83,7 @@ test("Donwloading asset has succeeded", async ({ reearth, page }) => { await expect(page.getByRole("alert").last()).toContainText( "One or more assets were successfully deleted!", ); + await closeNotification(page); await deleteProject(page); }); @@ -92,6 +98,7 @@ test("Comment CRUD on edit page has succeeded", async ({ reearth, page }) => { await page.getByPlaceholder("Please input a valid URL").fill(uploadFileUrl); await page.getByRole("button", { name: "Upload", exact: true }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); + await closeNotification(page); await expect(page.getByText(uploadFileName)).toBeVisible(); await page.getByRole("cell", { name: "edit" }).locator("svg").click(); @@ -112,6 +119,7 @@ test("Comment CRUD on Asset page has succeeded", async ({ reearth, page }) => { await page.getByPlaceholder("Please input a valid URL").fill(uploadFileUrl); await page.getByRole("button", { name: "Upload", exact: true }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully added asset!"); + await closeNotification(page); await expect(page.getByText(uploadFileName)).toBeVisible(); await page.getByRole("button", { name: "0" }).click(); diff --git a/web/e2e/project/content.spec.ts b/web/e2e/project/content.spec.ts index de5a502f5d..5fae73b1f3 100644 --- a/web/e2e/project/content.spec.ts +++ b/web/e2e/project/content.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; import { crudComment } from "./utils/comment"; @@ -18,12 +19,14 @@ test("Item CRUD and searching has succeeded", async ({ reearth, page }) => { .first() .click(); await handleFieldForm(page, "text"); + await closeNotification(page); await page.getByText("Content").click(); await page.getByRole("button", { name: "plus New Item" }).click(); await page.getByLabel("text").click(); await page.getByLabel("text").fill("text"); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await closeNotification(page); await page.getByLabel("Back").click(); await expect(page.getByRole("cell", { name: "text", exact: true })).toBeVisible(); await page.getByPlaceholder("Please enter").click(); @@ -37,10 +40,10 @@ test("Item CRUD and searching has succeeded", async ({ reearth, page }) => { await page.getByLabel("text").click(); await page.getByLabel("text").click(); - await page.getByLabel("text").press("Home"); await page.getByLabel("text").fill("new text"); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated Item!"); + await closeNotification(page); await page.getByLabel("Back").click(); await expect(page.getByRole("cell", { name: "new text" })).toBeVisible(); await page.getByLabel("", { exact: true }).check(); @@ -48,6 +51,7 @@ test("Item CRUD and searching has succeeded", async ({ reearth, page }) => { await expect(page.getByRole("alert").last()).toContainText( "One or more items were successfully deleted!", ); + await closeNotification(page); await expect(page.getByRole("cell", { name: "new text" })).not.toBeVisible(); await deleteProject(page); }); @@ -63,28 +67,35 @@ test("Publishing and Unpublishing item has succeeded", async ({ reearth, page }) .first() .click(); await handleFieldForm(page, "text"); + await closeNotification(page); await page.getByText("Content").click(); await page.getByRole("button", { name: "plus New Item" }).click(); await page.getByLabel("text").click(); await page.getByLabel("text").fill("text"); await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await closeNotification(page); await page.getByRole("button", { name: "Publish" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully published items!"); + await closeNotification(page); await expect(page.getByText("PUBLIC")).toBeVisible(); await page.getByLabel("Back").click(); await expect(page.getByText("PUBLIC")).toBeVisible(); await page.getByLabel("", { exact: true }).check(); await page.getByText("Unpublish").click(); await expect(page.getByRole("alert").last()).toContainText("Successfully unpublished items!"); + await closeNotification(page); await expect(page.getByText("DRAFT")).toBeVisible(); await page.getByRole("link", { name: "edit", exact: true }).click(); await expect(page.getByText("DRAFT")).toBeVisible(); await page.getByRole("button", { name: "Publish" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully published items!"); + await closeNotification(page); await expect(page.getByText("PUBLIC")).toBeVisible(); await page.getByRole("button", { name: "ellipsis" }).click(); await page.getByText("Unpublish").click(); await expect(page.getByRole("alert").last()).toContainText("Successfully unpublished items!"); + await closeNotification(page); await expect(page.getByText("DRAFT")).toBeVisible(); await page.getByLabel("Back").click(); await expect(page.getByText("DRAFT")).toBeVisible(); @@ -103,11 +114,14 @@ test("Creating a new request and adding to request has succeeded", async ({ reea await page.getByLabel("Back").click(); await page.getByRole("button", { name: "plus New Item" }).click(); await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await closeNotification(page); await page.getByRole("button", { name: "ellipsis" }).click(); await page.getByText("Add to Request").click(); await page.getByLabel("", { exact: true }).check(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated Request!"); + await closeNotification(page); await page.getByText("Request", { exact: true }).click(); await page.getByRole("button", { name: "edit" }).click(); await expect(page.getByRole("button", { name: "right e2e model name" }).first()).toBeVisible(); @@ -127,11 +141,14 @@ test("Comment CRUD on Content page has succeeded", async ({ reearth, page }) => .first() .click(); await handleFieldForm(page, "text"); + await closeNotification(page); await page.getByText("Content").click(); await page.getByRole("button", { name: "plus New Item" }).click(); await page.getByLabel("text").click(); await page.getByLabel("text").fill("text"); await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await closeNotification(page); await page.getByLabel("Back").click(); @@ -153,11 +170,14 @@ test("Comment CRUD on edit page has succeeded", async ({ reearth, page }) => { .first() .click(); await handleFieldForm(page, "text"); + await closeNotification(page); await page.getByText("Content").click(); await page.getByRole("button", { name: "plus New Item" }).click(); await page.getByLabel("text").click(); await page.getByLabel("text").fill("text"); await page.getByRole("button", { name: "Save" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await closeNotification(page); await page.getByLabel("message").click(); await expect(page.getByText("CommentsComment")).toBeVisible(); await crudComment(page); diff --git a/web/e2e/project/overview.spec.ts b/web/e2e/project/overview.spec.ts index fa18a03311..021190fe22 100644 --- a/web/e2e/project/overview.spec.ts +++ b/web/e2e/project/overview.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; import { createProject, deleteProject } from "./utils/project"; @@ -18,6 +19,7 @@ test("Model CRUD on Overview page has succeeded", async ({ reearth, page }) => { await page.getByLabel("Model key").fill("model-key"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created model!"); + await closeNotification(page); await expect(page.getByTitle("model name")).toBeVisible(); await expect(page.getByText("#model-key")).toBeVisible(); await expect(page.getByRole("menuitem", { name: "model name" }).locator("span")).toBeVisible(); @@ -32,12 +34,14 @@ test("Model CRUD on Overview page has succeeded", async ({ reearth, page }) => { await page.getByLabel("Model key").fill("new-model-key"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated model!"); + await closeNotification(page); await expect(page.locator("#root")).toContainText("new model name"); await expect(page.locator("#root")).toContainText("new model description"); await page.getByRole("list").locator("a").click(); await page.getByText("Delete").click(); await page.getByRole("button", { name: "Delete Model" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted model!"); + await closeNotification(page); await expect(page.locator("#root")).not.toContainText("new model name"); await deleteProject(page); diff --git a/web/e2e/project/request.spec.ts b/web/e2e/project/request.spec.ts index a4c127c257..37f6db5197 100644 --- a/web/e2e/project/request.spec.ts +++ b/web/e2e/project/request.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; import { crudComment } from "./utils/comment"; @@ -40,8 +41,10 @@ test("Request creating, searching, updating reviewer, and approving has succeede await page.locator(".ant-select-item").click(); await page.getByRole("heading", { name: "Reviewer" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated request!"); + await closeNotification(page); await page.getByRole("button", { name: "Approve" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully approved request!"); + await closeNotification(page); await expect(page.getByText(requestTitle, { exact: true })).not.toBeVisible(); await page.getByRole("cell", { name: "State filter" }).getByRole("button").click(); await page.getByRole("menuitem", { name: "WAITING" }).getByLabel("").uncheck(); @@ -71,6 +74,7 @@ test("Request closing and reopening has succeeded", async ({ reearth, page }) => await expect(page.getByRole("alert").last()).toContainText( "One or more requests were successfully closed!", ); + await closeNotification(page); await expect(page.getByText(requestTitle, { exact: true })).not.toBeVisible(); await expect(page.getByText("WAITING")).not.toBeVisible(); @@ -83,6 +87,7 @@ test("Request closing and reopening has succeeded", async ({ reearth, page }) => await expect(page.getByText("Closed", { exact: true })).toBeVisible(); await page.getByRole("button", { name: "Reopen" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated request!"); + await closeNotification(page); await page.getByLabel("Back").click(); await expect(page.getByText("title", { exact: true })).toBeVisible(); await expect(page.getByText("WAITING")).toBeVisible(); @@ -91,6 +96,7 @@ test("Request closing and reopening has succeeded", async ({ reearth, page }) => await expect(page.getByRole("alert").last()).toContainText( "One or more requests were successfully closed!", ); + await closeNotification(page); await page.getByRole("cell", { name: "State filter" }).getByRole("button").click(); await page.getByRole("menuitem", { name: "WAITING" }).getByLabel("").uncheck(); await page.getByRole("button", { name: "OK" }).click(); @@ -120,15 +126,18 @@ test("Comment CRUD on edit page has succeeded", async ({ reearth, page }) => { await page.locator("#content").fill("comment"); await page.getByRole("button", { name: "Comment" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created comment!"); + await closeNotification(page); await expect(page.getByText("comment").nth(1)).toBeVisible(); await page.getByLabel("edit").locator("svg").click(); await page.locator("textarea").filter({ hasText: "comment" }).click(); await page.locator("textarea").filter({ hasText: "comment" }).fill("new comment"); await page.getByLabel("check").locator("svg").first().click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated comment!"); + await closeNotification(page); await expect(page.getByText("new comment").nth(1)).toBeVisible(); await page.getByLabel("delete").locator("svg").click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted comment!"); + await closeNotification(page); await expect(page.getByText("new comment").nth(1)).not.toBeVisible(); await deleteProject(page); diff --git a/web/e2e/project/schema.spec.ts b/web/e2e/project/schema.spec.ts index 1f65658d55..7882f36a47 100644 --- a/web/e2e/project/schema.spec.ts +++ b/web/e2e/project/schema.spec.ts @@ -1,5 +1,6 @@ import { Page } from "@playwright/test"; +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; import { handleFieldForm } from "./utils/field"; @@ -11,6 +12,7 @@ async function deleteField(page: Page, name: string, key = name) { await page.getByLabel("delete").locator("svg").click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.locator("body")).toContainText("Successfully deleted field!"); + await closeNotification(page); await expect(page.getByText(`${name} #${key}`)).not.toBeVisible(); } @@ -40,9 +42,11 @@ test("Text field CRUD has succeeded", async ({ reearth, page }) => { .click(); await handleFieldForm(page, "text"); await expect(page.getByRole("alert").last()).toContainText("Successfully created field!"); + await closeNotification(page); await page.getByRole("img", { name: "ellipsis" }).locator("svg").click(); await handleFieldForm(page, "new text", "new-text"); await expect(page.getByRole("alert").last()).toContainText("Successfully updated field!"); + await closeNotification(page); await deleteField(page, "new text", "new-text"); await deleteProject(page); diff --git a/web/e2e/project/utils/comment.ts b/web/e2e/project/utils/comment.ts index 9c8d23df44..501d2597ef 100644 --- a/web/e2e/project/utils/comment.ts +++ b/web/e2e/project/utils/comment.ts @@ -1,5 +1,6 @@ import { Page } from "@playwright/test"; +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect } from "@reearth-cms/e2e/utils"; async function createComment(page: Page) { @@ -7,6 +8,7 @@ async function createComment(page: Page) { await page.locator("#content").fill("comment"); await page.getByRole("button", { name: "Comment" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created comment!"); + await closeNotification(page); await expect(page.getByRole("main")).toContainText("comment"); } @@ -16,12 +18,14 @@ async function updateComment(page: Page) { await page.locator("textarea").filter({ hasText: "comment" }).fill("new comment"); await page.getByLabel("check").locator("svg").first().click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated comment!"); + await closeNotification(page); await expect(page.getByRole("main")).toContainText("new comment"); } async function deleteComment(page: Page) { await page.getByLabel("delete").locator("svg").click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted comment!"); + await closeNotification(page); await expect(page.getByRole("main")).not.toContainText("new comment"); } diff --git a/web/e2e/project/utils/group.ts b/web/e2e/project/utils/group.ts index fa90885acd..907c096cc7 100644 --- a/web/e2e/project/utils/group.ts +++ b/web/e2e/project/utils/group.ts @@ -1,5 +1,6 @@ import { Page } from "@playwright/test"; +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect } from "@reearth-cms/e2e/utils"; async function createGroup(page: Page) { @@ -11,6 +12,7 @@ async function createGroup(page: Page) { await page.getByLabel("Group key").fill("e2e-group-key"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created group!"); + await closeNotification(page); await page.getByText("e2e group name").click(); await expect(page.getByTitle("e2e group name")).toBeVisible(); await expect(page.getByText("#e2e-group-key")).toBeVisible(); @@ -27,6 +29,7 @@ async function updateGroup(page: Page) { await page.getByLabel("Update Group").locator("#key").fill("new-e2e-group-key"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated group!"); + await closeNotification(page); await expect(page.getByTitle(updateGroupName)).toBeVisible(); await expect(page.getByText("#new-e2e-group-key")).toBeVisible(); await expect(page.getByRole("menuitem", { name: updateGroupName }).locator("span")).toBeVisible(); @@ -37,6 +40,7 @@ async function deleteGroup(page: Page) { await page.getByText("Delete").click(); await page.getByRole("button", { name: "Delete Group" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted group!"); + await closeNotification(page); await expect(page.getByTitle(updateGroupName)).not.toBeVisible(); } diff --git a/web/e2e/project/utils/item.ts b/web/e2e/project/utils/item.ts index 333b3804d2..20f44eefb0 100644 --- a/web/e2e/project/utils/item.ts +++ b/web/e2e/project/utils/item.ts @@ -1,5 +1,6 @@ import { Page } from "@playwright/test"; +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect } from "@reearth-cms/e2e/utils"; export async function createRequest(page: Page, reviewerName: string, title: string) { @@ -7,6 +8,7 @@ export async function createRequest(page: Page, reviewerName: string, title: str await page.getByRole("button", { name: "plus New Item" }).click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created Item!"); + await closeNotification(page); await page.getByRole("button", { name: "New Request" }).click(); await page.getByLabel("Title").click(); await page.getByLabel("Title").fill(title); @@ -15,4 +17,5 @@ export async function createRequest(page: Page, reviewerName: string, title: str await page.getByTitle(reviewerName).locator("div").click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created request!"); + await closeNotification(page); } diff --git a/web/e2e/project/utils/model.ts b/web/e2e/project/utils/model.ts index 6ccefc8b1b..11dd002636 100644 --- a/web/e2e/project/utils/model.ts +++ b/web/e2e/project/utils/model.ts @@ -1,5 +1,6 @@ import { Page } from "@playwright/test"; +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect } from "@reearth-cms/e2e/utils"; export async function createModel(page: Page) { @@ -11,6 +12,7 @@ export async function createModel(page: Page) { await page.getByLabel("Model key").fill("e2e-model-key"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created model!"); + await closeNotification(page); await expect(page.getByTitle("e2e model name")).toBeVisible(); await expect(page.getByText("#e2e-model-key")).toBeVisible(); await expect( @@ -29,6 +31,7 @@ async function updateModel(page: Page) { await page.getByLabel("Update Model").locator("#key").fill("new-e2e-model-key"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated model!"); + await closeNotification(page); await expect(page.getByTitle(updateModelName)).toBeVisible(); await expect(page.getByText("#new-e2e-model-key")).toBeVisible(); await expect(page.getByRole("menuitem", { name: updateModelName }).locator("span")).toBeVisible(); @@ -39,6 +42,7 @@ async function deleteModel(page: Page) { await page.getByText("Delete").click(); await page.getByRole("button", { name: "Delete Model" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted model!"); + await closeNotification(page); await expect(page.getByTitle(updateModelName)).not.toBeVisible(); } diff --git a/web/e2e/project/utils/project.ts b/web/e2e/project/utils/project.ts index d3e2608188..a16e09ab7d 100644 --- a/web/e2e/project/utils/project.ts +++ b/web/e2e/project/utils/project.ts @@ -1,5 +1,6 @@ import { Page } from "@playwright/test"; +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect } from "@reearth-cms/e2e/utils"; export async function createProject(page: Page) { @@ -11,6 +12,8 @@ export async function createProject(page: Page) { await page.getByLabel("Project description").click(); await page.getByLabel("Project description").fill("e2e project description"); await page.getByRole("button", { name: "OK" }).click(); + await expect(page.getByRole("alert").last()).toContainText("Successfully created project!"); + await closeNotification(page); await page.getByText("e2e project name", { exact: true }).click(); } @@ -19,4 +22,5 @@ export async function deleteProject(page: Page) { await page.getByRole("button", { name: "Delete Project" }).click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted project!"); + await closeNotification(page); } diff --git a/web/e2e/project/utils/workspace.ts b/web/e2e/project/utils/workspace.ts index b5c512c5c7..a8d1cea040 100644 --- a/web/e2e/project/utils/workspace.ts +++ b/web/e2e/project/utils/workspace.ts @@ -1,5 +1,6 @@ import { Page } from "@playwright/test"; +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect } from "@reearth-cms/e2e/utils"; export async function createWorkspace(page: Page) { @@ -8,6 +9,7 @@ export async function createWorkspace(page: Page) { await page.getByLabel("Workspace name").fill("e2e workspace name"); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created workspace!"); + await closeNotification(page); } export async function deleteWorkspace(page: Page) { @@ -15,4 +17,5 @@ export async function deleteWorkspace(page: Page) { await page.getByRole("button", { name: "Remove Workspace" }).click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); + await closeNotification(page); } diff --git a/web/e2e/settings/account.spec.ts b/web/e2e/settings/account.spec.ts index afb4e731e2..ed3e318cf0 100644 --- a/web/e2e/settings/account.spec.ts +++ b/web/e2e/settings/account.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; test("Name and email has updated", async ({ reearth, page }) => { @@ -16,6 +17,7 @@ test("Name and email has updated", async ({ reearth, page }) => { .getByRole("button") .click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated user!"); + await closeNotification(page); await page.getByLabel("Account Name").click(); await page.getByLabel("Account Name").fill(username); @@ -27,6 +29,7 @@ test("Name and email has updated", async ({ reearth, page }) => { .getByRole("button") .click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated user!"); + await closeNotification(page); }); test("Language has updated from English to Japanese", async ({ reearth, page }) => { @@ -45,6 +48,7 @@ test("Language has updated from English to Japanese", async ({ reearth, page }) .getByRole("button") .click(); await expect(page.getByRole("alert").last()).toContainText("言語設定の更新に成功しました。"); + await closeNotification(page); await expect(page.locator("#root")).toContainText("ホーム"); await page .locator("div") @@ -59,6 +63,7 @@ test("Language has updated from English to Japanese", async ({ reearth, page }) .getByRole("button") .click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); + await closeNotification(page); }); test("Language has updated from English to Auto", async ({ reearth, page }) => { @@ -78,6 +83,7 @@ test("Language has updated from English to Auto", async ({ reearth, page }) => { .getByRole("button") .click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); + await closeNotification(page); await page .locator("div") .filter({ hasText: /^AutoThis will change the UI language$/ }) @@ -87,4 +93,5 @@ test("Language has updated from English to Auto", async ({ reearth, page }) => { await page.getByTitle("English").click(); await page.locator("form").filter({ hasText: "Service" }).getByRole("button").click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated language!"); + await closeNotification(page); }); diff --git a/web/e2e/settings/integrations.spec.ts b/web/e2e/settings/integrations.spec.ts index 09175292b1..a16c4b4f40 100644 --- a/web/e2e/settings/integrations.spec.ts +++ b/web/e2e/settings/integrations.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; test("Integration CRUD and searching has succeeded", async ({ reearth, page }) => { @@ -21,6 +22,7 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = await expect(page.getByRole("alert").last()).toContainText( "Successfully connected integration to the workspace!", ); + await closeNotification(page); await page.locator("a").nth(3).click(); await expect(page.getByRole("cell", { name: "e2e integration name", exact: true })).toBeVisible(); await page.getByPlaceholder("Please enter").click(); @@ -37,6 +39,7 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = await expect(page.getByRole("alert").last()).toContainText( "Successfully updated workspace integration!", ); + await closeNotification(page); await page.locator("a").nth(3).click(); await expect(page.getByRole("cell", { name: "WRITER" })).toBeVisible(); await page.getByPlaceholder("Please enter").click(); @@ -54,6 +57,7 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = await expect(page.getByRole("alert").last()).toContainText( "One or more integrations were successfully deleted!", ); + await closeNotification(page); await page.getByText("My Integrations").click(); await page.getByText("e2e integration namee2e").click(); await page.getByRole("button", { name: "Remove Integration" }).click(); diff --git a/web/e2e/settings/member.spec.ts b/web/e2e/settings/member.spec.ts index 3099c07443..d1b280fa94 100644 --- a/web/e2e/settings/member.spec.ts +++ b/web/e2e/settings/member.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; test("Searching current members has succeeded", async ({ reearth, page }) => { @@ -18,4 +19,5 @@ test("Searching current members has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "Remove Workspace" }).click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted workspace!"); + await closeNotification(page); }); diff --git a/web/e2e/settings/myIntegrations.spec.ts b/web/e2e/settings/myIntegrations.spec.ts index 1aa1649bd8..5e0529f2bc 100644 --- a/web/e2e/settings/myIntegrations.spec.ts +++ b/web/e2e/settings/myIntegrations.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { expect, test } from "@reearth-cms/e2e/utils"; test("MyIntegration CRUD has succeeded", async ({ reearth, page }) => { @@ -11,6 +12,7 @@ test("MyIntegration CRUD has succeeded", async ({ reearth, page }) => { await page.getByLabel("Description").fill("description"); await page.getByRole("button", { name: "Create" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created integration!"); + await closeNotification(page); await page.getByText("namedescription", { exact: true }).click(); await page.getByLabel("Integration Name").click(); @@ -19,6 +21,7 @@ test("MyIntegration CRUD has succeeded", async ({ reearth, page }) => { await page.getByLabel("Description").fill("newDescription"); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated integration!"); + await closeNotification(page); await expect(page.locator("#root")).toContainText("newName"); await page.getByLabel("Back").click(); @@ -27,6 +30,7 @@ test("MyIntegration CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "Remove Integration" }).click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted integration!"); + await closeNotification(page); await expect(page.getByRole("main")).not.toContainText("newNamenewDescription"); }); @@ -56,6 +60,7 @@ test("Webhook CRUD has succeeded", async ({ reearth, page }) => { await page.getByLabel("Secret").fill("secret"); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully created webhook!"); + await closeNotification(page); await expect(page.getByLabel("Webhook")).toContainText("webhook name"); await expect(page.getByLabel("Webhook")).toContainText("http://test.com"); @@ -72,6 +77,7 @@ test("Webhook CRUD has succeeded", async ({ reearth, page }) => { await expect(page.getByLabel("Upload")).toBeChecked(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated webhook!"); + await closeNotification(page); await expect(page.getByLabel("Webhook")).toContainText("new webhook name"); await expect(page.getByLabel("Webhook")).toContainText("http://new.com"); await page.getByLabel("Webhook").getByLabel("setting").locator("svg").click(); @@ -82,8 +88,10 @@ test("Webhook CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("switch", { name: "OFF" }).click(); await expect(page.getByRole("switch")).toContainText("ON"); await expect(page.getByRole("alert").last()).toContainText("Successfully updated webhook!"); + await closeNotification(page); await page.getByLabel("delete").locator("svg").click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted webhook!"); + await closeNotification(page); await expect(page.getByLabel("Webhook")).not.toContainText("new webhook name"); await page @@ -100,9 +108,11 @@ test("Webhook CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "Save" }).click(); await page.getByLabel("delete").locator("svg").click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted webhook!"); + await closeNotification(page); await page.getByRole("tab", { name: "General" }).click(); await page.getByRole("button", { name: "Remove Integration" }).click(); await page.getByRole("button", { name: "OK" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully deleted integration!"); + await closeNotification(page); }); diff --git a/web/e2e/settings/settings.spec.ts b/web/e2e/settings/settings.spec.ts index 8c59182305..c492ea475a 100644 --- a/web/e2e/settings/settings.spec.ts +++ b/web/e2e/settings/settings.spec.ts @@ -1,3 +1,4 @@ +import { closeNotification } from "@reearth-cms/e2e/common/notification"; import { createWorkspace, deleteWorkspace } from "@reearth-cms/e2e/project/utils/workspace"; import { expect, test } from "@reearth-cms/e2e/utils"; @@ -16,6 +17,7 @@ test("Tiles CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "OK" }).click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated"); + await closeNotification(page); await page .locator("div:last-child > .ant-card-actions > li:nth-child(2) > span > .anticon") .click(); @@ -35,6 +37,7 @@ test("Tiles CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "OK" }).click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated"); + await closeNotification(page); await expect(page.getByText("url", { exact: true })).toBeVisible(); await expect(page.locator("img")).toBeVisible(); await page @@ -50,6 +53,7 @@ test("Tiles CRUD has succeeded", async ({ reearth, page }) => { .click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated"); + await closeNotification(page); await expect(page.getByText("url", { exact: true })).not.toBeVisible(); await deleteWorkspace(page); }); @@ -73,6 +77,7 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "OK" }).click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await closeNotification(page); await page.getByLabel("edit").locator("svg").click(); await expect(page.locator("form")).toContainText("ArcGIS Terrain"); await page @@ -94,6 +99,7 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await page.getByRole("button", { name: "OK" }).click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await closeNotification(page); await expect(page.getByText("name", { exact: true })).toBeVisible(); await page.getByLabel("edit").locator("svg").click(); await expect(page.locator("form")).toContainText("Cesium Ion"); @@ -106,11 +112,13 @@ test("Terrain on/off and CRUD has succeeded", async ({ reearth, page }) => { await page.getByLabel("delete").locator("svg").click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await closeNotification(page); await expect(page.getByText("name", { exact: true })).not.toBeVisible(); await page.getByRole("switch").click(); await page.getByRole("button", { name: "Save" }).click(); await expect(page.getByRole("alert").last()).toContainText("Successfully updated workspace!"); + await closeNotification(page); await expect(page.getByRole("switch")).toHaveAttribute("aria-checked", "false"); await expect(page.getByRole("button", { name: "plus Add new Terrain option" })).not.toBeVisible(); await deleteWorkspace(page); From 37927ae8f590de7298266bcd0035fdc689190183 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Wed, 28 Feb 2024 13:11:30 +0900 Subject: [PATCH 29/31] fix: exclude path in vite.config --- web/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/vite.config.ts b/web/vite.config.ts index c7e81b6c6b..10a18989d4 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -39,7 +39,7 @@ export default defineConfig({ test: { environment: "jsdom", setupFiles: "./src/test/setup.ts", - exclude: [...configDefaults.exclude, "e2e/*"], + exclude: [...configDefaults.exclude, "e2e/**/*"], coverage: { all: true, include: ["src/**/*.ts", "src/**/*.tsx"], From c765367b55c639ffa0c337dc95189095f300d787 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Wed, 28 Feb 2024 17:16:44 +0900 Subject: [PATCH 30/31] fix: integrations test --- web/e2e/settings/integrations.spec.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/web/e2e/settings/integrations.spec.ts b/web/e2e/settings/integrations.spec.ts index a16c4b4f40..739ef4fb4e 100644 --- a/web/e2e/settings/integrations.spec.ts +++ b/web/e2e/settings/integrations.spec.ts @@ -11,7 +11,7 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = await page.getByLabel("Description").click(); await page.getByLabel("Description").fill("e2e integration description"); await page.getByRole("button", { name: "Create" }).click(); - await page.locator("a").nth(3).click(); + await closeNotification(page); await page.getByText("Integrations", { exact: true }).click(); await page.getByRole("button", { name: "api Connect Integration" }).click(); await page @@ -23,7 +23,6 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = "Successfully connected integration to the workspace!", ); await closeNotification(page); - await page.locator("a").nth(3).click(); await expect(page.getByRole("cell", { name: "e2e integration name", exact: true })).toBeVisible(); await page.getByPlaceholder("Please enter").click(); await page.getByPlaceholder("Please enter").fill("e2e integration name"); @@ -40,7 +39,6 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = "Successfully updated workspace integration!", ); await closeNotification(page); - await page.locator("a").nth(3).click(); await expect(page.getByRole("cell", { name: "WRITER" })).toBeVisible(); await page.getByPlaceholder("Please enter").click(); await page.getByPlaceholder("Please enter").fill("no integration"); From f0129c559bc7c2d847a7510fa77aedef9213da0d Mon Sep 17 00:00:00 2001 From: caichi <54824604+caichi-t@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:43:58 +0900 Subject: [PATCH 31/31] Apply suggestions from code review Co-authored-by: Nour Balaha --- web/e2e/settings/integrations.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/e2e/settings/integrations.spec.ts b/web/e2e/settings/integrations.spec.ts index 739ef4fb4e..8c305d8cfd 100644 --- a/web/e2e/settings/integrations.spec.ts +++ b/web/e2e/settings/integrations.spec.ts @@ -13,10 +13,11 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = await page.getByRole("button", { name: "Create" }).click(); await closeNotification(page); await page.getByText("Integrations", { exact: true }).click(); - await page.getByRole("button", { name: "api Connect Integration" }).click(); + await page.getByRole("button", { name: "api Connect Integration" }).first().click(); await page .locator("div") .filter({ hasText: /^e2e integration name$/ }) + .first() .click(); await page.getByRole("button", { name: "Connect", exact: true }).click(); await expect(page.getByRole("alert").last()).toContainText( @@ -57,7 +58,7 @@ test("Integration CRUD and searching has succeeded", async ({ reearth, page }) = ); await closeNotification(page); await page.getByText("My Integrations").click(); - await page.getByText("e2e integration namee2e").click(); + await page.getByText("e2e integration namee2e").first().click(); await page.getByRole("button", { name: "Remove Integration" }).click(); await page.getByRole("button", { name: "OK" }).click(); });