From 348ae7d8993f924a6d1119d0368b895ea3a75fe1 Mon Sep 17 00:00:00 2001 From: EstyBiton Date: Sat, 26 Oct 2024 21:27:47 +0300 Subject: [PATCH] Improve task verification in application tasks tab test based on PR feedback. Signed-off-by: EstyBiton --- .../application_tasks_tab.test.ts | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/cypress/e2e/tests/migration/task-manager/application_tasks_tab.test.ts b/cypress/e2e/tests/migration/task-manager/application_tasks_tab.test.ts index baaef310c..615d8407a 100644 --- a/cypress/e2e/tests/migration/task-manager/application_tasks_tab.test.ts +++ b/cypress/e2e/tests/migration/task-manager/application_tasks_tab.test.ts @@ -1,4 +1,3 @@ - /* Copyright © 2021 the Konveyor Contributors (https://konveyor.io/) @@ -19,13 +18,11 @@ import { login, getRandomApplicationData, sidedrawerTab, - deleteByList, getRandomAnalysisData, } from "../../../../utils/utils"; import { Application } from "../../../../e2e/models/migration/applicationinventory/application"; import { Analysis } from "../../../models/migration/applicationinventory/analysis"; - -let applicationsList: Array = []; + let application: Analysis; describe(["@tier2"], "Open Tasks Tab and Verify Tasks", () => { @@ -42,8 +39,8 @@ describe(["@tier2"], "Open Tasks Tab and Verify Tasks", () => { }); cy.intercept("GET", "/api/applications/*").as("getApplication"); }); - - it(`Open 'Tasks' tab in the application drawer and verify task kinds `, function () { + + it("Open 'Tasks' tab in the application drawer and verify task kinds", function () { application = new Analysis( getRandomApplicationData("bookserverApp", { sourceData: this.appData["bookserver-app"], @@ -51,24 +48,22 @@ describe(["@tier2"], "Open Tasks Tab and Verify Tasks", () => { getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"]) ); application.create(); - applicationsList.push(application); - cy.wait("@getApplication"); + cy.wait("@getApplication"); cy.wait(2000); application.analyze(); application.verifyAnalysisStatus("Completed"); sidedrawerTab(application.name, "Tasks"); - cy.get("[data-label='Task Kind']").should((tasks) => { - const taskKinds = tasks.toArray().map(task => task.innerText); + const taskKinds = tasks.toArray().map(task => task.innerText); expect(taskKinds).to.include.members(["language-discovery", "tech-discovery", "analyzer"]); - }); - }); - - }); - afterEach("Persist session", function () { - Application.open(true); - }); - - after("Perform test data clean up", function () { - deleteByList(applicationsList); }); + }); + + afterEach("Clear state", function () { + Application.open(true); + }); + + after("Perform test data clean up", function () { + application.delete(); + }); +});