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
This commit is contained in:
Aishwarya-U-R 2023-04-06 16:32:20 +05:30 committed by GitHub
parent 59eb56053c
commit f51c25f8e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,10 @@ export class EntityExplorer {
"//div[text()='" + "//div[text()='" +
entityNameinLeftSidebar + entityNameinLeftSidebar +
"']/ancestor::div/preceding-sibling::a[contains(@class, 't--entity-collapse-toggle')]"; "']/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) => private _templateMenuTrigger = (entityNameinLeftSidebar: string) =>
"//div[contains(@class, 't--entity-name')][text()='" + "//div[contains(@class, 't--entity-name')][text()='" +
entityNameinLeftSidebar + entityNameinLeftSidebar +
@ -123,17 +127,41 @@ export class EntityExplorer {
.eq(index) .eq(index)
.invoke("attr", "name") .invoke("attr", "name")
.then((arrow) => { .then((arrow) => {
if (expand && arrow == "arrow-right") if (expand && arrow == "arrow-right") {
cy.xpath(this._expandCollapseArrow(entityName)) cy.xpath(this._expandCollapseArrow(entityName))
.eq(index) .eq(index)
.trigger("click", { multiple: true }) .trigger("click", { multiple: true })
.wait(1000); .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)) cy.xpath(this._expandCollapseArrow(entityName))
.eq(index) .eq(index)
.trigger("click", { multiple: true }) .trigger("click", { multiple: true })
.wait(1000); .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);
}); });
} }