Skip to content

Commit

Permalink
[RFR] Automate Bug MTA-1746 (#869)
Browse files Browse the repository at this point in the history
* Automate Bug MTA-1746

Signed-off-by: Shveta Sachdeva <[email protected]>

* Automate Bug MTA-1746

Signed-off-by: Shveta Sachdeva <[email protected]>

* Automate Bug MTA-1746

Signed-off-by: Shveta Sachdeva <[email protected]>

---------

Signed-off-by: Shveta Sachdeva <[email protected]>
Co-authored-by: Shveta Sachdeva <[email protected]>
  • Loading branch information
sshveta and Shveta Sachdeva authored Dec 8, 2023
1 parent 3da8246 commit 74497a2
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import {
selectItemsPerPage,
selectUserPerspective,
} from "../../../../utils/utils";
import { SEC, assessmentQuestionnaires, deleteAction, trTag } from "../../../types/constants";
import {
SEC,
assessmentQuestionnaires,
deleteAction,
legacyPathfinder,
trTag,
} from "../../../types/constants";
import {
questionnaireUpload,
confirmDeletion,
Expand Down Expand Up @@ -86,11 +92,18 @@ export class AssessmentQuestionnaire {
public static deleteAllQuesionnaire() {
AssessmentQuestionnaire.open();
selectItemsPerPage(100);
var row_name;
cy.get(commonView.commonTable)
.find('tbody[class="pf-v5-c-table__tbody"]')
.find(trTag)
.then(($rows) => {
for (let i = 0; i < $rows.length - 1; i++) {
cy.get(actionButton).eq(0).click({ force: true });
for (let i = 0; i < $rows.length; i++) {
row_name = $rows.eq(i).find('td[data-label="Name"]').text();
if (row_name == legacyPathfinder && $rows.length == 1) continue;
if (row_name == legacyPathfinder && $rows.length > 1)
cy.get(actionButton).eq(1).click({ force: true });
else cy.get(actionButton).eq(0).click({ force: true });

cy.get("li.pf-v5-c-menu__list-item")
.contains("Delete")
.then(($delete_btn) => {
Expand Down
15 changes: 6 additions & 9 deletions cypress/e2e/models/migration/applicationinventory/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ export class Application {
if ($url != Application.fullUrl) {
selectUserPerspective(migration);
clickByText(navMenu, applicationInventory);
selectItemsPerPage(100);
}
});
selectItemsPerPage(100);
}

protected fillName(name: string): void {
Expand Down Expand Up @@ -423,7 +423,6 @@ export class Application {

validateAppContextMenu(rbacRules: RbacValidationRules): void {
Application.open();
selectItemsPerPage(100);
cy.wait(SEC);
cy.get(tdTag)
.contains(this.name)
Expand Down Expand Up @@ -455,7 +454,6 @@ export class Application {

validateUploadBinary(rbacRules: RbacValidationRules): void {
Application.open();
selectItemsPerPage(100);
this.selectApplication();
cy.contains("button", analyzeButton, { timeout: 20 * SEC })
.should("be.enabled")
Expand Down Expand Up @@ -487,7 +485,6 @@ export class Application {

validateAppInformationExist(appData: applicationData, migrationWave?: MigrationWave): void {
Application.open();
selectItemsPerPage(100);
cy.wait(5 * SEC);
cy.get(tdTag)
.contains(this.name)
Expand Down Expand Up @@ -538,7 +535,6 @@ export class Application {
saveAndReview = false
) {
Application.open();
selectItemsPerPage(100);
clickItemInKebabMenu(this.name, "Assess");
cy.wait(SEC);
Assessment.perform_assessment(
Expand Down Expand Up @@ -572,9 +568,13 @@ export class Application {
Assessment.retake_questionnaire(risk, stakeholders, stakeholderGroups);
}

validateAssessmentField(risk: string): void {
Application.open();
Assessment.validateAssessmentField(this.name, "Application", risk);
}

verifyCopyAssessmentDisabled(): void {
Application.open();
selectItemsPerPage(100);
cy.wait(2 * SEC);
cy.get(tdTag)
.contains(this.name)
Expand Down Expand Up @@ -604,7 +604,6 @@ export class Application {
copy_assessment_review(applicationList: Array<Application>, cancel = false): void {
this.openCopyAssessmentModel(true);
this.selectApps(applicationList);

if (cancel) {
cancelForm();
} else {
Expand All @@ -615,7 +614,6 @@ export class Application {

selectKebabMenuItem(selection: string): void {
Application.open();
selectItemsPerPage(100);
this.selectApplication();
clickItemInKebabMenu(this.name, selection);
cy.get(continueButton).click();
Expand Down Expand Up @@ -660,7 +658,6 @@ export class Application {
// Opens the manage dependencies dialog from application inventory page
openManageDependencies(): void {
Application.open();
selectItemsPerPage(100);
performRowActionByIcon(this.name, kebabMenu);
clickByText(button, "Manage dependencies");
}
Expand Down
25 changes: 24 additions & 1 deletion cypress/e2e/models/migration/applicationinventory/assessment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ limitations under the License.
*/
import { tdTag, trTag, button, SEC, legacyPathfinder } from "../../../types/constants";
import * as commonView from "../../../views/common.view";
import { clickByText, selectItemsPerPage, selectFormItems, clickJs } from "../../../../utils/utils";
import {
clickByText,
selectItemsPerPage,
selectFormItems,
clickJs,
selectRow,
clickTab,
click,
} from "../../../../utils/utils";
import * as data from "../../../../utils/data_utils";
import {
assessmentColumnSelector,
Expand All @@ -35,6 +43,7 @@ import {
} from "../../../views/review.view";
import { Stakeholdergroups } from "../controls/stakeholdergroups";
import { Stakeholders } from "../controls/stakeholders";
import { rightSideMenu } from "../../../views/analysis.view";

export class Assessment {
public static selectStakeholders(stakeholders: Stakeholders[]): void {
Expand Down Expand Up @@ -220,4 +229,18 @@ export class Assessment {
cy.get(columnSelector).contains(status, { timeout: 30 * SEC });
});
}

public static validateAssessmentField(name: string, page: string, risk: string): void {
this.sidedrawerTab(name, "Details");
cy.get(commonView.sideDrawer.risk).contains(`${page} risk`);
cy.get(commonView.sideDrawer.riskValue).contains(risk);
click(commonView.sideDrawer.closeDrawer);
}

public static sidedrawerTab(name: string, tab: string): void {
selectRow(name);
cy.get(rightSideMenu).within(() => {
clickTab(tab);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe("Source Analysis without credentials", () => {

it(["@tier0"], "Source Analysis on bookserver app and its issues validation", function () {
// For source code analysis application must have source code URL git or svn
cy.log(this.analysisData[0]);
application = new Analysis(
getRandomApplicationData("bookserverApp", {
sourceData: this.appData["bookserver-app"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe(["@tier1"], "Application assessment and review tests", () => {
application.perform_review("low");
cy.wait(2 * SEC);
application.verifyStatus("review", "Completed");
application.validateAssessmentField("Low");

// Delete application
application.delete();
Expand All @@ -90,6 +91,7 @@ describe(["@tier1"], "Application assessment and review tests", () => {
application.perform_review("medium");
cy.wait(2 * SEC);
application.verifyStatus("review", "Completed");
application.validateAssessmentField("Medium");

// Delete application
application.delete();
Expand All @@ -112,6 +114,7 @@ describe(["@tier1"], "Application assessment and review tests", () => {
application.perform_review("high");
cy.wait(2 * SEC);
application.verifyStatus("review", "Completed");
application.validateAssessmentField("High");

// Delete application
application.delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import {
deleteApplicationTableRows,
deleteAppImportsTableRows,
notExists,
deleteByList,
} from "../../../../../utils/utils";

import * as data from "../../../../../utils/data_utils";
import { Stakeholders } from "../../../../models/migration/controls/stakeholders";
import { Application } from "../../../../models/migration/applicationinventory/application";

const filePath = "app_import/csv/";
let stakeholders: Stakeholders[];
const stakeholdersNameList: Array<string> = [];
let appdata = { name: "Customers" };

describe(["@tier2"], "Operations after application import", () => {
Expand Down Expand Up @@ -82,5 +81,6 @@ describe(["@tier2"], "Operations after application import", () => {
after("Perform test data clean up", function () {
deleteApplicationTableRows();
deleteAppImportsTableRows();
deleteByList(stakeholders);
});
});
6 changes: 6 additions & 0 deletions cypress/e2e/views/common.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,9 @@ export const filterDropDownContainer =
"div.pf-v5-c-toolbar__group.pf-m-toggle-group.pf-m-filter-group.pf-m-show";
export const filterDropDown = "div.pf-v5-c-select";
export const actionSelectToggle = "#action-select-toggle";

export enum sideDrawer {
risk = "h3.pf-v5-c-title.pf-m-md",
riskValue = "span.pf-v5-c-label__content",
closeDrawer = "button[aria-label='Close drawer panel']",
}
8 changes: 8 additions & 0 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ export function selectFormItems(fieldId: string, item: string): void {
cy.contains("button", item).click();
}

export function selectRow(name: string): void {
// Clicks on a particular row on any table
cy.get(tdTag, { timeout: 10 * SEC })
.contains(name)
.closest(trTag)
.click();
}

export function checkSuccessAlert(fieldId: string, message: string, close = false): void {
validateTextPresence(fieldId, message);
if (close) {
Expand Down

0 comments on commit 74497a2

Please sign in to comment.