From 2e9699d7fb7d96bbb20e5002972e0605a6fd8cc1 Mon Sep 17 00:00:00 2001 From: TalyaNaima Date: Mon, 4 Nov 2024 11:35:38 +0200 Subject: [PATCH] new test for filtering by analysis Signed-off-by: TalyaNaima --- .../applicationinventory/analysis.ts | 7 +- .../applications/filterByAnalysis.ts | 154 ++++++++++++++++++ 2 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 cypress/e2e/tests/migration/applicationinventory/applications/filterByAnalysis.ts diff --git a/cypress/e2e/models/migration/applicationinventory/analysis.ts b/cypress/e2e/models/migration/applicationinventory/analysis.ts index 63c49b8ed..e288fd604 100644 --- a/cypress/e2e/models/migration/applicationinventory/analysis.ts +++ b/cypress/e2e/models/migration/applicationinventory/analysis.ts @@ -186,7 +186,10 @@ export class Analysis extends Application { .find("input[type=checkbox]") .check(); - cy.get(languageSelectionDropdown).click(); + if(languageSelectionDropdown) + cy.get(languageSelectionDropdown).click(); + else + return; } public selectTarget(target: string[]): void { @@ -314,7 +317,7 @@ export class Analysis extends Application { if (this.binary) this.uploadBinary(); this.isNextEnabled(); next(); - Analysis.selectLanguage(this.language); + // Analysis.selectLanguage(this.language); cy.wait(2 * SEC); this.selectTarget(this.target); next(); diff --git a/cypress/e2e/tests/migration/applicationinventory/applications/filterByAnalysis.ts b/cypress/e2e/tests/migration/applicationinventory/applications/filterByAnalysis.ts new file mode 100644 index 000000000..07416e6af --- /dev/null +++ b/cypress/e2e/tests/migration/applicationinventory/applications/filterByAnalysis.ts @@ -0,0 +1,154 @@ +/* +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 { + exists, + applySearchFilter, + getRandomApplicationData, + getRandomAnalysisData, + checkSuccessAlert, + createMultipleApplicationsWithBSandTags, + createMultipleBusinessServices, + createMultipleTags, + login, + clearAllFilters, +} from "../../../../../utils/utils"; +import { + button, + analysis, +} from "../../../../types/constants"; + +import * as data from "../../../../../utils/data_utils"; +import { Application } from "../../../../models/migration/applicationinventory/application"; +import { BusinessServices } from "../../../../models/migration/controls/businessservices"; +import { Analysis } from "../../../../models/migration/applicationinventory/analysis"; +import { Tag } from "../../../../models/migration/controls/tags"; +import { Stakeholders } from "../../../../models/migration/controls/stakeholders"; +import * as commonView from "../../../../views/common.view"; +import { AppIssue } from "../../../../types/types"; +import { analysisDetails } from "../../../../views/analysis.view"; + + +let applicationsList: Array = []; +let businessServicesList: Array = []; +let tagList: Array = []; +let application: Analysis; + + +const fileName = "Legacy Pathfinder"; + +describe(["@tier3"], "Application inventory filter validations", function () { + + before("Login", function () { + login(); + }); + beforeEach("Load Fixtures & Interceptors", function () { + cy.fixture("analysis").then(function (analysisData) { + this.analysisData = analysisData; + }); + + let businessServicesList = createMultipleBusinessServices(2); + let tagList = createMultipleTags(2); + + applicationsList = createMultipleApplicationsWithBSandTags( + 2, + businessServicesList, + tagList, + null + ); + + cy.intercept("GET", "/hub/application*").as("getApplication"); + Application.open(true); + }); + + beforeEach("Load data", function () { + cy.fixture("application").then(function (appData) { + this.appData = appData; + }); + cy.fixture("analysis").then(function (analysisData) { + this.analysisData = analysisData; + }); + + // Interceptors + cy.intercept("POST", "/hub/application*").as("postApplication"); + cy.intercept("GET", "/hub/application*").as("getApplication"); + }); + + it("Source Analysis on bookserver app and its issues validation", function () { + // // For source code analysis application must have source code URL git or svn + 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(); + checkSuccessAlert(commonView.infoAlertMessage, `Submitted for analysis`); + application.verifyAnalysisStatus("Failed"); + application.validateIssues(this.analysisData["source_analysis_on_bookserverapp"]["issues"]); + this.analysisData["source_analysis_on_bookserverapp"]["issues"].forEach( + (currentIssue: AppIssue) => { + application.validateAffected(currentIssue); + } + ); + }); + + it("Source Analysis on bookserver app and its issues validation", function () { + // // For source code analysis application must have source code URL git or svn + 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(); + checkSuccessAlert(commonView.infoAlertMessage, `Submitted for analysis`); + application.verifyAnalysisStatus("Completed"); + application.validateIssues(this.analysisData["source_analysis_on_bookserverapp"]["issues"]); + this.analysisData["source_analysis_on_bookserverapp"]["issues"].forEach( + (currentIssue: AppIssue) => { + application.validateAffected(currentIssue); + } + ); + }); + + it("Analysis filter validations", function () { + Application.open(); + applySearchFilter(analysis,"Failed"); + exists("Failed"); + clearAllFilters(); + applySearchFilter(analysis,"Not started"); + exists("Not started"); + clearAllFilters(); + applySearchFilter(analysis,"Completed"); + exists("Completed"); + + + + }); +}); + + +