Skip to content

Commit

Permalink
Merge pull request #174 from amosproj/feat/#52-Display-health-state-i…
Browse files Browse the repository at this point in the history
…n-list-views

feat(Explorer): add cypress test case for sort
  • Loading branch information
muhdfahadali authored Jun 21, 2023
2 parents 99420df + 7ba6b29 commit afb6d4f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Explorer/cypress/e2e/containerlist_test.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe("Navigation", () => {
it("has anchor tags using cy.get and .each", () => {
//visit container list page
cy.visit("/");
cy.visit("http://localhost:3000/");

//Find each a link and check href is defined
cy.get("a").each(($a) => {
Expand Down
1 change: 1 addition & 0 deletions Explorer/cypress/e2e/cypress_test.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
describe("Navigation", () => {
it("should navigate to the about page", () => {
// Start from cypress_test_1

cy.visit("/cypress_test/cypress_test_1");

// Find a link with an href attribute containing "cypress_test_2" and click it
Expand Down
33 changes: 33 additions & 0 deletions Explorer/cypress/e2e/listsort_test.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
describe("ContainerTable", () => {
beforeEach(() => {
cy.visit("http://localhost:3000/"); // Replace with the URL of your application
});

it("should sort the list in ascending order", () => {
cy.get("a").contains("Assending").click({ force: true });

cy.get("td:nth-child(3)") // Assuming the status column is the third column
.invoke("text")
.then((statuses) => {
const sortOrder = ["Running", "Waiting", "Terminated", "Error"];
const sortedStatuses = [...statuses]
.sort((a, b) => sortOrder.indexOf(a) - sortOrder.indexOf(b))
.join("");
expect(sortedStatuses).to.equal(statuses);
});
});

it("should sort the list in descending order", () => {
cy.get("a").contains("Descending").click({ force: true });

cy.get("td:nth-child(3)") // Assuming the status column is the third column
.invoke("text")
.then((statuses) => {
const sortOrder = ["Running", "Waiting", "Terminated", "Error"];
const sortedStatuses = [...statuses]
.sort((a, b) => sortOrder.indexOf(b) - sortOrder.indexOf(a))
.join("");
expect(sortedStatuses).to.equal(statuses);
});
});
});

0 comments on commit afb6d4f

Please sign in to comment.