-
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.
tests:OH2-356 | Tests / Add cypress e2e tests to cover exam types (ad…
…min/types/exams) (#631)
- Loading branch information
Showing
8 changed files
with
159 additions
and
6 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...s/integrations/admin_activities/types_activities/exams_activities/add_exam_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 EXAM_TYPE_STARTS_PATH = "/admin/types/exams"; | ||
|
||
describe("Add exam type Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(EXAM_TYPE_STARTS_PATH); | ||
cy.dataCy("sub-activity-title").contains("Manage exam types"); | ||
}); | ||
|
||
it("should show exam type creation form", () => { | ||
cy.dataCy("add-exam-type").click(); | ||
cy.dataCy("sub-activity-title").contains("New exam type"); | ||
}); | ||
|
||
it("should fail to create a new exam type", () => { | ||
cy.byId("code").type("FAIL"); | ||
cy.byId("description").type("Exam type"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("info-box").contains("Fail"); | ||
}); | ||
|
||
it("should successfully create a new exam type", () => { | ||
cy.byId("code").clear().type("22"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"The exam type has been created successfully!" | ||
); | ||
cy.dataCy("approve-dialog").click(); | ||
}); | ||
|
||
it("should redirect after exam type creation", () => { | ||
cy.dataCy("sub-activity-title").contains("Manage exam types"); | ||
}); | ||
|
||
it("should cancel the cancellation of the exam type creation", () => { | ||
cy.dataCy("add-exam-type").click(); | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"Are you sure to cancel the exam type creation?" | ||
); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should cancel the exam 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 exam types"); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
.../integrations/admin_activities/types_activities/exams_activities/edit_exam_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 EXAM_TYPE_START_PATH = "/admin/types/exams"; | ||
|
||
describe("Exam types Edit Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(EXAM_TYPE_START_PATH); | ||
cy.dataCy("sub-activity-title").contains("Manage exam types"); | ||
}); | ||
|
||
it("should show exam type edit form", () => { | ||
cy.dataCy("table-edit-action").first().click(); | ||
cy.dataCy("sub-activity-title").contains("Edit exam type"); | ||
}); | ||
|
||
it("should fail to edit the exam 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 exam type changes", () => { | ||
cy.byId("description").clear().type("Exam type"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").contains("has been updated successfully!"); | ||
cy.dataCy("approve-dialog").click(); | ||
}); | ||
|
||
it("should redirect after exam type update", () => { | ||
cy.dataCy("sub-activity-title").contains("Manage exam types"); | ||
}); | ||
|
||
it("should cancel the cancellation of the exam 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 exam type update?" | ||
); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should cancel the exam 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 exam types"); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
...tegrations/admin_activities/types_activities/exams_activities/manage_exams_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,40 @@ | ||
/// <reference types="cypress" /> | ||
|
||
const EXAM_TYPES_START_PATH = "/admin/types/exams"; | ||
|
||
describe("Exam types Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(EXAM_TYPES_START_PATH); | ||
cy.dataCy("sub-activity-title").contains("Manage exam types"); | ||
}); | ||
|
||
it("should present the table with two rows", () => { | ||
cy.dataCy("exam-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(2); | ||
}); | ||
}); | ||
|
||
it("should cancel the deletion of the exam type", () => { | ||
cy.dataCy("table-delete-action").first().click(); | ||
cy.dataCy("dialog-info").contains("Are you sure to delete item with code"); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should delete the first exam type", () => { | ||
cy.dataCy("table-delete-action").first().click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").contains("has been deleted successfully!"); | ||
cy.dataCy("approve-dialog").last().click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("exam-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(1); | ||
}); | ||
}); | ||
}); |
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
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