forked from ohcnetwork/care_fe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test to search asset by qr and serial number (ohcnetwork#6266)
* add search by qr and ID * made variables values dynamic
- Loading branch information
Showing
2 changed files
with
65 additions
and
10 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
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,21 +1,58 @@ | ||
export class AssetSearchPage { | ||
typeSearchKeyword(keyword: string) { | ||
cy.get("[name='search']").type(keyword); | ||
cy.get("#search").clear(); | ||
cy.get("#search").click().type(keyword); | ||
} | ||
|
||
pressEnter() { | ||
cy.get("[name='search']").type("{enter}"); | ||
} | ||
|
||
verifyUrlChanged(initialUrl: string) { | ||
cy.url().should((currentUrl) => { | ||
expect(currentUrl).not.to.equal(initialUrl); | ||
}); | ||
clickAssetByName(assetName: string) { | ||
cy.get("[data-testid='created-asset-list']").contains(assetName).click(); | ||
} | ||
|
||
verifyBadgeContent(expectedText: string) { | ||
cy.get("[data-testid='Name/Serial No./QR ID']").should( | ||
"contain", | ||
expectedText | ||
); | ||
} | ||
|
||
verifyAssetIsPresent(assetName: string) { | ||
cy.get("[data-testid=created-asset-list]") | ||
.first() | ||
.should("contain", assetName); | ||
} | ||
|
||
clickUpdateButton() { | ||
cy.get("[data-testid='asset-update-button']").contains("Update").click(); | ||
} | ||
|
||
clearAndTypeQRCode(qrCode: string) { | ||
cy.get("#qr_code_id").clear(); | ||
cy.get("#qr_code_id").click().type(qrCode); | ||
} | ||
|
||
clearAndTypeSerialNumber(serialNumber: string) { | ||
cy.get("#serial-number").clear(); | ||
cy.get("#serial-number").click().type(serialNumber); | ||
} | ||
|
||
clickAssetSubmitButton() { | ||
cy.intercept("GET", "**/api/v1/asset/**").as("getAssets"); | ||
cy.get("#submit").click(); | ||
cy.wait("@getAssets").its("response.statusCode").should("eq", 200); | ||
} | ||
|
||
visitAssetsPage() { | ||
cy.visit("/assets"); | ||
} | ||
|
||
verifyAssetListContains(dummyCameraText: string) { | ||
cy.get("[data-testid='created-asset-list']").should( | ||
"contain", | ||
dummyCameraText | ||
); | ||
} | ||
} |