From fe3439052e9e6bdad6c04ca4c9d427be6451e341 Mon Sep 17 00:00:00 2001 From: EstyBiton Date: Mon, 14 Oct 2024 15:18:01 +0300 Subject: [PATCH 1/5] Add test to tasks tab and verify task kinds in the application drawer Signed-off-by: EstyBiton --- .../application_tasks_tab.test.ts | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 cypress/e2e/tests/migration/task-manager/application_tasks_tab.test.ts 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 new file mode 100644 index 000000000..0e99ca2ec --- /dev/null +++ b/cypress/e2e/tests/migration/task-manager/application_tasks_tab.test.ts @@ -0,0 +1,61 @@ + +/// +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", () => { + before("Login", function () { + login(); + }); + + beforeEach("Load data", function () { + cy.fixture("application").then(function (appData) { + this.appData = appData; + }); + cy.fixture("analysis").then(function (analysisData) { + this.analysisData = analysisData; + }); + cy.intercept("GET", "/api/applications/*").as("getApplication"); + }); + + it(`Open 'Tasks' tab in the application drawer and verify task kinds `, function () { + application = new Analysis( + getRandomApplicationData("bookserverApp", { + sourceData: this.appData["bookserver-app"], + }), + getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"]) + ); + application.create(); + applicationsList.push(application); + 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); + 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); + }); From 882ad844a8ba011de4043bfe2e0465e22ff15bd6 Mon Sep 17 00:00:00 2001 From: EstyBiton Date: Tue, 15 Oct 2024 16:20:54 +0300 Subject: [PATCH 2/5] test tasks tab Signed-off-by: EstyBiton --- .../task-manager/application_tasks_tab.test.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 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 0e99ca2ec..baaef310c 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,19 @@ +/* +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 { login, @@ -41,14 +56,12 @@ describe(["@tier2"], "Open Tasks Tab and Verify Tasks", () => { 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); expect(taskKinds).to.include.members(["language-discovery", "tech-discovery", "analyzer"]); }); - }); }); From 936def3874e2b775167b54b13cdaa771988f7c22 Mon Sep 17 00:00:00 2001 From: EstyBiton Date: Sat, 26 Oct 2024 21:27:47 +0300 Subject: [PATCH 3/5] 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(); + }); +}); From 67278fa9988a7f03596a460fa707c8ffef217624 Mon Sep 17 00:00:00 2001 From: EstyBiton Date: Sun, 27 Oct 2024 10:29:02 +0200 Subject: [PATCH 4/5] Changes to the test for the tasks tab Signed-off-by: EstyBiton --- .../tests/migration/task-manager/application_tasks_tab.test.ts | 2 -- 1 file changed, 2 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 615d8407a..72695c44d 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 @@ -48,10 +48,8 @@ describe(["@tier2"], "Open Tasks Tab and Verify Tasks", () => { getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"]) ); application.create(); - 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); From cc5d317e8263635fafd5c22385f1ec1b8d323c88 Mon Sep 17 00:00:00 2001 From: EstyBiton Date: Sun, 27 Oct 2024 10:57:12 +0200 Subject: [PATCH 5/5] chenge format Signed-off-by: EstyBiton --- .../task-manager/application_tasks_tab.test.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 72695c44d..8bb94349c 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 @@ -52,8 +52,12 @@ describe(["@tier2"], "Open Tasks Tab and Verify Tasks", () => { application.analyze(); sidedrawerTab(application.name, "Tasks"); cy.get("[data-label='Task Kind']").should((tasks) => { - const taskKinds = tasks.toArray().map(task => task.innerText); - expect(taskKinds).to.include.members(["language-discovery", "tech-discovery", "analyzer"]); + const taskKinds = tasks.toArray().map((task) => task.innerText); + expect(taskKinds).to.include.members([ + "language-discovery", + "tech-discovery", + "analyzer", + ]); }); }); @@ -62,6 +66,6 @@ describe(["@tier2"], "Open Tasks Tab and Verify Tasks", () => { }); after("Perform test data clean up", function () { - application.delete(); + application.delete(); }); });