mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 08:20:45 -05:00
✨ Refactor WorkspacePage so it has more semantic locators
This commit is contained in:
parent
7719cd8d0b
commit
f417445f31
3 changed files with 8 additions and 9 deletions
|
@ -48,7 +48,6 @@ export class WorkspacePage extends BaseWebSocketPage {
|
|||
this.layers = page.getByTestId("layer-tree");
|
||||
this.palette = page.getByTestId("palette");
|
||||
this.sidebar = page.getByTestId("left-sidebar");
|
||||
this.closeLibraries = page.getByTestId("close-libraries");
|
||||
this.librariesModal = page.getByTestId("libraries-modal");
|
||||
}
|
||||
|
||||
|
@ -126,7 +125,7 @@ export class WorkspacePage extends BaseWebSocketPage {
|
|||
await this.sidebar.getByText("Assets").click(clickOptions);
|
||||
}
|
||||
|
||||
async clickLibraries(clickOptions = {}) {
|
||||
async openLibrariesModal(clickOptions = {}) {
|
||||
await this.sidebar.getByText("Libraries").click(clickOptions);
|
||||
}
|
||||
|
||||
|
@ -138,8 +137,8 @@ export class WorkspacePage extends BaseWebSocketPage {
|
|||
.click(clickOptions);
|
||||
}
|
||||
|
||||
async clickCloseLibraries(clickOptions = {}) {
|
||||
await this.closeLibraries.click(clickOptions);
|
||||
async closeLibrariesModal(clickOptions = {}) {
|
||||
await this.librariesModal.getByRole("button", { name: "Close" }).click(clickOptions);
|
||||
}
|
||||
|
||||
async clickColorPalette(clickOptions = {}) {
|
||||
|
|
|
@ -40,16 +40,16 @@ test.describe("Assets tab", () => {
|
|||
await workspacePage.clickAssets();
|
||||
// Now the get-file call should return a library
|
||||
await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-library.json");
|
||||
await workspacePage.clickLibraries();
|
||||
await workspacePage.openLibrariesModal();
|
||||
await workspacePage.clickLibrary("Testing library 1");
|
||||
await workspacePage.clickCloseLibraries();
|
||||
await workspacePage.closeLibrariesModal();
|
||||
|
||||
await expect(workspacePage.palette.getByRole("button", { name: "test-color-187cd5" })).toBeVisible();
|
||||
|
||||
// Remove Testing library 1
|
||||
await workspacePage.clickLibraries();
|
||||
await workspacePage.openLibrariesModal();
|
||||
await workspacePage.clickLibrary("Testing library 1");
|
||||
await workspacePage.clickCloseLibraries();
|
||||
await workspacePage.closeLibrariesModal();
|
||||
|
||||
await expect(
|
||||
workspacePage.palette.getByText("There are no color styles in your library yet"),
|
||||
|
|
|
@ -519,7 +519,7 @@
|
|||
[:div {:class (stl/css :modal-dialog)}
|
||||
[:button {:class (stl/css :close-btn)
|
||||
:on-click close-dialog
|
||||
:data-testid "close-libraries"}
|
||||
:aria-label (tr "labels.close")}
|
||||
close-icon]
|
||||
[:div {:class (stl/css :modal-title)}
|
||||
(tr "workspace.libraries.libraries")]
|
||||
|
|
Loading…
Reference in a new issue