Skip to content

Commit

Permalink
[WIP][JF] Fixed affected files test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Karishma Punwatkar <[email protected]>

	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
  • Loading branch information
kpunwatk committed Apr 5, 2024
1 parent 286d540 commit 1cf3c76
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
});
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export type AppIssue = {
source: string;
targets: string[];
effort: number;
toatlEffort?: number;
incidents: number;
affectedFiles: number;
tags?: string[];
Expand Down
5 changes: 4 additions & 1 deletion cypress/fixtures/analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -337,6 +338,7 @@
"source": "java-ee",
"targets": ["quarkus"],
"effort": 1,
"totalEffort": 8,
"incidents": 1,
"affectedFiles": 1,
"ruleSet": "quarkus/springboot",
Expand All @@ -357,6 +359,7 @@
"source": "camel",
"targets": ["camel"],
"effort": 1,
"totalEffort": 4,
"incidents": 1,
"affectedFiles": 1,
"ruleSet": "camel3/camel2",
Expand Down
5 changes: 4 additions & 1 deletion cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export function selectItemsPerPage(items: number): void {
.click({
force: true,
log: false,
timeout: 30 * SEC,
});
cy.wait(2 * SEC);
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1cf3c76

Please sign in to comment.