Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into EVG-20201
Browse files Browse the repository at this point in the history
  • Loading branch information
minnakt committed Oct 4, 2023
2 parents 8a5f7ba + 9c4fcbb commit 6e0d7cc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
40 changes: 16 additions & 24 deletions cypress/integration/version/task_filters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { urlSearchParamsAreUpdated } from "../../utils";
import { urlSearchParamsAreUpdated, waitForTaskTable } from "../../utils";

const patch = {
id: "5e4ff3abe3c3317e352062e4",
Expand All @@ -10,7 +10,7 @@ const defaultPath = `${pathTasks}?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC`;
describe("Tasks filters", () => {
it("Should clear any filters with the Clear All Filters button and reset the table to its default state", () => {
cy.visit(pathURLWithFilters);
waitForTable();
waitForTaskTable();
cy.dataCy("clear-all-filters").click();
cy.location().should((loc) => {
expect(loc.href).to.equal(loc.origin + defaultPath);
Expand Down Expand Up @@ -40,7 +40,7 @@ describe("Tasks filters", () => {
const urlParam = "variant";
it("Updates url with input value and fetches tasks filtered by variant", () => {
cy.visit(defaultPath);
waitForTable();
waitForTaskTable();
cy.toggleTableFilter(4);
cy.dataCy("variant-input-wrapper")
.find("input")
Expand All @@ -53,7 +53,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: variantInputValue,
});
waitForTable();
waitForTaskTable();
cy.dataCy("filtered-count").should("contain.text", 2);

cy.toggleTableFilter(4);
Expand All @@ -68,7 +68,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: null,
});
waitForTable();
waitForTaskTable();
cy.dataCy("filtered-count").should("contain.text", 46);
});
});
Expand All @@ -78,7 +78,7 @@ describe("Tasks filters", () => {
const urlParam = "taskName";
it("Updates url with input value and fetches tasks filtered by task name", () => {
cy.visit(defaultPath);
waitForTable();
waitForTaskTable();
cy.toggleTableFilter(1);
cy.dataCy("taskname-input-wrapper")
.find("input")
Expand All @@ -91,7 +91,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: taskNameInputValue,
});
waitForTable();
waitForTaskTable();
cy.dataCy("filtered-count").should("contain.text", 1);

cy.toggleTableFilter(1);
Expand All @@ -106,7 +106,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: null,
});
waitForTable();
waitForTaskTable();
cy.dataCy("filtered-count").should("contain.text", 46);
});
});
Expand All @@ -115,7 +115,7 @@ describe("Tasks filters", () => {
const urlParam = "statuses";
beforeEach(() => {
cy.visit(defaultPath);
waitForTable();
waitForTaskTable();
cy.toggleTableFilter(2);
});

Expand All @@ -129,7 +129,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: "failed",
});
waitForTable();
waitForTaskTable();
cy.dataCy("filtered-count").should("have.text", 2);

cy.dataCy("filtered-count")
Expand All @@ -145,7 +145,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: "failed-umbrella,failed,known-issue,success",
});
waitForTable();
waitForTaskTable();
cy.dataCy("filtered-count").should(
"not.have.text",
postFilterCount
Expand Down Expand Up @@ -175,7 +175,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: "all",
});
waitForTable();
waitForTaskTable();

selectCheckboxOption("All", false);
assertChecked(taskStatuses, false);
Expand All @@ -191,7 +191,7 @@ describe("Tasks filters", () => {
const urlParam = "baseStatuses";
beforeEach(() => {
cy.visit(defaultPath);
waitForTable();
waitForTaskTable();
cy.toggleTableFilter(3);
});

Expand All @@ -206,7 +206,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: "success",
});
waitForTable();
waitForTaskTable();

cy.dataCy("filtered-count").should("have.text", 44);
selectCheckboxOption("Succeeded", false);
Expand All @@ -215,7 +215,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: null,
});
waitForTable();
waitForTaskTable();
cy.dataCy("filtered-count").should("have.text", preFilterCount);
});
});
Expand All @@ -229,7 +229,7 @@ describe("Tasks filters", () => {
paramName: urlParam,
search: "all",
});
waitForTable();
waitForTaskTable();

selectCheckboxOption("All", false);
assertChecked(taskStatuses, false);
Expand All @@ -242,14 +242,6 @@ describe("Tasks filters", () => {
});
});

/**
* Function used to assert that table exists and is not loading.
*/
const waitForTable = () => {
cy.dataCy("tasks-table").should("be.visible");
cy.dataCy("tasks-table").should("not.have.attr", "data-loading", "true");
};

/**
* Function used to assert if checkboxes with certain labels are checked or unchecked.
* @param statuses list of labels to assert on
Expand Down
6 changes: 5 additions & 1 deletion cypress/integration/version/task_table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { clickOnPageSizeBtnAndAssertURLandTableSize } from "../../utils";
import {
clickOnPageSizeBtnAndAssertURLandTableSize,
waitForTaskTable,
} from "../../utils";

const pathTasks = `/version/5e4ff3abe3c3317e352062e4/tasks`;
const patchDescriptionTasksExist = "dist";
Expand All @@ -14,6 +17,7 @@ describe("Task table", () => {

it("Updates the url when column headers are clicked", () => {
cy.visit(pathTasks);
waitForTaskTable();
cy.location("search").should(
"contain",
"sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC"
Expand Down
10 changes: 10 additions & 0 deletions cypress/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,13 @@ export const clickSave = () => {
.should("not.have.attr", "aria-disabled", "true")
.click();
};

/**
* Wait for the AntD task table to fully render and not be in a loading state
* This function helps ensure table column header button clicks register
*/
export const waitForTaskTable = () => {
cy.dataCy("tasks-table")
.should("be.visible")
.should("not.have.attr", "data-loading", "true");
};

0 comments on commit 6e0d7cc

Please sign in to comment.