Skip to content

Commit

Permalink
[RFR] Fix Source analysis test case
Browse files Browse the repository at this point in the history
	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
  • Loading branch information
kpunwatk committed Dec 23, 2024
1 parent c59b03d commit cedb61e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand All @@ -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"],
Expand All @@ -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"],
Expand Down Expand Up @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/views/analysis.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions cypress/fixtures/analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit cedb61e

Please sign in to comment.