Skip to content

Commit

Permalink
Refactor deleteAppImportsTableRows()
Browse files Browse the repository at this point in the history
Signed-off-by: Nandini Chandra <[email protected]>
  • Loading branch information
nachandr committed Aug 29, 2023
1 parent b4ecfaf commit 8778802
Showing 1 changed file with 18 additions and 27 deletions.
45 changes: 18 additions & 27 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,36 +856,27 @@ export function deleteApplicationTableRows(): void {
});
}

export function deleteAppImportsTableRows(lastPage = false): void {
if (!lastPage) {
openManageImportsPage();
// Select 100 items per page
selectItemsPerPage(100);
cy.wait(2000);
export function deleteAppImportsTableRows() {
function deleteItems(rowCount): void {
if (rowCount < 1) return;
cy.get(sideKebabMenuImports, { timeout: 10000 }).first().click();
cy.get("ul[role=menu] > li").contains("Delete").click();
cy.get(commonView.confirmButton)
.click()
.then(() => {
cy.wait(4000);
deleteItems(--rowCount);
});
}

openManageImportsPage();
cy.get(commonView.appTable)
.next()
.then(($div) => {
if (!$div.hasClass("pf-c-empty-state")) {
cy.get("tbody")
.find(trTag)
.not(".pf-c-table__expandable-row")
.each(($tableRow) => {
var date = $tableRow.find("td[data-label=Date]").text();
cy.get(tdTag)
.contains(date)
.parent(trTag)
.within(() => {
cy.get(sideKebabMenuImports).click();
})
.contains(button, deleteAction)
.click();
cy.wait(800);
click(commonView.confirmButton);
cy.wait(4000);
});
}
.find(trTag)
.then(($rows) => {
let rowCount = 0;
rowCount = $rows.length - 1;

if (rowCount >= 1) deleteItems(rowCount);
});
}

Expand Down

0 comments on commit 8778802

Please sign in to comment.