Skip to content

Commit

Permalink
[RFR] adapted to submit button and fixed field_validation (#713)
Browse files Browse the repository at this point in the history
* [RFR]adapted to submit button

Signed-off-by: Neilhamza <[email protected]>

* using submitForm method

Signed-off-by: Neilhamza <[email protected]>

* using clickJs function in some cases

Signed-off-by: Neilhamza <[email protected]>

* added a fix for field_validation

Signed-off-by: Neilhamza <[email protected]>

* removed applicationSubmitButton from mw views

Signed-off-by: Neilhamza <[email protected]>

---------

Signed-off-by: Neilhamza <[email protected]>
  • Loading branch information
Neilhamza authored Sep 11, 2023
1 parent 31aa9e9 commit 5a8f49e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
11 changes: 6 additions & 5 deletions cypress/e2e/models/migration/migration-waves/migration-wave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
inputText,
selectItemsPerPage,
selectUserPerspective,
submitForm,
} from "../../../../utils/utils";
import {
createNewButton,
Expand Down Expand Up @@ -83,7 +84,7 @@ export class MigrationWave {
public create() {
MigrationWave.openNewForm();
this.fillForm(this);
clickJs(MigrationWaveView.submitButton);
submitForm();
this.setApplications();
}

Expand All @@ -92,7 +93,7 @@ export class MigrationWave {
this.expandActionsMenu();
cy.contains(editAction).click();
this.fillForm(updateValues);
clickJs(MigrationWaveView.submitButton);
submitForm();
}

public delete() {
Expand Down Expand Up @@ -123,7 +124,7 @@ export class MigrationWave {
cy.get(MigrationWaveView.issueTypeSelectToggle).click();
cy.contains(issueType).click({ timeout: 10 * SEC, force: true });

cy.get(submitButton).click();
submitForm();
}

public setApplications(toBeCanceled = false): void {
Expand Down Expand Up @@ -151,7 +152,7 @@ export class MigrationWave {
return;
}

cy.get(MigrationWaveView.applicationsSubmitButton).click();
clickJs(submitButton);
}

public clearApplications(): void {
Expand All @@ -167,7 +168,7 @@ export class MigrationWave {
cy.contains(manageApplications).click();
cy.get(itemsSelectInsideDialog).click();
cy.contains(button, selectNone).click();
cy.get(MigrationWaveView.applicationsSubmitButton).click();
clickJs(submitButton);
this.applications = [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.

import {
checkSuccessAlert,
clickJs,
deleteByList,
generateRandomDateRange,
login,
Expand Down Expand Up @@ -51,19 +52,19 @@ describe(["@tier1"], "Migration Waves Validations", () => {
it("Name validations", function () {
const invalidMessage = "Name is invalid. The name must be between 3 and 120 characters";
MigrationWave.openNewForm();
cy.get(MigrationWaveView.submitButton).should("be.disabled");
cy.get(commonView.submitButton).should("be.disabled");

validateTooShortInput(MigrationWaveView.nameInput, "body", invalidMessage);
validateTooLongInput(MigrationWaveView.nameInput, 121, null, invalidMessage);

cy.get(MigrationWaveView.submitButton).should("be.disabled");
cy.get(cancelButton).click();
cy.get(commonView.submitButton).should("be.disabled");
clickJs(cancelButton);
});

it("Dates Validations", function () {
MigrationWave.openNewForm();
MigrationWave.fillName(data.getRandomWord(5));
cy.get(MigrationWaveView.submitButton).should("be.disabled");
cy.get(commonView.submitButton).should("be.disabled");
const now = new Date();

const options = { year: "numeric", month: "long", day: "numeric" } as const;
Expand Down Expand Up @@ -94,8 +95,8 @@ describe(["@tier1"], "Migration Waves Validations", () => {
);
cy.get(`button[aria-label="${dayAfterTomorrowLabel}"]`).should("be.enabled").click();

cy.get(MigrationWaveView.submitButton).should("be.enabled");
cy.get(cancelButton).click();
cy.get(commonView.submitButton).should("be.enabled");
clickJs(cancelButton);
});
it("Duplicate Migration wave name validation", function () {
const migrationWavesList: MigrationWave[] = [];
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/views/migration-wave.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export enum MigrationWaveView {
generalDatePicker = ".pf-v5-c-date-picker",
calendarButton = "[aria-label='Toggle date picker']",
submitButton = "#migration-wave-form-submit",
applicationsSubmitButton = "#wave-form-submit",
nameInput = "#name",
startDateInput = "input[aria-label='startDateStr']",
endDateInput = "input[aria-label='endDateStr']",
Expand Down

0 comments on commit 5a8f49e

Please sign in to comment.