From a6fd93a14e64ee97f110e0f28edce814fd6b75c5 Mon Sep 17 00:00:00 2001 From: Neilhamza <132557033+Neilhamza@users.noreply.github.com> Date: Fri, 16 Feb 2024 20:31:20 +0200 Subject: [PATCH] [RFR] automate auto tagging of archetypes based on answers and use questionnaire template in test (#959) * minor update to TC-MTA387 Signed-off-by: nhamza * add TC-MTA502 Signed-off-by: nhamza * assert tags close drawer Signed-off-by: nhamza * add line Signed-off-by: nhamza * force open Signed-off-by: nhamza * apply requested changes Signed-off-by: nhamza * change TC title and add comment Signed-off-by: nhamza --------- Signed-off-by: nhamza --- .../models/migration/archetypes/archetype.ts | 13 +++++ .../assessment/miscellaneous.test.ts | 57 +++++++++++++++---- 2 files changed, 59 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/models/migration/archetypes/archetype.ts b/cypress/e2e/models/migration/archetypes/archetype.ts index 728f45238..5c02b6ed0 100644 --- a/cypress/e2e/models/migration/archetypes/archetype.ts +++ b/cypress/e2e/models/migration/archetypes/archetype.ts @@ -34,6 +34,7 @@ import { Stakeholders } from "../controls/stakeholders"; import * as archetype from "../../../views/archetype.view"; import * as commonView from "../../../views/common.view"; import { Assessment } from "../applicationinventory/assessment"; +import { tagsColumnSelector } from "../../../views/applicationinventory.view"; export interface Archetype { name: string; @@ -347,4 +348,16 @@ export class Archetype { Assessment.verifyButtonEnabled(button); }); } + + validateTagsColumn(tagsNames: string[]): void { + Archetype.open(); + tagsNames.forEach((tag) => { + cy.get(tdTag) + .contains(this.name) + .parent(trTag) + .within(() => { + cy.get(tagsColumnSelector).contains(tag, { timeout: 30 * SEC }); + }); + }); + } } diff --git a/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts b/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts index 519143c34..ecae00f22 100644 --- a/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts @@ -31,7 +31,14 @@ import { import { Stakeholders } from "../../../../models/migration/controls/stakeholders"; import { AssessmentQuestionnaire } from "../../../../models/administration/assessment_questionnaire/assessment_questionnaire"; import { alertTitle, confirmButton, successAlertMessage } from "../../../../views/common.view"; -import { legacyPathfinder, cloudNative, SEC, button } from "../../../../types/constants"; +import { + legacyPathfinder, + cloudNative, + SEC, + button, + cloudReadinessFilePath, + cloudReadinessQuestionnaire, +} from "../../../../types/constants"; import { ArchivedQuestionnaires, ArchivedQuestionnairesTableDataCell, @@ -308,19 +315,47 @@ describe(["@tier3"], "Tests related to application assessment and review", () => deleteByList(archetypes); }); - it("Validates auto tagging of applications based on assessment answers", function () { - //automates polarion MTA-387 + it("Validates auto tagging of applications and archetypes based on assessment answers", function () { + //automates polarion MTA-387 and MTA-502 + const appdata = { name: "test1", tags: ["Language / Java"] }; + const application = new Application(appdata); + application.create(); AssessmentQuestionnaire.deleteAllQuestionnaires(); - AssessmentQuestionnaire.import(yamlFile); - AssessmentQuestionnaire.enable(cloudNative); + AssessmentQuestionnaire.import(cloudReadinessFilePath); + AssessmentQuestionnaire.enable(cloudReadinessQuestionnaire); AssessmentQuestionnaire.disable(legacyPathfinder); - const applications = createMultipleApplications(1); - applications[0].perform_assessment("medium", stakeholderList, null, cloudNative); - applications[0].validateTagsCount("1"); - applications[0].applicationDetailsTab("Tags"); - applications[0].tagAndCategoryExists("Spring Boot"); - applications[0].closeApplicationDetails(); + application.perform_assessment( + "medium", + stakeholderList, + null, + cloudReadinessQuestionnaire + ); + application.validateTagsCount("2"); + application.applicationDetailsTab("Tags"); + application.tagAndCategoryExists([["Runtime", "Spring Boot"]]); + application.closeApplicationDetails(); + // Automates Polarion MTA-502 + const archetype = new Archetype( + data.getRandomWord(8), + ["Language / Java"], + ["Language / Java"], + null + ); + archetype.create(); + archetype.perform_assessment("medium", stakeholderList, null, cloudReadinessQuestionnaire); + Archetype.open(true); + archetype.validateTagsColumn(["Spring Boot"]); + archetype.assertsTagsMatch("Assessment Tags", ["Spring Boot"], true, true); + const appdata2 = { name: "test2", tags: ["Language / Java"] }; + const application2 = new Application(appdata2); + application2.create(); + application2.applicationDetailsTab("Tags"); + application2.tagAndCategoryExists([["Runtime", "Spring Boot"]]); + + archetype.delete(); + application.delete(); + application2.delete(); }); after("Perform test data clean up", function () {