Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] [JF] Fix application field validation #691

Merged
merged 14 commits into from
Aug 24, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import {
applicationBusinessServiceSelect,
applicationContributorsInput,
applicationOwnerInput,
applicationContributorsText,
applicationContributorsAction,
} from "../../../../views/applicationinventory.view";

import * as commonView from "../../../../views/common.view";
Expand All @@ -65,28 +67,26 @@ describe(["@tier2"], "Application validations", () => {
});

beforeEach("Interceptors", function () {
// Interceptors
cy.intercept("POST", "/hub/tag*").as("postTag");
cy.intercept("POST", "/hub/application*").as("postApplication");
cy.intercept("GET", "/hub/application*").as("getApplication");
});

it("Application field validations", function () {
// Navigate to application inventory page and click "Create New" button
Assessment.open();
clickByText(button, createNewButton);

selectFormItems(applicationBusinessServiceSelect, businessservicesList[0].name);

// Name constraints
inputText(applicationNameInput, data.getRandomWord(2));
cy.get(commonView.nameHelper).should("contain", minCharsMsg);
inputText(applicationNameInput, data.getRandomWords(90));
cy.get(commonView.nameHelper).should("contain", max120CharsMsg);
cy.get(applicationNameInput).clear();

// Description constraint
inputText(applicationDescriptionInput, data.getRandomWords(90));
cy.get(commonView.descriptionHelper).should("contain", max250CharsMsg);
cy.get(commonView.nameHelper).should("contain", max250CharsMsg);
nachandr marked this conversation as resolved.
Show resolved Hide resolved
// Clear description field to make it valid input
cy.get(applicationDescriptionInput).clear();

Expand All @@ -105,7 +105,7 @@ describe(["@tier2"], "Application validations", () => {
});

cy.get(applicationOwnerInput)
.parent()
.closest("div")
.next("button")
.click()
.then(() => {
Expand All @@ -124,17 +124,19 @@ describe(["@tier2"], "Application validations", () => {
cy.get("button").contains(stakeHoldersList[1].name).click();

cy.get(applicationContributorsInput)
.parent()
.closest("div")
.should("contain", stakeHoldersList[0].name)
.and("contain", stakeHoldersList[1].name);

cy.get(applicationContributorsInput)
// Unassign contributor#1 and verify only contributor#2 is listed
cy.get(applicationContributorsText)
.contains(stakeHoldersList[0].name)
.parent()
.contains("span", stakeHoldersList[0].name)
.next("button")
.next(applicationContributorsAction)
.click();

cy.get(applicationContributorsInput).parent().and("contain", stakeHoldersList[1].name);
cy.get(applicationContributorsInput)
.closest("div")
.should("contain", stakeHoldersList[1].name);

// Close the form
cy.get(commonView.closeButton).click();
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/views/applicationinventory.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const applicationDescriptionInput = "input[name=description]";
export const applicationBusinessServiceSelect = "[placeholder='Select a business service']";
export const applicationContributorsInput =
"#contributors-select-toggle-select-multi-typeahead-typeahead";
export const applicationContributorsText = ".pf-v5-c-chip__text";
export const applicationContributorsAction = ".pf-v5-c-chip__actions";
export const applicationOwnerInput = "#owner-toggle-select-typeahead";
export const repoTypeSelect = "button[id='repo-type-toggle']";
export const applicationTagsSelect = "[placeholder='Select tags']";
Expand Down
Loading