Skip to content

Commit

Permalink
Fixing task manager filtering test
Browse files Browse the repository at this point in the history
Signed-off-by: Maayan Hadasi <[email protected]>
  • Loading branch information
mguetta1 committed Nov 13, 2024
1 parent d80905f commit 296f66e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getRandomAnalysisData,
getRandomApplicationData,
login,
notExists,
validateNumberPresence,
validatePagination,
validateSortBy,
Expand All @@ -31,7 +32,7 @@ import {
import { Analysis } from "../../../models/migration/applicationinventory/analysis";
import { TaskManager } from "../../../models/migration/task-manager/task-manager";
import { TaskFilter, TaskKind, TaskStatus, trTag } from "../../../types/constants";
import { TaskManagerColumns } from "../../../views/taskmanager.view";
import { TaskManagerColumns, tasksTable } from "../../../views/taskmanager.view";

describe(["@tier3"], "Filtering, sorting and pagination in Task Manager Page", function () {
const applicationsList: Analysis[] = [];
Expand Down Expand Up @@ -62,6 +63,7 @@ describe(["@tier3"], "Filtering, sorting and pagination in Task Manager Page", f
applicationsList.forEach((application) => application.create());
});
});

});

it("Filtering tasks", function () {
Expand All @@ -70,6 +72,9 @@ describe(["@tier3"], "Filtering, sorting and pagination in Task Manager Page", f

Analysis.analyzeAll(dayTraderApp);
TaskManager.open();

cy.intercept("GET", "/hub/tasks*").as("getTasks");

// Filter by status
TaskManager.applyFilter(TaskFilter.status, TaskStatus.pending);
validateTextPresence(TaskManagerColumns.status, TaskStatus.pending);
Expand All @@ -88,12 +93,15 @@ describe(["@tier3"], "Filtering, sorting and pagination in Task Manager Page", f
clearAllFilters();

// Filter by ID
TaskManager.applyFilter(TaskFilter.id, "1");
validateNumberPresence(TaskManagerColumns.id, 1);
clearAllFilters();
TaskManager.applyFilter(TaskFilter.id, "2");
validateNumberPresence(TaskManagerColumns.id, 2);
clearAllFilters();
cy.wait("@getTasks")
.its('response.body')
.should('have.length.gte', 2) // Make sure there are at least two items
.then((responseBody) => {
TaskManager.applyFilter(TaskFilter.id, responseBody[0].id.toString());
validateNumberPresence(TaskManagerColumns.id, responseBody[0].id);
notExists(responseBody[1].id.toString(), tasksTable);
clearAllFilters();
});

// Filter by Applications
TaskManager.applyFilter(TaskFilter.applicationName, applicationsList[0].name);
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/views/taskmanager.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ export enum TaskManagerColumns {
preemption = 'td[data-label="Preemption"]',
createdBy = 'td[data-label="Created By"]',
}
export const tasksTable = "table[aria-label='Tasks table']";

0 comments on commit 296f66e

Please sign in to comment.