-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* impl * rename * fix: type bug * i18n * fix: validate * add: e2e test * Merge branch 'main' of https://github.com/reearth/reearth-cms into fix-web/float-field * rename
- Loading branch information
Showing
25 changed files
with
225 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import { closeNotification } from "@reearth-cms/e2e/common/notification"; | ||
import { createModel } from "@reearth-cms/e2e/project/utils/model"; | ||
import { createProject, deleteProject } from "@reearth-cms/e2e/project/utils/project"; | ||
import { expect, test } from "@reearth-cms/e2e/utils"; | ||
|
||
test.beforeEach(async ({ reearth, page }) => { | ||
await reearth.goto("/", { waitUntil: "domcontentloaded" }); | ||
await createProject(page); | ||
await createModel(page); | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
await deleteProject(page); | ||
}); | ||
|
||
test("Float field creating and updating has succeeded", async ({ page }) => { | ||
await page.locator("li").filter({ hasText: "Float" }).locator("div").first().click(); | ||
await page.getByLabel("Display name").click(); | ||
await page.getByLabel("Display name").fill("float1"); | ||
await page.getByLabel("Settings").locator("#key").click(); | ||
await page.getByLabel("Settings").locator("#key").fill("float1"); | ||
await page.getByLabel("Settings").locator("#description").click(); | ||
await page.getByLabel("Settings").locator("#description").fill("float1 description"); | ||
|
||
await page.getByRole("button", { name: "OK" }).click(); | ||
await closeNotification(page); | ||
|
||
await expect(page.getByLabel("Fields").getByRole("paragraph")).toContainText("float1#float1"); | ||
await page.getByText("Content").click(); | ||
await page.getByRole("button", { name: "plus New Item" }).click(); | ||
await expect(page.locator("label")).toContainText("float1"); | ||
await expect(page.getByRole("main")).toContainText("float1 description"); | ||
await page.getByLabel("float1").click(); | ||
await page.getByLabel("float1").fill("1.1"); | ||
await page.getByRole("button", { name: "Save" }).click(); | ||
await closeNotification(page); | ||
await page.getByLabel("Back").click(); | ||
await expect(page.getByRole("cell", { name: "1.1", exact: true })).toBeVisible(); | ||
|
||
await page.getByRole("cell").getByLabel("edit").locator("svg").click(); | ||
await expect(page.getByLabel("float1")).toHaveValue("1.1"); | ||
await page.getByLabel("float1").click(); | ||
await page.getByLabel("float1").fill("2.2"); | ||
await page.getByRole("button", { name: "Save" }).click(); | ||
await closeNotification(page); | ||
await page.getByLabel("Back").click(); | ||
await expect(page.getByRole("cell", { name: "2.2", exact: true })).toBeVisible(); | ||
}); | ||
|
||
test("Float field editing has succeeded", async ({ page }) => { | ||
await page.locator("li").filter({ hasText: "Float" }).locator("div").first().click(); | ||
await page.getByLabel("Display name").click(); | ||
await page.getByLabel("Display name").fill("float1"); | ||
await page.getByLabel("Settings").locator("#key").click(); | ||
await page.getByLabel("Settings").locator("#key").fill("float1"); | ||
await page.getByLabel("Settings").locator("#description").click(); | ||
await page.getByLabel("Settings").locator("#description").fill("float1 description"); | ||
await page.getByRole("tab", { name: "Default value" }).click(); | ||
await page.getByLabel("Set default value").click(); | ||
await page.getByLabel("Set default value").fill("1.1"); | ||
await page.getByRole("button", { name: "OK" }).click(); | ||
await closeNotification(page); | ||
|
||
await page.getByText("Content").click(); | ||
await expect(page.locator("thead")).toContainText("float1"); | ||
await page.getByRole("button", { name: "plus New Item" }).click(); | ||
await page.getByRole("button", { name: "Save" }).click(); | ||
await closeNotification(page); | ||
await page.getByLabel("Back").click(); | ||
await expect(page.getByRole("cell", { name: "1.1", exact: true })).toBeVisible(); | ||
|
||
await page.getByText("Schema").click(); | ||
await page.getByRole("img", { name: "ellipsis" }).locator("svg").click(); | ||
await page.getByRole("tab", { name: "Settings" }).click(); | ||
await page.getByLabel("Display name").click(); | ||
await page.getByLabel("Display name").fill("new float1"); | ||
await page.getByLabel("Field Key").click(); | ||
await page.getByLabel("Field Key").fill("new-float1"); | ||
await page.getByLabel("Description(optional)").click(); | ||
await page.getByLabel("Description(optional)").fill("new float1 description"); | ||
await page.getByLabel("Support multiple values").check(); | ||
await page.getByLabel("Use as title").check(); | ||
await page.getByRole("tab", { name: "Validation" }).click(); | ||
await page.getByLabel("Set minimum value").click(); | ||
await page.getByLabel("Set minimum value").fill("10.1"); | ||
await page.getByLabel("Set maximum value").click(); | ||
await page.getByLabel("Set maximum value").fill("2.1"); | ||
await expect(page.getByRole("button", { name: "OK" })).toBeDisabled(); | ||
await page.getByLabel("Set minimum value").click(); | ||
await page.getByLabel("Set minimum value").fill("2.1"); | ||
await page.getByLabel("Set maximum value").click(); | ||
await page.getByLabel("Set maximum value").fill("10.1"); | ||
await page.getByLabel("Make field required").check(); | ||
await page.getByLabel("Set field as unique").check(); | ||
await page.getByRole("tab", { name: "Default value" }).click(); | ||
await expect(page.getByLabel("Set default value")).toBeVisible(); | ||
await expect(page.getByLabel("Set default value")).toHaveValue("1.1"); | ||
await expect(page.getByRole("button", { name: "OK" })).toBeDisabled(); | ||
await page.getByLabel("Set default value").click(); | ||
await page.getByLabel("Set default value").fill("11.1"); | ||
await expect(page.getByRole("button", { name: "OK" })).toBeDisabled(); | ||
await page.getByLabel("Set default value").click(); | ||
await page.getByLabel("Set default value").fill("2.2"); | ||
await page.getByRole("button", { name: "plus New" }).click(); | ||
await page.locator("#defaultValue").nth(1).click(); | ||
await page.locator("#defaultValue").nth(1).fill("3.3"); | ||
await page.getByRole("button", { name: "OK" }).click(); | ||
await closeNotification(page); | ||
|
||
await expect(page.getByText("new float1 *#new-float1(unique)")).toBeVisible(); | ||
await page.getByText("Content").click(); | ||
await expect(page.locator("thead")).toContainText("new float1"); | ||
await expect(page.getByRole("cell", { name: "1.1", exact: true })).toBeVisible(); | ||
await page.getByRole("button", { name: "plus New Item" }).click(); | ||
await expect(page.getByText("new float1(unique)Title")).toBeVisible(); | ||
await expect(page.getByRole("spinbutton").nth(0)).toHaveValue("2.2"); | ||
await expect(page.getByRole("spinbutton").nth(1)).toHaveValue("3.3"); | ||
await page.getByRole("button", { name: "Save" }).click(); | ||
await closeNotification(page); | ||
await page.getByLabel("Back").click(); | ||
await page.getByRole("button", { name: "x2" }).click(); | ||
await expect(page.getByRole("tooltip")).toContainText("new float12.23.3"); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 12 additions & 3 deletions
15
web/src/components/molecules/Content/Form/fields/FieldTypesMap.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.