From e38b6c918aa6205079950f9de0e16e928515ce80 Mon Sep 17 00:00:00 2001 From: Nikola Anachkov Date: Mon, 23 Jun 2025 14:26:05 +0300 Subject: [PATCH 1/8] chore(ui5-flexible-column-layout): migrate wdio tests to cypress --- packages/fiori/cypress/specs/FCL.cy.tsx | 941 +++++++++++++++++++++++- 1 file changed, 940 insertions(+), 1 deletion(-) diff --git a/packages/fiori/cypress/specs/FCL.cy.tsx b/packages/fiori/cypress/specs/FCL.cy.tsx index 6626b94417a1..2873a47b2f12 100644 --- a/packages/fiori/cypress/specs/FCL.cy.tsx +++ b/packages/fiori/cypress/specs/FCL.cy.tsx @@ -106,7 +106,7 @@ describe("ACC", () => { .find("slot[name=endColumn]") .should("have.attr", "aria-hidden"); }); - + it("verifies that aria-valuenow is set on separators", () => { cy.mount( @@ -130,3 +130,942 @@ describe("ACC", () => { .should("have.attr", "aria-valuenow"); }); }); + +describe("FlexibleColumnLayout Behavior", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1000, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("tests Desktop size 1400px", () => { + cy.viewport(1400, 1080); + + cy.get("#fcl3") + .invoke("attr", "_visible-columns") + .should("equal", "3"); + }); + + it("tests Tablet Size 1000px", () => { + cy.viewport(1000, 1080); + + cy.get("#fcl3") + .invoke("attr", "_visible-columns") + .should("equal", "2"); + }); + + it("tests Phone size 500px", () => { + cy.viewport(320, 1080); + + cy.get("#fcl3") + .invoke("attr", "_visible-columns") + .should("equal", "1"); + }); +}); + +describe("Layout API Tests", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1600, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("tests change layout with API", () => { + cy.get("#fcl1") + .invoke("attr", "_visible-columns") + .should("equal", "2"); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "TwoColumnsStartExpanded"); + + cy.get("#fcl1") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl1") + .invoke("attr", "_visible-columns") + .should("equal", "3"); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + }); + + it("tests change layout upon dragging the separator to a new layout", () => { + cy.get("#fcl1") + .invoke("prop", "layout", "TwoColumnsStartExpanded"); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "TwoColumnsStartExpanded"); + + cy.get("#fcl1") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(-400, 0) + .realMouseUp(); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "TwoColumnsMidExpanded"); + + cy.get("#fcl1") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(400, 0) + .realMouseUp(); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "TwoColumnsStartExpanded"); + }); +}); + +describe("Column Expansion Tests", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1600, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("allows expand mid column from TwoColumnsStartExpanded to TwoColumnsMidExpanded", () => { + cy.get("#fcl-expansion") + .invoke("prop", "layout", "TwoColumnsMidExpanded"); + + cy.get("#fcl-expansion") + .invoke("prop", "layout") + .should("equal", "TwoColumnsMidExpanded"); + }); + + it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", () => { + cy.get("#fcl-expansion") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl-expansion") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl-expansion") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl-expansion") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + }); +}); + +describe("Start Column Expansion Test", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1600, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", () => { + cy.get("#fcl-start") + .invoke("prop", "layout", "TwoColumnsMidExpanded"); + + cy.get("#fcl-start") + .invoke("prop", "layout") + .should("equal", "TwoColumnsMidExpanded"); + + cy.get("#fcl-start") + .invoke("prop", "layout", "TwoColumnsStartExpanded"); + + cy.get("#fcl-start") + .invoke("prop", "layout") + .should("equal", "TwoColumnsStartExpanded"); + }); + + it("allows expand start column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsStartExpandedEndHidden", () => { + cy.get("#fcl-start") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl-start") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl-start") + .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); + + cy.get("#fcl-start") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsStartExpandedEndHidden"); + }); + + it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", () => { + cy.get("#fcl-start") + .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); + + cy.get("#fcl-start") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsStartExpandedEndHidden"); + + cy.get("#fcl-start") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl-start") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + }); + + it("allows expand end column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", () => { + cy.get("#fcl-start") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl-start") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl-start") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl-start") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + }); +}); + +describe("Layout change by dragging end-separator on desktop", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1600, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("allows expand end-column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", () => { + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-400, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + }); + + it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-400, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsEndExpanded"); + }); +}); + +describe("Layout change by dragging start-separator on tablet", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1000, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("allows expand mid column from TwoColumnsStartExpanded to TwoColumnsMidExpanded", () => { + cy.get("#fcl1") + .invoke("prop", "layout", "TwoColumnsStartExpanded"); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "TwoColumnsStartExpanded"); + + cy.get("#fcl1") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(-400, 0) + .realMouseUp(); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "TwoColumnsMidExpanded"); + }); + + it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", () => { + cy.get("#fcl1") + .invoke("prop", "layout", "TwoColumnsMidExpanded"); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "TwoColumnsMidExpanded"); + + cy.get("#fcl1") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(400, 0) + .realMouseUp(); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "TwoColumnsStartExpanded"); + }); + + it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", () => { + cy.get("#fcl1") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl1") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(300, 0) + .realMouseUp(); + + cy.get("#fcl1") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + }); +}); + +describe("Tablet Layout Tests", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1000, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("allows expand start column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsStartExpandedEndHidden", () => { + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(400, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsStartExpandedEndHidden"); + }); + + it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", () => { + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsStartExpandedEndHidden"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(-400, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + }); + + it("preserves ThreeColumnsMidExpandedEndHidden when dragging to shrink start column", () => { + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(-100, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + }); +}); + +describe("Layout change by dragging end-separator on tablet", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1000, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("allows expand end-column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", () => { + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-400, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + }); + + it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-300, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsEndExpanded"); + }); +}); + +describe("Preserves column min-width", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1400, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("complies with min-width requirement on smallest desktop", () => { + const smallestDesktopWidth = 1024; + const smallestColumnWidth = 248; + + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .invoke("css", "width", `${smallestDesktopWidth}px`); + + cy.get("#fcl3") + .should("have.css", "width", `${smallestDesktopWidth}px`); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--start") + .should($startColumn => { + const width = $startColumn.width(); + expect(width).to.equal(smallestColumnWidth); + }); + }); + + it("preserves min-width of begin column", () => { + const smallestColumnWidth = 248; + + cy.get("#fcl3") + .invoke("prop", "layout", "TwoColumnsMidExpanded"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "TwoColumnsMidExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--start") + .then($startColumn => { + const initialWidth = $startColumn.width(); + + const differenceFromSmallestWidth = initialWidth - smallestColumnWidth; + const testOffsetX = differenceFromSmallestWidth + 50; + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(-testOffsetX, 0) + .realMouseUp(); + + // Check what actually happened + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--start") + .then($finalColumn => { + const finalWidth = $finalColumn.width(); + }); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "TwoColumnsMidExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--start") + .should($startColumn => { + const finalWidth = $startColumn.width(); + expect(finalWidth).to.be.at.least(smallestColumnWidth); + }); + }); + }); + + it("preserves min-width of mid column in 2-column layout", () => { + const smallestColumnWidth = 248; + + cy.get("#fcl3") + .invoke("prop", "layout", "TwoColumnsStartExpanded"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "TwoColumnsStartExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--middle") + .then($midColumn => { + const midColumnWidth = $midColumn.width(); + const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; + const testOffsetX = differenceFromSmallestWidth + 10; + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(testOffsetX, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "TwoColumnsStartExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--middle") + .then($finalMidColumn => { + const finalWidth = $finalMidColumn.width(); + + expect(finalWidth).to.be.closeTo(smallestColumnWidth, 5); + }); + }); + }); + + it("preserves min-width of mid column in 3-column layout", () => { + const smallestColumnWidth = 248; + + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--middle") + .then($midColumn => { + const midColumnWidth = $midColumn.width(); + const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; + const testOffsetX = differenceFromSmallestWidth + 10; + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-testOffsetX, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsEndExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--middle") + .then($finalMidColumn => { + const finalWidth = $finalMidColumn.width(); + + expect(finalWidth).to.be.closeTo(smallestColumnWidth, 10); + }); + }); + }); + + it("preserves min-width of end column", () => { + const smallestColumnWidth = 248; + + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--end") + .then($endColumn => { + const endColumnWidth = $endColumn.width(); + const differenceFromSmallestWidth = endColumnWidth - smallestColumnWidth; + const testOffsetX = differenceFromSmallestWidth + 10; + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(testOffsetX, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--end") + .then($finalEndColumn => { + const finalWidth = $finalEndColumn.width(); + + expect(finalWidth).to.be.closeTo(smallestColumnWidth, 10); + }); + }); + }); + + it("fully reveals the end-column on dragging the end-separator only few pixels", () => { + const smallestColumnWidth = 248; + + cy.get("#fcl3") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-100, 0) + .realMouseUp(); + + cy.get("#fcl3") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl3") + .shadow() + .find(".ui5-fcl-column--end") + .should($endColumn => { + const width = $endColumn.width(); + expect(width).to.be.closeTo(smallestColumnWidth, 10); + }); + }); +}); + +describe("Accessibility with Animation Disabled", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + + cy.get("#fclAcc").then(($fcl) => { + ($fcl[0] as any).accessibilityAttributes = { + startColumn: { + name: "Products list", + }, + midColumn: { + name: "Product information", + }, + endColumn: { + name: "Product detailed information", + }, + startSeparator: { + name: "Start Draggable Splitter", + }, + endSeparator: { + name: "End Draggable Splitter", + }, + }; + }); + }); + + it("tests separator acc attrs", () => { + const startSeparatorText = "Start Draggable Splitter"; + const endSeparatorText = "End Draggable Splitter"; + + cy.get("#fclAcc") + .shadow() + .find(".ui5-fcl-separator-start") + .should("have.attr", "title", startSeparatorText); + + cy.get("#fclAcc") + .shadow() + .find(".ui5-fcl-separator-end") + .should("have.attr", "title", endSeparatorText); + }); + + it("tests acc default roles", () => { + cy.get("#fclAcc") + .shadow() + .find(".ui5-fcl-column--start") + .should("have.attr", "role", "region"); + + cy.get("#fclAcc") + .shadow() + .find(".ui5-fcl-column--middle") + .should("have.attr", "role", "region"); + + cy.get("#fclAcc") + .shadow() + .find(".ui5-fcl-column--end") + .should("not.have.attr", "role"); + + cy.get("#fclAcc") + .shadow() + .find(".ui5-fcl-separator-start") + .should("have.attr", "role", "separator"); + + cy.get("#fclAcc") + .shadow() + .find(".ui5-fcl-separator-end") + .should("have.attr", "role", "separator"); + }); + + it("tests acc custom roles", () => { + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + + cy.get("#fclAccRoles").then(($fcl) => { + ($fcl[0] as any).accessibilityAttributes = { + startColumn: { role: "complementary" }, + startSeparator: { role: "navigation" }, + midColumn: { role: "main" }, + endSeparator: { role: "navigation" }, + endColumn: { role: "complementary" }, + }; + }); + + cy.get("#fclAccRoles") + .shadow() + .find(".ui5-fcl-column--start") + .should("have.attr", "role", "complementary"); + + cy.get("#fclAccRoles") + .shadow() + .find(".ui5-fcl-column--middle") + .should("have.attr", "role", "main"); + + cy.get("#fclAccRoles") + .shadow() + .find(".ui5-fcl-column--end") + .should("have.attr", "role", "complementary"); + + cy.get("#fclAccRoles") + .shadow() + .find(".ui5-fcl-separator-start") + .should("have.attr", "role", "navigation"); + + cy.get("#fclAccRoles") + .shadow() + .find(".ui5-fcl-separator-end") + .should("have.attr", "role", "navigation"); + }); + + it("tests acc attrs", () => { + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + + cy.get("#fclAccAttrs") + .shadow() + .find(".ui5-fcl-column--start") + .should("not.have.attr", "aria-hidden"); + + cy.get("#fclAccAttrs") + .shadow() + .find(".ui5-fcl-column--middle") + .should("have.attr", "aria-hidden", "true"); + }); +}); + +describe("First column closing arrow behavior", () => { + beforeEach(() => { + cy.wrap({ setAnimationMode }) + .invoke("setAnimationMode", AnimationMode.None); + + cy.viewport(1400, 1080); + + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + }); + + it("should switch layout and update arrow icon on desktop", () => { + cy.get("#fcl10") + .invoke("prop", "layout", "ThreeColumnsStartHiddenMidExpanded"); + + cy.get("#fcl10") + .shadow() + .find(".ui5-fcl-arrow--start") + .should("have.attr", "icon", "slim-arrow-right"); + + cy.get("#fcl10") + .shadow() + .find(".ui5-fcl-arrow--start") + .click(); + + cy.get("#fcl10") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsMidExpanded"); + + cy.get("#fcl10") + .shadow() + .find(".ui5-fcl-arrow--start") + .should("have.attr", "icon", "slim-arrow-left"); + + cy.get("#fcl10") + .shadow() + .find(".ui5-fcl-arrow--start") + .click(); + + cy.get("#fcl10") + .invoke("prop", "layout") + .should("equal", "ThreeColumnsStartHiddenMidExpanded"); + + cy.get("#fcl10") + .shadow() + .find(".ui5-fcl-arrow--start") + .should("have.attr", "icon", "slim-arrow-right"); + }); +}); \ No newline at end of file From 691aba90b3cd74b3bb7d7a587877a17bec644643 Mon Sep 17 00:00:00 2001 From: Nikola Anachkov Date: Mon, 23 Jun 2025 17:06:28 +0300 Subject: [PATCH 2/8] refactor: move animation mode setup to global before hook --- packages/fiori/cypress/specs/FCL.cy.tsx | 43 ++++--------------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/packages/fiori/cypress/specs/FCL.cy.tsx b/packages/fiori/cypress/specs/FCL.cy.tsx index 2873a47b2f12..107c3bf76cb9 100644 --- a/packages/fiori/cypress/specs/FCL.cy.tsx +++ b/packages/fiori/cypress/specs/FCL.cy.tsx @@ -2,11 +2,15 @@ import { setAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationM import FlexibleColumnLayout from "../../src/FlexibleColumnLayout.js"; import AnimationMode from "@ui5/webcomponents-base/dist/types/AnimationMode.js"; +before(() => { + cy.wrap({ setAnimationMode }) + .then(api => { + return api.setAnimationMode("none"); + }); + }); + describe("Columns resize", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.mount(
some content
@@ -133,9 +137,6 @@ describe("ACC", () => { describe("FlexibleColumnLayout Behavior", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1000, 1080); cy.mount( @@ -174,9 +175,6 @@ describe("FlexibleColumnLayout Behavior", () => { describe("Layout API Tests", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1600, 1080); cy.mount( @@ -243,9 +241,6 @@ describe("Layout API Tests", () => { describe("Column Expansion Tests", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1600, 1080); cy.mount( @@ -285,9 +280,6 @@ describe("Column Expansion Tests", () => { describe("Start Column Expansion Test", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1600, 1080); cy.mount( @@ -366,9 +358,6 @@ describe("Start Column Expansion Test", () => { describe("Layout change by dragging end-separator on desktop", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1600, 1080); cy.mount( @@ -423,9 +412,6 @@ describe("Layout change by dragging end-separator on desktop", () => { describe("Layout change by dragging start-separator on tablet", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1000, 1080); cy.mount( @@ -500,9 +486,6 @@ describe("Layout change by dragging start-separator on tablet", () => { describe("Tablet Layout Tests", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1000, 1080); cy.mount( @@ -577,9 +560,6 @@ describe("Tablet Layout Tests", () => { describe("Layout change by dragging end-separator on tablet", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1000, 1080); cy.mount( @@ -634,9 +614,6 @@ describe("Layout change by dragging end-separator on tablet", () => { describe("Preserves column min-width", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1400, 1080); cy.mount( @@ -875,9 +852,6 @@ describe("Preserves column min-width", () => { describe("Accessibility with Animation Disabled", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.mount(
some content
@@ -1017,9 +991,6 @@ describe("Accessibility with Animation Disabled", () => { describe("First column closing arrow behavior", () => { beforeEach(() => { - cy.wrap({ setAnimationMode }) - .invoke("setAnimationMode", AnimationMode.None); - cy.viewport(1400, 1080); cy.mount( From a370abb76404b9639ab216c7b883d21b42189d1b Mon Sep 17 00:00:00 2001 From: Nikola Anachkov Date: Tue, 24 Jun 2025 11:18:15 +0300 Subject: [PATCH 3/8] refactor: comment out the problematic tests --- packages/fiori/cypress/specs/FCL.cy.tsx | 245 ++++++++++++------------ 1 file changed, 122 insertions(+), 123 deletions(-) diff --git a/packages/fiori/cypress/specs/FCL.cy.tsx b/packages/fiori/cypress/specs/FCL.cy.tsx index 107c3bf76cb9..acde1017066a 100644 --- a/packages/fiori/cypress/specs/FCL.cy.tsx +++ b/packages/fiori/cypress/specs/FCL.cy.tsx @@ -1,6 +1,5 @@ import { setAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js"; import FlexibleColumnLayout from "../../src/FlexibleColumnLayout.js"; -import AnimationMode from "@ui5/webcomponents-base/dist/types/AnimationMode.js"; before(() => { cy.wrap({ setAnimationMode }) @@ -389,25 +388,25 @@ describe("Layout change by dragging end-separator on desktop", () => { .should("equal", "ThreeColumnsMidExpanded"); }); - it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { - cy.get("#fcl3") - .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); - - cy.get("#fcl3") - .shadow() - .find(".ui5-fcl-separator-end") - .realMouseDown() - .realMouseMove(-400, 0) - .realMouseUp(); - - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsEndExpanded"); - }); + // it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { + // cy.get("#fcl3") + // .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsMidExpanded"); + + // cy.get("#fcl3") + // .shadow() + // .find(".ui5-fcl-separator-end") + // .realMouseDown() + // .realMouseMove(-400, 0) + // .realMouseUp(); + + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsEndExpanded"); + // }); }); describe("Layout change by dragging start-separator on tablet", () => { @@ -443,45 +442,45 @@ describe("Layout change by dragging start-separator on tablet", () => { .should("equal", "TwoColumnsMidExpanded"); }); - it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", () => { - cy.get("#fcl1") - .invoke("prop", "layout", "TwoColumnsMidExpanded"); - - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "TwoColumnsMidExpanded"); - - cy.get("#fcl1") - .shadow() - .find(".ui5-fcl-separator-start") - .realMouseDown() - .realMouseMove(400, 0) - .realMouseUp(); - - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "TwoColumnsStartExpanded"); - }); - - it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", () => { - cy.get("#fcl1") - .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); - - cy.get("#fcl1") - .shadow() - .find(".ui5-fcl-separator-start") - .realMouseDown() - .realMouseMove(300, 0) - .realMouseUp(); - - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); - }); + // it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", () => { + // cy.get("#fcl1") + // .invoke("prop", "layout", "TwoColumnsMidExpanded"); + + // cy.get("#fcl1") + // .invoke("prop", "layout") + // .should("equal", "TwoColumnsMidExpanded"); + + // cy.get("#fcl1") + // .shadow() + // .find(".ui5-fcl-separator-start") + // .realMouseDown() + // .realMouseMove(400, 0) + // .realMouseUp(); + + // cy.get("#fcl1") + // .invoke("prop", "layout") + // .should("equal", "TwoColumnsStartExpanded"); + // }); + + // it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", () => { + // cy.get("#fcl1") + // .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + // cy.get("#fcl1") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsMidExpanded"); + + // cy.get("#fcl1") + // .shadow() + // .find(".ui5-fcl-separator-start") + // .realMouseDown() + // .realMouseMove(300, 0) + // .realMouseUp(); + + // cy.get("#fcl1") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsMidExpandedEndHidden"); + // }); }); describe("Tablet Layout Tests", () => { @@ -517,25 +516,25 @@ describe("Tablet Layout Tests", () => { .should("equal", "ThreeColumnsStartExpandedEndHidden"); }); - it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", () => { - cy.get("#fcl3") - .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); + // it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", () => { + // cy.get("#fcl3") + // .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsStartExpandedEndHidden"); + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsStartExpandedEndHidden"); - cy.get("#fcl3") - .shadow() - .find(".ui5-fcl-separator-start") - .realMouseDown() - .realMouseMove(-400, 0) - .realMouseUp(); + // cy.get("#fcl3") + // .shadow() + // .find(".ui5-fcl-separator-start") + // .realMouseDown() + // .realMouseMove(-400, 0) + // .realMouseUp(); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); - }); + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsMidExpandedEndHidden"); + // }); it("preserves ThreeColumnsMidExpandedEndHidden when dragging to shrink start column", () => { cy.get("#fcl3") @@ -591,25 +590,25 @@ describe("Layout change by dragging end-separator on tablet", () => { .should("equal", "ThreeColumnsMidExpanded"); }); - it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { - cy.get("#fcl3") - .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); - - cy.get("#fcl3") - .shadow() - .find(".ui5-fcl-separator-end") - .realMouseDown() - .realMouseMove(-300, 0) - .realMouseUp(); - - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsEndExpanded"); - }); + // it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { + // cy.get("#fcl3") + // .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsMidExpanded"); + + // cy.get("#fcl3") + // .shadow() + // .find(".ui5-fcl-separator-end") + // .realMouseDown() + // .realMouseMove(-300, 0) + // .realMouseUp(); + + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsEndExpanded"); + // }); }); describe("Preserves column min-width", () => { @@ -819,35 +818,35 @@ describe("Preserves column min-width", () => { }); }); - it("fully reveals the end-column on dragging the end-separator only few pixels", () => { - const smallestColumnWidth = 248; - - cy.get("#fcl3") - .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); - - cy.get("#fcl3") - .shadow() - .find(".ui5-fcl-separator-end") - .realMouseDown() - .realMouseMove(-100, 0) - .realMouseUp(); - - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); - - cy.get("#fcl3") - .shadow() - .find(".ui5-fcl-column--end") - .should($endColumn => { - const width = $endColumn.width(); - expect(width).to.be.closeTo(smallestColumnWidth, 10); - }); - }); + // it("fully reveals the end-column on dragging the end-separator only few pixels", () => { + // const smallestColumnWidth = 248; + + // cy.get("#fcl3") + // .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsMidExpandedEndHidden"); + + // cy.get("#fcl3") + // .shadow() + // .find(".ui5-fcl-separator-end") + // .realMouseDown() + // .realMouseMove(-100, 0) + // .realMouseUp(); + + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "ThreeColumnsMidExpanded"); + + // cy.get("#fcl3") + // .shadow() + // .find(".ui5-fcl-column--end") + // .should($endColumn => { + // const width = $endColumn.width(); + // expect(width).to.be.closeTo(smallestColumnWidth, 10); + // }); + // }); }); describe("Accessibility with Animation Disabled", () => { From 0afad6e18cd5a47df8d9989479e4fef90f589eb5 Mon Sep 17 00:00:00 2001 From: Nikola Anachkov Date: Tue, 24 Jun 2025 11:30:19 +0300 Subject: [PATCH 4/8] refactor: comment out the problematic tests --- packages/fiori/cypress/specs/FCL.cy.tsx | 72 ++++++++++++------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/packages/fiori/cypress/specs/FCL.cy.tsx b/packages/fiori/cypress/specs/FCL.cy.tsx index acde1017066a..83475341fd18 100644 --- a/packages/fiori/cypress/specs/FCL.cy.tsx +++ b/packages/fiori/cypress/specs/FCL.cy.tsx @@ -698,45 +698,45 @@ describe("Preserves column min-width", () => { }); }); - it("preserves min-width of mid column in 2-column layout", () => { - const smallestColumnWidth = 248; - - cy.get("#fcl3") - .invoke("prop", "layout", "TwoColumnsStartExpanded"); - - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "TwoColumnsStartExpanded"); - - cy.get("#fcl3") - .shadow() - .find(".ui5-fcl-column--middle") - .then($midColumn => { - const midColumnWidth = $midColumn.width(); - const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; - const testOffsetX = differenceFromSmallestWidth + 10; - - cy.get("#fcl3") - .shadow() - .find(".ui5-fcl-separator-start") - .realMouseDown() - .realMouseMove(testOffsetX, 0) - .realMouseUp(); + // it("preserves min-width of mid column in 2-column layout", () => { + // const smallestColumnWidth = 248; - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "TwoColumnsStartExpanded"); + // cy.get("#fcl3") + // .invoke("prop", "layout", "TwoColumnsStartExpanded"); - cy.get("#fcl3") - .shadow() - .find(".ui5-fcl-column--middle") - .then($finalMidColumn => { - const finalWidth = $finalMidColumn.width(); + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "TwoColumnsStartExpanded"); - expect(finalWidth).to.be.closeTo(smallestColumnWidth, 5); - }); - }); - }); + // cy.get("#fcl3") + // .shadow() + // .find(".ui5-fcl-column--middle") + // .then($midColumn => { + // const midColumnWidth = $midColumn.width(); + // const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; + // const testOffsetX = differenceFromSmallestWidth + 10; + + // cy.get("#fcl3") + // .shadow() + // .find(".ui5-fcl-separator-start") + // .realMouseDown() + // .realMouseMove(testOffsetX, 0) + // .realMouseUp(); + + // cy.get("#fcl3") + // .invoke("prop", "layout") + // .should("equal", "TwoColumnsStartExpanded"); + + // cy.get("#fcl3") + // .shadow() + // .find(".ui5-fcl-column--middle") + // .then($finalMidColumn => { + // const finalWidth = $finalMidColumn.width(); + + // expect(finalWidth).to.be.closeTo(smallestColumnWidth, 5); + // }); + // }); + // }); it("preserves min-width of mid column in 3-column layout", () => { const smallestColumnWidth = 248; From ea4212ded62cd14eaf8d2c85bbdb4071cee80922 Mon Sep 17 00:00:00 2001 From: Nikola Anachkov Date: Wed, 25 Jun 2025 14:29:36 +0300 Subject: [PATCH 5/8] refactor: address comments --- packages/fiori/cypress/specs/FCL.cy.tsx | 765 +++++++++++------------- packages/fiori/test/specs/FCL.spec.js | 590 ------------------ 2 files changed, 361 insertions(+), 994 deletions(-) delete mode 100644 packages/fiori/test/specs/FCL.spec.js diff --git a/packages/fiori/cypress/specs/FCL.cy.tsx b/packages/fiori/cypress/specs/FCL.cy.tsx index 83475341fd18..e27959a6e955 100644 --- a/packages/fiori/cypress/specs/FCL.cy.tsx +++ b/packages/fiori/cypress/specs/FCL.cy.tsx @@ -135,40 +135,49 @@ describe("ACC", () => { }); describe("FlexibleColumnLayout Behavior", () => { - beforeEach(() => { - cy.viewport(1000, 1080); + it("tests Desktop size 1400px", () => { + cy.viewport(1400, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); - }); - it("tests Desktop size 1400px", () => { - cy.viewport(1400, 1080); - - cy.get("#fcl3") - .invoke("attr", "_visible-columns") - .should("equal", "3"); + cy.get("[ui5-flexible-column-layout]") + .should("have.attr", "_visible-columns", "3"); }); it("tests Tablet Size 1000px", () => { cy.viewport(1000, 1080); - cy.get("#fcl3") - .invoke("attr", "_visible-columns") - .should("equal", "2"); + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + + cy.get("[ui5-flexible-column-layout]") + .should("have.attr", "_visible-columns", "2"); }); it("tests Phone size 500px", () => { cy.viewport(320, 1080); - cy.get("#fcl3") - .invoke("attr", "_visible-columns") - .should("equal", "1"); + cy.mount( + +
some content
+
some content
+
some content
+
+ ); + + cy.get("[ui5-flexible-column-layout]") + .should("have.attr", "_visible-columns", "1"); }); }); @@ -177,64 +186,57 @@ describe("Layout API Tests", () => { cy.viewport(1600, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); it("tests change layout with API", () => { - cy.get("#fcl1") - .invoke("attr", "_visible-columns") - .should("equal", "2"); + cy.get("[ui5-flexible-column-layout]") + .should("have.attr", "_visible-columns", "2"); - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "TwoColumnsStartExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsStartExpanded"); - cy.get("#fcl1") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl1") - .invoke("attr", "_visible-columns") - .should("equal", "3"); + cy.get("[ui5-flexible-column-layout]") + .should("have.attr", "_visible-columns", "3"); - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); }); it("tests change layout upon dragging the separator to a new layout", () => { - cy.get("#fcl1") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "TwoColumnsStartExpanded"); - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "TwoColumnsStartExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsStartExpanded"); - cy.get("#fcl1") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .realMouseDown() .realMouseMove(-400, 0) .realMouseUp(); - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "TwoColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsMidExpanded"); - cy.get("#fcl1") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .realMouseDown() .realMouseMove(400, 0) .realMouseUp(); - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "TwoColumnsStartExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsStartExpanded"); }); }); @@ -243,37 +245,34 @@ describe("Column Expansion Tests", () => { cy.viewport(1600, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); it("allows expand mid column from TwoColumnsStartExpanded to TwoColumnsMidExpanded", () => { - cy.get("#fcl-expansion") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "TwoColumnsMidExpanded"); - cy.get("#fcl-expansion") - .invoke("prop", "layout") - .should("equal", "TwoColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsMidExpanded"); }); it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", () => { - cy.get("#fcl-expansion") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl-expansion") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl-expansion") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl-expansion") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); }); }); @@ -282,76 +281,68 @@ describe("Start Column Expansion Test", () => { cy.viewport(1600, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", () => { - cy.get("#fcl-start") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "TwoColumnsMidExpanded"); - cy.get("#fcl-start") - .invoke("prop", "layout") - .should("equal", "TwoColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsMidExpanded"); - cy.get("#fcl-start") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "TwoColumnsStartExpanded"); - cy.get("#fcl-start") - .invoke("prop", "layout") - .should("equal", "TwoColumnsStartExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsStartExpanded"); }); it("allows expand start column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsStartExpandedEndHidden", () => { - cy.get("#fcl-start") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl-start") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl-start") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); - cy.get("#fcl-start") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsStartExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsStartExpandedEndHidden"); }); it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", () => { - cy.get("#fcl-start") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); - cy.get("#fcl-start") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsStartExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsStartExpandedEndHidden"); - cy.get("#fcl-start") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl-start") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); }); it("allows expand end column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", () => { - cy.get("#fcl-start") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl-start") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl-start") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl-start") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); }); }); @@ -360,53 +351,49 @@ describe("Layout change by dragging end-separator on desktop", () => { cy.viewport(1600, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); it("allows expand end-column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", () => { - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") .realMouseDown() .realMouseMove(-400, 0) .realMouseUp(); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); }); - // it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { - // cy.get("#fcl3") - // .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsMidExpanded"); - - // cy.get("#fcl3") - // .shadow() - // .find(".ui5-fcl-separator-end") - // .realMouseDown() - // .realMouseMove(-400, 0) - // .realMouseUp(); - - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsEndExpanded"); - // }); + it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { + cy.get("[ui5-flexible-column-layout]") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-400, 0) + .realMouseUp(); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsEndExpanded"); + }); }); describe("Layout change by dragging start-separator on tablet", () => { @@ -414,73 +401,67 @@ describe("Layout change by dragging start-separator on tablet", () => { cy.viewport(1000, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); it("allows expand mid column from TwoColumnsStartExpanded to TwoColumnsMidExpanded", () => { - cy.get("#fcl1") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "TwoColumnsStartExpanded"); - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "TwoColumnsStartExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsStartExpanded"); - cy.get("#fcl1") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .realMouseDown() .realMouseMove(-400, 0) .realMouseUp(); - cy.get("#fcl1") - .invoke("prop", "layout") - .should("equal", "TwoColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsMidExpanded"); }); - // it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", () => { - // cy.get("#fcl1") - // .invoke("prop", "layout", "TwoColumnsMidExpanded"); - - // cy.get("#fcl1") - // .invoke("prop", "layout") - // .should("equal", "TwoColumnsMidExpanded"); - - // cy.get("#fcl1") - // .shadow() - // .find(".ui5-fcl-separator-start") - // .realMouseDown() - // .realMouseMove(400, 0) - // .realMouseUp(); - - // cy.get("#fcl1") - // .invoke("prop", "layout") - // .should("equal", "TwoColumnsStartExpanded"); - // }); - - // it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", () => { - // cy.get("#fcl1") - // .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - - // cy.get("#fcl1") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsMidExpanded"); - - // cy.get("#fcl1") - // .shadow() - // .find(".ui5-fcl-separator-start") - // .realMouseDown() - // .realMouseMove(300, 0) - // .realMouseUp(); - - // cy.get("#fcl1") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsMidExpandedEndHidden"); - // }); + it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", () => { + cy.get("[ui5-flexible-column-layout]") + .invoke("prop", "layout", "TwoColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(400, 0) + .realMouseUp(); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsStartExpanded"); + }); + + it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", () => { + cy.get("[ui5-flexible-column-layout]") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(300, 0) + .realMouseUp(); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + }); }); describe("Tablet Layout Tests", () => { @@ -488,72 +469,66 @@ describe("Tablet Layout Tests", () => { cy.viewport(1000, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); it("allows expand start column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsStartExpandedEndHidden", () => { - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .realMouseDown() .realMouseMove(400, 0) .realMouseUp(); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsStartExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsStartExpandedEndHidden"); }); - // it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", () => { - // cy.get("#fcl3") - // .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); + it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", () => { + cy.get("[ui5-flexible-column-layout]") + .invoke("prop", "layout", "ThreeColumnsStartExpandedEndHidden"); - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsStartExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsStartExpandedEndHidden"); - // cy.get("#fcl3") - // .shadow() - // .find(".ui5-fcl-separator-start") - // .realMouseDown() - // .realMouseMove(-400, 0) - // .realMouseUp(); + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(-400, 0) + .realMouseUp(); - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsMidExpandedEndHidden"); - // }); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + }); it("preserves ThreeColumnsMidExpandedEndHidden when dragging to shrink start column", () => { - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .realMouseDown() .realMouseMove(-100, 0) .realMouseUp(); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); }); }); @@ -562,53 +537,49 @@ describe("Layout change by dragging end-separator on tablet", () => { cy.viewport(1000, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); it("allows expand end-column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", () => { - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpandedEndHidden"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") .realMouseDown() .realMouseMove(-400, 0) .realMouseUp(); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); }); - // it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { - // cy.get("#fcl3") - // .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsMidExpanded"); - - // cy.get("#fcl3") - // .shadow() - // .find(".ui5-fcl-separator-end") - // .realMouseDown() - // .realMouseMove(-300, 0) - // .realMouseUp(); - - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsEndExpanded"); - // }); + it("allows expand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", () => { + cy.get("[ui5-flexible-column-layout]") + .invoke("prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-300, 0) + .realMouseUp(); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsEndExpanded"); + }); }); describe("Preserves column min-width", () => { @@ -616,10 +587,10 @@ describe("Preserves column min-width", () => { cy.viewport(1400, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); @@ -628,20 +599,19 @@ describe("Preserves column min-width", () => { const smallestDesktopWidth = 1024; const smallestColumnWidth = 248; - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("css", "width", `${smallestDesktopWidth}px`); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .should("have.css", "width", `${smallestDesktopWidth}px`); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--start") .should($startColumn => { @@ -653,14 +623,13 @@ describe("Preserves column min-width", () => { it("preserves min-width of begin column", () => { const smallestColumnWidth = 248; - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "TwoColumnsMidExpanded"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "TwoColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsMidExpanded"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--start") .then($startColumn => { @@ -669,26 +638,24 @@ describe("Preserves column min-width", () => { const differenceFromSmallestWidth = initialWidth - smallestColumnWidth; const testOffsetX = differenceFromSmallestWidth + 50; - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .realMouseDown() .realMouseMove(-testOffsetX, 0) .realMouseUp(); - // Check what actually happened - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--start") .then($finalColumn => { const finalWidth = $finalColumn.width(); }); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "TwoColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsMidExpanded"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--start") .should($startColumn => { @@ -698,57 +665,54 @@ describe("Preserves column min-width", () => { }); }); - // it("preserves min-width of mid column in 2-column layout", () => { - // const smallestColumnWidth = 248; - - // cy.get("#fcl3") - // .invoke("prop", "layout", "TwoColumnsStartExpanded"); - - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "TwoColumnsStartExpanded"); - - // cy.get("#fcl3") - // .shadow() - // .find(".ui5-fcl-column--middle") - // .then($midColumn => { - // const midColumnWidth = $midColumn.width(); - // const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; - // const testOffsetX = differenceFromSmallestWidth + 10; - - // cy.get("#fcl3") - // .shadow() - // .find(".ui5-fcl-separator-start") - // .realMouseDown() - // .realMouseMove(testOffsetX, 0) - // .realMouseUp(); - - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "TwoColumnsStartExpanded"); - - // cy.get("#fcl3") - // .shadow() - // .find(".ui5-fcl-column--middle") - // .then($finalMidColumn => { - // const finalWidth = $finalMidColumn.width(); - - // expect(finalWidth).to.be.closeTo(smallestColumnWidth, 5); - // }); - // }); - // }); + it("preserves min-width of mid column in 2-column layout", () => { + const smallestColumnWidth = 248; + + cy.get("[ui5-flexible-column-layout]") + .invoke("prop", "layout", "TwoColumnsStartExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsStartExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-column--middle") + .then($midColumn => { + const midColumnWidth = $midColumn.width(); + const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; + const testOffsetX = differenceFromSmallestWidth + 10; + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-separator-start") + .realMouseDown() + .realMouseMove(testOffsetX, 0) + .realMouseUp(); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "TwoColumnsStartExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-column--middle") + .then($finalMidColumn => { + const finalWidth = $finalMidColumn.width(); + + expect(finalWidth).to.be.closeTo(smallestColumnWidth, 5); + }); + }); + }); it("preserves min-width of mid column in 3-column layout", () => { const smallestColumnWidth = 248; - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--middle") .then($midColumn => { @@ -756,18 +720,17 @@ describe("Preserves column min-width", () => { const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; const testOffsetX = differenceFromSmallestWidth + 10; - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") .realMouseDown() .realMouseMove(-testOffsetX, 0) .realMouseUp(); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsEndExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsEndExpanded"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--middle") .then($finalMidColumn => { @@ -781,14 +744,13 @@ describe("Preserves column min-width", () => { it("preserves min-width of end column", () => { const smallestColumnWidth = 248; - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--end") .then($endColumn => { @@ -796,18 +758,17 @@ describe("Preserves column min-width", () => { const differenceFromSmallestWidth = endColumnWidth - smallestColumnWidth; const testOffsetX = differenceFromSmallestWidth + 10; - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") .realMouseDown() .realMouseMove(testOffsetX, 0) .realMouseUp(); - cy.get("#fcl3") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl3") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--end") .then($finalEndColumn => { @@ -818,48 +779,46 @@ describe("Preserves column min-width", () => { }); }); - // it("fully reveals the end-column on dragging the end-separator only few pixels", () => { - // const smallestColumnWidth = 248; - - // cy.get("#fcl3") - // .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsMidExpandedEndHidden"); - - // cy.get("#fcl3") - // .shadow() - // .find(".ui5-fcl-separator-end") - // .realMouseDown() - // .realMouseMove(-100, 0) - // .realMouseUp(); - - // cy.get("#fcl3") - // .invoke("prop", "layout") - // .should("equal", "ThreeColumnsMidExpanded"); - - // cy.get("#fcl3") - // .shadow() - // .find(".ui5-fcl-column--end") - // .should($endColumn => { - // const width = $endColumn.width(); - // expect(width).to.be.closeTo(smallestColumnWidth, 10); - // }); - // }); + it("fully reveals the end-column on dragging the end-separator only few pixels", () => { + const smallestColumnWidth = 248; + + cy.get("[ui5-flexible-column-layout]") + .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-separator-end") + .realMouseDown() + .realMouseMove(-100, 0) + .realMouseUp(); + + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); + + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-column--end") + .should($endColumn => { + const width = $endColumn.width(); + expect(width).to.be.closeTo(smallestColumnWidth, 10); + }); + }); }); describe("Accessibility with Animation Disabled", () => { beforeEach(() => { cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); - cy.get("#fclAcc").then(($fcl) => { + cy.get("[ui5-flexible-column-layout]").then(($fcl) => { ($fcl[0] as any).accessibilityAttributes = { startColumn: { name: "Products list", @@ -884,39 +843,39 @@ describe("Accessibility with Animation Disabled", () => { const startSeparatorText = "Start Draggable Splitter"; const endSeparatorText = "End Draggable Splitter"; - cy.get("#fclAcc") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .should("have.attr", "title", startSeparatorText); - cy.get("#fclAcc") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") .should("have.attr", "title", endSeparatorText); }); it("tests acc default roles", () => { - cy.get("#fclAcc") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--start") .should("have.attr", "role", "region"); - cy.get("#fclAcc") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--middle") .should("have.attr", "role", "region"); - cy.get("#fclAcc") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--end") .should("not.have.attr", "role"); - cy.get("#fclAcc") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .should("have.attr", "role", "separator"); - cy.get("#fclAcc") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") .should("have.attr", "role", "separator"); @@ -924,14 +883,14 @@ describe("Accessibility with Animation Disabled", () => { it("tests acc custom roles", () => { cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); - cy.get("#fclAccRoles").then(($fcl) => { + cy.get("[ui5-flexible-column-layout]").then(($fcl) => { ($fcl[0] as any).accessibilityAttributes = { startColumn: { role: "complementary" }, startSeparator: { role: "navigation" }, @@ -941,27 +900,27 @@ describe("Accessibility with Animation Disabled", () => { }; }); - cy.get("#fclAccRoles") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--start") .should("have.attr", "role", "complementary"); - cy.get("#fclAccRoles") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--middle") .should("have.attr", "role", "main"); - cy.get("#fclAccRoles") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--end") .should("have.attr", "role", "complementary"); - cy.get("#fclAccRoles") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") .should("have.attr", "role", "navigation"); - cy.get("#fclAccRoles") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") .should("have.attr", "role", "navigation"); @@ -969,19 +928,19 @@ describe("Accessibility with Animation Disabled", () => { it("tests acc attrs", () => { cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); - cy.get("#fclAccAttrs") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--start") .should("not.have.attr", "aria-hidden"); - cy.get("#fclAccAttrs") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--middle") .should("have.attr", "aria-hidden", "true"); @@ -993,47 +952,45 @@ describe("First column closing arrow behavior", () => { cy.viewport(1400, 1080); cy.mount( - -
some content
-
some content
-
some content
+ +
some content
+
some content
+
some content
); }); it("should switch layout and update arrow icon on desktop", () => { - cy.get("#fcl10") + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsStartHiddenMidExpanded"); - cy.get("#fcl10") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-arrow--start") .should("have.attr", "icon", "slim-arrow-right"); - cy.get("#fcl10") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-arrow--start") .click(); - cy.get("#fcl10") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsMidExpanded"); - cy.get("#fcl10") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-arrow--start") .should("have.attr", "icon", "slim-arrow-left"); - cy.get("#fcl10") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-arrow--start") .click(); - cy.get("#fcl10") - .invoke("prop", "layout") - .should("equal", "ThreeColumnsStartHiddenMidExpanded"); + cy.get("[ui5-flexible-column-layout]") + .should("have.prop", "layout", "ThreeColumnsStartHiddenMidExpanded"); - cy.get("#fcl10") + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-arrow--start") .should("have.attr", "icon", "slim-arrow-right"); diff --git a/packages/fiori/test/specs/FCL.spec.js b/packages/fiori/test/specs/FCL.spec.js deleted file mode 100644 index aa11d2712377..000000000000 --- a/packages/fiori/test/specs/FCL.spec.js +++ /dev/null @@ -1,590 +0,0 @@ -import { assert } from "chai"; - - -describe("FlexibleColumnLayout Behavior", () => { - before(async () => { - await browser.setWindowSize(1000, 1080); - await browser.url(`test/pages/FCL.html?sap-ui-animationMode=none`); - }); - - it("tests Desktop size 1400px", async () => { - // act - await browser.setWindowSize(1400, 1080); - - const layoutChangeCounter = await browser.$("#testLayoutChange"); - const visibleColumns = await browser.$("#fcl3").getAttribute("_visible-columns"); - - // assert - assert.strictEqual(visibleColumns, "3", "3 columns are visible"); - assert.strictEqual(await layoutChangeCounter.getValue(), "1", "The event layout-change is not fired."); - }); - - it("tests Tablet Size 1000px", async () => { - // act - await browser.setWindowSize(1000, 1080); - - const layoutChangeCounter = await browser.$("#testLayoutChange"); - const visibleColumns = await browser.$("#fcl3").getAttribute("_visible-columns"); - - // assert - assert.strictEqual(visibleColumns, "2", "2 columns are visible"); - assert.strictEqual(await layoutChangeCounter.getValue(), "2", "The event layout-change after resizing."); - }); - - it("tests Phone size 500px", async () => { - // act - await browser.setWindowSize(500, 1080); - - const layoutChangeCounter = await browser.$("#testLayoutChange"); - const visibleColumns = await browser.$("#fcl3").getAttribute("_visible-columns"); - - // assert - assert.strictEqual(visibleColumns, "1", "1 columns are visible"); - assert.strictEqual(await layoutChangeCounter.getValue(), "3", "The event layout-change after resizing."); - - // reset - await browser.setWindowSize(1400, 1080); - }); - - it("tests change layout with API", async () => { - const fcl = await browser.$("#fcl1"); - const btn = await browser.$("#switchBtn1"); - - let visibleColumns = await browser.$("#fcl1").getAttribute("_visible-columns"); - - assert.strictEqual(visibleColumns, "2", "2 columns are visible"); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "new layout set"); - - // act - await btn.click(); // fcl1.layout = "ThreeColumnsMidExpanded" - - visibleColumns = await browser.$("#fcl1").getAttribute("_visible-columns"); - - // assert - assert.strictEqual(visibleColumns, "3", "3 columns are visible"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - }); - - it("tests change layout upon dragging the separator to a new layout", async () => { - const fcl = await browser.$("#fcl1"); - const layoutChangeCounter = await browser.$("#layoutChangeRes4"); - const separator = await fcl.shadow$(".ui5-fcl-separator-start"); - let counter = parseInt(await layoutChangeCounter.getValue()) || 0; - - // set init state - await fcl.setProperty("layout", "TwoColumnsStartExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "expected initilal layout"); - - // act - await separator.dragAndDrop({ x: -400, y: 0 }); // drag to "TwoColumnsMidExpanded" - - // assert - assert.strictEqual(await layoutChangeCounter.getValue(), `${++counter}`, "The event layout-change fired once."); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsMidExpanded", "new layout set"); - - // act - await separator.dragAndDrop({ x: 400, y: 0 }); // drag to "TwoColumnsStartExpanded" - - // assert - assert.strictEqual(await layoutChangeCounter.getValue(), `${++counter}`, "The event layout-change fired again."); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "new layout set"); - }); -}); - -describe("Layout change by dragging start-separator on desktop", () => { - before(async () => { - await browser.url(`test/pages/FCL.html?sap-ui-animationMode=none`); - }); - - it("allows expand mid column from TwoColumnsStartExpanded to TwoColumnsMidExpanded", async () => { - const fcl = await browser.$("#fcl1"); - const startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "TwoColumnsStartExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "expected initilal layout"); - - // act - await startSeparator.dragAndDrop({ x: -400, y: 0 }); // expand the mid column - - // assert - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsMidExpanded", "new layout set"); - }); - - it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", async () => { - const fcl = await browser.$("#fcl1"); - const separator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "TwoColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsMidExpanded", "expected initilal layout"); - - // act - await separator.dragAndDrop({ x: 400, y: 0 }); // expand the start column - - // assert - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "new layout set"); - }); - - it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "ThreeColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "expected initilal layout"); - - // act: expand start-column - await startSeparator.dragAndDrop({ x: 300, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - }); - - it("allows expand start column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsStartExpandedEndHidden", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "ThreeColumnsMidExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - - // act - await startSeparator.dragAndDrop({ x: 100, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsStartExpandedEndHidden", "new layout set"); - }); - - it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "ThreeColumnsStartExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsStartExpandedEndHidden", "new layout set"); - - // act - await startSeparator.dragAndDrop({ x: -100, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - }); - - it("allows expand end column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // assert init state - await fcl.setProperty("layout", "ThreeColumnsMidExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "expected initilal layout"); - - // act: expand start-column - await startSeparator.dragAndDrop({ x: -300, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - }); -}); - -describe("Layout change by dragging end-separator on desktop", () => { - before(async () => { - await browser.url(`test/pages/FCL.html?sap-ui-animationMode=none`); - }); - - it("allows expand end-column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", async () => { - const fcl = await browser.$("#fcl3"), - endSeparator = await fcl.shadow$(".ui5-fcl-separator-end"); - - // set initial state - await fcl.setProperty("layout", "ThreeColumnsMidExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - - // act: drag to show the end column - await endSeparator.dragAndDrop({ x: -400, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - }); - - it("allows exoand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", async () => { - const fcl = await browser.$("#fcl3"), - endSeparator = await fcl.shadow$(".ui5-fcl-separator-end"); - - // set initial state - await fcl.setProperty("layout", "ThreeColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - - // act: drag to make the end column wider than mid-column - await endSeparator.dragAndDrop({ x: -400, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsEndExpanded", "new layout set"); - }); -}); - -describe("Layout change by dragging start-separator on tablet", () => { - before(async () => { - await browser.url(`test/pages/FCL.html?sap-ui-animationMode=none`); - }); - - it("allows expand mid column from TwoColumnsStartExpanded to TwoColumnsMidExpanded", async () => { - await browser.setWindowSize(1000, 1080); // set tablet size - - const fcl = await browser.$("#fcl1"); - const startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "TwoColumnsStartExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "expected initilal layout"); - - // act - await startSeparator.dragAndDrop({ x: -400, y: 0 }); // expand the mid column - - // assert - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsMidExpanded", "new layout set"); - }); - - it("allows expand start column from TwoColumnsMidExpanded to TwoColumnsStartExpanded", async () => { - const fcl = await browser.$("#fcl1"); - const separator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "TwoColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsMidExpanded", "expected initilal layout"); - - // act - await separator.dragAndDrop({ x: 400, y: 0 }); // expand the start column - - // assert - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "new layout set"); - }); - - it("allows hide end column from ThreeColumnsMidExpanded to ThreeColumnsMidExpandedEndHidden", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "ThreeColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "expected initilal layout"); - - // act: expand start-column - await startSeparator.dragAndDrop({ x: 300, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - }); - - it("allows expand start column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsStartExpandedEndHidden", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "ThreeColumnsMidExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - - // act - await startSeparator.dragAndDrop({ x: 400, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsStartExpandedEndHidden", "new layout set"); - }); - - it("allows expand mid column from ThreeColumnsStartExpandedEndHidden to ThreeColumnsMidExpandedEndHidden", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // set init state - await fcl.setProperty("layout", "ThreeColumnsStartExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsStartExpandedEndHidden", "new layout set"); - - // act - await startSeparator.dragAndDrop({ x: -400, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - }); - - it("preserves ThreeColumnsMidExpandedEndHidden when dragging to shrink start column", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"); - - // assert init state - await fcl.setProperty("layout", "ThreeColumnsMidExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "expected initilal layout"); - - // act: expand start-column - await startSeparator.dragAndDrop({ x: -100, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "layout is preserved"); - }); -}); - -describe("Layout change by dragging end-separator on tablet", () => { - before(async () => { - await browser.url(`test/pages/FCL.html?sap-ui-animationMode=none`); - }); - - it("allows expand end-column from ThreeColumnsMidExpandedEndHidden to ThreeColumnsMidExpanded", async () => { - const fcl = await browser.$("#fcl3"), - endSeparator = await fcl.shadow$(".ui5-fcl-separator-end"); - - // set initial state - await fcl.setProperty("layout", "ThreeColumnsMidExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - - // act: drag to show the end column - await endSeparator.dragAndDrop({ x: -400, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - }); - - it("allows exoand end-column from ThreeColumnsMidExpanded to ThreeColumnsEndExpanded", async () => { - const fcl = await browser.$("#fcl3"), - endSeparator = await fcl.shadow$(".ui5-fcl-separator-end"); - - // set initial state - await fcl.setProperty("layout", "ThreeColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - - // act: drag to make the end column wider than mid-column - await endSeparator.dragAndDrop({ x: -300, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsEndExpanded", "new layout set"); - }); -}); - -describe("Preserves column min-width", () => { - before(async () => { - await browser.url(`test/pages/FCL.html?sap-ui-animationMode=none`); - }); - - it("complies with min-width requiremet on smallest desktop", async () => { - await browser.setWindowSize(1400, 1080); - - const fcl = await browser.$("#fcl3"), - smallestDesktopWidth = 1024, - smallestColumnWidth = 248; - - // set initial state - await fcl.setProperty("layout", "ThreeColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - - // set FCL width to the smallest desktop width - await browser.executeAsync(async (newWidth, done) => { - document.getElementById("fcl3").style.width = `${newWidth}px`; - done(); - }, smallestDesktopWidth); - - const startColumn = await fcl.shadow$(".ui5-fcl-column--start"); - const startColumnWidth = await startColumn.getSize("width"); - const fclWidth = await fcl.getSize("width"); - - // assert - assert.strictEqual(fclWidth, smallestDesktopWidth, "fcl is the smallest desktop width"); - assert.strictEqual(startColumnWidth, smallestColumnWidth, "min-width is respected"); - }); - - it("preserves min-width of begin column", async () => { - await browser.setWindowSize(1400, 1080); - - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"), - smallestColumnWidth = 248; - - // set initial state - await fcl.setProperty("layout", "TwoColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsMidExpanded", "new layout set"); - - const startColumn = await fcl.shadow$(".ui5-fcl-column--start"); - const startColumnWidth = await startColumn.getSize("width"); - const differenceFromSmallestWidth = startColumnWidth - smallestColumnWidth; - const testOffsetX = differenceFromSmallestWidth + 10; // surpass allowed diff with 10px - - // act: drag srink below min-width - await startSeparator.dragAndDrop({ x: -testOffsetX, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsMidExpanded", "the layout is preserved"); - assert.strictEqual(await startColumn.getSize("width"), smallestColumnWidth, "min-width is preserved"); - }); - - it("preserves min-width of mid column in 2-column layout", async () => { - const fcl = await browser.$("#fcl3"), - startSeparator = await fcl.shadow$(".ui5-fcl-separator-start"), - smallestColumnWidth = 248; - - // set initial state - await fcl.setProperty("layout", "TwoColumnsStartExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "new layout set"); - - const midColumn = await fcl.shadow$(".ui5-fcl-column--middle"); - const midColumnWidth = await midColumn.getSize("width"); - const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; - const testOffsetX = differenceFromSmallestWidth + 10; // surpass allowed diff with 10px - - // act: drag to srink below min-width - await startSeparator.dragAndDrop({ x: testOffsetX, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "TwoColumnsStartExpanded", "the layout is preserved"); - assert.strictEqual(await midColumn.getSize("width"), smallestColumnWidth, "min-width is preserved"); - }); - - it("preserves min-width of mid column in 3-column layout", async () => { - const fcl = await browser.$("#fcl3"), - endSeparator = await fcl.shadow$(".ui5-fcl-separator-end"), - smallestColumnWidth = 248; - - // set initial state - await fcl.setProperty("layout", "ThreeColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - - const midColumn = await fcl.shadow$(".ui5-fcl-column--middle"); - const midColumnWidth = await midColumn.getSize("width"); - const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; - const testOffsetX = differenceFromSmallestWidth + 10; // surpass allowed diff with 10px - - // act: drag to srink below min-width - await endSeparator.dragAndDrop({ x: -testOffsetX, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsEndExpanded", "the layout is updated"); - assert.strictEqual(await midColumn.getSize("width"), smallestColumnWidth, "min-width is preserved"); - }); - - it("preserves min-width of end column", async () => { - const fcl = await browser.$("#fcl3"), - endSeparator = await fcl.shadow$(".ui5-fcl-separator-end"), - smallestColumnWidth = 248; - - // set initial state - await fcl.setProperty("layout", "ThreeColumnsMidExpanded"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - - const endColumn = await fcl.shadow$(".ui5-fcl-column--end"); - const endColumnWidth = await endColumn.getSize("width"); - const differenceFromSmallestWidth = endColumnWidth - smallestColumnWidth; - const testOffsetX = differenceFromSmallestWidth + 10; // surpass allowed diff with 10px - - // act: drag to srink below min-width - await endSeparator.dragAndDrop({ x: testOffsetX, y: 0 }); - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "the layout is preserved"); - assert.strictEqual(await endColumn.getSize("width"), smallestColumnWidth, "min-width is preserved"); - }); - - it("fully reveals the end-column on dragging the end-separator only few pixels", async () => { - const fcl = await browser.$("#fcl3"), - endSeparator = await fcl.shadow$(".ui5-fcl-separator-end"), - endColumn = await fcl.shadow$(".ui5-fcl-column--end"), - smallestColumnWidth = 248; - - // set initial state - await fcl.setProperty("layout", "ThreeColumnsMidExpandedEndHidden"); - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpandedEndHidden", "new layout set"); - - // act: drag to show the end column - await endSeparator.dragAndDrop({ x: -100, y: 0 }); - - // assert - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "new layout set"); - assert.strictEqual(await endColumn.getSize("width"), smallestColumnWidth, "min-width is ensured"); - }); -}); - -describe("ACC", () => { - before(async () => { - await browser.url(`test/pages/FCL.html?sap-ui-animationMode=none`); - }); - - it("tests separator acc attrs", async () => { - const fcl = await browser.$("#fclAcc"); - const startSeparatorDOM = await fcl.shadow$(".ui5-fcl-separator-start"); - const endSeparatorDOM = await fcl.shadow$(".ui5-fcl-separator-end"); - const startSeparatorText = "Start Draggable Splitter"; - const endSeparatorText = "End Draggable Splitter"; - - // assert - assert.strictEqual(await startSeparatorDOM.getAttribute("title"), startSeparatorText, - "Start arrow container has the correct label."); - assert.strictEqual(await endSeparatorDOM.getAttribute("title"), endSeparatorText, - "End arrow container has the correct label."); - }); - - it("tests acc default roles", async () => { - let fcl = await browser.$("#fclAcc"); - - const startColumnDOM = await fcl.shadow$(".ui5-fcl-column--start"); - const middleColumnDOM = await fcl.shadow$(".ui5-fcl-column--middle"); - const endColumnDOM = await fcl.shadow$(".ui5-fcl-column--end"); - - const startSeparatorDOM = await fcl.shadow$(".ui5-fcl-separator-start"); - const endSeparatorDOM = await fcl.shadow$(".ui5-fcl-separator-end"); - - // assert - assert.strictEqual(await startColumnDOM.getAttribute("role"), "region", - "Start column has the correct default role."); - - assert.strictEqual(await middleColumnDOM.getAttribute("role"), "region", - "Middle column has the correct default role."); - - assert.strictEqual(await endColumnDOM.getAttribute("role"), null, - "End column has the correct default role."); // hidden column - - assert.strictEqual(await startSeparatorDOM.getAttribute("role"), "separator", - "Start arrow container has the correct default role."); - - assert.strictEqual(await endSeparatorDOM.getAttribute("role"), "separator", - "End arrow container has the correct default role."); - }); - - it("tests acc custom roles", async () => { - let fcl = await browser.$("#fclAccRoles"); - - const startColumnDOM = await fcl.shadow$(".ui5-fcl-column--start"); - const middleColumnDOM = await fcl.shadow$(".ui5-fcl-column--middle"); - const endColumnDOM = await fcl.shadow$(".ui5-fcl-column--end"); - - const startSeparatorDOM = await fcl.shadow$(".ui5-fcl-separator-start"); - const endSeparatorDOM = await fcl.shadow$(".ui5-fcl-separator-end"); - - // assert - assert.strictEqual(await startColumnDOM.getAttribute("role"), "complementary", - "Start column has the correct custom role."); - - assert.strictEqual(await middleColumnDOM.getAttribute("role"), "main", - "Middle column has the correct custom role."); - - assert.strictEqual(await endColumnDOM.getAttribute("role"), "complementary", - "End column has the correct custom role."); - - assert.strictEqual(await startSeparatorDOM.getAttribute("role"), "navigation", - "Start arrow container has the correct custom role."); - - assert.strictEqual(await endSeparatorDOM.getAttribute("role"), "navigation", - "End arrow container has the correct custom role."); - }); - - it("tests acc attrs", async () => { - let fcl = await browser.$("#fclAccAttrs"); - - const startColumnDOM = await fcl.shadow$(".ui5-fcl-column--start"); - const middleColumnDOM = await fcl.shadow$(".ui5-fcl-column--middle"); - - // assert - assert.strictEqual(await startColumnDOM.getAttribute("aria-hidden"), null, - "Start column is not hidden from the acc tree."); - - assert.strictEqual(await middleColumnDOM.getAttribute("aria-hidden"), "true", - "Middle column is hidden from the acc tree."); - }); -}); - -describe("First column closing arrow behavior", () => { - it("should switch layout and update arrow icon on desktop", async () => { - const fcl = await browser.$("#fcl10"); - const arrowBtn = await fcl.shadow$(".ui5-fcl-arrow--start"); - - await fcl.setProperty("layout", "ThreeColumnsStartHiddenMidExpanded"); - assert.strictEqual(await arrowBtn.getAttribute("icon"), "slim-arrow-right", "Arrow should point right"); - - await arrowBtn.click(); - - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsMidExpanded", "Layout should switch to ThreeColumnsMidExpanded"); - assert.strictEqual(await arrowBtn.getAttribute("icon"), "slim-arrow-left", "Arrow should point left"); - - await arrowBtn.click(); - - assert.strictEqual(await fcl.getProperty("layout"), "ThreeColumnsStartHiddenMidExpanded", "Layout should switch to ThreeColumnsStartHiddenMidExpanded"); - assert.strictEqual(await arrowBtn.getAttribute("icon"), "slim-arrow-right", "Arrow should point right"); - }); -}); \ No newline at end of file From 87c26e9cdfb4659c1c84e36315c520e6a7ffa68b Mon Sep 17 00:00:00 2001 From: Nikola Anachkov Date: Wed, 25 Jun 2025 15:04:52 +0300 Subject: [PATCH 6/8] fix: failing tests --- packages/fiori/cypress/specs/FCL.cy.tsx | 100 ++++++++++++++++++------ 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/packages/fiori/cypress/specs/FCL.cy.tsx b/packages/fiori/cypress/specs/FCL.cy.tsx index e27959a6e955..09911dcd6df9 100644 --- a/packages/fiori/cypress/specs/FCL.cy.tsx +++ b/packages/fiori/cypress/specs/FCL.cy.tsx @@ -3,10 +3,10 @@ import FlexibleColumnLayout from "../../src/FlexibleColumnLayout.js"; before(() => { cy.wrap({ setAnimationMode }) - .then(api => { - return api.setAnimationMode("none"); - }); - }); + .then(api => { + return api.setAnimationMode("none"); + }); +}); describe("Columns resize", () => { beforeEach(() => { @@ -437,8 +437,17 @@ describe("Layout change by dragging start-separator on tablet", () => { cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") - .realMouseDown() - .realMouseMove(400, 0) + .should("be.visible") + .as("separator"); + + // Separate the drag operations + cy.get("@separator") + .realMouseDown(); + + cy.get("@separator") + .realMouseMove(400, 0); + + cy.get("@separator") .realMouseUp(); cy.get("[ui5-flexible-column-layout]") @@ -455,8 +464,16 @@ describe("Layout change by dragging start-separator on tablet", () => { cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") - .realMouseDown() - .realMouseMove(300, 0) + .should("be.visible") + .as("startSeparator"); + + cy.get("@startSeparator") + .realMouseDown(); + + cy.get("@startSeparator") + .realMouseMove(300, 0); + + cy.get("@startSeparator") .realMouseUp(); cy.get("[ui5-flexible-column-layout]") @@ -505,8 +522,16 @@ describe("Tablet Layout Tests", () => { cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-start") - .realMouseDown() - .realMouseMove(-400, 0) + .should("be.visible") + .as("separator"); + + cy.get("@separator") + .realMouseDown(); + + cy.get("@separator") + .realMouseMove(-400, 0); + + cy.get("@separator") .realMouseUp(); cy.get("[ui5-flexible-column-layout]") @@ -573,8 +598,16 @@ describe("Layout change by dragging end-separator on tablet", () => { cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") - .realMouseDown() - .realMouseMove(-300, 0) + .should("be.visible") + .as("endSeparator"); + + cy.get("@endSeparator") + .realMouseDown(); + + cy.get("@endSeparator") + .realMouseMove(-300, 0); + + cy.get("@endSeparator") .realMouseUp(); cy.get("[ui5-flexible-column-layout]") @@ -674,6 +707,12 @@ describe("Preserves column min-width", () => { cy.get("[ui5-flexible-column-layout]") .should("have.prop", "layout", "TwoColumnsStartExpanded"); + cy.get("[ui5-flexible-column-layout]") + .shadow() + .find(".ui5-fcl-separator-start") + .should("be.visible") + .as("separator"); + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--middle") @@ -682,11 +721,13 @@ describe("Preserves column min-width", () => { const differenceFromSmallestWidth = midColumnWidth - smallestColumnWidth; const testOffsetX = differenceFromSmallestWidth + 10; - cy.get("[ui5-flexible-column-layout]") - .shadow() - .find(".ui5-fcl-separator-start") - .realMouseDown() - .realMouseMove(testOffsetX, 0) + cy.get("@separator") + .realMouseDown(); + + cy.get("@separator") + .realMouseMove(testOffsetX, 0); + + cy.get("@separator") .realMouseUp(); cy.get("[ui5-flexible-column-layout]") @@ -695,9 +736,8 @@ describe("Preserves column min-width", () => { cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--middle") - .then($finalMidColumn => { + .should($finalMidColumn => { const finalWidth = $finalMidColumn.width(); - expect(finalWidth).to.be.closeTo(smallestColumnWidth, 5); }); }); @@ -781,23 +821,31 @@ describe("Preserves column min-width", () => { it("fully reveals the end-column on dragging the end-separator only few pixels", () => { const smallestColumnWidth = 248; - + cy.get("[ui5-flexible-column-layout]") .invoke("prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - + cy.get("[ui5-flexible-column-layout]") .should("have.prop", "layout", "ThreeColumnsMidExpandedEndHidden"); - + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-separator-end") - .realMouseDown() - .realMouseMove(-100, 0) + .should("be.visible") + .as("endSeparator"); + + cy.get("@endSeparator") + .realMouseDown(); + + cy.get("@endSeparator") + .realMouseMove(-100, 0); + + cy.get("@endSeparator") .realMouseUp(); - + cy.get("[ui5-flexible-column-layout]") .should("have.prop", "layout", "ThreeColumnsMidExpanded"); - + cy.get("[ui5-flexible-column-layout]") .shadow() .find(".ui5-fcl-column--end") From 4b34fcd95172b5ffd1dbfe6283b4087448dc39dd Mon Sep 17 00:00:00 2001 From: Nikola Anachkov Date: Mon, 30 Jun 2025 10:39:21 +0300 Subject: [PATCH 7/8] refactor: change the realMouseMove --- packages/fiori/cypress/specs/FCL.cy.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/fiori/cypress/specs/FCL.cy.tsx b/packages/fiori/cypress/specs/FCL.cy.tsx index 09911dcd6df9..319e42f4e4fe 100644 --- a/packages/fiori/cypress/specs/FCL.cy.tsx +++ b/packages/fiori/cypress/specs/FCL.cy.tsx @@ -388,7 +388,7 @@ describe("Layout change by dragging end-separator on desktop", () => { .shadow() .find(".ui5-fcl-separator-end") .realMouseDown() - .realMouseMove(-400, 0) + .realMouseMove(-600, 0) .realMouseUp(); cy.get("[ui5-flexible-column-layout]") @@ -445,7 +445,7 @@ describe("Layout change by dragging start-separator on tablet", () => { .realMouseDown(); cy.get("@separator") - .realMouseMove(400, 0); + .realMouseMove(600, 0) cy.get("@separator") .realMouseUp(); @@ -529,7 +529,7 @@ describe("Tablet Layout Tests", () => { .realMouseDown(); cy.get("@separator") - .realMouseMove(-400, 0); + .realMouseMove(-600, 0) cy.get("@separator") .realMouseUp(); @@ -605,7 +605,7 @@ describe("Layout change by dragging end-separator on tablet", () => { .realMouseDown(); cy.get("@endSeparator") - .realMouseMove(-300, 0); + .realMouseMove(-500, 0) cy.get("@endSeparator") .realMouseUp(); @@ -838,7 +838,7 @@ describe("Preserves column min-width", () => { .realMouseDown(); cy.get("@endSeparator") - .realMouseMove(-100, 0); + .realMouseMove(-150, 0) cy.get("@endSeparator") .realMouseUp(); From ee17fc9a5a7438728322e8c6d23ff9cf9395c5d3 Mon Sep 17 00:00:00 2001 From: Nikola Anachkov Date: Mon, 30 Jun 2025 11:44:08 +0300 Subject: [PATCH 8/8] refactor: change the viewport --- packages/fiori/cypress/specs/FCL.cy.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/fiori/cypress/specs/FCL.cy.tsx b/packages/fiori/cypress/specs/FCL.cy.tsx index 319e42f4e4fe..ffa10d518c5c 100644 --- a/packages/fiori/cypress/specs/FCL.cy.tsx +++ b/packages/fiori/cypress/specs/FCL.cy.tsx @@ -348,7 +348,7 @@ describe("Start Column Expansion Test", () => { describe("Layout change by dragging end-separator on desktop", () => { beforeEach(() => { - cy.viewport(1600, 1080); + cy.viewport(1400, 1080); cy.mount( @@ -388,7 +388,7 @@ describe("Layout change by dragging end-separator on desktop", () => { .shadow() .find(".ui5-fcl-separator-end") .realMouseDown() - .realMouseMove(-600, 0) + .realMouseMove(-400, 0) .realMouseUp(); cy.get("[ui5-flexible-column-layout]") @@ -398,7 +398,7 @@ describe("Layout change by dragging end-separator on desktop", () => { describe("Layout change by dragging start-separator on tablet", () => { beforeEach(() => { - cy.viewport(1000, 1080); + cy.viewport(800, 1080); cy.mount( @@ -445,7 +445,7 @@ describe("Layout change by dragging start-separator on tablet", () => { .realMouseDown(); cy.get("@separator") - .realMouseMove(600, 0) + .realMouseMove(400, 0); cy.get("@separator") .realMouseUp(); @@ -483,7 +483,7 @@ describe("Layout change by dragging start-separator on tablet", () => { describe("Tablet Layout Tests", () => { beforeEach(() => { - cy.viewport(1000, 1080); + cy.viewport(800, 1080); cy.mount( @@ -529,7 +529,7 @@ describe("Tablet Layout Tests", () => { .realMouseDown(); cy.get("@separator") - .realMouseMove(-600, 0) + .realMouseMove(-400, 0); cy.get("@separator") .realMouseUp(); @@ -559,7 +559,7 @@ describe("Tablet Layout Tests", () => { describe("Layout change by dragging end-separator on tablet", () => { beforeEach(() => { - cy.viewport(1000, 1080); + cy.viewport(800, 1080); cy.mount( @@ -605,7 +605,7 @@ describe("Layout change by dragging end-separator on tablet", () => { .realMouseDown(); cy.get("@endSeparator") - .realMouseMove(-500, 0) + .realMouseMove(-300, 0); cy.get("@endSeparator") .realMouseUp(); @@ -838,7 +838,7 @@ describe("Preserves column min-width", () => { .realMouseDown(); cy.get("@endSeparator") - .realMouseMove(-150, 0) + .realMouseMove(-100, 0); cy.get("@endSeparator") .realMouseUp();