diff --git a/cypress.config.ts b/cypress.config.ts index 772dd37bc..160e6ab67 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -20,7 +20,7 @@ export default defineConfig({ jira_atlassian_cloud_token: "", jira_atlassian_cloud_url: "", jira_atlassian_cloud_project: "Test", - jira_stage_datacenter_project_id: 12340621, + jira_stage_datacenter_project_id: 12335626, tackleUrl: "https://tackle-konveyor-tackle.apps.mtv03.rhos-psi.cnv-qe.rhood.us", rwx_enabled: true, logLevel: "ASSERT", diff --git a/cypress/e2e/models/administration/jira-connection/jira.ts b/cypress/e2e/models/administration/jira-connection/jira.ts index 6493c5326..00710cb62 100644 --- a/cypress/e2e/models/administration/jira-connection/jira.ts +++ b/cypress/e2e/models/administration/jira-connection/jira.ts @@ -293,7 +293,7 @@ export class Jira { public getIssues(projectName: string): Cypress.Chainable { return this.doJiraRequest( - `${this.url}/rest/api/2/search?jql=project=${projectName}` + `${this.url}/rest/api/2/search?jql=project="${projectName}"` ).its("issues"); } diff --git a/cypress/e2e/models/migration/archetypes/archetype.ts b/cypress/e2e/models/migration/archetypes/archetype.ts index 3e1ed281b..9ede7ca24 100644 --- a/cypress/e2e/models/migration/archetypes/archetype.ts +++ b/cypress/e2e/models/migration/archetypes/archetype.ts @@ -68,17 +68,22 @@ export class Archetype { static fullUrl = Cypress.env("tackleUrl") + "/archetypes"; public static open(forceReload = false) { + const itemsPerPage = 100; if (forceReload) { - cy.visit(Archetype.fullUrl); + cy.visit(Archetype.fullUrl, { timeout: 15 * SEC }).then((_) => + selectItemsPerPage(itemsPerPage) + ); + return; } + cy.url().then(($url) => { if (!$url.includes(Archetype.fullUrl)) { selectUserPerspective(migration); clickByText(navMenu, "Archetypes"); cy.get("h1", { timeout: 60 * SEC }).should("contain", "Archetypes"); - selectItemsPerPage(100); } }); + selectItemsPerPage(itemsPerPage); } protected fillName(name: string): void { diff --git a/cypress/e2e/models/migration/custom-metrics/custom-metrics.ts b/cypress/e2e/models/migration/custom-metrics/custom-metrics.ts index 7f4866c6e..0b9a92885 100644 --- a/cypress/e2e/models/migration/custom-metrics/custom-metrics.ts +++ b/cypress/e2e/models/migration/custom-metrics/custom-metrics.ts @@ -13,6 +13,16 @@ export class Metrics { cy.request(this.metricsUrl).its("body").should("contain", `${metricName} ${value}`); } + validateMetricsDisabled(): void { + cy.wait(30 * SEC); + cy.request({ + url: this.metricsUrl, + failOnStatusCode: false, // Prevent Cypress from failing the test on non-2xx responses + }).then((response) => { + expect(response.status).to.eq(503); // Ensure the response status is 503 + }); + } + getValue(metricName: string): Cypress.Chainable { cy.wait(30 * SEC); return cy diff --git a/cypress/e2e/tests/administration/custom-migration-targets/crud.test.ts b/cypress/e2e/tests/administration/custom-migration-targets/crud.test.ts index 9c0346f19..209963e84 100644 --- a/cypress/e2e/tests/administration/custom-migration-targets/crud.test.ts +++ b/cypress/e2e/tests/administration/custom-migration-targets/crud.test.ts @@ -40,7 +40,7 @@ import { Analysis } from "../../../models/migration/applicationinventory/analysi import { cancelButton } from "../../../views/common.view"; import * as commonView from "../../../views/common.view"; -describe(["@tier1", "@dc", "@interop"], "Custom Migration Targets CRUD operations", () => { +describe(["@tier1", "@interop"], "Custom Migration Targets CRUD operations", () => { before("Login", function () { login(); }); diff --git a/cypress/e2e/tests/administration/jira-connection/crud.test.ts b/cypress/e2e/tests/administration/jira-connection/crud.test.ts index 26dcc1a5b..b66a08b5b 100644 --- a/cypress/e2e/tests/administration/jira-connection/crud.test.ts +++ b/cypress/e2e/tests/administration/jira-connection/crud.test.ts @@ -46,7 +46,7 @@ describe(["@tier1"], "CRUD operations for Jira Cloud instance", () => { ); jiraBasicStageCredential = new JiraCredentials( - getJiraCredentialData(CredentialType.jiraBasic, useTestingAccount, isStage) + getJiraCredentialData(CredentialType.jiraToken, useTestingAccount, isStage) ); jiraBasicCredential.create(); diff --git a/cypress/e2e/tests/custom-metrics/disable_metrics.test.ts b/cypress/e2e/tests/custom-metrics/disable_metrics.test.ts new file mode 100644 index 000000000..be712aefb --- /dev/null +++ b/cypress/e2e/tests/custom-metrics/disable_metrics.test.ts @@ -0,0 +1,36 @@ +/* +Copyright © 2021 the Konveyor Contributors (https://konveyor.io/) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +/// + +import { patchTackleCR } from "../../../utils/utils"; +import { Metrics } from "../../models/migration/custom-metrics/custom-metrics"; +const metrics = new Metrics(); +let metricsEnabled: boolean; + +describe(["@tier3"], "Custom Metrics - Disable metrics", function () { + it("Disable metrics in Tackle CR - Validate service is unavailable", function () { + metricsEnabled = false; + patchTackleCR("metrics", metricsEnabled); + metrics.validateMetricsDisabled(); + }); + + it("Re-enable metrics - Validate custom metric value is zero", function () { + metricsEnabled = true; + let metricName = "konveyor_assessments_initiated_total"; + patchTackleCR("metrics", metricsEnabled); + metrics.validateMetric(metricName, 0); + }); +}); diff --git a/cypress/e2e/tests/migration/applicationinventory/applications/pagination.test.ts b/cypress/e2e/tests/migration/applicationinventory/applications/pagination.test.ts index 16fe5d1ac..7aabb464b 100644 --- a/cypress/e2e/tests/migration/applicationinventory/applications/pagination.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/applications/pagination.test.ts @@ -40,14 +40,14 @@ describe(["@tier3"], "Application inventory pagination validations", function () it("Navigation button validations", function () { // Navigate to Application inventory tab - Application.open(); + Application.open(true); cy.wait("@getApplications"); selectItemsPerPage(10); validatePagination(); }); it("Items per page validations", function () { - Application.open(); + Application.open(true); cy.wait("@getApplications"); itemsPerPageValidation(); }); diff --git a/cypress/e2e/tests/migration/applicationinventory/applications/sort.test.ts b/cypress/e2e/tests/migration/applicationinventory/applications/sort.test.ts index 28bd0cfdc..8ed9fe9b5 100644 --- a/cypress/e2e/tests/migration/applicationinventory/applications/sort.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/applications/sort.test.ts @@ -24,7 +24,7 @@ import { clickOnSortButton, deleteByList, } from "../../../../../utils/utils"; -import { name, tags, SortType, businessService } from "../../../../types/constants"; +import { name, tags, SortType, businessService, SEC } from "../../../../types/constants"; import * as data from "../../../../../utils/data_utils"; import { BusinessServices } from "../../../../models/migration/controls/businessservices"; import { Application } from "../../../../models/migration/applicationinventory/application"; @@ -51,22 +51,15 @@ describe(["@tier2"], "Application inventory sort validations", function () { } }); - beforeEach("Interceptors", function () { - // Interceptors - cy.intercept("GET", "/hub/application*").as("getApplications"); - }); - it("Name sort validations", function () { - // Navigate to application inventory page Application.open(); - cy.wait("@getApplications"); // get unsorted list when page loads const unsortedList = getTableColumnData(name); // Sort the application inventory by name in ascending order clickOnSortButton(name, SortType.ascending); - cy.wait(2000); + cy.wait(2 * SEC); // Verify that the application inventory table rows are displayed in ascending order const afterAscSortList = getTableColumnData(name); @@ -74,7 +67,7 @@ describe(["@tier2"], "Application inventory sort validations", function () { // Sort the application inventory by name in descending order clickOnSortButton(name, SortType.descending); - cy.wait(2000); + cy.wait(2 * SEC); // Verify that the application inventory table rows are displayed in descending order const afterDescSortList = getTableColumnData(name); @@ -82,16 +75,14 @@ describe(["@tier2"], "Application inventory sort validations", function () { }); it("Business service sort validations", function () { - // Navigate to application inventory page Application.open(); - cy.wait("@getApplications"); // get unsorted list when page loads const unsortedList = getTableColumnData(businessService); // Sort the application inventory by Tag count in ascending order clickOnSortButton(businessService, SortType.ascending); - cy.wait(2000); + cy.wait(2 * SEC); // Verify that the application inventory table rows are displayed in ascending order const afterAscSortList = getTableColumnData(businessService); @@ -107,9 +98,7 @@ describe(["@tier2"], "Application inventory sort validations", function () { }); it("Tag count sort validations", function () { - // Navigate to application inventory page Application.open(); - cy.wait("@getApplications"); // get unsorted list when page loads const unsortedList = getTableColumnData(tags); diff --git a/cypress/e2e/tests/migration/applicationinventory/assessment/assessment_after_import.test.ts b/cypress/e2e/tests/migration/applicationinventory/assessment/assessment_after_import.test.ts index 82f1bdb63..512d857b4 100644 --- a/cypress/e2e/tests/migration/applicationinventory/assessment/assessment_after_import.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/assessment/assessment_after_import.test.ts @@ -37,7 +37,7 @@ let stakeholders: Stakeholders[]; let appdata = { name: "Customers" }; describe(["@tier2"], "Operations after application import", () => { - before("Login and create test data", function () { + before("Bug MTA-2451: Login and create test data", function () { login(); // This test will fail if there are preexisting questionnaire. AssessmentQuestionnaire.deleteAllQuestionnaires(); diff --git a/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts b/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts index 1ad78aace..ba7c7f5f0 100644 --- a/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts @@ -85,7 +85,8 @@ describe(["@tier3"], "Tests related to application assessment and review", () => applicationList[0].verifyStatus("assessment", "Completed"); }); - it("Discard Assessment from kebabMenu, AssessPage and ArchetypePage", function () { + it("Bug MTA-2503: Discard application assessment from kebabMenu, Assessment actions Page", function () { + // Automates Polarion MTA-418 Discard assessment from kebab menu applicationList[0].selectKebabMenuItem("Discard assessment(s)"); checkSuccessAlert( alertTitle, @@ -93,6 +94,7 @@ describe(["@tier3"], "Tests related to application assessment and review", () => ); applicationList[0].verifyStatus("assessment", "Not started"); + // Automates Polarion MTA-440 Delete assessment from Assessment actions Page applicationList[0].perform_assessment("low", stakeholderList); Application.open(true); applicationList[0].deleteAssessments(); @@ -104,15 +106,6 @@ describe(["@tier3"], "Tests related to application assessment and review", () => ); applicationList[0].validateAssessmentField("Unknown"); archetypeList[0].perform_assessment("low", stakeholderList); - Archetype.open(true); - archetypeList[0].deleteAssessments(); - archetypeList[0].verifyButtonEnabled("Take"); - checkSuccessAlert( - successAlertMessage, - `Success! Assessment discarded for ${archetypeList[0].name}.`, - true - ); - archetypeList[0].validateAssessmentField("Unknown"); }); it("Discard Review", function () { @@ -290,7 +283,7 @@ describe(["@tier3"], "Tests related to application assessment and review", () => deleteByList(tags); }); - it("Deletes assessments from archived questionnaire associated with an archetype and an application", function () { + it("BUG MTA-2505: Deletes assessments from archived questionnaire associated with an archetype and an application", function () { //automates polarion MTA-441 and MTA-442 const applications = createMultipleApplications(1); const archetypes = createMultipleArchetypes(1); diff --git a/cypress/e2e/tests/migration/archetypes/miscellaneous.test.ts b/cypress/e2e/tests/migration/archetypes/miscellaneous.test.ts new file mode 100644 index 000000000..525dccf8e --- /dev/null +++ b/cypress/e2e/tests/migration/archetypes/miscellaneous.test.ts @@ -0,0 +1,133 @@ +/* +Copyright © 2021 the Konveyor Contributors (https://konveyor.io/) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +/// + +import { + login, + deleteByList, + clickByText, + createMultipleStakeholders, + checkSuccessAlert, +} from "../../../../utils/utils"; +import { Stakeholders } from "../../../models/migration/controls/stakeholders"; +import { AssessmentQuestionnaire } from "../../../models/administration/assessment_questionnaire/assessment_questionnaire"; +import { successAlertMessage } from "../../../views/common.view"; +import { + legacyPathfinder, + SEC, + button, + cloudReadinessQuestionnaire, + cloudReadinessFilePath, +} from "../../../types/constants"; +import { Archetype } from "../../../models/migration/archetypes/archetype"; +import { Assessment } from "../../../models/migration/applicationinventory/assessment"; +import * as data from "../../../../utils/data_utils"; +import { + ArchivedQuestionnaires, + ArchivedQuestionnairesTableDataCell, +} from "../../../views/assessmentquestionnaire.view"; + +let stakeholderList: Array = []; +let archetype: Archetype; + +describe(["@tier3"], "Miscellaneous Archetype tests", () => { + before("Import and enable Cloud readiness questionnaire template", function () { + login(); + AssessmentQuestionnaire.deleteAllQuestionnaires(); + AssessmentQuestionnaire.disable(legacyPathfinder); + AssessmentQuestionnaire.import(cloudReadinessFilePath); + AssessmentQuestionnaire.enable(cloudReadinessQuestionnaire); + stakeholderList = createMultipleStakeholders(1); + + archetype = new Archetype( + data.getRandomWord(8), + ["Language / Java", "Runtime / Quarkus"], + ["Language / Java"], + null + ); + archetype.create(); + cy.wait(2 * SEC); + archetype.perform_assessment("high", stakeholderList, null, cloudReadinessQuestionnaire); + archetype.validateAssessmentField("High"); + }); + + it("Retake questionnaire for Archetype", function () { + //Automates Polarion MTA-394 + archetype.clickAssessButton(); + cy.wait(SEC); + clickByText(button, "Retake"); + checkSuccessAlert( + successAlertMessage, + `Success! Assessment discarded for ${archetype.name}.`, + true + ); + Assessment.fill_assessment_form("High", stakeholderList); + archetype.validateAssessmentField("High"); + }); + + it("View archived questionnaire for archetype", function () { + // Polarion TC MTA-391 + AssessmentQuestionnaire.disable(cloudReadinessQuestionnaire); + archetype.clickAssessButton(); + cy.contains("table", ArchivedQuestionnaires) + .find(ArchivedQuestionnairesTableDataCell) + .should("have.text", cloudReadinessQuestionnaire); + + AssessmentQuestionnaire.enable(legacyPathfinder); + archetype.clickAssessButton(); + cy.contains("table", ArchivedQuestionnaires) + .find(ArchivedQuestionnairesTableDataCell) + .last() + .should("not.have.text", legacyPathfinder); + cy.contains("table", "Required questionnaires") + .find('td[data-label="Required questionnaires"]') + .last() + .should("have.text", legacyPathfinder); + + AssessmentQuestionnaire.disable(legacyPathfinder); + AssessmentQuestionnaire.enable(cloudReadinessQuestionnaire); + }); + + it("Discard archetype assessment from kebab menu & Assessment Actions page", function () { + //Automates Polarion MTA-427 Discard assessment through kebab menu + archetype.discard("Discard assessment(s)"); + checkSuccessAlert( + successAlertMessage, + `Success! Assessment discarded for ${archetype.name}.`, + true + ); + archetype.validateAssessmentField("Unknown"); + + // Automates Polarion MTA-439 Delete assessment through Assessment Actions page + AssessmentQuestionnaire.enable(cloudReadinessQuestionnaire); + archetype.perform_assessment("high", stakeholderList, null, cloudReadinessQuestionnaire); + Archetype.open(true); + archetype.deleteAssessments(); + archetype.verifyButtonEnabled("Take"); + checkSuccessAlert( + successAlertMessage, + `Success! Assessment discarded for ${archetype.name}.`, + true + ); + archetype.validateAssessmentField("Unknown"); + }); + + after("Perform test data clean up", function () { + deleteByList(stakeholderList); + AssessmentQuestionnaire.deleteAllQuestionnaires(); + archetype.delete(); + }); +}); diff --git a/cypress/e2e/tests/migration/dynamic-report/dependencies/mta_2008_validation.test.ts b/cypress/e2e/tests/migration/dynamic-report/dependencies/mta_2008_validation.test.ts new file mode 100644 index 000000000..581b809c2 --- /dev/null +++ b/cypress/e2e/tests/migration/dynamic-report/dependencies/mta_2008_validation.test.ts @@ -0,0 +1,76 @@ +import { Analysis } from "../../../../models/migration/applicationinventory/analysis"; +import { + clickWithinByText, + deleteByList, + getRandomAnalysisData, + getRandomApplicationData, + login, + selectItemsPerPage, +} from "../../../../../utils/utils"; +import { rightSideMenu } from "../../../../views/analysis.view"; +import { AnalysisStatuses, button } from "../../../../types/constants"; +import { AppDependency } from "../../../../types/types"; +import { Dependencies } from "../../../../models/migration/dynamic-report/dependencies/dependencies"; + +describe(["@tier3"], "Testing dependencies bugs", function () { + let applicationsList: Array = []; + + before("Login and prerequisites", function () { + login(); + + cy.fixture("application").then((appData) => { + cy.fixture("analysis").then((analysisData) => { + const bookServerApp = new Analysis( + getRandomApplicationData("mta_2008_book_server_", { + sourceData: appData["bookserver-app"], + }), + getRandomAnalysisData(analysisData["analysis_for_openSourceLibraries"]) + ); + applicationsList.push(bookServerApp); + }); + }); + cy.fixture("application").then((appData) => { + cy.fixture("analysis").then((analysisData) => { + const dayTraderApp = new Analysis( + getRandomApplicationData("mta_2008_daytrader_", { + sourceData: appData["daytrader-app"], + }), + getRandomAnalysisData(analysisData["source+dep_analysis_on_daytrader-app"]) + ); + applicationsList.push(dayTraderApp); + + applicationsList.forEach((application) => application.create()); + }); + }); + }); + + beforeEach("Load data", function () { + cy.fixture("application").then(function (appData) { + this.appData = appData; + }); + cy.fixture("analysis").then(function (analysisData) { + this.analysisData = analysisData; + }); + }); + + it("Validate dependencies filter is applied when drilling down from application page", function () { + // Validation of bug https://issues.redhat.com/browse/MTA-2008 + const application = applicationsList[0]; + Analysis.analyzeAll(application); + Analysis.verifyAllAnalysisStatuses(AnalysisStatuses.completed); + application.applicationDetailsTab("Details"); + clickWithinByText(rightSideMenu, "a", "Dependencies"); + selectItemsPerPage(100); + cy.contains('[id^="pf-random-id-"]', application.name); + cy.contains(button, "Clear all filters"); + this.analysisData["source_analysis_on_bookserverapp"]["dependencies"].forEach( + (dependency: AppDependency) => { + Dependencies.validateFilter(dependency); + } + ); + }); + + after("Cleanup", function () { + deleteByList(applicationsList); + }); +}); diff --git a/cypress/e2e/tests/rbac/custom-migration-target.test.ts b/cypress/e2e/tests/rbac/custom-migration-target.test.ts index 22f71a6e0..277581360 100644 --- a/cypress/e2e/tests/rbac/custom-migration-target.test.ts +++ b/cypress/e2e/tests/rbac/custom-migration-target.test.ts @@ -41,7 +41,8 @@ import { UserMigrator } from "../../models/keycloak/users/userMigrator"; import { User } from "../../models/keycloak/users/user"; import { selectBox } from "../../views/applicationinventory.view"; -describe(["tier2", "@dc"], "Custom Migration Targets RBAC operations", function () { + +describe(["tier2"], "1 Bug: Custom Migration Targets RBAC operations", function () { // Polarion TC 317 & 319 let analysis: Analysis; let target: CustomMigrationTarget; diff --git a/cypress/e2e/tests/rbac/disable_keycloak.test.ts b/cypress/e2e/tests/rbac/disable_keycloak.test.ts new file mode 100644 index 000000000..e7ec5156c --- /dev/null +++ b/cypress/e2e/tests/rbac/disable_keycloak.test.ts @@ -0,0 +1,83 @@ +/* +Copyright © 2021 the Konveyor Contributors (https://konveyor.io/) +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +/// + +import { + getRandomApplicationData, + patchTackleCR, + createMultipleStakeholders, + deleteByList, + login, +} from "../../../utils/utils"; +import { Stakeholders } from "../../models/migration/controls/stakeholders"; +import { Application } from "../../models/migration/applicationinventory/application"; +import { + legacyPathfinder, + cloudReadinessQuestionnaire, + cloudReadinessFilePath, + SEC, +} from "../../types/constants"; +import { AssessmentQuestionnaire } from "../../models/administration/assessment_questionnaire/assessment_questionnaire"; +import { Analysis } from "../../models/migration/applicationinventory/analysis"; +import { applicationInventory } from "../../types/constants"; + +let application = new Application(getRandomApplicationData()); +let stakeholders: Stakeholders[]; + +describe(["@tier5"], "Perform certain operations after disabling Keycloak", function () { + // Automates Polarion MTA-293 + before("Disable Keycloak", function () { + patchTackleCR("keycloak", false); + login(); + + application.create(); + stakeholders = createMultipleStakeholders(1); + + AssessmentQuestionnaire.deleteAllQuestionnaires(); + AssessmentQuestionnaire.import(cloudReadinessFilePath); + AssessmentQuestionnaire.enable(cloudReadinessQuestionnaire); + AssessmentQuestionnaire.disable(legacyPathfinder); + }); + + beforeEach("Load data", function () { + // RBAC rules for architect are applicable to admin as well + cy.fixture("rbac").then(function (rbacRules) { + this.rbacRules = rbacRules["architect"]; + }); + }); + + it("With Auth disabled, Perform application assessment and review", function () { + application.perform_assessment("high", stakeholders, null, cloudReadinessQuestionnaire); + cy.wait(SEC); + application.verifyStatus("assessment", "Completed"); + + application.perform_review("low"); + cy.wait(SEC); + application.verifyStatus("assessment", "Completed"); + }); + + it("Validate content of top kebab menu", function () { + // Import button should be available + Analysis.validateTopActionMenu(this.rbacRules); + }); + + it("Validate content of application kebab menu", function () { + application.validateAppContextMenu(this.rbacRules); + }); + + after("Clean up", function () { + // Keycloak is not re-enabled because of Bug MTA-1152 + application.delete(); + deleteByList(stakeholders); + }); +}); diff --git a/cypress/e2e/tests/upgrade/after_upgrade.test.ts b/cypress/e2e/tests/upgrade/after_upgrade.test.ts index d165db17e..5913d2804 100644 --- a/cypress/e2e/tests/upgrade/after_upgrade.test.ts +++ b/cypress/e2e/tests/upgrade/after_upgrade.test.ts @@ -44,6 +44,7 @@ import { stakeHoldersTable } from "../../views/stakeholders.view"; import { AssessmentQuestionnaire } from "../../models/administration/assessment_questionnaire/assessment_questionnaire"; import { legacyPathfinder } from "../../types/constants"; import { Application } from "../../models/migration/applicationinventory/application"; +import { Archetype } from "../../models/migration/archetypes/archetype"; describe(["@post-upgrade"], "Performing post-upgrade validations", () => { const expectedMtaVersion = Cypress.env("mtaVersion"); @@ -104,6 +105,12 @@ describe(["@post-upgrade"], "Performing post-upgrade validations", () => { exists(tagName); }); + it("Archetype - testing existence of instance created before upgrade", function () { + const { archetypeName } = this.upgradeData; + Archetype.open(); + exists(archetypeName); + }); + it("Applications - testing existence of instances created before upgrade", function () { const { sourceApplicationName, binaryApplicationName, uploadBinaryApplicationName } = this.upgradeData; diff --git a/cypress/e2e/tests/upgrade/create_upgrade_data.test.ts b/cypress/e2e/tests/upgrade/create_upgrade_data.test.ts index d1f984847..27f4f3579 100644 --- a/cypress/e2e/tests/upgrade/create_upgrade_data.test.ts +++ b/cypress/e2e/tests/upgrade/create_upgrade_data.test.ts @@ -36,11 +36,14 @@ import { Analysis } from "../../models/migration/applicationinventory/analysis"; import { UpgradeData } from "../../types/types"; import { CredentialsMaven } from "../../models/administration/credentials/credentialsMaven"; import { AssessmentQuestionnaire } from "../../models/administration/assessment_questionnaire/assessment_questionnaire"; +import { Archetype } from "../../models/migration/archetypes/archetype"; describe(["@pre-upgrade"], "Creating pre-requisites before an upgrade", () => { let mavenCredentialsUsername: CredentialsMaven; let sourceControlUsernameCredentials: CredentialsSourceControlUsername; let stakeHolder: Stakeholders; + let archetype: Archetype; + let stakeHolderGroup: Stakeholdergroups; const expectedMtaVersion = Cypress.env("sourceMtaVersion"); before("Login", function () { @@ -94,7 +97,7 @@ describe(["@pre-upgrade"], "Creating pre-requisites before an upgrade", () => { tagName, } = this.upgradeData; const jobFunction = new Jobfunctions(jobFunctionName); - const stakeHolderGroup = new Stakeholdergroups(stakeHolderGroupName); + stakeHolderGroup = new Stakeholdergroups(stakeHolderGroupName); stakeHolder = new Stakeholders("test@gmail.com", stakeHolderName, jobFunctionName, [ stakeHolderGroupName, ]); @@ -110,6 +113,21 @@ describe(["@pre-upgrade"], "Creating pre-requisites before an upgrade", () => { tag.create(); }); + it("Creating and assess archetype", function () { + const { tagName, archetypeName } = this.upgradeData; + archetype = new Archetype( + archetypeName, + ["EJB XML", "Servlet"], + [tagName], + null, + [stakeHolder], + [stakeHolderGroup] + ); + archetype.create(); + archetype.perform_assessment("Low", [stakeHolder], [stakeHolderGroup]); + archetype.validateAssessmentField("Low"); + }); + it("Creating Upload Binary Analysis", function () { const uploadBinaryApplication = new Analysis( getRandomApplicationData("uploadBinary"), @@ -127,6 +145,7 @@ describe(["@pre-upgrade"], "Creating pre-requisites before an upgrade", () => { }); it("Creating source applications", function () { + const { tagName } = this.upgradeData; const sourceApplication = new Analysis( getRandomApplicationData("bookserverApp", { sourceData: this.appData["bookserver-app"], @@ -134,6 +153,7 @@ describe(["@pre-upgrade"], "Creating pre-requisites before an upgrade", () => { getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"]) ); sourceApplication.name = this.upgradeData.sourceApplicationName; + sourceApplication.tags = [tagName]; sourceApplication.create(); sourceApplication.perform_assessment("low", [stakeHolder]); sourceApplication.verifyStatus("assessment", "Completed"); diff --git a/cypress/e2e/types/types.ts b/cypress/e2e/types/types.ts index 687fd42ed..1e9380eca 100644 --- a/cypress/e2e/types/types.ts +++ b/cypress/e2e/types/types.ts @@ -173,6 +173,7 @@ export type UpgradeData = { binaryApplicationName?: string; uploadBinaryApplicationName?: string; assessmentApplicationName?: string; + archetypeName?: string; }; export type RulesRepositoryFields = { diff --git a/cypress/fixtures/upgrade-data.json b/cypress/fixtures/upgrade-data.json index 205daf6ed..ec5a555be 100644 --- a/cypress/fixtures/upgrade-data.json +++ b/cypress/fixtures/upgrade-data.json @@ -10,5 +10,6 @@ "sourceApplicationName": "upgrade-sourceApp", "binaryApplicationName": "upgrade-binaryApp", "uploadBinaryApplicationName": "upgrade-uploadBinaryApp", - "assessmentApplicationName": "upgrade-assessmentApplication" + "assessmentApplicationName": "upgrade-assessmentApplication", + "archetypeName": "upgrade-archetype" } diff --git a/cypress/utils/utils.ts b/cypress/utils/utils.ts index 9137ac13a..105ea783b 100644 --- a/cypress/utils/utils.ts +++ b/cypress/utils/utils.ts @@ -204,7 +204,12 @@ export function login(username?: string, password?: string, firstLogin = false): cy.visit(Cypress.env("tackleUrl"), { timeout: 120 * SEC }); cy.wait(5000); cy.get("h1", { timeout: 120 * SEC, log: false }).then(($title) => { - if ($title.text().toString().trim() !== "Sign in to your account") { + // With auth disabled, login page is not displayed and users are taken straight + // to the Application Inventory page. + if ( + $title.text().toString().trim() !== "Sign in to your account" && + $title.text().includes("Application inventory") + ) { return; } @@ -1652,7 +1657,7 @@ export function enumKeys(obj: O): } export function getUrl(): string { - return window.location.href; + return Cypress.env("tackleUrl"); } export function getNamespace(): string { @@ -1685,6 +1690,7 @@ export function patchTackleCR(option: string, isEnabled = true): void { if (option == "configureRWX") command += `--patch '{"spec":{"rwx_supported": ${value}}}'`; else if (option == "keycloak") command += `--patch '{"spec":{"feature_auth_required": ${value}}}'`; + else if (option == "metrics") command += `--patch '{"spec":{"hub_metrics_enabled": ${value}}}'`; cy.log(command); cy.exec(command).then((result) => { cy.log(result.stderr);