-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to delete location (#6996)
* Add support to delete location * fix button widths * add modal for delete confirmation * add cypress for delete location functionality * add confirmation dialog before deleting * update cypress tests * refactor * fix cypress tests * show modal with links to linked assets and beds * use pom in tests and cover all cases * update cypress tests to close notifications * use id for cypress tests * re-order asset creation commands * add wait for creating asset in tests * refactor * verify location creation success * update location name in cypress * change facility name * update to dummy shifting facility * load specific facility for test * fix typo * fix tests for new assets page --------- Co-authored-by: Mohammed Nihal <[email protected]> Co-authored-by: Rithvik Nishad <[email protected]>
- Loading branch information
1 parent
925eb6b
commit a946b9e
Showing
4 changed files
with
323 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import FacilityPage from "../../pageobject/Facility/FacilityCreation"; | |
import FacilityLocation from "../../pageobject/Facility/FacilityLocation"; | ||
import { AssetPagination } from "../../pageobject/Asset/AssetPagination"; | ||
import FacilityHome from "../../pageobject/Facility/FacilityHome"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
describe("Location Management Section", () => { | ||
const assetPage = new AssetPage(); | ||
|
@@ -40,6 +41,9 @@ describe("Location Management Section", () => { | |
const bedModifiedType = "Isolation"; | ||
const numberOfBeds = 10; | ||
const numberOfModifiedBeds = 25; | ||
const qr_id_1 = uuidv4(); | ||
const phone_number = "9999999999"; | ||
const serialNumber = Math.floor(Math.random() * 10 ** 10).toString(); | ||
|
||
before(() => { | ||
cy.loginByApi("devdistrictadmin", "Coronasafe@123"); | ||
|
@@ -51,9 +55,7 @@ describe("Location Management Section", () => { | |
cy.restoreLocalStorage(); | ||
cy.clearLocalStorage(/filters--.+/); | ||
cy.awaitUrl("/"); | ||
facilityPage.visitAlreadyCreatedFacility(); | ||
facilityPage.clickManageFacilityDropdown(); | ||
facilityLocation.clickFacilityLocationManagement(); | ||
facilityLocation.loadLocationManagementPage("Dummy Shifting Center"); | ||
}); | ||
|
||
it("Add a Bed to facility location along with duplication and deleting a bed", () => { | ||
|
@@ -103,6 +105,7 @@ describe("Location Management Section", () => { | |
facilityLocation.verifyBedNameBadge(bedModifiedName); | ||
facilityLocation.verifyBedBadge(bedModifiedType); | ||
facilityLocation.verifyBedBadge(bedStatus); | ||
facilityLocation.closeNotification(); | ||
}); | ||
|
||
it("Adds Location to a facility and modify it", () => { | ||
|
@@ -134,6 +137,7 @@ describe("Location Management Section", () => { | |
facilityLocation.verifyLocationType(locationModifiedType); | ||
facilityLocation.verifyLocationDescription(locationModifiedDescription); | ||
facilityLocation.verifyLocationMiddleware(locationModifiedMiddleware); | ||
facilityLocation.closeNotification(); | ||
}); | ||
|
||
it("Multiple Bed to a facility location and delete a bed", () => { | ||
|
@@ -155,6 +159,7 @@ describe("Location Management Section", () => { | |
facilityLocation.deleteBedRequest(); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.deleteBedRequest(); | ||
facilityLocation.closeNotification(); | ||
}); | ||
|
||
it("Add Multiple Bed to a facility location and verify pagination", () => { | ||
|
@@ -169,6 +174,106 @@ describe("Location Management Section", () => { | |
// pagination | ||
assetPagination.navigateToNextPage(); | ||
assetPagination.navigateToPreviousPage(); | ||
facilityLocation.closeNotification(); | ||
}); | ||
|
||
it("Delete location", () => { | ||
facilityLocation.clickAddNewLocationButton(); | ||
facilityLocation.enterLocationName("Test Location"); | ||
facilityLocation.selectLocationType("OTHER"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.deleteLocation("Test Location"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.verifyNotification( | ||
"Location Test Location deleted successfully" | ||
); | ||
facilityLocation.closeNotification(); | ||
}); | ||
|
||
it("Delete location with linked beds", () => { | ||
facilityLocation.clickAddNewLocationButton(); | ||
facilityLocation.enterLocationName("Test Location with Beds"); | ||
facilityLocation.selectLocationType("OTHER"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.clickManageBedButton(); | ||
facilityLocation.clickAddBedButton(); | ||
facilityLocation.enterBedName("Bed 1"); | ||
facilityLocation.selectBedType("Regular"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.loadLocationManagementPage("Dummy Shifting Center"); | ||
facilityLocation.deleteLocation("Test Location with Beds"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.verifyNotification( | ||
"Cannot delete a Location with associated Beds" | ||
); | ||
facilityLocation.closeNotification(); | ||
|
||
// delete bed | ||
facilityLocation.clickManageBeds(); | ||
facilityLocation.deleteFirstBed(); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.closeNotification(); | ||
|
||
// delete location | ||
facilityLocation.loadLocationManagementPage("Dummy Shifting Center"); | ||
facilityLocation.deleteLocation("Test Location with Beds"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.verifyNotification( | ||
"Location Test Location with Beds deleted successfully" | ||
); | ||
facilityLocation.closeNotification(); | ||
}); | ||
|
||
it("Delete location with linked assets", () => { | ||
facilityLocation.clickAddNewLocationButton(); | ||
facilityLocation.enterLocationName("Test Location with linked Assets"); | ||
facilityLocation.selectLocationType("OTHER"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.verifyNotification("Location created successfully"); | ||
facilityLocation.closeNotification(); | ||
// create asset and link it to location | ||
cy.awaitUrl("/assets"); | ||
assetPage.createAsset(); | ||
assetPage.selectFacility("Dummy Shifting Center"); | ||
assetPage.selectLocation("Test Location with linked Assets"); | ||
assetPage.enterAssetDetails( | ||
"Test Asset linked to Facility", | ||
"Test Description", | ||
"Working", | ||
qr_id_1, | ||
"Manufacturer's Name", | ||
"2025-12-25", | ||
"Customer Support's Name", | ||
phone_number, | ||
"[email protected]", | ||
"Vendor's Name", | ||
serialNumber, | ||
"25122021", | ||
"Test note for asset creation!" | ||
); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.loadLocationManagementPage("Dummy Shifting Center"); | ||
facilityLocation.deleteLocation("Test Location with linked Assets"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.verifyNotification( | ||
"Cannot delete a Location with associated Assets" | ||
); | ||
facilityLocation.closeNotification(); | ||
|
||
// delete asset | ||
facilityLocation.clickManageAssets(); | ||
assetPage.openCreatedAsset(); | ||
assetPage.deleteAsset(); | ||
facilityLocation.closeNotification(); | ||
|
||
// delete location | ||
facilityLocation.loadLocationManagementPage("Dummy Shifting Center"); | ||
facilityLocation.deleteLocation("Test Location with linked Assets"); | ||
assetPage.clickassetupdatebutton(); | ||
facilityLocation.verifyNotification( | ||
"Location Test Location with linked Assets deleted successfully" | ||
); | ||
facilityLocation.closeNotification(); | ||
}); | ||
|
||
afterEach(() => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.