Skip to content

Commit

Permalink
Fixed field validation test in custom targets (#717)
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Braginsky <[email protected]>
  • Loading branch information
ibragins authored Sep 13, 2023
1 parent 54a5c15 commit ef8bde0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ limitations under the License.

import {
click,
clickJs,
doesExistText,
login,
preservecookies,
validateTooLongInput,
validateTooShortInput,
} from "../../../../utils/utils";
import * as data from "../../../../utils/data_utils";
import { CustomMigrationTarget } from "../../../models/administration/custom-migration-targets/custom-migration-target";
import { CustomMigrationTargetView } from "../../../views/custom-migration-target.view";
import { RepositoryType, SEC } from "../../../types/constants";
import { cancelButton } from "../../../views/common.view";
import { cancelButton, submitButton } from "../../../views/common.view";

describe(["@tier1"], "Custom Migration Target Validations", () => {
let target: CustomMigrationTarget;
Expand All @@ -40,22 +38,18 @@ describe(["@tier1"], "Custom Migration Target Validations", () => {
login();
});

beforeEach(function () {
preservecookies();
});

it("Name validations", function () {
CustomMigrationTarget.openNewForm();
cy.get(CustomMigrationTargetView.createSubmitButton).should("be.disabled");
cy.get(submitButton).should("be.disabled");

validateTooShortInput(CustomMigrationTargetView.nameInput, "body");
validateTooLongInput(CustomMigrationTargetView.nameInput);

CustomMigrationTarget.fillName("Containerization");
doesExistText("A custom target with this name already exists. Use a different name", true);

cy.get(CustomMigrationTargetView.createSubmitButton).should("be.disabled");
clickJs(cancelButton);
cy.get(submitButton).should("be.disabled");
click(cancelButton);
});

it("Rule files validations", function () {
Expand All @@ -67,18 +61,18 @@ describe(["@tier1"], "Custom Migration Target Validations", () => {

doesExistText("0 of 1 files uploaded", true);

cy.get(CustomMigrationTargetView.createSubmitButton).should("be.disabled");
cy.get(submitButton).should("be.disabled");

CustomMigrationTarget.uploadRules(["xml/javax-package-custom.windup.xml"]);
doesExistText("1 of 2 files uploaded", true);

cy.get(CustomMigrationTargetView.createSubmitButton).should("be.enabled");
cy.get(submitButton).should("be.enabled");

cy.get('button[aria-label="Remove from list"]').each((btn) => cy.wrap(btn).click());
doesExistText("0 of 0 files uploaded", true);

cy.get(CustomMigrationTargetView.createSubmitButton).should("be.disabled");
cy.contains("Cancel").click();
cy.get(submitButton).should("be.disabled");
click(cancelButton);
});

it("Image Validations", function () {
Expand All @@ -96,7 +90,7 @@ describe(["@tier1"], "Custom Migration Target Validations", () => {
CustomMigrationTarget.uploadImage("img/big-image.jpg");
cy.get(CustomMigrationTargetView.imageInput).blur();
cy.wait(2 * SEC);
cy.contains("Cancel").click();
click(cancelButton);
});

it("Rule repository URL validation", function () {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/views/common.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/
export const itemsPerPageToggleButton = "#pagination-id-top-toggle";
export const submitButton = "#submit";
export const cancelButton = '[id*="cancel"]';
export const cancelButton = "#cancel";
export const closeButton = "button[aria-label=Close]";
export const confirmButton = "#confirm-dialog-button";
export const editButton = "button[aria-label=edit]";
Expand Down

0 comments on commit ef8bde0

Please sign in to comment.