From b577b29de345a2731d6012a632c35147bd49da20 Mon Sep 17 00:00:00 2001 From: Neilhamza Date: Sun, 27 Aug 2023 09:30:09 +0300 Subject: [PATCH 1/4] [RFR] added missing import in reports.ts Signed-off-by: Neilhamza --- cypress/e2e/models/migration/reports/reports.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/e2e/models/migration/reports/reports.ts b/cypress/e2e/models/migration/reports/reports.ts index 62a8a0b1b..7a64a17af 100644 --- a/cypress/e2e/models/migration/reports/reports.ts +++ b/cypress/e2e/models/migration/reports/reports.ts @@ -19,6 +19,7 @@ limitations under the License. import { selectItemsPerPage } from "../../../../utils/utils"; import { applicationName, button, risk } from "../../../types/constants"; import { + adoptionCandidateDistributionTitle, articleButton, articleCard, articleExpandedContent, From 7cff73a2f13fae3b77126813ab7fd4e4951e7bc6 Mon Sep 17 00:00:00 2001 From: Neilhamza Date: Mon, 28 Aug 2023 13:42:12 +0300 Subject: [PATCH 2/4] applied requested changes - typo Signed-off-by: Neilhamza --- .../e2e/models/migration/reports/reports.ts | 8 ++++---- .../e2e/tests/migration/reports/filter.test.ts | 14 +++++++------- .../tests/migration/reports/pagination.test.ts | 18 +++++++++--------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cypress/e2e/models/migration/reports/reports.ts b/cypress/e2e/models/migration/reports/reports.ts index 7a64a17af..93b0d6a56 100644 --- a/cypress/e2e/models/migration/reports/reports.ts +++ b/cypress/e2e/models/migration/reports/reports.ts @@ -27,7 +27,7 @@ import { articleItem, } from "../../../views/reports.view"; -export function selectItemsPerPageinReports(items: number, articleTitle: string): void { +export function selectItemsPerPageInReports(items: number, articleTitle: string): void { cy.get(articleTitle) .closest(articleItem) .within(() => { @@ -47,9 +47,9 @@ export function expandArticle(name: string): void { }); } -export function verifyApplicationRisk(risktype: string, appName: string): void { +export function verifyApplicationRisk(riskType: string, appName: string): void { // Verifies particular application's risk type - selectItemsPerPageinReports(100, adoptionCandidateDistributionTitle); + selectItemsPerPageInReports(100, adoptionCandidateDistributionTitle); cy.wait(4000); cy.get(adoptionCandidateDistributionTitle) .closest(articleItem) @@ -57,7 +57,7 @@ export function verifyApplicationRisk(risktype: string, appName: string): void { .each(($ele) => { if ($ele.find(`td[data-label="${applicationName}"]`).text() == appName) { expect($ele.find(`td[data-label="${risk}"]`).text().toLowerCase()).to.equal( - risktype + riskType ); } }); diff --git a/cypress/e2e/tests/migration/reports/filter.test.ts b/cypress/e2e/tests/migration/reports/filter.test.ts index 9f34f4514..ba7b0c546 100644 --- a/cypress/e2e/tests/migration/reports/filter.test.ts +++ b/cypress/e2e/tests/migration/reports/filter.test.ts @@ -52,7 +52,7 @@ import * as data from "../../../../utils/data_utils"; import { expandArticle, closeArticle, - selectItemsPerPageinReports, + selectItemsPerPageInReports, } from "../../../models/migration/reports/reports"; import { Stakeholders } from "../../../models/migration/controls/stakeholders"; @@ -90,7 +90,7 @@ describe(["@tier2"], "Reports filter validations", () => { cy.wait(3 * SEC); // Check element filtered for table Adoption Candidate Distribution - selectItemsPerPageinReports(100, adoptionCandidateDistributionTitle); + selectItemsPerPageInReports(100, adoptionCandidateDistributionTitle); // Wait for DOM to render table and sibling elements cy.get(adoptionCandidateDistributionTitle) @@ -104,7 +104,7 @@ describe(["@tier2"], "Reports filter validations", () => { expandArticle(identiFiedRisks); cy.wait(2 * SEC); - selectItemsPerPageinReports(100, identiFiedRisksTitle); + selectItemsPerPageInReports(100, identiFiedRisksTitle); let applicationsData = getTableColumnData("Application(s)"); cy.wrap(applicationsData).each((application) => { @@ -151,7 +151,7 @@ describe(["@tier2"], "Reports filter validations", () => { expandArticle(identiFiedRisks); cy.wait(2 * SEC); - selectItemsPerPageinReports(100, identiFiedRisksTitle); + selectItemsPerPageInReports(100, identiFiedRisksTitle); applySearchFilter(name, validSearchInput, true, 1); cy.wait(3 * SEC); @@ -197,7 +197,7 @@ describe(["@tier2"], "Reports filter validations", () => { expandArticle(identiFiedRisks); cy.wait(2 * SEC); - selectItemsPerPageinReports(100, identiFiedRisksTitle); + selectItemsPerPageInReports(100, identiFiedRisksTitle); // Get a category of assessment questions and apply it as search filter let categoryString = "Application details"; @@ -247,7 +247,7 @@ describe(["@tier2"], "Reports filter validations", () => { expandArticle(identiFiedRisks); cy.wait(2 * SEC); - selectItemsPerPageinReports(100, identiFiedRisksTitle); + selectItemsPerPageInReports(100, identiFiedRisksTitle); // Get a question from assessment question's list and apply it as search filter let questionString = "How is the application tested?"; @@ -296,7 +296,7 @@ describe(["@tier2"], "Reports filter validations", () => { expandArticle(identiFiedRisks); cy.wait(2 * SEC); - selectItemsPerPageinReports(100, identiFiedRisksTitle); + selectItemsPerPageInReports(100, identiFiedRisksTitle); // select an answer input from existing answers and apply it as search filter let answerString = "Not tracked"; diff --git a/cypress/e2e/tests/migration/reports/pagination.test.ts b/cypress/e2e/tests/migration/reports/pagination.test.ts index 91343d721..d8a0256e1 100644 --- a/cypress/e2e/tests/migration/reports/pagination.test.ts +++ b/cypress/e2e/tests/migration/reports/pagination.test.ts @@ -29,7 +29,7 @@ import { migration, reports, SEC } from "../../../types/constants"; import { Assessment } from "../../../models/migration/applicationinventory/assessment"; import { expandArticle, - selectItemsPerPageinReports, + selectItemsPerPageInReports, } from "../../../models/migration/reports/reports"; import { Stakeholders } from "../../../models/migration/controls/stakeholders"; import * as commonView from "../../../views/common.view"; @@ -69,7 +69,7 @@ describe(["@tier3"], "Reports pagination validations", () => { cy.wait(3 * SEC); // select 10 items per page - selectItemsPerPageinReports(10, adoptionCandidateDistributionTitle); + selectItemsPerPageInReports(10, adoptionCandidateDistributionTitle); // Verify next buttons are enabled as there are more than 11 rows present cy.get(commonView.nextPageButton).each(($nextBtn) => { @@ -106,7 +106,7 @@ describe(["@tier3"], "Reports pagination validations", () => { cy.wait(3 * SEC); // Select 10 items per page - selectItemsPerPageinReports(10, adoptionCandidateDistributionTitle); + selectItemsPerPageInReports(10, adoptionCandidateDistributionTitle); cy.wait(2 * SEC); // Verify that only 10 items are displayed @@ -115,7 +115,7 @@ describe(["@tier3"], "Reports pagination validations", () => { }); // Select 20 items per page - selectItemsPerPageinReports(20, adoptionCandidateDistributionTitle); + selectItemsPerPageInReports(20, adoptionCandidateDistributionTitle); cy.wait(2 * SEC); // Verify that items less than or equal to 20 and greater than 10 are displayed @@ -131,7 +131,7 @@ describe(["@tier3"], "Reports pagination validations", () => { cy.wait(3 * SEC); // Select 10 items per page - selectItemsPerPageinReports(10, adoptionCandidateDistributionTitle); + selectItemsPerPageInReports(10, adoptionCandidateDistributionTitle); cy.wait(2 * SEC); // Go to page number 2 @@ -154,7 +154,7 @@ describe(["@tier3"], "Reports pagination validations", () => { cy.wait(3 * SEC); // select 10 items per page - selectItemsPerPageinReports(10, identiFiedRisksTitle); + selectItemsPerPageInReports(10, identiFiedRisksTitle); // Verify next buttons are enabled as there are more than 11 rows present cy.get(commonView.nextPageButton).eq(2).should("not.be.disabled"); @@ -192,7 +192,7 @@ describe(["@tier3"], "Reports pagination validations", () => { cy.wait(2 * SEC); // Select 10 items per page - selectItemsPerPageinReports(10, identiFiedRisksTitle); + selectItemsPerPageInReports(10, identiFiedRisksTitle); cy.wait(2 * SEC); // Verify that only 10 items are displayed @@ -201,7 +201,7 @@ describe(["@tier3"], "Reports pagination validations", () => { }); // Select 20 items per page - selectItemsPerPageinReports(20, identiFiedRisksTitle); + selectItemsPerPageInReports(20, identiFiedRisksTitle); cy.wait(2 * SEC); // Verify that items less than or equal to 20 and greater than 10 are displayed @@ -221,7 +221,7 @@ describe(["@tier3"], "Reports pagination validations", () => { cy.wait(2 * SEC); // Select 10 items per page - selectItemsPerPageinReports(10, identiFiedRisksTitle); + selectItemsPerPageInReports(10, identiFiedRisksTitle); cy.wait(2 * SEC); // Go to page number 2 From 5bbe4de498311c4ebd0cbb1c10c659f23ebef416 Mon Sep 17 00:00:00 2001 From: Neilhamza Date: Mon, 28 Aug 2023 13:53:41 +0300 Subject: [PATCH 3/4] applied selector fixes and adapted click_assess_button method Signed-off-by: Neilhamza --- .../e2e/models/migration/applicationinventory/assessment.ts | 4 +++- cypress/e2e/views/applicationinventory.view.ts | 2 +- cypress/e2e/views/common.view.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/models/migration/applicationinventory/assessment.ts b/cypress/e2e/models/migration/applicationinventory/assessment.ts index 8643222bb..0b42988ab 100644 --- a/cypress/e2e/models/migration/applicationinventory/assessment.ts +++ b/cypress/e2e/models/migration/applicationinventory/assessment.ts @@ -231,7 +231,9 @@ export class Assessment extends Application { } click_assess_button(): void { - click(assessAppButton); + performRowActionByIcon(this.name, kebabMenu); + cy.wait(200); + cy.get(commonView.actionMenuItem).contains("Assess").click(); } perform_assessment( diff --git a/cypress/e2e/views/applicationinventory.view.ts b/cypress/e2e/views/applicationinventory.view.ts index 352e21346..d91a79e49 100644 --- a/cypress/e2e/views/applicationinventory.view.ts +++ b/cypress/e2e/views/applicationinventory.view.ts @@ -42,7 +42,7 @@ export const southboundHelper = "div[id=southbound-dependencies-helper]"; export const selectBox = "input[type=checkbox]"; export const tags = "span"; export const user = "User"; -export const kebabMenu = "td[class='pf-v5-c-table__td pf-v5-c-table__action'] > button"; +export const kebabMenu = "button[aria-label='kebab dropdown toggle']"; export const topKebabMenu = "div > button[aria-label='Actions']"; export const kebabMenuItem = "a.pf-v5-c-dropdown__menu-item"; diff --git a/cypress/e2e/views/common.view.ts b/cypress/e2e/views/common.view.ts index 3946aab60..eb4b72f15 100644 --- a/cypress/e2e/views/common.view.ts +++ b/cypress/e2e/views/common.view.ts @@ -53,6 +53,7 @@ export const selectFilter = "div.pf-m-toggle-group.pf-m-filter-group.pf-m-show"; export const itemsSelectInsideDialog = "div[role='dialog'] button[aria-label='Select']"; export const nameHelperBusiness = "#business-service-name-helper"; export const nameHelperStakeholderGroup = "#-helper"; +export const actionMenuItem = "span.pf-v5-c-menu__item-text"; export const kebabMenuItem = "a.pf-c-dropdown__menu-item"; export const commonTable = "table[aria-label='main-table']"; export const dropdownClearSelection = "pf-v5-c-select__toggle-clear"; From 7166ae7c187e0d39645e2d3e6f47aa8295729b64 Mon Sep 17 00:00:00 2001 From: Neilhamza Date: Mon, 28 Aug 2023 15:55:02 +0300 Subject: [PATCH 4/4] delete irrelevant wait Signed-off-by: Neilhamza --- cypress/e2e/models/migration/applicationinventory/assessment.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/models/migration/applicationinventory/assessment.ts b/cypress/e2e/models/migration/applicationinventory/assessment.ts index 0b42988ab..9ea37b0b4 100644 --- a/cypress/e2e/models/migration/applicationinventory/assessment.ts +++ b/cypress/e2e/models/migration/applicationinventory/assessment.ts @@ -232,7 +232,6 @@ export class Assessment extends Application { click_assess_button(): void { performRowActionByIcon(this.name, kebabMenu); - cy.wait(200); cy.get(commonView.actionMenuItem).contains("Assess").click(); }