From 2d42529ad8ed30117f2228bf4fcd0af6529f0766 Mon Sep 17 00:00:00 2001 From: heswell Date: Fri, 12 Jan 2024 14:53:36 +0000 Subject: [PATCH 1/3] fix build so type libraries are published correctly (#1125) --- vuu-ui/scripts/build.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vuu-ui/scripts/build.mjs b/vuu-ui/scripts/build.mjs index 850470d6e..5ab7ccdfd 100644 --- a/vuu-ui/scripts/build.mjs +++ b/vuu-ui/scripts/build.mjs @@ -132,9 +132,10 @@ export default async function main(customConfig) { } = packageJson; let files = getDefaultFilesToPublish(options); + let defaultStyle = undefined; - if (filesFromPackageJson) { + if (filesFromPackageJson || isTypeLib) { const filesToPublish = isTypeLib ? [indexDTS] : filesFromPackageJson.filter( From a2f2c3a67548f38e48f20463d097d1e13b880b6d Mon Sep 17 00:00:00 2001 From: Peter Ling Date: Fri, 12 Jan 2024 14:55:12 +0000 Subject: [PATCH 2/3] SLVUU-50: Add E2E tests for layout management --- .../layout-management/layout-management.cy.ts | 74 +++++++++++++++++++ vuu-ui/cypress/pages/ShellWithNewTheme.ts | 55 +++++++++++--- .../notifications/NotificationsProvider.tsx | 1 + 3 files changed, 120 insertions(+), 10 deletions(-) create mode 100644 vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts diff --git a/vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts b/vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts new file mode 100644 index 000000000..9bc5ee276 --- /dev/null +++ b/vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts @@ -0,0 +1,74 @@ +import "cypress-iframe"; +import { ShellWithNewTheme } from "../../pages/ShellWithNewTheme"; +import { SaveLayoutDialog } from "../../pages/SaveLayoutDialog"; + +const page = new ShellWithNewTheme(); +const dialog = new SaveLayoutDialog(); + +context("Layout Management", () => { + beforeEach(() => { + page.visit(); + }); + + it("Saves and reloads layout", () => { + const savedLayoutName = "Saved Layout"; + const updatedLayoutName = "Updated Layout"; + const layoutGroup = "Layout Group"; + const layoutSaveName = "My Layout"; + + // Update open layout + page.getTab(0).dblclick(); + cy.focused().type(`${savedLayoutName}{enter}`); + + // Save the updated layout + page.getContextMenuButton().click(); + page.getSaveLayoutButton().click(); + + dialog.getGroupField().type(layoutGroup); + dialog.getNameField().clear().type(layoutSaveName); + dialog.getSaveButton().click(); + + // Verify success notification + page.getToasts().should("have.length", 1); + page.getToastText("Layout Saved Successfully").should("be.visible"); + page + .getToastText(`${layoutSaveName} saved successfully`) + .should("be.visible"); + + // Update open layout again + page.getTab(0).dblclick(); + cy.focused().type(`${updatedLayoutName}{enter}`); + + // Load saved layout + page.getMyLayoutsButton().click(); + page + .getLayoutTile(layoutSaveName, layoutGroup, "test-user", new Date()) + .should("be.visible") + .click(); + + // Verify saved layout is loaded + page.getTabs().should("have.length", 2); + page.getTab(0).should("contain.text", updatedLayoutName); + page.getTab(1).should("contain.text", savedLayoutName); + }); + + it("Does not save when cancel button is clicked", () => { + const layoutGroup = "Layout Group"; + const layoutSaveName = "My Layout"; + + // Go to save a layout, but cancel + page.getContextMenuButton().click(); + page.getSaveLayoutButton().click(); + + dialog.getGroupField().type(layoutGroup); + dialog.getNameField().clear().type(layoutSaveName); + dialog.getCancelButton().click(); + + // Verify no notification + page.getToasts().should("have.length", 0); + + // Verify no saved layouts show in drawer + page.getMyLayoutsButton().click(); + page.getLayoutGroup(layoutGroup).should("not.exist"); + }); +}); diff --git a/vuu-ui/cypress/pages/ShellWithNewTheme.ts b/vuu-ui/cypress/pages/ShellWithNewTheme.ts index 6195346b0..030aa9d90 100644 --- a/vuu-ui/cypress/pages/ShellWithNewTheme.ts +++ b/vuu-ui/cypress/pages/ShellWithNewTheme.ts @@ -6,22 +6,49 @@ export class ShellWithNewTheme { cy.visit(SHELL_WITH_NEW_THEME_URL); }; + getTabs: () => Cypress.Chainable> = () => { + return cy.findByRole("tablist", { name: "data tabs" }).findAllByRole("tab"); + }; + + getTab: (n: number) => Cypress.Chainable> = ( + n: number + ) => { + return this.getTabs().eq(n); + }; + getContextMenuButton: () => Cypress.Chainable> = () => { - return cy - .findByRole("tablist", { name: "data tabs" }) - .findAllByRole("tab") - .first() - .findByRole("button", { name: "context menu" }); + return this.getTab(0).findByRole("button", { name: "context menu" }); }; getSaveLayoutButton: () => Cypress.Chainable> = () => { return cy.findByRole("menuitem", { name: "Save Layout" }); }; + getRenameLayoutButton: () => Cypress.Chainable> = () => { + return cy.findByRole("menuitem", { name: "Rename" }); + }; + getMyLayoutsButton: () => Cypress.Chainable> = () => { return cy.findByRole("tab", { name: "MY LAYOUTS" }); }; + getVuuTablesButton: () => Cypress.Chainable> = () => { + return cy.findByRole("tab", { name: "VUU TABLES" }); + }; + + getFirstAvailableVuuTable: () => Cypress.Chainable> = + () => { + return cy.findAllByRole("option").first(); + }; + + getLayoutGroup: (group: string) => Cypress.Chainable> = ( + group: string + ) => { + return cy + .findByRole("listbox", { name: "my layouts" }) + .findByRole("list", { name: group }); + }; + getLayoutTile: ( layoutName: string, group: string, @@ -36,10 +63,18 @@ export class ShellWithNewTheme { const formattedDate = formatDate({ date: "dd.mm.yyyy" })(date); const layoutTileName = `${layoutName} ${creator}, ${formattedDate}`; - return cy - .findByRole("listbox", { name: "my layouts" }) - .findByRole("list", { name: group }) - .findByRole("listitem", { name: layoutTileName }) - .findByRole("button"); + return this.getLayoutGroup(group).findByRole("button", { + name: layoutTileName, + }); + }; + + getToasts: () => Cypress.Chainable> = () => { + return cy.findAllByRole("status"); + }; + + getToastText: (text: string) => Cypress.Chainable> = ( + text: string + ) => { + return cy.findByRole("status").findByText(text); }; } diff --git a/vuu-ui/packages/vuu-popups/src/notifications/NotificationsProvider.tsx b/vuu-ui/packages/vuu-popups/src/notifications/NotificationsProvider.tsx index 96fa49e33..a3d3cc93a 100644 --- a/vuu-ui/packages/vuu-popups/src/notifications/NotificationsProvider.tsx +++ b/vuu-ui/packages/vuu-popups/src/notifications/NotificationsProvider.tsx @@ -107,6 +107,7 @@ export const ToastNotification = (props: ToastNotificationProps) => {
Date: Fri, 12 Jan 2024 15:23:53 +0000 Subject: [PATCH 3/3] SLVUU-50: Disable linting for chaining of cy.focused() --- vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts b/vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts index 9bc5ee276..cb0ad7eec 100644 --- a/vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts +++ b/vuu-ui/cypress/e2e/layout-management/layout-management.cy.ts @@ -18,6 +18,7 @@ context("Layout Management", () => { // Update open layout page.getTab(0).dblclick(); + // eslint-disable-next-line cypress/unsafe-to-chain-command cy.focused().type(`${savedLayoutName}{enter}`); // Save the updated layout @@ -37,6 +38,7 @@ context("Layout Management", () => { // Update open layout again page.getTab(0).dblclick(); + // eslint-disable-next-line cypress/unsafe-to-chain-command cy.focused().type(`${updatedLayoutName}{enter}`); // Load saved layout