From 11fcf20a2f47beb88ec2fd0c968809abb945443d Mon Sep 17 00:00:00 2001 From: kpunwatk Date: Thu, 15 Feb 2024 22:27:12 +0530 Subject: [PATCH] [RFR][TA] OpenJDK Targets Automation Signed-off-by: Karishma Punwatkar 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 modified: cypress/e2e/models/migration/applicationinventory/analysis.ts modified: cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts modified: cypress/e2e/types/types.ts modified: cypress/e2e/views/analysis.view.ts modified: cypress/fixtures/analysis.json modified: cypress/utils/utils.ts --- .../applicationinventory/analysis.ts | 37 ++++++++++++------- .../analysis/source_analysis.test.ts | 37 ++++++++++++++++++- cypress/e2e/types/types.ts | 2 +- cypress/e2e/views/analysis.view.ts | 8 ++-- cypress/fixtures/analysis.json | 19 +++++++++- cypress/utils/utils.ts | 2 +- 6 files changed, 82 insertions(+), 23 deletions(-) diff --git a/cypress/e2e/models/migration/applicationinventory/analysis.ts b/cypress/e2e/models/migration/applicationinventory/analysis.ts index b65a47982..371fc146b 100644 --- a/cypress/e2e/models/migration/applicationinventory/analysis.ts +++ b/cypress/e2e/models/migration/applicationinventory/analysis.ts @@ -31,7 +31,6 @@ import { cleanupDownloads, click, clickByText, - clickJs, clickTab, clickWithin, doesExistSelector, @@ -41,6 +40,7 @@ import { performRowActionByIcon, selectCheckBox, selectFormItems, + selectFromDropList, sidedrawerTab, uploadApplications, uploadXml, @@ -58,6 +58,8 @@ import { analysisColumn, analysisDetails, analyzeManuallyButton, + camelToggleButton, + dropDownMenu, effortColumn, enableAutomatedTagging, enableTransactionAnalysis, @@ -69,6 +71,7 @@ import { kebabTopMenuButton, manageCredentials, mavenCredential, + openjdkToggleButton, panelBody, reportStoryPoints, rightSideMenu, @@ -82,7 +85,6 @@ import { } from "../../../views/applicationinventory.view"; import { CustomMigrationTargetView } from "../../../views/custom-migration-target.view"; import { actionSelectToggle } from "../../../views/common.view"; -import * as commonView from "../../../views/common.view"; export class Analysis extends Application { name: string; @@ -98,7 +100,7 @@ export class Analysis extends Application { enableTransaction?: boolean; disableTagging?: boolean; appName?: string; - storyPoints?: number; + effort?: number; manuallyAnalyzePackages?: string[]; excludedPackagesList?: string[]; openSourceLibraries?: boolean; @@ -129,7 +131,7 @@ export class Analysis extends Application { enableTransaction, disableTagging, appName, - storyPoints, + effort, manuallyAnalyzePackages, excludedPackagesList, incidents, @@ -149,7 +151,7 @@ export class Analysis extends Application { if (enableTransaction) this.enableTransaction = enableTransaction; if (disableTagging) this.disableTagging = disableTagging; if (appName) this.appName = appName; - if (storyPoints) this.storyPoints = storyPoints; + if (effort) this.effort = effort; if (excludePackages) this.excludePackages = excludePackages; if (manuallyAnalyzePackages) this.manuallyAnalyzePackages = manuallyAnalyzePackages; if (excludedPackagesList) this.excludedPackagesList = excludedPackagesList; @@ -170,7 +172,22 @@ export class Analysis extends Application { protected selectTarget(target: string[]): void { for (let i = 0; i < target.length; i++) { - cy.get("div.pf-v5-c-empty-state__content").children("h4").contains(target[i]).click(); + if ( + target.includes("OpenJDK 11") || + target.includes("OpenJDK 17") || + target.includes("OpenJDK 21") + ) { + click(openjdkToggleButton); + clickByText(dropDownMenu, target[i]); + } else if (target.includes("camel:3") || target.includes("camel:4")) { + click(camelToggleButton); + clickByText(dropDownMenu, target[i]); + } else { + cy.get("div.pf-v5-c-empty-state__content") + .children("h4") + .contains(target[i]) + .click(); + } } } @@ -414,14 +431,6 @@ export class Analysis extends Application { cy.wait(2000); } - validateStoryPoints(): void { - cy.get(fileName).should("contain", this.appName); - //Validating that this field contains number - cy.get(reportStoryPoints).should((value) => { - expect(Number.isNaN(parseInt(value.text(), 10))).to.eq(false); - }); - } - static validateTopActionMenu(rbacRules: RbacValidationRules) { Application.open(); if (rbacRules["Top action menu"]["Not available"]) { 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 c2e99d46e..f1d790b50 100644 --- a/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts @@ -256,7 +256,42 @@ describe(["@tier1"], "Source Analysis", () => { application.manageCredentials(source_credential.name, maven_credential.name); application.analyze(); application.verifyAnalysisStatus("Completed"); - application.verifyEffort(3); + application.verifyEffort(this.analysisData["jws6_source+dep_analysis_on_tackletestapp"]["effort"]); + }); + + it("Openjdk17 Source + dependencies analysis on tackletest app", function () { + const application = new Analysis( + getRandomApplicationData("tackleTestApp_Source+dependencies_openjdk17", { + sourceData: this.appData["tackle-testapp-git"], + }), + getRandomAnalysisData( + this.analysisData["openJDK17_source+dep_analysis_on_tackletestapp"] + ) + ); + application.create(); + applicationsList.push(application); + cy.wait("@getApplication"); + cy.wait(2 * SEC); + application.manageCredentials(source_credential.name, maven_credential.name); + application.analyze(); + application.verifyAnalysisStatus("Completed"); + application.verifyEffort(this.analysisData["openJDK17_source+dep_analysis_on_tackletestapp"]["effort"]); + }); + + it("OpenJDK21 Source + dependencies analysis on daytrader app", function () { + const application = new Analysis( + getRandomApplicationData("dayTraderApp_Source+dependencies_openjdk21", { + sourceData: this.appData["daytrader-app"], + }), + getRandomAnalysisData(this.analysisData["openJDK21_source+dep_analysis_on_dayTrader"]) + ); + application.create(); + applicationsList.push(application); + cy.wait("@getApplication"); + cy.wait(2 * SEC); + application.analyze(); + application.verifyAnalysisStatus("Completed"); + application.verifyEffort(this.analysisData["openJDK21_source+dep_analysis_on_dayTrader"]["effort"]); }); after("Perform test data clean up", function () { diff --git a/cypress/e2e/types/types.ts b/cypress/e2e/types/types.ts index ca55a21c4..0edc6d566 100644 --- a/cypress/e2e/types/types.ts +++ b/cypress/e2e/types/types.ts @@ -111,7 +111,7 @@ export type analysisData = { enableTransaction?: boolean; disableTagging?: boolean; appName?: string; - storyPoints?: number; + effort?: number; excludePackages?: string[]; manuallyAnalyzePackages?: string[]; excludedPackagesList?: string[]; diff --git a/cypress/e2e/views/analysis.view.ts b/cypress/e2e/views/analysis.view.ts index 82a73848c..53acd1da9 100644 --- a/cypress/e2e/views/analysis.view.ts +++ b/cypress/e2e/views/analysis.view.ts @@ -13,10 +13,6 @@ 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. */ -export const actionButton = "div > button[aria-label='Actions']"; -export const applicationNameInput = "input[name=name]"; -export const applicationDescriptionInput = "input[name=description]"; -export const sourceofAnalysiSelect = "[placeholder='Select a business service']"; export const sourceDropdown = "#analysis-mode-toggle"; export const analysisColumn = "td[data-label='Analysis']"; export const effortColumn = "td[data-label='Effort']"; @@ -41,4 +37,6 @@ export const analysisDetailsEditor = ".monaco-editor"; export const rightSideMenu = "#page-drawer-content"; export const enableAutomatedTagging = "input[name=autoTaggingEnabled]"; export const kebabTopMenuButton = "#toolbar-kebab"; -export const kebabButton = 'button[aria-label="Kebab toggle"]'; +export const camelToggleButton = "#Camel-toggle"; +export const openjdkToggleButton = "#OpenJDK-toggle"; +export const dropDownMenu = "ul.pf-v5-c-select__menu"; diff --git a/cypress/fixtures/analysis.json b/cypress/fixtures/analysis.json index 884596f0a..1d9ebac72 100644 --- a/cypress/fixtures/analysis.json +++ b/cypress/fixtures/analysis.json @@ -342,6 +342,23 @@ "jws6_source+dep_analysis_on_tackletestapp": { "source": "Source code + dependencies", "target": ["JBoss Web Server 6"], - "appName": "tackle-testapp" + "appName": "tackle-testapp", + "openSourceLibraries": true + }, + + "openJDK17_source+dep_analysis_on_tackletestapp": { + "source": "Source code + dependencies", + "target": ["OpenJDK 17"], + "appName": "tackle-testapp", + "openSourceLibraries": true, + "effort": 3 + }, + + "openJDK21_source+dep_analysis_on_dayTrader": { + "source": "Source code + dependencies", + "target": ["OpenJDK 21"], + "appName": "deps", + "openSourceLibraries": true, + "effort": 596 } } diff --git a/cypress/utils/utils.ts b/cypress/utils/utils.ts index 1a915c779..76735aa70 100644 --- a/cypress/utils/utils.ts +++ b/cypress/utils/utils.ts @@ -1091,7 +1091,7 @@ export function getRandomAnalysisData(analysisdata): analysisData { enableTransaction: analysisdata.enableTransaction, disableTagging: analysisdata.disableTagging, appName: analysisdata.appName, - storyPoints: analysisdata.storyPoints, + effort: analysisdata.effort, excludePackages: analysisdata.excludePackages, excludeRuleTags: analysisdata.excludeRuleTags, manuallyAnalyzePackages: analysisdata.manuallyAnalyzePackages,