Skip to content

Commit

Permalink
fix JF - migration/dynamic-report/issues/filter.sorting.pagination.te…
Browse files Browse the repository at this point in the history
…st.ts (konveyor#1053)

Signed-off-by: nhamza <[email protected]>

	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/tests/migration/dynamic-report/issues/filter.sorting.pagination.test.ts
	modified:   cypress/e2e/types/types.ts
	modified:   cypress/fixtures/analysis.json
	modified:   cypress/utils/utils.ts
  • Loading branch information
Neilhamza authored and kpunwatk committed Apr 5, 2024
1 parent ea07b13 commit e6042c3
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 31 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: 30 * 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.totalEffort);
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Stakeholdergroups } from "../../../../models/migration/controls/stakeho
import { Tag } from "../../../../models/migration/controls/tags";
import { Issues } from "../../../../models/migration/dynamic-report/issues/issues";
import { AppIssue } from "../../../../types/types";
import { AnalysisStatuses, issueFilter, SEC, trTag } from "../../../../types/constants";
import { AnalysisStatuses, issueFilter, trTag } from "../../../../types/constants";
import { randomWordGenerator } from "../../../../../utils/data_utils";

describe(["@tier3"], "Filtering, sorting and pagination in Issues", function () {
Expand All @@ -32,7 +32,7 @@ describe(["@tier3"], "Filtering, sorting and pagination in Issues", function ()
let tags: Tag[];
let tagNames: string[];
const allIssuesSortByList = ["Issue", "Category", "Effort", "Affected applications"];
const affectedApplicationSortByList = ["Name", "Business service", "Effort", "Incidents"];
const affectedApplicationSortByList = ["Name", "Business service", "Total Effort", "Incidents"];
const singleApplicationSortByList = ["Issue", "Category", "Effort", "Affected files"];

before("Login", function () {
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;
totalEffort?: number;
incidents: number;
affectedFiles: number;
tags?: string[];
Expand Down
6 changes: 5 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 @@ -350,13 +352,15 @@
"source": "Source code + dependencies",
"target": ["Camel"],
"appName": "tackle-testapp",
"openSourceLibraries": true,
"issues": [
{
"name": "'jaxb-core' Maven dependency missing",
"category": "potential",
"source": "camel",
"targets": ["camel"],
"effort": 1,
"totalEffort": 4,
"incidents": 1,
"affectedFiles": 1,
"ruleSet": "camel3/camel2",
Expand Down
1 change: 1 addition & 0 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export function selectItemsPerPage(items: number): void {
cy.get(`li[data-action="per-page-${items}"]`, { log: false })
.contains(`${items}`)
.click({
timeout: 30 * SEC,
force: true,
log: false,
});
Expand Down

0 comments on commit e6042c3

Please sign in to comment.