Skip to content

Commit

Permalink
facility cover image
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Jan 15, 2024
1 parent a9a8aed commit a4789d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityManage from "../../pageobject/Facility/FacilityManage";

describe("Facility Manage Functions", () => {
const loginPage = new LoginPage();
const facilityManage = new FacilityManage();

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -21,13 +24,10 @@ describe("Facility Manage Functions", () => {

it("Facility Cover Image button functionality", () => {
// It's only button functionality because we can't access S3 bucket in local
cy.get("#facility-coverimage").click({ force: true });
cy.get("#upload-cover-image").should("be.visible");
cy.get("#upload-cover-image")
.selectFile("cypress/fixtures/facilitycoverimage.jpg", { force: true })
.wait(100);
cy.get("#save-cover-image").scrollIntoView();
cy.get("#save-cover-image").click();
facilityManage.clickCoverImage();
facilityManage.verifyUploadButtonVisible();
facilityManage.uploadCoverImage("facilitycoverimage.jpg");
facilityManage.clickSaveCoverImage();
});

afterEach(() => {
Expand Down
21 changes: 21 additions & 0 deletions cypress/pageobject/Facility/FacilityManage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class FacilityManage {
clickCoverImage() {
cy.get("#facility-coverimage").click({ force: true });
}

verifyUploadButtonVisible() {
cy.get("#upload-cover-image").should("be.visible");
}

uploadCoverImage(fileName) {
cy.get("#upload-cover-image")
.selectFile(`cypress/fixtures/${fileName}`, { force: true })
.wait(100); // Adjust the wait time as needed
}

clickSaveCoverImage() {
cy.get("#save-cover-image").scrollIntoView();
cy.get("#save-cover-image").click();
}
}
export default FacilityManage;

0 comments on commit a4789d1

Please sign in to comment.