diff --git a/cypress/e2e/models/migration/task-manager/task-manager.ts b/cypress/e2e/models/migration/task-manager/task-manager.ts index b8422bac7..05dbb8dba 100644 --- a/cypress/e2e/models/migration/task-manager/task-manager.ts +++ b/cypress/e2e/models/migration/task-manager/task-manager.ts @@ -28,11 +28,11 @@ import { SEC, TaskKind, TaskStatus, - itemsPerPage, migration, TaskFilter, trTag, MIN, + taskDetails, } from "../../../types/constants"; import { sideKebabMenu } from "../../../views/applicationinventory.view"; import { @@ -52,7 +52,7 @@ export class TaskManager { static fullUrl = Cypress.env("tackleUrl") + "/tasks"; static menuName = "Task Manager"; - static open(itemsPerPage = 100, forceReload = false) { + static open(itemsPerPage = 10, forceReload = false) { if (forceReload) { cy.visit(TaskManager.fullUrl, { timeout: 15 * SEC }).then((_) => selectItemsPerPage(itemsPerPage) @@ -70,20 +70,21 @@ export class TaskManager { selectItemsPerPage(itemsPerPage); } - static verifyTaskStatus( + private static getTaskRow( application: string, - kind: TaskKind, - status: TaskStatus - ): Cypress.Chainable { - TaskManager.open(); - selectItemsPerPage(itemsPerPage); + kind: TaskKind + ): Cypress.Chainable> { return cy .get(trTag) .filter(':contains("' + application + '")') - .filter(':contains("' + kind + '")') - .within(() => { - return cy.get(tasksStatusColumn).contains(status, { timeout: 10 * MIN }); - }); + .filter(':contains("' + kind + '")'); + } + + public static verifyTaskStatus(application: string, kind: TaskKind, status: TaskStatus) { + TaskManager.open(); + TaskManager.getTaskRow(application, kind) + .find(tasksStatusColumn) + .contains(status, { timeout: 10 * MIN }); } public static applyFilter(filterType: TaskFilter, filterValue: string) { @@ -95,8 +96,7 @@ export class TaskManager { public static setPreemption(preemption: boolean): void { const setPreemption = preemption === true ? "Enable preemption" : "Disable preemption"; - - TaskManager.open(10); + TaskManager.open(); cy.contains("Pending") .closest(trTag) .within(() => { @@ -106,7 +106,7 @@ export class TaskManager { } public static cancelTask(status: string): void { - TaskManager.open(10); + TaskManager.open(); cy.contains(status) .closest(trTag) .within(() => { @@ -130,10 +130,8 @@ export class TaskManager { enabled = true ): void { TaskManager.open(); - selectItemsPerPage(itemsPerPage); - this.verifyTaskStatus(appName, TaskKind.analyzer, status).within(() => { - click(sideKebabMenu); - }); + TaskManager.verifyTaskStatus(appName, TaskKind.analyzer, status); + TaskManager.getTaskRow(appName, TaskKind.analyzer).find(sideKebabMenu).click(); if (enabled) { cy.get(kebabActionButton).contains("Cancel").click(); } else { @@ -141,22 +139,35 @@ export class TaskManager { } } - public static openTaskDetailsByStatus( - appName: string, - taskKind: TaskKind, - taskStatus: TaskStatus = TaskStatus.succeeded - ) { - this.open(10, true); - this.verifyTaskStatus(appName, taskKind, taskStatus).within(() => { - cy.get(TaskManagerColumns.status).click(); - }); + private static taskDetailsSanity(appName: string, taskKind: TaskKind, taskStatus?: TaskStatus) { cy.wait(2 * SEC); cy.get(taskDetailsEditor) .invoke("text") .then((text) => { const normalizedText = normalizeText(text); + expect(normalizedText).to.include(`name: ${appName}-${taskKind}`); expect(normalizedText).to.include(`kind: ${taskKind}`); - expect(normalizedText).to.include(`state: ${taskStatus}`); + if (taskStatus) { + expect(normalizedText).to.include(`state: ${taskStatus}`); + } }); } + + public static openTaskDetailsByStatus( + appName: string, + taskKind: TaskKind, + taskStatus: TaskStatus = TaskStatus.succeeded + ) { + TaskManager.open(10, true); + TaskManager.verifyTaskStatus(appName, taskKind, taskStatus); + TaskManager.getTaskRow(appName, taskKind).find(TaskManagerColumns.status).click(); + TaskManager.taskDetailsSanity(appName, taskKind, taskStatus); + } + + public static openTaskDetailsByKebabMenu(appName: string, taskKind: TaskKind) { + TaskManager.open(10, true); + TaskManager.getTaskRow(appName, taskKind).find(sideKebabMenu).click(); + cy.get(kebabActionButton).contains(taskDetails).click(); + TaskManager.taskDetailsSanity(appName, taskKind); + } } diff --git a/cypress/e2e/tests/migration/task-manager/sorting.filter.pagination.test.ts b/cypress/e2e/tests/migration/task-manager/sorting.filter.pagination.test.ts index 075248ce9..460e86e3c 100644 --- a/cypress/e2e/tests/migration/task-manager/sorting.filter.pagination.test.ts +++ b/cypress/e2e/tests/migration/task-manager/sorting.filter.pagination.test.ts @@ -156,7 +156,7 @@ describe(["@tier3"], "Filtering, sorting and pagination in Task Manager Page", f }); it("Pagination validation", function () { - TaskManager.open(10); + TaskManager.open(); validatePagination(); }); diff --git a/cypress/e2e/tests/migration/task-manager/task_details.test.ts b/cypress/e2e/tests/migration/task-manager/task_details.test.ts index 4309a83cb..3a7e958fe 100644 --- a/cypress/e2e/tests/migration/task-manager/task_details.test.ts +++ b/cypress/e2e/tests/migration/task-manager/task_details.test.ts @@ -56,6 +56,11 @@ describe(["@tier3"], "Task details validation", function () { TaskManager.openTaskDetailsByStatus(application.name, TaskKind.techDiscovery); }); + it("Open task details from right kebab menu", function () { + TaskManager.openTaskDetailsByKebabMenu(application.name, TaskKind.languageDiscovery); + TaskManager.openTaskDetailsByStatus(application.name, TaskKind.techDiscovery); + }); + after("Perform test data clean up", function () { deleteApplicationTableRows(); }); diff --git a/cypress/e2e/types/constants.ts b/cypress/e2e/types/constants.ts index c1d35ad34..a5c179804 100644 --- a/cypress/e2e/types/constants.ts +++ b/cypress/e2e/types/constants.ts @@ -69,7 +69,7 @@ export const reports = "Reports"; export const repositoryType = "Repository type"; export const save = "Save"; export const cancel = "Cancel"; - +export const taskDetails = "Task details"; export const stakeholders = "Stakeholders"; export const stakeholderGroups = "Stakeholder groups"; export const subversion = "Subversion";