diff --git a/cypress/e2e/models/migration/task-manager/task-manager.ts b/cypress/e2e/models/migration/task-manager/task-manager.ts
index abdc8cad5..b8422bac7 100644
--- a/cypress/e2e/models/migration/task-manager/task-manager.ts
+++ b/cypress/e2e/models/migration/task-manager/task-manager.ts
@@ -19,6 +19,7 @@ import {
click,
clickByText,
inputText,
+ normalizeText,
selectFilter,
selectItemsPerPage,
selectUserPerspective,
@@ -31,6 +32,7 @@ import {
migration,
TaskFilter,
trTag,
+ MIN,
} from "../../../types/constants";
import { sideKebabMenu } from "../../../views/applicationinventory.view";
import {
@@ -40,7 +42,11 @@ import {
searchInput,
} from "../../../views/common.view";
import { navMenu } from "../../../views/menu.view";
-import { tasksStatusColumn } from "../../../views/taskmanager.view";
+import {
+ taskDetailsEditor,
+ TaskManagerColumns,
+ tasksStatusColumn,
+} from "../../../views/taskmanager.view";
export class TaskManager {
static fullUrl = Cypress.env("tackleUrl") + "/tasks";
@@ -64,14 +70,19 @@ export class TaskManager {
selectItemsPerPage(itemsPerPage);
}
- static verifyTaskStatus(application: string, kind: TaskKind, status: TaskStatus): void {
+ static verifyTaskStatus(
+ application: string,
+ kind: TaskKind,
+ status: TaskStatus
+ ): Cypress.Chainable {
TaskManager.open();
selectItemsPerPage(itemsPerPage);
- cy.get(trTag)
+ return cy
+ .get(trTag)
.filter(':contains("' + application + '")')
.filter(':contains("' + kind + '")')
.within(() => {
- cy.get(tasksStatusColumn).contains(status, { timeout: 30 * SEC });
+ return cy.get(tasksStatusColumn).contains(status, { timeout: 10 * MIN });
});
}
@@ -120,17 +131,32 @@ export class TaskManager {
): void {
TaskManager.open();
selectItemsPerPage(itemsPerPage);
- cy.get(trTag)
- .filter(':contains("' + TaskKind.analyzer + '")')
- .filter(':contains("' + appName + '")')
- .filter(':contains("' + status + '")')
- .within(() => {
- click(sideKebabMenu);
- });
+ this.verifyTaskStatus(appName, TaskKind.analyzer, status).within(() => {
+ click(sideKebabMenu);
+ });
if (enabled) {
cy.get(kebabActionButton).contains("Cancel").click();
} else {
cy.get(kebabActionButton).contains("Cancel").should("not.be.enabled");
}
}
+
+ 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();
+ });
+ cy.wait(2 * SEC);
+ cy.get(taskDetailsEditor)
+ .invoke("text")
+ .then((text) => {
+ const normalizedText = normalizeText(text);
+ expect(normalizedText).to.include(`kind: ${taskKind}`);
+ expect(normalizedText).to.include(`state: ${taskStatus}`);
+ });
+ }
}
diff --git a/cypress/e2e/tests/migration/task-manager/task_details.test.ts b/cypress/e2e/tests/migration/task-manager/task_details.test.ts
new file mode 100644
index 000000000..4309a83cb
--- /dev/null
+++ b/cypress/e2e/tests/migration/task-manager/task_details.test.ts
@@ -0,0 +1,62 @@
+/*
+Copyright © 2021 the Konveyor Contributors (https://konveyor.io/)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+///
+
+import {
+ deleteApplicationTableRows,
+ getRandomAnalysisData,
+ getRandomApplicationData,
+ login,
+} from "../../../../utils/utils";
+import { Analysis } from "../../../models/migration/applicationinventory/analysis";
+import { TaskManager } from "../../../models/migration/task-manager/task-manager";
+import { TaskKind } from "../../../types/constants";
+
+describe(["@tier3"], "Task details validation", function () {
+ let application: Analysis;
+ before("Login", function () {
+ login();
+ deleteApplicationTableRows();
+ });
+
+ beforeEach("Load data", function () {
+ cy.fixture("application").then(function (appData) {
+ this.appData = appData;
+ });
+ cy.fixture("analysis").then(function (analysisData) {
+ this.analysisData = analysisData;
+ });
+ });
+
+ it("Open language-discovery details by clicking on the status link", function () {
+ application = new Analysis(
+ getRandomApplicationData("", {
+ sourceData: this.appData["bookserver-app"],
+ }),
+ getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"])
+ );
+ application.create();
+ TaskManager.openTaskDetailsByStatus(application.name, TaskKind.languageDiscovery);
+ });
+
+ it("Open tech-discovery details by clicking on the status link", function () {
+ TaskManager.openTaskDetailsByStatus(application.name, TaskKind.techDiscovery);
+ });
+
+ after("Perform test data clean up", function () {
+ deleteApplicationTableRows();
+ });
+});
diff --git a/cypress/e2e/views/taskmanager.view.ts b/cypress/e2e/views/taskmanager.view.ts
index e39f9e921..69bb017d8 100644
--- a/cypress/e2e/views/taskmanager.view.ts
+++ b/cypress/e2e/views/taskmanager.view.ts
@@ -25,3 +25,4 @@ export enum TaskManagerColumns {
createdBy = 'td[data-label="Created By"]',
}
export const tasksTable = "table[aria-label='Tasks table']";
+export const taskDetailsEditor = "div[class='pf-v5-c-code-editor__code']";
diff --git a/cypress/utils/utils.ts b/cypress/utils/utils.ts
index ffcbe3fb2..9dfbecbb7 100644
--- a/cypress/utils/utils.ts
+++ b/cypress/utils/utils.ts
@@ -1965,3 +1965,12 @@ export function getUniqueNamesMap(instanceArrays: T[
return instanceMap;
}
+
+/**
+ * Normalizes text by:
+ * - Collapsing all sequences of whitespace into a single space.
+ * - Trimming leading and trailing whitespace.
+ */
+export function normalizeText(text: string): string {
+ return text.replace(/\s+/g, " ").trim();
+}