Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Cherry-pick: Added admin user to perform post-upgrade tests (#1194) #1215

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions cypress/e2e/tests/upgrade/after_upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,20 @@ import { AssessmentQuestionnaire } from "../../models/administration/assessment_
import { cloudReadinessQuestionnaire, legacyPathfinder } from "../../types/constants";
import { Application } from "../../models/migration/applicationinventory/application";
import { Archetype } from "../../models/migration/archetypes/archetype";
import { UserAdmin } from "../../models/keycloak/users/userAdmin";
import { getRandomUserData } from "../../../utils/data_utils";

describe(["@post-upgrade"], "Performing post-upgrade validations", () => {
const expectedMtaVersion = Cypress.env("mtaVersion");
before("Login", function () {
// Perform login
login();
before("Login as created admin user", function () {
cy.fixture("upgrade-data").then((upgradeData: UpgradeData) => {
this.upgradeData = upgradeData;
const userAdmin = new UserAdmin(getRandomUserData());
userAdmin.username = this.upgradeData.adminUser;
userAdmin.password = Cypress.env("pass");
userAdmin.login();
});

AssessmentQuestionnaire.enable(legacyPathfinder);
});

Expand Down
15 changes: 15 additions & 0 deletions cypress/e2e/tests/upgrade/create_upgrade_data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ 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";
import { UserAdmin } from "../../models/keycloak/users/userAdmin";
import { User } from "../../models/keycloak/users/user";
import { getRandomUserData } from "../../../utils/data_utils";

describe(["@pre-upgrade"], "Creating pre-requisites before an upgrade", () => {
let mavenCredentialsUsername: CredentialsMaven;
Expand Down Expand Up @@ -231,4 +234,16 @@ describe(["@pre-upgrade"], "Creating pre-requisites before an upgrade", () => {
AssessmentQuestionnaire.enable(legacyPathfinder);
AssessmentQuestionnaire.disable(cloudReadinessQuestionnaire);
});

it("Create new admin user to use after upgrade", function () {
const user = this.upgradeData.adminUser;
const password = Cypress.env("pass");
const userAdmin = new UserAdmin(getRandomUserData());
userAdmin.username = this.upgradeData.adminUser;
userAdmin.password = Cypress.env("pass");

//Logging in as keycloak admin to create new user
User.loginKeycloakAdmin();
userAdmin.create();
});
});
3 changes: 2 additions & 1 deletion cypress/fixtures/upgrade-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"uploadBinaryApplicationName": "upgrade-uploadBinaryApp",
"assessmentApplicationName": "upgrade-assessmentApplication",
"archetypeName": "upgrade-archetype",
"importedQuestionnaireAppName": "upgrade-questionnaireApplication"
"importedQuestionnaireAppName": "upgrade-questionnaireApplication",
"adminUser": "upgrade-admin-user"
}
Loading