Skip to content

Commit

Permalink
[RFR] automate auto tagging of archetypes based on answers and use qu…
Browse files Browse the repository at this point in the history
…estionnaire template in test (#959)

* minor update to TC-MTA387

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

* add TC-MTA502

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

* assert tags close drawer

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

* add line

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

* force open

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

* apply requested changes

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

* change TC title and add comment

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

---------

Signed-off-by: nhamza <[email protected]>
  • Loading branch information
Neilhamza authored Feb 16, 2024
1 parent 6230704 commit a6fd93a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 11 deletions.
13 changes: 13 additions & 0 deletions cypress/e2e/models/migration/archetypes/archetype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 });
});
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit a6fd93a

Please sign in to comment.