Skip to content

Commit

Permalink
Merge branch 'main' into rbac_fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Shveta Sachdeva <[email protected]>
  • Loading branch information
sshveta authored Apr 3, 2024
2 parents 267419c + 31395a3 commit cc1cd27
Show file tree
Hide file tree
Showing 20 changed files with 401 additions and 40 deletions.
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/models/administration/jira-connection/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class Jira {

public getIssues(projectName: string): Cypress.Chainable<JiraIssue[]> {
return this.doJiraRequest<JiraIssue[]>(
`${this.url}/rest/api/2/search?jql=project=${projectName}`
`${this.url}/rest/api/2/search?jql=project="${projectName}"`
).its("issues");
}

Expand Down
9 changes: 7 additions & 2 deletions cypress/e2e/models/migration/archetypes/archetype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions cypress/e2e/models/migration/custom-metrics/custom-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<number> {
cy.wait(30 * SEC);
return cy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
36 changes: 36 additions & 0 deletions cypress/e2e/tests/custom-metrics/disable_metrics.test.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
/// <reference types="cypress" />

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);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -51,47 +51,38 @@ 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);
verifySortAsc(afterAscSortList, unsortedList);

// 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);
verifySortDesc(afterDescSortList, unsortedList);
});

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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,16 @@ 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,
`Success alert:Success! Assessment discarded for ${applicationList[0].name}.`
);
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();
Expand All @@ -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 () {
Expand Down Expand Up @@ -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);
Expand Down
133 changes: 133 additions & 0 deletions cypress/e2e/tests/migration/archetypes/miscellaneous.test.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
/// <reference types="cypress" />

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<Stakeholders> = [];
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();
});
});
Loading

0 comments on commit cc1cd27

Please sign in to comment.