Skip to content

Commit

Permalink
cypress test fix for asset homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Dec 24, 2024
1 parent 5adfdb0 commit 49e8010
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions cypress/pageobject/Asset/AssetHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,13 @@ export class AssetHome {
}

selectImportFacility(facilityName: string) {
cy.get("input[name='facilities']")
.type(facilityName)
.then(() => {
cy.get("[role='option']").contains(facilityName).click();
});
cy.typeAndSelectOption("input[name='facilities']", facilityName);
}

selectAssetImportButton(action: "click" | "verifyNotExist"): void {
const selector = "[data-testid=import-asset-button]";
if (action === "click") {
cy.get(selector).scrollIntoView().should("be.visible").click();
cy.verifyAndClickElement(selector, "Import/Export");
} else if (action === "verifyNotExist") {
cy.get(selector).should("not.exist");
}
Expand Down Expand Up @@ -98,15 +94,12 @@ export class AssetHome {
}

selectImportLocation(locationName: string) {
cy.clickAndSelectOption(
"[data-testid=select-import-location]",
locationName,
);
cy.clickAndSelectOption("#asset-import-location", locationName);
}

clickImportAsset() {
cy.intercept("POST", "**/api/v1/asset/").as("importAsset");
cy.clickSubmitButton("Import");
cy.clickSubmitButton("Submit");
cy.wait("@importAsset").its("response.statusCode").should("eq", 201);
}
}

0 comments on commit 49e8010

Please sign in to comment.