From c42604ffc5c3e17b28f3de094a176b51724cd3be Mon Sep 17 00:00:00 2001 From: Maayan Hadasi <60384172+mguetta1@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:40:27 +0200 Subject: [PATCH] Limit analysis verifyStatus timeout to 10 mins (#1289) (#1290) * Limit analysis verifyStatus timeout to 10 mins * Changes after review --------- Signed-off-by: Maayan Hadasi --- .../models/migration/applicationinventory/analysis.ts | 9 +++++---- .../applicationinventory/analysis/load_analysis.test.ts | 6 +++--- cypress/e2e/types/constants.ts | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/models/migration/applicationinventory/analysis.ts b/cypress/e2e/models/migration/applicationinventory/analysis.ts index 66c7ef426..19bcd268d 100644 --- a/cypress/e2e/models/migration/applicationinventory/analysis.ts +++ b/cypress/e2e/models/migration/applicationinventory/analysis.ts @@ -20,6 +20,7 @@ import { button, clearAllFilters, Languages, + MIN, ReportTypeSelectors, RepositoryType, save, @@ -364,13 +365,13 @@ export class Analysis extends Application { doesExistSelector(analyzeAppButton, rbacRules["Analyze"]); } - verifyAnalysisStatus(status: string) { + verifyAnalysisStatus(status: string, timeout?: number) { cy.log(`Verifying analysis status, expecting ${status}`); cy.get(tdTag, { log: false }) .contains(this.name, { log: false }) .closest(trTag, { log: false }) .within(() => { - Analysis.verifyStatus(cy.get(analysisColumn, { log: false }), status); + Analysis.verifyStatus(cy.get(analysisColumn, { log: false }), status, timeout); }); this.selectApplication(); } @@ -391,9 +392,9 @@ export class Analysis extends Application { }); } - public static verifyStatus(element: Cypress.Chainable, status: string) { + public static verifyStatus(element: Cypress.Chainable, status: string, timeout = 10 * MIN) { element - .find("div > div:nth-child(2)", { timeout: 3600000, log: false }) // 1h + .find("div > div:nth-child(2)", { timeout: timeout, log: false }) .should("not.have.text", AnalysisStatuses.notStarted) .and("not.have.text", AnalysisStatuses.scheduled) .and("not.have.text", AnalysisStatuses.inProgress) diff --git a/cypress/e2e/tests/migration/applicationinventory/analysis/load_analysis.test.ts b/cypress/e2e/tests/migration/applicationinventory/analysis/load_analysis.test.ts index 5530efc35..2e90aa578 100644 --- a/cypress/e2e/tests/migration/applicationinventory/analysis/load_analysis.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/analysis/load_analysis.test.ts @@ -24,7 +24,7 @@ import { deleteApplicationTableRows, } from "../../../../../utils/utils"; import { Analysis } from "../../../../models/migration/applicationinventory/analysis"; -import { AnalysisStatuses, SEC } from "../../../../types/constants"; +import { AnalysisStatuses, MIN, SEC } from "../../../../types/constants"; import { Application } from "../../../../models/migration/applicationinventory/application"; import { CustomMigrationTarget } from "../../../../models/administration/custom-migration-targets/custom-migration-target"; import * as data from "../../../../../utils/data_utils"; @@ -93,7 +93,7 @@ describe(["@tier2"], "Source Analysis of big applications", () => { cy.wait("@getApplication"); cy.wait(2 * SEC); application.analyze(); - application.verifyAnalysisStatus(AnalysisStatuses.completed); + application.verifyAnalysisStatus(AnalysisStatuses.completed, 60 * MIN); }); it("Source Analysis on OpenMRS app", function () { @@ -108,7 +108,7 @@ describe(["@tier2"], "Source Analysis of big applications", () => { cy.wait("@getApplication"); cy.wait(2 * SEC); application.analyze(); - application.verifyAnalysisStatus(AnalysisStatuses.completed); + application.verifyAnalysisStatus(AnalysisStatuses.completed, 30 * MIN); }); after("Test data clean up", function () { diff --git a/cypress/e2e/types/constants.ts b/cypress/e2e/types/constants.ts index 30672fed6..c0c263675 100644 --- a/cypress/e2e/types/constants.ts +++ b/cypress/e2e/types/constants.ts @@ -122,7 +122,8 @@ export const max120CharsMsg = "This field must contain fewer than 120 characters export const max250CharsMsg = "This field must contain fewer than 250 characters."; export const minCharsMsg = "This field must contain at least 3 characters."; -export const SEC = 1000; +export const SEC = 1000; // milliseconds +export const MIN = 60000; // milliseconds export const administration = "Administration"; export const migration = "Migration"; export const general = "General";