-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cypress test for asset creation (#5632)
* Added test for patient creation * Fixed patient creation suite * Fixed edit and update test cases and removed unwanted changes * Tried a fix * Added tests for asset creation * Nits * Update Facility name * Update facility name * Trying a fix for the failure * FIxed failing test * Reverted unwanted changes ---------
- Loading branch information
1 parent
5f0db99
commit 5ee4f15
Showing
5 changed files
with
114 additions
and
11 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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
/// <reference types="cypress" /> | ||
|
||
import { cy, describe, before, beforeEach, it } from "local-cypress"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
describe("Assets List", () => { | ||
const phone_number = "9" + parseInt((Math.random() * 10 ** 9).toString()); | ||
const serial_no = parseInt((Math.random() * 10 ** 10).toString()); | ||
|
||
describe("Asset", () => { | ||
before(() => { | ||
cy.loginByApi("devdistrictadmin", "Coronasafe@123"); | ||
cy.saveLocalStorage(); | ||
|
@@ -13,6 +17,62 @@ describe("Assets List", () => { | |
cy.awaitUrl("/assets"); | ||
}); | ||
|
||
it("Create an Asset", () => { | ||
cy.get("button").should("contain", "Create Asset"); | ||
cy.get("[data-testid=create-asset-buttom] button").click(); | ||
cy.get("input[name='facilities']") | ||
.type("Dummy Facility 1") | ||
.then(() => { | ||
cy.get("[role='option']").contains("Dummy Facility 1").click(); | ||
}); | ||
cy.get("button").should("contain", "Select"); | ||
cy.get("button").get("#submit").click(); | ||
cy.get("[data-testid=asset-name-input] input").type("New Test Asset"); | ||
cy.get("[data-testid=asset-location-input] input").type( | ||
"Camera Location{enter}" | ||
); | ||
cy.get("[data-testid=asset-type-input] button") | ||
.click() | ||
.then(() => { | ||
cy.get("li").contains("Internal").click(); | ||
}); | ||
cy.get("[data-testid=asset-class-input] button") | ||
.click() | ||
.then(() => { | ||
cy.get("li").contains("ONVIF Camera").click(); | ||
}); | ||
cy.get("[data-testid=asset-description-input] textarea").type( | ||
"Test Description" | ||
); | ||
cy.get("[data-testid=asset-working-status-input] li") | ||
.contains("Working") | ||
.click(); | ||
const qr_id = uuidv4(); | ||
cy.get("[data-testid=asset-qr-id-input] input").type(qr_id); | ||
cy.get("[data-testid=asset-manufacturer-input] input").type( | ||
"Manufacturer's Name" | ||
); | ||
cy.get("[data-testid=asset-warranty-input] input").type("2025-12-25"); | ||
cy.get("[data-testid=asset-support-name-input] input").type( | ||
"Customer Support's Name" | ||
); | ||
cy.get("#customer-support-phone-div").type(phone_number); | ||
cy.get("[data-testid=asset-support-email-input] input").type( | ||
"[email protected]" | ||
); | ||
cy.get("[data-testid=asset-vendor-name-input] input").type("Vendor's Name"); | ||
cy.get("[data-testid=asset-serial-number-input] input").type(serial_no); | ||
cy.get("[data-testid=asset-last-serviced-on-input] input").type( | ||
"2021-12-25" | ||
); | ||
cy.get("[data-testid=asset-notes-input] textarea").type( | ||
"Test note for asset creation!" | ||
); | ||
cy.wait(500); | ||
cy.get("#submit").contains("Create Asset").click(); | ||
cy.verifyNotification("Asset created successfully"); | ||
}); | ||
|
||
it("Search Asset Name", () => { | ||
const initialUrl = cy.url(); | ||
cy.get("[name='search']").type("dummy camera 30"); | ||
|
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
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
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
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