2021-09-27 10:04:21 +00:00
|
|
|
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
|
|
|
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
|
|
|
|
2021-12-17 11:07:51 +00:00
|
|
|
Cypress.Commands.add("findElementOnTable", (elementName, alias) => {
|
2022-01-31 08:37:49 +00:00
|
|
|
cy.get(SHARED_ELEMENTS.skeleton).should("not.exist");
|
2021-09-27 10:04:21 +00:00
|
|
|
cy.getTextFromElement(SHARED_ELEMENTS.table).then(tableText => {
|
|
|
|
if (tableText.includes(elementName)) {
|
|
|
|
cy.contains(SHARED_ELEMENTS.tableRow, elementName).click({ force: true });
|
|
|
|
} else {
|
2021-12-17 11:07:51 +00:00
|
|
|
cy.addAliasToGraphRequest(alias);
|
|
|
|
cy.get(BUTTON_SELECTORS.nextPaginationButton).click();
|
|
|
|
if (alias) {
|
|
|
|
cy.wait(`@${alias}`);
|
|
|
|
}
|
2022-01-31 08:37:49 +00:00
|
|
|
cy.waitForProgressBarToNotExist();
|
2021-12-17 11:07:51 +00:00
|
|
|
cy.findElementOnTable(elementName, alias);
|
2021-09-27 10:04:21 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
Cypress.Commands.add("searchInTable", query => {
|
|
|
|
cy.get(SHARED_ELEMENTS.searchInput)
|
|
|
|
.type(query)
|
|
|
|
.waitForProgressBarToNotExist();
|
|
|
|
});
|