test: Simplify list_view test

This commit is contained in:
Suraj Shetty 2023-06-24 19:20:11 +05:30
parent 0d4574e95b
commit 3667d1ae04

View file

@ -13,15 +13,8 @@ context("List View", () => {
it("Keep checkbox checked after Refresh", { scrollBehavior: false }, () => { it("Keep checkbox checked after Refresh", { scrollBehavior: false }, () => {
cy.go_to_list("ToDo"); cy.go_to_list("ToDo");
cy.clear_filters(); cy.clear_filters();
cy.get(".list-row-container .list-row-checkbox").click({ cy.get(".list-header-subject > .list-subject > .list-check-all").click();
multiple: true, cy.get("button[data-original-title='Refresh']").click();
force: true,
});
cy.get(".actions-btn-group button").contains("Actions").should("be.visible");
cy.intercept("/api/method/frappe.desk.reportview.get").as("list-refresh");
cy.wait(3000); // wait before you hit another refresh
cy.get('button[data-original-title="Refresh"]').click();
cy.wait("@list-refresh");
cy.get(".list-row-container .list-row-checkbox:checked").should("be.visible"); cy.get(".list-row-container .list-row-checkbox:checked").should("be.visible");
}); });
@ -39,11 +32,8 @@ context("List View", () => {
]; ];
cy.go_to_list("ToDo"); cy.go_to_list("ToDo");
cy.clear_filters(); cy.clear_filters();
cy.get('.list-row-container:contains("Pending") .list-row-checkbox').click({ cy.get(".list-header-subject > .list-subject > .list-check-all").click();
multiple: true, cy.findByRole("button", { name: "Actions" }).click();
force: true,
});
cy.get(".actions-btn-group button").contains("Actions").should("be.visible").click();
cy.get(".dropdown-menu li:visible .dropdown-item") cy.get(".dropdown-menu li:visible .dropdown-item")
.should("have.length", 9) .should("have.length", 9)
.each((el, index) => { .each((el, index) => {
@ -56,8 +46,7 @@ context("List View", () => {
}).as("bulk-approval"); }).as("bulk-approval");
cy.wrap(elements).contains("Approve").click(); cy.wrap(elements).contains("Approve").click();
cy.wait("@bulk-approval"); cy.wait("@bulk-approval");
cy.wait(300); cy.hide_dialog();
cy.get_open_dialog().find(".btn-modal-close").click();
cy.reload(); cy.reload();
cy.clear_filters(); cy.clear_filters();
cy.get(".list-row-container:visible").should("contain", "Approved"); cy.get(".list-row-container:visible").should("contain", "Approved");