Skip to content

Commit

Permalink
made variables values dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Sep 11, 2023
1 parent 16b0bd8 commit 824e5ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import LoginPage from "../../pageobject/Login/LoginPage";
import { v4 as uuidv4 } from "uuid";

describe("Asset Tab", () => {
const assetSearchPage = new AssetSearchPage();
const assetQRScanPage = new AssetQRScanPage();
const assetPagination = new AssetPagination();
const assetFilters = new AssetFilters();
const loginPage = new LoginPage();
const assetName = "Dummy Camera 10";
const qrCode = uuidv4();
const serialNumber = Math.floor(Math.random() * 10 ** 10).toString();

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -27,26 +31,22 @@ describe("Asset Tab", () => {
// search for a element

it("Search Asset Name/QR_ID/Serial_number", () => {
assetSearchPage.typeSearchKeyword("dummy camera 10");
assetSearchPage.typeSearchKeyword(assetName);
assetSearchPage.pressEnter();
assetSearchPage.verifyBadgeContent(
"Name/Serial No./QR ID: dummy camera 10"
);
assetSearchPage.clickAssetByName("Dummy Camera 10");
assetSearchPage.verifyBadgeContent(assetName);
assetSearchPage.clickAssetByName(assetName);
assetSearchPage.clickUpdateButton();
assetSearchPage.clearAndTypeQRCode("340543-05935-04953-05234-04");
assetSearchPage.clearAndTypeSerialNumber("8989898989898");
assetSearchPage.clearAndTypeQRCode(qrCode);
assetSearchPage.clearAndTypeSerialNumber(serialNumber);
assetSearchPage.clickAssetSubmitButton();
assetSearchPage.visitAssetsPage();
assetSearchPage.typeSearchKeyword("340543-05935-04953-05234-04");
assetSearchPage.typeSearchKeyword(qrCode);
assetSearchPage.pressEnter();
assetSearchPage.verifyAssetListContains("Dummy Camera 10");
assetSearchPage.verifyBadgeContent(
"Name/Serial No./QR ID: 340543-05935-04953-05234-04"
);
assetSearchPage.typeSearchKeyword("8989898989898");
assetSearchPage.verifyAssetListContains("Dummy Camera 10");
assetSearchPage.verifyBadgeContent("Name/Serial No./QR ID: 8989898989898");
assetSearchPage.verifyAssetListContains(assetName);
assetSearchPage.verifyBadgeContent(qrCode);
assetSearchPage.typeSearchKeyword(serialNumber);
assetSearchPage.verifyAssetListContains(assetName);
assetSearchPage.verifyBadgeContent(serialNumber);
});

// scan a asset qr code
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Asset/AssetSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class AssetSearchPage {

verifyBadgeContent(expectedText: string) {
cy.get("[data-testid='Name/Serial No./QR ID']").should(
"have.text",
"contain",
expectedText
);
}
Expand Down

0 comments on commit 824e5ae

Please sign in to comment.