Skip to content

Commit

Permalink
[RFR] remove success message validation and add it to create test (#740)
Browse files Browse the repository at this point in the history
* [RFR] remove success message validation and add it to create test

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

* fix filter test

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

* add stakeholder.delete()

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

---------

Signed-off-by: Neilhamza <[email protected]>
  • Loading branch information
Neilhamza authored Oct 10, 2023
1 parent 42c4d9f commit 5adb088
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import * as commonView from "../../../../views/common.view";

import { BusinessServices } from "../../../../models/migration/controls/businessservices";
import * as data from "../../../../../utils/data_utils";
import { Stakeholders } from "../../../../models/migration/controls/stakeholders";

describe(["@tier2"], "Business service validations", () => {
before("Login", function () {
Expand Down Expand Up @@ -91,7 +92,13 @@ describe(["@tier2"], "Business service validations", () => {
});

it("Business service success alert and unique constraint validation", function () {
const businessService = new BusinessServices(data.getCompanyName());
const stakeholder = new Stakeholders(data.getEmail(), data.getFullName());
stakeholder.create();
const businessService = new BusinessServices(
data.getCompanyName(),
data.getDescription(),
stakeholder.name
);

selectUserPerspective(migration);

Expand All @@ -102,6 +109,12 @@ describe(["@tier2"], "Business service validations", () => {
`Success alert:Business service ${businessService.name} was successfully created.`
);
exists(businessService.name);
const businessService1 = new BusinessServices(data.getCompanyName(), data.getDescription());
businessService1.create();
checkSuccessAlert(
commonView.successAlertMessage,
`Success alert:Business service ${businessService1.name} was successfully created.`
);

// Navigate to business service tab and click "Create New" button
clickByText(button, createNewButton);
Expand All @@ -114,6 +127,10 @@ describe(["@tier2"], "Business service validations", () => {
// Delete created business service
cy.get(commonView.closeButton).click();
businessService.delete();
checkSuccessAlert(commonView.successAlertMessage, `Success alert:Business service deleted`);
businessService1.delete();
checkSuccessAlert(commonView.successAlertMessage, `Success alert:Business service deleted`);
stakeholder.delete();
notExists(businessService.name);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ limitations under the License.
*/
/// <reference types="cypress" />

import {
checkSuccessAlert,
exists,
login,
notExists,
selectUserPerspective,
} from "../../../../../utils/utils";
import { exists, login, notExists, selectUserPerspective } from "../../../../../utils/utils";
import { BusinessServices } from "../../../../models/migration/controls/businessservices";
import { Stakeholders } from "../../../../models/migration/controls/stakeholders";

Expand Down Expand Up @@ -52,20 +46,12 @@ describe(["@tier1", "@interop"], "Business service CRUD operations", () => {

// Create new Business service
businessService.create();
checkSuccessAlert(
commonView.successAlertMessage,
`Success alert:Business service ${businessService.name} was successfully created.`
);
cy.wait("@postBusinessService");
exists(businessService.name);

// Edit Business service's name
let updatedBusinessServiceName = data.getCompanyName();
businessService.edit({ name: updatedBusinessServiceName });
checkSuccessAlert(
commonView.successAlertMessage,
`Success alert:Business service ${businessService.name} was successfully saved.`
);
cy.wait("@getBusinessService");
exists(updatedBusinessServiceName);

Expand All @@ -92,34 +78,24 @@ describe(["@tier1", "@interop"], "Business service CRUD operations", () => {
stakeholder.name
);
businessService.create();
checkSuccessAlert(
commonView.successAlertMessage,
`Success alert:Business service ${businessService.name} was successfully created.`
);
cy.wait("@postBusinessService");
exists(businessService.name);

// Edit Business service's name
let updatedBusinessServiceName = data.getCompanyName();
businessService.edit({ name: updatedBusinessServiceName });
checkSuccessAlert(
commonView.successAlertMessage,
`Success alert:Business service ${businessService.name} was successfully saved.`
);
cy.wait("@getBusinessService");
exists(updatedBusinessServiceName);

// Delete Business service
businessService.delete();
checkSuccessAlert(commonView.successAlertMessage, `Success alert:Business service deleted`);
cy.wait("@getBusinessService");

// Assert that Business service is deleted
notExists(businessService.name);

// Delete stakeholder owner
stakeholder.delete();
checkSuccessAlert(commonView.successAlertMessage, `Success alert:Stakeholder deleted`);
cy.wait("@getStakeholders");

// Assert that stakeholder owner is deleted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
exists,
notExists,
selectUserPerspective,
checkSuccessAlert,
} from "../../../../../utils/utils";
import { navTab } from "../../../../views/menu.view";
import { BusinessServices } from "../../../../models/migration/controls/businessservices";
Expand Down Expand Up @@ -51,10 +50,6 @@ describe(["@tier1"], "Business service linked to stakeholder", () => {
// Create new stakeholder
const stakeholder = new Stakeholders(data.getEmail(), data.getFullName());
stakeholder.create();
checkSuccessAlert(
commonView.successAlertMessage,
`Success alert:Stakeholder was successfully created.`
);
cy.wait("@postStakeholder");

// Create new business service and attach a stakeholder
Expand All @@ -64,10 +59,6 @@ describe(["@tier1"], "Business service linked to stakeholder", () => {
stakeholder.name
);
businessservice.create();
checkSuccessAlert(
commonView.successAlertMessage,
`Success alert:Business service ${businessservice.name} was successfully created.`
);
cy.get("@postBusinessService");
exists(businessservice.name);

Expand Down

0 comments on commit 5adb088

Please sign in to comment.