mirror of
https://github.com/penpot/penpot.git
synced 2025-02-01 03:49:22 -05:00
Add integration tests for creating sets
This commit is contained in:
parent
b5110c2222
commit
7bce4ab425
3 changed files with 40 additions and 0 deletions
|
@ -80,6 +80,8 @@ export class WorkspacePage extends BaseWebSocketPage {
|
||||||
"token-update-create-modal",
|
"token-update-create-modal",
|
||||||
);
|
);
|
||||||
this.tokenThemesSetsSidebar = page.getByTestId("token-themes-sets-sidebar");
|
this.tokenThemesSetsSidebar = page.getByTestId("token-themes-sets-sidebar");
|
||||||
|
this.tokenSetItems = page.getByTestId("tokens-set-item");
|
||||||
|
this.tokenSetGroupItems = page.getByTestId("tokens-set-group-item");
|
||||||
}
|
}
|
||||||
|
|
||||||
async goToWorkspace({
|
async goToWorkspace({
|
||||||
|
|
|
@ -22,6 +22,8 @@ const setupFileWithTokens = async (page) => {
|
||||||
workspacePage,
|
workspacePage,
|
||||||
tokensUpdateCreateModal: workspacePage.tokensUpdateCreateModal,
|
tokensUpdateCreateModal: workspacePage.tokensUpdateCreateModal,
|
||||||
tokenThemesSetsSidebar: workspacePage.tokenThemesSetsSidebar,
|
tokenThemesSetsSidebar: workspacePage.tokenThemesSetsSidebar,
|
||||||
|
tokenSetItems: workspacePage.tokenSetItems,
|
||||||
|
tokenSetGroupItems: workspacePage.tokenSetGroupItems,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,3 +104,37 @@ test.describe("Tokens: Tokens Tab", () => {
|
||||||
).toHaveAttribute("aria-checked", "true");
|
).toHaveAttribute("aria-checked", "true");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.describe("Tokens: Sets Tab", () => {
|
||||||
|
const createSet = async (sidebar, setName) => {
|
||||||
|
const tokensTabButton = sidebar
|
||||||
|
.getByRole("button", { name: "Add set" })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
const setInput = sidebar.locator("input:focus");
|
||||||
|
await expect(setInput).toBeVisible();
|
||||||
|
await setInput.fill(setName);
|
||||||
|
await setInput.press("Enter");
|
||||||
|
};
|
||||||
|
|
||||||
|
test("User creates sets tree structure by entering a set path", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const {
|
||||||
|
workspacePage,
|
||||||
|
tokenThemesSetsSidebar,
|
||||||
|
tokenSetItems,
|
||||||
|
tokenSetGroupItems,
|
||||||
|
} = await setupFileWithTokens(page);
|
||||||
|
|
||||||
|
const tokensTabButton = tokenThemesSetsSidebar
|
||||||
|
.getByRole("button", { name: "Add set" })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await createSet(tokenThemesSetsSidebar, "core/colors/light");
|
||||||
|
await createSet(tokenThemesSetsSidebar, "core/colors/dark");
|
||||||
|
|
||||||
|
await expect(tokenSetItems).toHaveCount(2);
|
||||||
|
await expect(tokenSetGroupItems).toHaveCount(2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
:tree-path tree-path})))))]
|
:tree-path tree-path})))))]
|
||||||
[:div {;; :ref dref
|
[:div {;; :ref dref
|
||||||
:role "button"
|
:role "button"
|
||||||
|
:data-testid "tokens-set-group-item"
|
||||||
:style {"--tree-depth" tree-depth}
|
:style {"--tree-depth" tree-depth}
|
||||||
:class (stl/css-case :set-item-container true
|
:class (stl/css-case :set-item-container true
|
||||||
:selected-set selected?)
|
:selected-set selected?)
|
||||||
|
@ -133,6 +134,7 @@
|
||||||
:tree-path tree-path})))))]
|
:tree-path tree-path})))))]
|
||||||
[:div {;; :ref dref
|
[:div {;; :ref dref
|
||||||
:role "button"
|
:role "button"
|
||||||
|
:data-testid "tokens-set-item"
|
||||||
:style {"--tree-depth" tree-depth}
|
:style {"--tree-depth" tree-depth}
|
||||||
:class (stl/css-case :set-item-container true
|
:class (stl/css-case :set-item-container true
|
||||||
:selected-set selected?)
|
:selected-set selected?)
|
||||||
|
|
Loading…
Add table
Reference in a new issue