From f51c25f8e6d45fbaabf36136c52eb495cac5a9ce Mon Sep 17 00:00:00 2001 From: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com> Date: Thu, 6 Apr 2023 16:32:20 +0530 Subject: [PATCH] test: Cypress - EntityExplorer ExpandCollapse() improvement (#22149) ## Description - This PR improves the ExpandCollpase() method - so the Expand method does not fail in CI ## Type of change - Script fixes ## How Has This Been Tested? - Cypress CI runs ## Checklist: ### QA activity: - [X] Added Test Plan Approved label after reviewing all Cypress test --- .../cypress/support/Pages/EntityExplorer.ts | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/app/client/cypress/support/Pages/EntityExplorer.ts b/app/client/cypress/support/Pages/EntityExplorer.ts index 3025906809..7de125cf08 100644 --- a/app/client/cypress/support/Pages/EntityExplorer.ts +++ b/app/client/cypress/support/Pages/EntityExplorer.ts @@ -37,6 +37,10 @@ export class EntityExplorer { "//div[text()='" + entityNameinLeftSidebar + "']/ancestor::div/preceding-sibling::a[contains(@class, 't--entity-collapse-toggle')]"; + private _expandCollapseSection = (entityNameinLeftSidebar: string) => + this._expandCollapseArrow(entityNameinLeftSidebar) + + "/ancestor::div[contains(@class, 't--entity')]//div[@class='bp3-collapse']"; + private _templateMenuTrigger = (entityNameinLeftSidebar: string) => "//div[contains(@class, 't--entity-name')][text()='" + entityNameinLeftSidebar + @@ -123,17 +127,41 @@ export class EntityExplorer { .eq(index) .invoke("attr", "name") .then((arrow) => { - if (expand && arrow == "arrow-right") + if (expand && arrow == "arrow-right") { cy.xpath(this._expandCollapseArrow(entityName)) .eq(index) .trigger("click", { multiple: true }) .wait(1000); - else if (!expand && arrow == "arrow-down") + this.agHelper + .GetElement(this._expandCollapseSection(entityName)) + .then(($div: any) => { + cy.log("Checking style - expand"); + while (!$div.attr("style").includes("overflow-y: visible;")) { + cy.log("Inside style check - expand"); + cy.xpath(this._expandCollapseArrow(entityName)) + .eq(index) + .trigger("click", { multiple: true }) + .wait(500); + } + }); + } else if (!expand && arrow == "arrow-down") { cy.xpath(this._expandCollapseArrow(entityName)) .eq(index) .trigger("click", { multiple: true }) .wait(1000); - else this.agHelper.Sleep(500); + this.agHelper + .GetElement(this._expandCollapseSection(entityName)) + .then(($div: any) => { + cy.log("Checking style - collapse"); + while ($div.attr("style").includes("overflow-y: visible;")) { + cy.log("Inside style check - collapse"); + cy.xpath(this._expandCollapseArrow(entityName)) + .eq(index) + .trigger("click", { multiple: true }) + .wait(500); + } + }); + } else this.agHelper.Sleep(500); }); }