From 1cf3c768e1547cd57756c06285334f70c86ce153 Mon Sep 17 00:00:00 2001 From: kpunwatk Date: Tue, 2 Apr 2024 14:34:20 +0530 Subject: [PATCH] [WIP][JF] Fixed affected files test cases Signed-off-by: Karishma Punwatkar modified: cypress/e2e/tests/migration/applicationinventory/analysis/affected_files.test.ts modified: cypress/utils/utils.ts 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/affected_files.test.ts modified: cypress/e2e/types/types.ts modified: cypress/fixtures/analysis.json modified: cypress/e2e/tests/migration/applicationinventory/analysis/affected_files.test.ts modified: cypress/utils/utils.ts --- .../applicationinventory/application.ts | 7 +-- .../migration/dynamic-report/issues/issues.ts | 2 +- .../analysis/affected_files.test.ts | 44 +++++++++---------- cypress/e2e/types/types.ts | 1 + cypress/fixtures/analysis.json | 5 ++- cypress/utils/utils.ts | 5 ++- 6 files changed, 34 insertions(+), 30 deletions(-) diff --git a/cypress/e2e/models/migration/applicationinventory/application.ts b/cypress/e2e/models/migration/applicationinventory/application.ts index bb6f7e631..27390f3c9 100644 --- a/cypress/e2e/models/migration/applicationinventory/application.ts +++ b/cypress/e2e/models/migration/applicationinventory/application.ts @@ -155,7 +155,7 @@ export class Application { public static open(forceReload = false): void { const itemsPerPage = 100; if (forceReload) { - cy.visit(Application.fullUrl, { timeout: 15 * SEC }).then((_) => + cy.visit(Application.fullUrl, { timeout: 35 * SEC }).then((_) => selectItemsPerPage(itemsPerPage) ); return; @@ -510,10 +510,7 @@ export class Application { validateTextPresence('td[data-label="Business service"]', this.business); } // Validating total effort for fixing issue, it is basic effort from main issue page multiplied on incidents amount - validateNumberPresence( - 'td[data-label="Total Effort"]', - appIssue.effort * appIssue.incidents - ); + validateNumberPresence('td[data-label="Total Effort"]', appIssue.toatlEffort); validateNumberPresence('td[data-label="Incidents"]', appIssue.incidents); }); } diff --git a/cypress/e2e/models/migration/dynamic-report/issues/issues.ts b/cypress/e2e/models/migration/dynamic-report/issues/issues.ts index a095de3be..a849b4a9e 100644 --- a/cypress/e2e/models/migration/dynamic-report/issues/issues.ts +++ b/cypress/e2e/models/migration/dynamic-report/issues/issues.ts @@ -138,7 +138,7 @@ export class Issues { Issues.validateSection(sections.sourceTechnologies, div, issue.source); Issues.validateSection(sections.ruleSet, div, issue.ruleSet); Issues.validateSection(sections.rule, div, issue.rule); - Issues.validateSection(sections.labels, span, issue.labels); + Issues.validateSection(sections.labels, div, issue.labels); } private static validateSection( diff --git a/cypress/e2e/tests/migration/applicationinventory/analysis/affected_files.test.ts b/cypress/e2e/tests/migration/applicationinventory/analysis/affected_files.test.ts index 656db471c..26bfa10cb 100644 --- a/cypress/e2e/tests/migration/applicationinventory/analysis/affected_files.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/analysis/affected_files.test.ts @@ -70,28 +70,6 @@ describe(["@tier2"], "Bug MTA-2006: Affected files validation", () => { Application.open(true); }); - it("Bug MTA-2006: Affected files validation with Source + dependencies analysis on daytrader app", function () { - // Automate bug https://issues.redhat.com/browse/MTA-2006 - const application = new Analysis( - getRandomApplicationData("affected_files_on_day_trader_app", { - sourceData: this.appData["daytrader-app"], - }), - getRandomAnalysisData(this.analysisData["affected_files_on_day_trader_app"]) - ); - application.create(); - applicationsList.push(application); - cy.wait("@getApplication"); - cy.wait(2 * SEC); - application.analyze(); - application.verifyAnalysisStatus("Completed"); - application.validateIssues(this.analysisData["affected_files_on_day_trader_app"]["issues"]); - this.analysisData["affected_files_on_day_trader_app"]["issues"].forEach( - (currentIssue: AppIssue) => { - application.validateAffected(currentIssue); - } - ); - }); - it("Affected files validation with source analysis on bookserver app", function () { // Automate bug https://issues.redhat.com/browse/MTA-1628 const application = new Analysis( @@ -161,6 +139,28 @@ describe(["@tier2"], "Bug MTA-2006: Affected files validation", () => { ); }); + it("Bug MTA-2006: Affected files validation with Source + dependencies analysis on daytrader app", function () { + // Automate bug https://issues.redhat.com/browse/MTA-2006 + const application = new Analysis( + getRandomApplicationData("affected_files_on_day_trader_app", { + sourceData: this.appData["daytrader-app"], + }), + getRandomAnalysisData(this.analysisData["affected_files_on_day_trader_app"]) + ); + application.create(); + applicationsList.push(application); + cy.wait("@getApplication"); + cy.wait(2 * SEC); + application.analyze(); + application.verifyAnalysisStatus("Completed"); + application.validateIssues(this.analysisData["affected_files_on_day_trader_app"]["issues"]); + this.analysisData["affected_files_on_day_trader_app"]["issues"].forEach( + (currentIssue: AppIssue) => { + application.validateAffected(currentIssue); + } + ); + }); + after("Perform test data clean up", function () { deleteByList(applicationsList); }); diff --git a/cypress/e2e/types/types.ts b/cypress/e2e/types/types.ts index 1e9380eca..ffc2d402e 100644 --- a/cypress/e2e/types/types.ts +++ b/cypress/e2e/types/types.ts @@ -196,6 +196,7 @@ export type AppIssue = { source: string; targets: string[]; effort: number; + toatlEffort?: number; incidents: number; affectedFiles: number; tags?: string[]; diff --git a/cypress/fixtures/analysis.json b/cypress/fixtures/analysis.json index 3baa31ba7..c468656e8 100644 --- a/cypress/fixtures/analysis.json +++ b/cypress/fixtures/analysis.json @@ -317,7 +317,8 @@ "source": "java-ee", "targets": ["quarkus"], "effort": 1, - "incidents": 2, + "totalEffort": 9, + "incidents": 1, "affectedFiles": 1, "ruleSet": "quarkus/springboot", "rule": "javaee-pom-to-quarkus-00060", @@ -337,6 +338,7 @@ "source": "java-ee", "targets": ["quarkus"], "effort": 1, + "totalEffort": 8, "incidents": 1, "affectedFiles": 1, "ruleSet": "quarkus/springboot", @@ -357,6 +359,7 @@ "source": "camel", "targets": ["camel"], "effort": 1, + "totalEffort": 4, "incidents": 1, "affectedFiles": 1, "ruleSet": "camel3/camel2", diff --git a/cypress/utils/utils.ts b/cypress/utils/utils.ts index 105ea783b..13b7838aa 100644 --- a/cypress/utils/utils.ts +++ b/cypress/utils/utils.ts @@ -275,6 +275,7 @@ export function selectItemsPerPage(items: number): void { .click({ force: true, log: false, + timeout: 30 * SEC, }); cy.wait(2 * SEC); } @@ -1393,7 +1394,9 @@ export function goToPage(page: number): void { export function selectUserPerspective(userType: string): void { cy.get(commonView.optionMenu).click(); - cy.get(commonView.actionMenuItem).contains(userType).click(); + cy.get(commonView.actionMenuItem, { timeout: 30 * SEC }) + .contains(userType) + .click(); } export function selectWithinModal(selector: string): void {