From 0138a776e35c8022f23d34e9d4332b06aa574144 Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Thu, 26 Oct 2023 16:56:49 -0700 Subject: [PATCH] [RFR][JF]Fix download CSV test (#768) * Fix downloaad CSV test Signed-off-by: Shveta Sachdeva * Fix Application failures Signed-off-by: Shveta Sachdeva * Fix Application failures Signed-off-by: Shveta Sachdeva * Fix Application failures Signed-off-by: Shveta Sachdeva * Fix Application failures Signed-off-by: Shveta Sachdeva * Fix Application failures Signed-off-by: Shveta Sachdeva * Fix Application failures Signed-off-by: Shveta Sachdeva --------- Signed-off-by: Shveta Sachdeva Co-authored-by: Shveta Sachdeva --- .../applicationinventory/application.ts | 14 ++++++-------- .../applications/create.test.ts | 10 +++++----- .../applications/dependency.test.ts | 12 +++++------- .../applications/filter.test.ts | 1 - .../applications/interlinked.test.ts | 17 ++++++----------- .../manageimports/csv.test.ts | 9 +++++++-- cypress/e2e/types/constants.ts | 4 ++-- cypress/e2e/views/applicationinventory.view.ts | 6 ++---- cypress/e2e/views/common.view.ts | 6 +++--- 9 files changed, 36 insertions(+), 43 deletions(-) diff --git a/cypress/e2e/models/migration/applicationinventory/application.ts b/cypress/e2e/models/migration/applicationinventory/application.ts index ba4416940..9e0df2e89 100644 --- a/cypress/e2e/models/migration/applicationinventory/application.ts +++ b/cypress/e2e/models/migration/applicationinventory/application.ts @@ -19,7 +19,6 @@ import { trTag, button, createNewButton, - deleteAction, assessment, assessAppButton, createAppButton, @@ -48,7 +47,6 @@ import { packaging, kebabMenu, repoTypeSelect, - topKebabMenu, } from "../../../views/applicationinventory.view"; import { appDetailsView } from "../../../views/applicationinventory.view"; import * as commonView from "../../../views/common.view"; @@ -126,7 +124,6 @@ export class Application { if (packaging) this.packaging = packaging; } - //Navigate to the Application inventory public static open(): void { selectUserPerspective(migration); clickByText(navMenu, applicationInventory); @@ -273,7 +270,6 @@ export class Application { cy.wait(4000); cy.get(tdTag) .contains(this.name) - // .parent(tdTag) .closest(trTag) .within(() => { click(selectBox); @@ -285,10 +281,9 @@ export class Application { selectItemsPerPage(100); cy.get(tdTag) .contains(this.name) - .parent(tdTag) - .parent(trTag) + .closest(trTag) .within(() => { - cy.get(columnSelector).find("span").should("contain", columnText); + cy.get(columnSelector).should("contain", columnText); }); } @@ -301,7 +296,6 @@ export class Application { } closeApplicationDetails(): void { - // closes application details page click(appDetailsView.closeDetailsPage); } @@ -345,6 +339,10 @@ export class Application { else cy.get(appDetailsView.applicationTag).should("contain", tags); } + noTagExists(): void { + cy.contains("h2", "No tags available", { timeout: 2 * SEC }); + } + static validateAssessButton(rbacRules: RbacValidationRules) { Application.open(); doesExistSelector(assessAppButton, rbacRules["Assess"]); diff --git a/cypress/e2e/tests/migration/applicationinventory/applications/create.test.ts b/cypress/e2e/tests/migration/applicationinventory/applications/create.test.ts index 794e96829..a96194583 100644 --- a/cypress/e2e/tests/migration/applicationinventory/applications/create.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/applications/create.test.ts @@ -79,14 +79,14 @@ describe(["@tier2"], "Application validations", () => { // Name constraints inputText(applicationNameInput, data.getRandomWord(2)); - cy.get(commonView.nameHelper).should("contain", minCharsMsg); + cy.get(commonView.helper).should("contain", minCharsMsg); inputText(applicationNameInput, data.getRandomWords(90)); - cy.get(commonView.nameHelper).should("contain", max120CharsMsg); + cy.get(commonView.helper).should("contain", max120CharsMsg); cy.get(applicationNameInput).clear(); // Description constraint inputText(applicationDescriptionInput, data.getRandomWords(90)); - cy.get(commonView.nameHelper).should("contain", max250CharsMsg); + cy.get(commonView.helper).should("contain", max250CharsMsg); // Clear description field to make it valid input cy.get(applicationDescriptionInput).clear(); @@ -174,7 +174,7 @@ describe(["@tier2"], "Application validations", () => { application.create(); checkSuccessAlert( commonView.successAlertMessage, - `Application ${application.name} was successfully saved.` + `Application ${application.name} was successfully created.` ); cy.wait("@postApplication"); exists(application.name); @@ -185,7 +185,7 @@ describe(["@tier2"], "Application validations", () => { // Check name duplication inputText(applicationNameInput, application.name); selectFormItems(applicationBusinessServiceSelect, businessservicesList[0].name); - cy.get(commonView.nameHelper).should("contain.text", duplicateApplication); + cy.get(commonView.helper).should("contain.text", duplicateApplication); cy.get(commonView.closeButton).click(); application.delete(); }); diff --git a/cypress/e2e/tests/migration/applicationinventory/applications/dependency.test.ts b/cypress/e2e/tests/migration/applicationinventory/applications/dependency.test.ts index 46a0a69f4..5779fc0f1 100644 --- a/cypress/e2e/tests/migration/applicationinventory/applications/dependency.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/applications/dependency.test.ts @@ -20,11 +20,10 @@ import { Assessment } from "../../../../models/migration/applicationinventory/as import { closeForm, cyclicDependenciesErrorMsg, - northboundHelper, northdependenciesDropdownBtn, - southboundHelper, southdependenciesDropdownBtn, } from "../../../../views/applicationinventory.view"; +import { helper } from "../../../../views/common.view"; var applicationsList: Array = []; @@ -34,7 +33,7 @@ describe(["@tier3"], "Manage application dependencies", () => { applicationsList = createMultipleApplications(3); }); - it("Bug MTA-1329: Non-cyclic dependencies for applications", function () { + it("Non-cyclic dependencies for applications", function () { var northboundApps: Array = [applicationsList[0].name]; var southboundApps: Array = [applicationsList[2].name]; @@ -51,7 +50,7 @@ describe(["@tier3"], "Manage application dependencies", () => { applicationsList[1].removeDependencies(northboundApps, southboundApps); }); - it("Bug MTA-1155, Bug-1329: Cyclic dependencies for applications", function () { + it("Cyclic dependencies for applications", function () { var northboundApps: Array = [applicationsList[0].name]; var southboundApps: Array = [applicationsList[2].name]; @@ -64,7 +63,7 @@ describe(["@tier3"], "Manage application dependencies", () => { applicationsList[2].name, ]); cy.wait(500); - cy.get(northboundHelper).should("contain.text", cyclicDependenciesErrorMsg); + cy.get(helper).should("contain.text", cyclicDependenciesErrorMsg); click(closeForm); // Adding app[0] as southbound dependency for app[2] should yield cyclic error @@ -73,12 +72,11 @@ describe(["@tier3"], "Manage application dependencies", () => { applicationsList[0].name, ]); cy.wait(500); - cy.get(southboundHelper).should("contain.text", cyclicDependenciesErrorMsg); + cy.get(helper).should("contain.text", cyclicDependenciesErrorMsg); click(closeForm); }); after("Perform test data clean up", function () { - // Delete the applications deleteByList(applicationsList); }); }); diff --git a/cypress/e2e/tests/migration/applicationinventory/applications/filter.test.ts b/cypress/e2e/tests/migration/applicationinventory/applications/filter.test.ts index 0840729a5..eaf871861 100644 --- a/cypress/e2e/tests/migration/applicationinventory/applications/filter.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/applications/filter.test.ts @@ -62,7 +62,6 @@ let tagList: Array = []; describe(["@tier2"], "Application inventory filter validations", function () { before("Login and Create Test Data", function () { - // Perform login login(); //Create Multiple Application with Business service and Tags diff --git a/cypress/e2e/tests/migration/applicationinventory/applications/interlinked.test.ts b/cypress/e2e/tests/migration/applicationinventory/applications/interlinked.test.ts index ee3a0d720..75f792ba3 100644 --- a/cypress/e2e/tests/migration/applicationinventory/applications/interlinked.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/applications/interlinked.test.ts @@ -18,24 +18,20 @@ limitations under the License. import { login, clickByText, - click, createMultipleStakeholders, createMultipleStakeholderGroups, createMultipleBusinessServices, createMultipleTags, deleteByList, deleteFromArrayByIndex, + clickItemInKebabMenu, } from "../../../../../utils/utils"; import { businessColumnSelector } from "../../../../views/applicationinventory.view"; -import { - continueButton, - stakeholdergroupsSelect, - stakeholderSelect, -} from "../../../../views/assessment.view"; +import { stakeholdergroupsSelect, stakeholderSelect } from "../../../../views/assessment.view"; import { navMenu } from "../../../../views/menu.view"; import { Stakeholders } from "../../../../models/migration/controls/stakeholders"; import { Stakeholdergroups } from "../../../../models/migration/controls/stakeholdergroups"; -import { applicationInventory, SEC } from "../../../../types/constants"; +import { applicationInventory, button, SEC } from "../../../../types/constants"; import { BusinessServices } from "../../../../models/migration/controls/businessservices"; import * as data from "../../../../../utils/data_utils"; import { Assessment } from "../../../../models/migration/applicationinventory/assessment"; @@ -99,7 +95,7 @@ describe(["@tier3"], "Applications interlinked to tags and business service", () // Assert that deleted tag is removed application.applicationDetailsTab("Tags"); - application.tagAndCategoryExists(""); + application.noTagExists(); application.closeApplicationDetails(); application.edit({ @@ -146,9 +142,8 @@ describe(["@tier3"], "Applications interlinked to tags and business service", () clickByText(navMenu, applicationInventory); application.selectApplication(); - application.click_assess_button(); - click(continueButton); - cy.wait(6 * SEC); + clickItemInKebabMenu(application.name, "Assess"); + clickByText(button, "Retake"); //Verify that values show blank cy.get(stakeholderSelect).should("have.value", ""); diff --git a/cypress/e2e/tests/migration/applicationinventory/manageimports/csv.test.ts b/cypress/e2e/tests/migration/applicationinventory/manageimports/csv.test.ts index de4c5b5ee..7e92f3597 100644 --- a/cypress/e2e/tests/migration/applicationinventory/manageimports/csv.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/manageimports/csv.test.ts @@ -15,7 +15,7 @@ limitations under the License. */ /// -import { click, login, openManageImportsPage } from "../../../../../utils/utils"; +import { cleanupDownloads, click, login, openManageImportsPage } from "../../../../../utils/utils"; import { kebabMenuItem } from "../../../../views/applicationinventory.view"; import { Application } from "../../../../models/migration/applicationinventory/application"; import { manageImportsActionsButton } from "../../../../views/common.view"; @@ -28,11 +28,16 @@ describe(["@tier2"], "Manage imports tests", function () { }); it("Download CSV template", function () { - click(manageImportsActionsButton, true, false, 1); + cy.get(manageImportsActionsButton).eq(0).click({ force: true }); + cy.wait(2000); cy.get(kebabMenuItem).contains("Download CSV template").click(); cy.readFile("cypress/downloads/template_application_import.csv").should( "contain", "Customers" ); }); + + after("Cleaning up", function () { + cleanupDownloads(); + }); }); diff --git a/cypress/e2e/types/constants.ts b/cypress/e2e/types/constants.ts index 42089df65..c34dc62ba 100644 --- a/cypress/e2e/types/constants.ts +++ b/cypress/e2e/types/constants.ts @@ -25,7 +25,7 @@ export const analysis = "Analysis"; export const analyzeButton = "Analyze"; export const artifact = "Artifact"; export const businessServices = "Business services"; -export const businessService = "Business service"; +export const businessService = "Business Service"; export const button = "button"; export const category = "Category"; export const clearAllFilters = "Clear all filters"; @@ -69,7 +69,7 @@ export const stakeholders = "Stakeholders"; export const stakeholderGroups = "Stakeholder groups"; export const subversion = "Subversion"; export const tag = "Tag"; -export const tagCount = "Tag count"; +export const tagCount = "Tags"; export const tags = "Tags"; export const tdTag = "td"; export const trTag = "tr"; diff --git a/cypress/e2e/views/applicationinventory.view.ts b/cypress/e2e/views/applicationinventory.view.ts index 477919f7f..d849d0168 100644 --- a/cypress/e2e/views/applicationinventory.view.ts +++ b/cypress/e2e/views/applicationinventory.view.ts @@ -25,7 +25,7 @@ export const applicationOwnerInput = "#owner-toggle-select-typeahead"; export const repoTypeSelect = "button[id='repo-type-toggle']"; export const applicationTagsSelect = "[placeholder='Select tags']"; export const applicationCommentInput = "textarea[name=comments]"; -export const businessColumnSelector = "td[data-label='Business service']"; +export const businessColumnSelector = "td[data-label='Business Service']"; export const csvFileName = "File name"; export const FileName = "File Name"; export const closeForm = "button[aria-label='close']"; @@ -36,14 +36,12 @@ export const southdependenciesDropdownBtn = "button[aria-label='southbound-depen export const date = "Date"; export const editButton = "#pencil-action"; export const importStatus = "Status"; -export const northboundHelper = "div[id=northbound-dependencies-helper]"; -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 = "#row-actions"; export const topKebabMenu = "#toolbar-kebab"; -export const kebabMenuItem = "a.pf-v5-c-dropdown__menu-item"; +export const kebabMenuItem = "span.pf-v5-c-menu__item-text"; export const bulkApplicationSelectionCheckBox = "input[name='bulk-selected-items-checkbox']"; // This is on the Application imports page. export const sideKebabMenuImports = "button[aria-label='Kebab toggle']"; diff --git a/cypress/e2e/views/common.view.ts b/cypress/e2e/views/common.view.ts index 03beffc49..ddbe80be3 100644 --- a/cypress/e2e/views/common.view.ts +++ b/cypress/e2e/views/common.view.ts @@ -32,7 +32,7 @@ export const infoAlertMessage = ".pf-m-info"; export const alertTitle = "h4[class*='alert__title']"; export const appTable = ".pf-v5-c-table"; export const expandableRow = ".pf-c-expandable-row"; -export const nameHelper = "span.pf-v5-c-helper-text__item-text"; +export const helper = "span.pf-v5-c-helper-text__item-text"; export const filterToggleButton = "div.pf-c-dropdown > button.pf-c-dropdown__toggle"; export const filterInput = "input[type='search']"; export const searchButton = "button#search-button"; @@ -55,9 +55,9 @@ export const helperBusiness = 'span[class*="helper-text__item"]'; export const stakeHolderGroupHelper = "div.pf-v5-c-helper-text"; 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 commonTable = "table[class='pf-v5-c-table pf-m-grid-md']"; export const dropdownClearSelection = "pf-v5-c-select__toggle-clear"; export const footer = "footer"; -export const manageImportsActionsButton = 'button[aria-label="Actions"]'; +export const manageImportsActionsButton = "button[aria-label='Table toolbar actions kebab toggle']"; export const nextButton = "button[cy-data='next']"; export const span = "span";