Skip to content

Commit

Permalink
Fix pagination text verification
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt committed Aug 14, 2024
1 parent add9887 commit 6a9b744
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
15 changes: 11 additions & 4 deletions src/client/cypress/e2e/editor/boreholeTable.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { loginAsAdmin } from "../helpers/testHelpers.js";
import { showTableAndWaitForData, sortBy, verifyRowContains } from "../helpers/dataGridHelpers";
import { loginAsAdmin, returnToOverview } from "../helpers/testHelpers.js";
import {
clickOnRowWithText,
showTableAndWaitForData,
sortBy,
verifyPaginationText,
verifyRowContains,
waitForTableData,
} from "../helpers/dataGridHelpers";

describe("Borehole editor table tests", () => {
it("Boreholes are displayed in correct order with admin login", () => {
Expand Down Expand Up @@ -58,7 +65,7 @@ describe("Borehole editor table tests", () => {
waitForTableData();

// verify current page is 4
verifiyPaginationText("401 - 500 of 1626");
verifyPaginationText("401500 of 1626");
verifyRowContains("Nichole VonRueden", 0);

// navigate to detail
Expand All @@ -69,7 +76,7 @@ describe("Borehole editor table tests", () => {

// verify current page is still 4
showTableAndWaitForData();
verifiyPaginationText("401 - 500 of 1626");
verifyPaginationText("401500 of 1626");
verifyRowContains("Nichole VonRueden", 0);
});
});
12 changes: 6 additions & 6 deletions src/client/cypress/e2e/filters/filter.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { loginAsAdmin } from "../helpers/testHelpers.js";
import { showTableAndWaitForData, verifiyPaginationText } from "../helpers/dataGridHelpers";
import { showTableAndWaitForData, verifyPaginationText } from "../helpers/dataGridHelpers";

describe("Search filter tests", () => {
it("has search filters", () => {
Expand Down Expand Up @@ -91,7 +91,7 @@ describe("Search filter tests", () => {

// check content of table
showTableAndWaitForData();
verifiyPaginationText("1 - 100 of 329"); // when testing with cypress locally use electron browser, otherwise text might be displayed as "1-100 of 329"
verifyPaginationText("1100 of 329");
});

it("filters boreholes by color and uscs3", () => {
Expand All @@ -117,7 +117,7 @@ describe("Search filter tests", () => {

cy.wait("@edit_list");
showTableAndWaitForData();
verifiyPaginationText("1 - 100 of 229");
verifyPaginationText("1100 of 229");

let uscs3Dropdown = cy.contains("label", "USCS 3").next();
uscs3Dropdown.scrollIntoView().click({ force: true });
Expand All @@ -135,7 +135,7 @@ describe("Search filter tests", () => {
cy.wait("@edit_list");

// check content of table
verifiyPaginationText("1 - 39 of 39");
verifyPaginationText("139 of 39");
cy.get(".MuiDataGrid-row").contains("Darion Rowe").should("exist");
});

Expand All @@ -152,7 +152,7 @@ describe("Search filter tests", () => {
filterByOriginalLithology();
cy.wait("@edit_list");
showTableAndWaitForData();
verifiyPaginationText("1 - 21 of 21");
verifyPaginationText("121 of 21");
});
it("filters boreholes by creation date", () => {
loginAsAdmin();
Expand Down Expand Up @@ -180,7 +180,7 @@ describe("Search filter tests", () => {

// check content of table
showTableAndWaitForData();
verifiyPaginationText("1 - 3 of 3");
verifyPaginationText("13 of 3");
});

it("filters boreholes by workgroup", () => {
Expand Down
10 changes: 5 additions & 5 deletions src/client/cypress/e2e/filters/identifierFilter.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { newEditableBorehole, returnToOverview, stopBoreholeEditing } from "../helpers/testHelpers.js";
import { checkAllVisibleRows, verifiyPaginationText } from "../helpers/dataGridHelpers";
import { checkAllVisibleRows, verifyPaginationText } from "../helpers/dataGridHelpers";

describe("Tests for filtering data by identifier.", () => {
it("can filter by identifier", () => {
Expand All @@ -21,7 +21,7 @@ describe("Tests for filtering data by identifier.", () => {
// show all options
cy.get('[class="ui fitted toggle checkbox"]').eq(0).children().first().check({ force: true });

verifiyPaginationText("1 - 100 of 1627"); // when testing with cypress locally use electron browser, otherwise text might be displayed as "1-100 of 1627"
verifyPaginationText("1100 of 1627");

cy.get('[data-cy="domain-dropdown"]')
.first()
Expand All @@ -30,10 +30,10 @@ describe("Tests for filtering data by identifier.", () => {
.eq(1)
.click({ force: true });

verifiyPaginationText("1 - 1 of 1");
verifyPaginationText("11 of 1");
// click reset label
cy.get('[data-cy="reset-filter-button"]').click();
verifiyPaginationText("1 - 100 of 1627");
verifyPaginationText("1100 of 1627");
});

it("can bulk edit boreholes while filter by identifier is set", () => {
Expand Down Expand Up @@ -74,7 +74,7 @@ describe("Tests for filtering data by identifier.", () => {
.find('[role="option"]')
.eq(1)
.click({ force: true });
verifiyPaginationText("1 - 2 of 2");
verifyPaginationText("12 of 2");
checkAllVisibleRows();
cy.contains("button", "Bulk editing").click({ force: true });

Expand Down
10 changes: 5 additions & 5 deletions src/client/cypress/e2e/filters/srsFilter.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { loginAsAdmin, newEditableBorehole, returnToOverview, stopBoreholeEditing } from "../helpers/testHelpers.js";
import { verifiyPaginationText } from "../helpers/dataGridHelpers";
import { verifyPaginationText } from "../helpers/dataGridHelpers";

describe("Tests for filtering data by reference system.", () => {
function goToEditorLocationFilter() {
Expand Down Expand Up @@ -51,18 +51,18 @@ describe("Tests for filtering data by reference system.", () => {
cy.contains("h6", "Location").click();
cy.get('[class="ui fitted toggle checkbox"]').eq(0).children().first().check({ force: true });
cy.get('[data-cy="radiobutton-all"]').click();
verifiyPaginationText("1 - 100 of 1627"); // when testing with cypress locally use electron browser, otherwise text might be displayed as "1-100 of 1627"
verifyPaginationText("1100 of 1627");

cy.get('[data-cy="spatial-reference-filter"]').should("exist");

cy.get('[data-cy="radiobutton-LV95"]').click();
verifiyPaginationText("1 - 100 of 813");
verifyPaginationText("1100 of 813");

cy.get('[data-cy="radiobutton-LV03"]').click();
verifiyPaginationText("1 - 100 of 814");
verifyPaginationText("1100 of 814");

// click reset label
cy.get('[data-cy="reset-filter-button"]').click();
verifiyPaginationText("1 - 100 of 1627");
verifyPaginationText("1100 of 1627");
});
});
2 changes: 1 addition & 1 deletion src/client/cypress/e2e/helpers/dataGridHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const verifiyPaginationText = text => {
export const verifyPaginationText = text => {
cy.get(".MuiTablePagination-displayedRows").should("have.text", text);
};

Expand Down

0 comments on commit 6a9b744

Please sign in to comment.