From 5f048aaf8547fee7128e08bc0221542ac930fa19 Mon Sep 17 00:00:00 2001 From: kpunwatk Date: Tue, 21 Jan 2025 12:01:38 +0530 Subject: [PATCH] [RFR] Fix Source analysis Signed-off-by: Karishma Punwatkar modified: cypress/e2e/models/migration/applicationinventory/application.ts modified: cypress/e2e/models/migration/dynamic-report/issues/issues.ts modified: cypress/e2e/models/migration/dynamic-report/issues/issues.ts modified: cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts modified: cypress/fixtures/analysis.json modified: cypress/e2e/models/migration/dynamic-report/issues/issues.ts modified: cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts modified: cypress/fixtures/analysis.json modified: cypress/e2e/models/migration/applicationinventory/application.ts modified: cypress/e2e/models/migration/dynamic-report/issues/issues.ts modified: cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts modified: cypress/fixtures/analysis.json --- .../applicationinventory/application.ts | 4 +-- .../migration/dynamic-report/issues/issues.ts | 4 ++- .../analysis/source_analysis.test.ts | 30 +++++++++++-------- cypress/fixtures/analysis.json | 3 +- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/cypress/e2e/models/migration/applicationinventory/application.ts b/cypress/e2e/models/migration/applicationinventory/application.ts index 54039ca3b..d4e6059ff 100644 --- a/cypress/e2e/models/migration/applicationinventory/application.ts +++ b/cypress/e2e/models/migration/applicationinventory/application.ts @@ -573,11 +573,11 @@ export class Application { }); cy.get("ul[role=tablist] >li >button").then((button) => { if (!button.text().includes("All incidents")) { - // Asserting that content of text field has at least 100 symbols + // Asserting that content of text field has at least 50 symbols cy.get("div.monaco-scrollable-element.editor-scrollable.vs-dark") .invoke("text") .then((text) => { - expect(text.length).to.be.at.least(100); + expect(text.length).to.be.at.least(50); }); } }); diff --git a/cypress/e2e/models/migration/dynamic-report/issues/issues.ts b/cypress/e2e/models/migration/dynamic-report/issues/issues.ts index 724f92bd9..4fdca0afc 100644 --- a/cypress/e2e/models/migration/dynamic-report/issues/issues.ts +++ b/cypress/e2e/models/migration/dynamic-report/issues/issues.ts @@ -214,7 +214,9 @@ export class Issues { ); Issues.validateSection(issue.name, sections.targetTechnologies, span, issue.targets); Issues.validateSection(issue.name, sections.sourceTechnologies, div, issue.sources); - Issues.validateSection(issue.name, sections.ruleSet, div, issue.ruleSet); + if (issue.ruleSet) { + Issues.validateSection(issue.name, sections.ruleSet, div, issue.ruleSet); + } Issues.validateSection(issue.name, sections.rule, div, issue.rule); Issues.validateSection(issue.name, sections.labels, div, issue.labels); } 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 510042fa4..42b0d14a9 100644 --- a/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts @@ -264,6 +264,7 @@ describe(["@tier1"], "Source Analysis", () => { cy.wait(2 * SEC); application.analyze(); application.verifyAnalysisStatus("Completed"); + Application.open(); // Polarion TC 406 application.verifyEffort(this.analysisData["analysis_on_example-1-app"]["effort"]); }); @@ -284,6 +285,7 @@ describe(["@tier1"], "Source Analysis", () => { application.manageCredentials(source_credential.name, maven_credential.name); application.analyze(); application.verifyAnalysisStatus("Completed"); + Application.open(); application.verifyEffort( this.analysisData["jws6_source+dep_analysis_on_tackletestapp"]["effort"] ); @@ -364,22 +366,22 @@ describe(["@tier1"], "Source Analysis", () => { cy.wait(5 * SEC); application.analyze(); application.verifyAnalysisStatus("Completed"); + Application.open(); application.verifyEffort(this.analysisData["tackle-testapp-public-4-targets"]["effort"]); }); // Automates customer bug MTA-2973 it("Source analysis on tackle app public with custom rule", function () { - const { appData, analysisData } = this; - const applicationData = getRandomApplicationData("tackle-public-customRule", { - sourceData: appData["tackle-testapp-public"], - }); - - const analysisDataCustomRule = analysisData["tackle-testapp-public-customRule"]; + const applicationsList = []; for (let i = 0; i < 2; i++) { - applicationsList.push( - new Analysis(applicationData, getRandomAnalysisData(analysisDataCustomRule)) + const application = new Analysis( + getRandomApplicationData("tackle-public-customRule", { + sourceData: this.appData["tackle-testapp-public"], + }), + getRandomAnalysisData(this.analysisData["tackle-testapp-public-customRule"]) ); + applicationsList.push(application); } // Analyze an application @@ -388,10 +390,14 @@ describe(["@tier1"], "Source Analysis", () => { if (credentials) application.manageCredentials(null, credentials.name); application.analyze(); application.verifyAnalysisStatus("Completed"); - application.validateIssues(analysisDataCustomRule.issues); - analysisDataCustomRule.issues.forEach((issue) => { - application.validateAffected(issue); - }); + application.validateIssues( + this.analysisData["tackle-testapp-public-customRule"]["issues"] + ); + this.analysisData["tackle-testapp-public-customRule"]["issues"].forEach( + (currentIssue: AppIssue) => { + application.validateAffected(currentIssue); + } + ); }; // Analyze application with Maven credentials diff --git a/cypress/fixtures/analysis.json b/cypress/fixtures/analysis.json index 101b2a797..8f1550e2b 100644 --- a/cypress/fixtures/analysis.json +++ b/cypress/fixtures/analysis.json @@ -1403,9 +1403,8 @@ "totalEffort": 1, "incidents": 1, "affectedFiles": 1, - "ruleSet": "files", "rule": "corporate-config-01000", - "labels": ["None"] + "labels": ["configuration", "konveyor.io/include=always"] } ] },