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] adapt field validation in custom migration targets #690

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.

import {
click,
doesExistText,
login,
preservecookies,
validateTooLongInput,
Expand Down Expand Up @@ -49,9 +50,7 @@ describe(["@tier1"], "Custom Migration Target Validations", () => {
validateTooLongInput(CustomMigrationTargetView.nameInput);

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

cy.get(CustomMigrationTargetView.createSubmitButton).should("be.disabled");
cy.contains("Cancel").click();
Expand All @@ -62,29 +61,20 @@ describe(["@tier1"], "Custom Migration Target Validations", () => {
CustomMigrationTarget.fillName(data.getRandomWord(5));

CustomMigrationTarget.uploadRules(["xml/invalid-rule.windup.xml"]);
cy.get(CustomMigrationTargetView.ruleHelper).should(
"contain",
'Error: File "invalid-rule.windup.xml" is not a valid XML'
);
cy.get(CustomMigrationTargetView.ruleFilesToggle).should(
"contain",
"0 of 1 files uploaded"
);
doesExistText('Error: File "invalid-rule.windup.xml" is not a valid XML', true);

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

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

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

cy.get(CustomMigrationTargetView.createSubmitButton).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.ruleFilesToggle).should(
"contain",
"0 of 0 files uploaded"
);
cy.get(CustomMigrationTargetView.createSubmitButton).should("be.disabled");
cy.contains("Cancel").click();
});
Expand Down Expand Up @@ -113,18 +103,12 @@ describe(["@tier1"], "Custom Migration Target Validations", () => {
CustomMigrationTarget.selectRepositoryType(RepositoryType.git);

CustomMigrationTarget.fillRepositoryUrl(" ");
cy.get(CustomMigrationTargetView.repositoryUrlHelper).should(
"contain",
"Must be a valid URL."
);
doesExistText("Must be a valid URL.", true);

CustomMigrationTarget.fillRepositoryUrl("Invalid url");
cy.get(CustomMigrationTargetView.repositoryUrlHelper).should(
"contain",
"Must be a valid URL."
);
doesExistText("Must be a valid URL.", true);

CustomMigrationTarget.fillRepositoryUrl("https://github.com/konveyor/tackle-testapp");
cy.get(CustomMigrationTargetView.repositoryUrlHelper).should("not.exist");
doesExistText("Must be a valid URL.", false);
});
});
7 changes: 3 additions & 4 deletions cypress/e2e/views/custom-migration-target.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ export enum CustomMigrationTargetView {
editSubmitButton = "button[id='identity-form-submit']:contains('Save')",
actionsButton = "button[aria-label=Actions]",
nameInput = "#name",
nameHelper = "#name-helper",
helperText = "span[class*='helper-text']",
descriptionInput = "#description",
imageInput = "#custom-migration-target-upload-image-filename",
imageHelper = "#custom-migration-target-upload-image-helper",
ruleInput = "input[accept='.xml']",
ruleHelper = "div[aria-label='Danger Alert']",
ruleInput = "input[accept*='.xml']",
ruleHelper = "h4[class*='alert__title']",
ruleFilesToggle = "button[aria-expanded='true']",
takeMeThereNotification = "Take me there",
repositoryTypeDropdown = "#repo-type-select-toggle",
repositoryUrl = "#sourceRepository",
repositoryUrlHelper = "#sourceRepository-helper",
branch = "#branch",
rootPath = "#rootPath",
credentialsDropdown = "#associated-credentials-select-toggle",
Expand Down
Loading