From cedb61e06abee19266429bb4072be294e06bb98f Mon Sep 17 00:00:00 2001 From: kpunwatk Date: Mon, 16 Dec 2024 16:13:09 +0530 Subject: [PATCH] [RFR] Fix Source analysis test case modified: cypress/e2e/models/migration/applicationinventory/analysis.ts modified: cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts modified: cypress/e2e/views/analysis.view.ts modified: cypress/fixtures/analysis.json --- .../applicationinventory/analysis.ts | 5 +- .../analysis/source_analysis.test.ts | 75 ++++++++----------- cypress/e2e/views/analysis.view.ts | 2 +- cypress/fixtures/analysis.json | 8 +- 4 files changed, 41 insertions(+), 49 deletions(-) diff --git a/cypress/e2e/models/migration/applicationinventory/analysis.ts b/cypress/e2e/models/migration/applicationinventory/analysis.ts index b1c56c175..6cf828184 100644 --- a/cypress/e2e/models/migration/applicationinventory/analysis.ts +++ b/cypress/e2e/models/migration/applicationinventory/analysis.ts @@ -195,11 +195,14 @@ export class Analysis extends Application { if (["OpenJDK 11", "OpenJDK 17", "OpenJDK 21"].includes(target[i])) { click(openjdkToggleButton); clickByText(dropDownMenu, target[i]); + click(`#target-OpenJDK-select`); } else if (["camel:3", "camel:4"].includes(target[i])) { click(camelToggleButton); clickByText(dropDownMenu, target[i]); + click(`#target-Camel-select`); + } else { + click(`#target-${target[i].replace(/ /g, "-")}-select`); } - click(`#target-${target[i].replace(/ /g, "-")}-select`); } } diff --git a/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts b/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts index cb07d2688..36f147904 100644 --- a/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts @@ -268,7 +268,7 @@ describe(["@tier1"], "Source Analysis", () => { application.verifyEffort(this.analysisData["analysis_on_example-1-app"]["effort"]); }); - it("Bug MTA-2916: JWS6 target Source + deps analysis on tackletest app", function () { + it("JWS6 target Source + deps analysis on tackletest app", function () { // Source code analysis require both source and maven credentials const application = new Analysis( getRandomApplicationData("tackleTestApp_Source+dependencies_jws6", { @@ -289,7 +289,7 @@ describe(["@tier1"], "Source Analysis", () => { ); }); - it("Bug MTA-2916: Openjdk17 Source + dependencies analysis on tackletest app", function () { + it("Bug MTA-4408: Openjdk17 Source + dependencies analysis on tackletest app", function () { const application = new Analysis( getRandomApplicationData("tackleTestApp_Source+dependencies_openjdk17", { sourceData: this.appData["tackle-testapp-git"], @@ -311,7 +311,7 @@ describe(["@tier1"], "Source Analysis", () => { ); }); - it("Bug MTA-2916: OpenJDK21 Source + dependencies analysis on daytrader app", function () { + it("OpenJDK21 Source + dependencies analysis on daytrader app", function () { const application = new Analysis( getRandomApplicationData("dayTraderApp_Source+dependencies_openjdk21", { sourceData: this.appData["daytrader-app"], @@ -368,49 +368,38 @@ describe(["@tier1"], "Source Analysis", () => { // Automates customer bug MTA-2973 it("Source analysis on tackle app public with custom rule", function () { - const applicationList = [ - new Analysis( - getRandomApplicationData("tackle-public-customRule", { - sourceData: this.appData["tackle-testapp-public"], - }), - getRandomAnalysisData(this.analysisData["tackle-testapp-public-customRule"]) - ), - ]; - - // Analysis application with maven credential - cy.wait(2 * SEC); + const { appData, analysisData } = this; + const applicationData = getRandomApplicationData("tackle-public-customRule", { + sourceData: appData["tackle-testapp-public"], + }); + + const analysisDataCustomRule = analysisData["tackle-testapp-public-customRule"]; + + for (let i = 0; i < 2; i++) { + applicationsList.push( + new Analysis(applicationData, getRandomAnalysisData(analysisDataCustomRule)) + ); + } + + // Analyze an application + const analyzeApplication = (application, credentials) => { + application.create(); + if (credentials) application.manageCredentials(null, credentials.name); + application.analyze(); + application.verifyAnalysisStatus("Completed"); + application.validateIssues(analysisDataCustomRule.issues); + analysisDataCustomRule.issues.forEach((issue) => { + application.validateAffected(issue); + }); + }; + + // Analyze application with Maven credentials Application.open(); - applicationList[0].create(); - applicationList[0].manageCredentials(null, maven_credential.name); - applicationsList.push(applicationList[0]); - cy.wait(5 * SEC); - applicationList[0].analyze(); - applicationList[0].verifyAnalysisStatus("Completed"); - applicationList[0].validateIssues( - this.analysisData["tackle-testapp-public-customRule"]["issues"] - ); - this.analysisData["tackle-testapp-public-customRule"]["issues"].forEach( - (currentIssue: AppIssue) => { - applicationList[0].validateAffected(currentIssue); - } - ); + analyzeApplication(applicationsList[0], maven_credential); - // Analysis application without maven credential - cy.wait(2 * SEC); + // Analyze application without Maven credentials Application.open(); - applicationList[1].create(); - applicationsList.push(applicationList[0]); - cy.wait(5 * SEC); - applicationList[1].analyze(); - applicationList[1].verifyAnalysisStatus("Completed"); - applicationList[1].validateIssues( - this.analysisData["tackle-testapp-public-customRule"]["issues"] - ); - this.analysisData["tackle-testapp-public-customRule"]["issues"].forEach( - (currentIssue: AppIssue) => { - applicationList[1].validateAffected(currentIssue); - } - ); + analyzeApplication(applicationsList[1], null); }); it("Bug MTA-3701: Source analysis on tackle app with hash in Password", function () { diff --git a/cypress/e2e/views/analysis.view.ts b/cypress/e2e/views/analysis.view.ts index c5ac5e8b6..2ba60d3b8 100644 --- a/cypress/e2e/views/analysis.view.ts +++ b/cypress/e2e/views/analysis.view.ts @@ -39,7 +39,7 @@ export const enableAutomatedTagging = "input[name=autoTaggingEnabled]"; export const kebabTopMenuButton = "#toolbar-kebab"; export const camelToggleButton = "#Camel-toggle"; export const openjdkToggleButton = "#OpenJDK-toggle"; -export const dropDownMenu = "ul.pf-v5-c-select__menu"; +export const dropDownMenu = "ul.pf-v5-c-menu__list"; export const closeWizard = ".pf-v5-c-wizard__close > .pf-v5-c-button"; export const codeEditorControls = "div.pf-v5-c-code-editor__controls"; export const menuToggle = "button.pf-v5-c-menu-toggle"; diff --git a/cypress/fixtures/analysis.json b/cypress/fixtures/analysis.json index 1929bfe61..94f5159c5 100644 --- a/cypress/fixtures/analysis.json +++ b/cypress/fixtures/analysis.json @@ -1321,8 +1321,8 @@ { "name": "Hardcoded IP Address", "category": "mandatory", - "source": "None", - "targets": ["cloud-readiness", "discovery"], + "sources": ["None"], + "targets": ["cloud-readiness"], "effort": 1, "totalEffort": 1, "incidents": 1, @@ -1334,8 +1334,8 @@ { "name": "Legacy configuration with io.konveyor.demo.config.ApplicationConfiguration", "category": "mandatory", - "sources": ["java", "java-ee"], - "targets": ["cloud-readiness"], + "sources": ["traditional-corporate-framework"], + "targets": ["cloud-corporate-framework"], "effort": 1, "totalEffort": 1, "incidents": 1,