forked from informatici/openhospital-ui
-
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.
OH2-331 |Tests / Add cypress e2e tests to cover admission types (admi…
…n/types/admissions) (informatici#627) * tests:Tests | Add cypress e2e tests to cover admission types (admin/types/admissions) * fix:check mode before setting it
- Loading branch information
Showing
7 changed files
with
145 additions
and
8 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...ions/admin_activities/types_activities/admissions_activities/add_admission_activity.cy.ts
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/// <reference types="cypress" /> | ||
|
||
const ADMISSION_TYPE_STARTS_PATH = "/admin/types/admissions"; | ||
|
||
describe("Add admission type Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(ADMISSION_TYPE_STARTS_PATH); | ||
cy.dataCy("sub-activity-title").contains("Manage admission types"); | ||
}); | ||
|
||
it("should show admission type creation form", () => { | ||
cy.dataCy("add-admission-type").click(); | ||
cy.dataCy("sub-activity-title").contains("New admission type"); | ||
}); | ||
|
||
it("should fail to create a new admission type", () => { | ||
cy.byId("code").type("FAIL"); | ||
cy.byId("description").type("Admission type"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("info-box").contains("Fail"); | ||
}); | ||
|
||
it("should successfully create a new admission type", () => { | ||
cy.byId("code").clear().type("22"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"The admission type has been created successfully!" | ||
); | ||
cy.dataCy("approve-dialog").click(); | ||
}); | ||
|
||
it("should redirect after admission type creation", () => { | ||
cy.dataCy("sub-activity-title").contains("Manage admission types"); | ||
}); | ||
|
||
it("should cancel the cancellation of the admission type creation", () => { | ||
cy.dataCy("add-admission-type").click(); | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"Are you sure to cancel the admission type creation?" | ||
); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should cancel the admission type creation", () => { | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("sub-activity-title").contains("Manage admission types"); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
...ons/admin_activities/types_activities/admissions_activities/edit_admission_activity.cy.ts
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/// <reference types="cypress" /> | ||
|
||
const ADMISSION_TYPE_START_PATH = "/admin/types/admissions"; | ||
|
||
describe("Admission types Edit Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(ADMISSION_TYPE_START_PATH); | ||
cy.dataCy("sub-activity-title").contains("Manage admission types"); | ||
}); | ||
|
||
it("should show admission type edit form", () => { | ||
cy.dataCy("table-edit-action").first().click(); | ||
cy.dataCy("sub-activity-title").contains("Edit admission type"); | ||
}); | ||
|
||
it("should fail to edit the admission type", () => { | ||
cy.byId("code").should("be.disabled"); | ||
cy.byId("description").clear(); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should successfully save admission type changes", () => { | ||
cy.byId("description").clear().type("Admission type"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").contains("has been updated successfully!"); | ||
cy.dataCy("approve-dialog").click(); | ||
}); | ||
|
||
it("should redirect after admission type update", () => { | ||
cy.dataCy("sub-activity-title").contains("Manage admission types"); | ||
}); | ||
|
||
it("should cancel the cancellation of the admission type update", () => { | ||
cy.dataCy("table-edit-action").first().click(); | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"Are you sure to cancel the admission type update?" | ||
); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should cancel the admission type update", () => { | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("sub-activity-title").contains("Manage admission types"); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
.../admin_activities/types_activities/admissions_activities/manage_admissions_activity.cy.ts
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// <reference types="cypress" /> | ||
|
||
const ADMISSION_TYPES_START_PATH = "/admin/types/admissions"; | ||
|
||
describe("Admission types Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(ADMISSION_TYPES_START_PATH); | ||
cy.dataCy("sub-activity-title").contains("Manage admission types"); | ||
}); | ||
|
||
it("should present the table with three rows", () => { | ||
cy.dataCy("admission-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(3); | ||
}); | ||
}); | ||
}); |
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