-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OH2-357 | Add cypress e2e tests to cover medical types (admin/types/m…
…edicals) (#632) * Add cypress e2e tests to cover medical types (admin/types/medicals) * Correction de typo * Correction des attributs mal renseignes * Remane medical file * Files organisation
- Loading branch information
fogouang
authored
Jul 18, 2024
1 parent
1a33146
commit fccc1c6
Showing
8 changed files
with
194 additions
and
8 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...grations/admin_activities/types_activities/medicals_activities/add_medical_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 MEDICAL_TYPE_STARTS_PATH = "/admin/types/medicals"; | ||
|
||
describe("Add medical type Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(MEDICAL_TYPE_STARTS_PATH); | ||
cy.dataCy("sub-medical-title").contains("Manage medical types"); | ||
}); | ||
|
||
it("should show medical type creation form", () => { | ||
cy.dataCy("add-medical-type").click(); | ||
cy.dataCy("sub-medical-title").contains("New medical type"); | ||
}); | ||
|
||
it("should fail to create a new medical type", () => { | ||
cy.byId("code").type("FAIL"); | ||
cy.byId("description").type("Medical type"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("info-box").contains("Fail"); | ||
}); | ||
|
||
it("should successfully create a new medical type", () => { | ||
cy.byId("code").clear().type("22"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"The medical type has been created successfully!" | ||
); | ||
cy.dataCy("approve-dialog").click(); | ||
}); | ||
|
||
it("should redirect after medical type creation", () => { | ||
cy.dataCy("sub-medical-title").contains("Manage medical types"); | ||
}); | ||
|
||
it("should cancel the cancellation of the medical type creation", () => { | ||
cy.dataCy("add-medical-type").click(); | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"Are you sure to cancel the medical type creation?" | ||
); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should cancel the medical type creation", () => { | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("sub-medical-title").contains("Manage medical types"); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
...tions/admin_activities/types_activities/medicals_activities/delete_medical_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 MEDICAL2_TYPES_START_PATH = "/admin/types/medicals"; | ||
|
||
describe("Medical Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(MEDICAL2_TYPES_START_PATH); | ||
cy.dataCy("sub-medical-title").contains("Manage medical types"); | ||
}); | ||
|
||
it("should present the table with four rows", () => { | ||
cy.dataCy("medical-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(4); | ||
}); | ||
}); | ||
|
||
it("should display the deletion dialog", () => { | ||
cy.dataCy("table-delete-action").first().click(); | ||
cy.dataCy("dialog-info").contains("Are you sure to delete item with code"); | ||
}); | ||
|
||
it("should cancel the medical deletion", () => { | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("medical-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(4); | ||
}); | ||
}); | ||
|
||
it("should delete the medical", () => { | ||
cy.dataCy("table-delete-action").first().click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"The medical type has been deleted successfully!" | ||
); | ||
cy.dataCy("approve-dialog").last().click(); | ||
cy.dataCy("medical-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(3); | ||
}); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
...rations/admin_activities/types_activities/medicals_activities/edit_medical_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 MEDICAL_TYPE_START_PATH = "/admin/types/medicals"; | ||
|
||
describe("Medical types Edit Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(MEDICAL_TYPE_START_PATH); | ||
cy.dataCy("sub-medical-title").contains("Manage medical types"); | ||
}); | ||
|
||
it("should show medical type edit form", () => { | ||
cy.dataCy("table-edit-action").first().click(); | ||
cy.dataCy("sub-medical-title").contains("Edit medical type"); | ||
}); | ||
|
||
it("should fail to edit the medical 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 medical type changes", () => { | ||
cy.byId("description").clear().type("Medical type"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").contains("has been updated successfully!"); | ||
cy.dataCy("approve-dialog").click(); | ||
}); | ||
|
||
it("should redirect after medical type update", () => { | ||
cy.dataCy("sub-medical-title").contains("Manage medical types"); | ||
}); | ||
|
||
it("should cancel the cancellation of the medical 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 medical type update?" | ||
); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should cancel the medical type update", () => { | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("sub-medical-title").contains("Manage medical types"); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
...ons/admin_activities/types_activities/medicals_activities/manage_medicals_-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 MEDICAL_TYPES_START_PATH = "/admin/types/medicals"; | ||
|
||
describe("Medical types Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(MEDICAL_TYPES_START_PATH); | ||
cy.dataCy("sub-medical-title").contains("Manage medical types"); | ||
}); | ||
|
||
it("should present the table with four rows", () => { | ||
cy.dataCy("medical-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(4); | ||
}); | ||
}); | ||
}); |
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