Skip to content

Commit

Permalink
[RFR][JF]Fix download CSV test (#768)
Browse files Browse the repository at this point in the history
* Fix downloaad CSV test

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

* Fix Application failures

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

* Fix Application failures

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

* Fix Application failures

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

* Fix Application failures

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

* Fix Application failures

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

* Fix Application failures

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 Oct 26, 2023
1 parent 2924672 commit 0138a77
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 43 deletions.
14 changes: 6 additions & 8 deletions cypress/e2e/models/migration/applicationinventory/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
trTag,
button,
createNewButton,
deleteAction,
assessment,
assessAppButton,
createAppButton,
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -273,7 +270,6 @@ export class Application {
cy.wait(4000);
cy.get(tdTag)
.contains(this.name)
// .parent(tdTag)
.closest(trTag)
.within(() => {
click(selectBox);
Expand All @@ -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);
});
}

Expand All @@ -301,7 +296,6 @@ export class Application {
}

closeApplicationDetails(): void {
// closes application details page
click(appDetailsView.closeDetailsPage);
}

Expand Down Expand Up @@ -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"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand All @@ -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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Assessment> = [];

Expand All @@ -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<string> = [applicationsList[0].name];
var southboundApps: Array<string> = [applicationsList[2].name];

Expand All @@ -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<string> = [applicationsList[0].name];
var southboundApps: Array<string> = [applicationsList[2].name];

Expand All @@ -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
Expand All @@ -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);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ let tagList: Array<Tag> = [];

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/
/// <reference types="cypress" />

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";
Expand All @@ -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();
});
});
4 changes: 2 additions & 2 deletions cypress/e2e/types/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/views/applicationinventory.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']";
Expand All @@ -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']";
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/views/common.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";

0 comments on commit 0138a77

Please sign in to comment.