-
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-358 | Add cypress e2e tests to cover operation types (admin/types…
…/operations) (#633) * Add cypress e2e tests to cover operation types (admin/types/operations) * Review corrections * Files organisation * typo correction
- Loading branch information
Showing
8 changed files
with
194 additions
and
8 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...ions/admin_activities/types_activities/operations_activities/add_operation_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 OPERATION_TYPE_STARTS_PATH = "/admin/types/operations"; | ||
|
||
describe("Add operation type Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(OPERATION_TYPE_STARTS_PATH); | ||
cy.dataCy("sub-operation-title").contains("Manage operation types"); | ||
}); | ||
|
||
it("should show operation type creation form", () => { | ||
cy.dataCy("add-operation-type").click(); | ||
cy.dataCy("sub-operation-title").contains("New operation type"); | ||
}); | ||
|
||
it("should fail to create a new operation type", () => { | ||
cy.byId("code").type("FAIL"); | ||
cy.byId("description").type("Operation type"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("info-box").contains("Fail"); | ||
}); | ||
|
||
it("should successfully create a new operation type", () => { | ||
cy.byId("code").clear().type("22"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"The operation type has been created successfully!" | ||
); | ||
cy.dataCy("approve-dialog").click(); | ||
}); | ||
|
||
it("should redirect after operation type creation", () => { | ||
cy.dataCy("sub-operation-title").contains("Manage operation types"); | ||
}); | ||
|
||
it("should cancel the cancellation of the operation type creation", () => { | ||
cy.dataCy("add-operation-type").click(); | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"Are you sure to cancel the operation type creation?" | ||
); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should cancel the operation type creation", () => { | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("sub-operation-title").contains("Manage operation types"); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
...s/admin_activities/types_activities/operations_activities/delete_operation_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 OPERATION2_TYPES_START_PATH = "/admin/types/operations"; | ||
|
||
describe("Operation Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(OPERATION2_TYPES_START_PATH); | ||
cy.dataCy("sub-operation-title").contains("Manage operation types"); | ||
}); | ||
|
||
it("should present the table with four rows", () => { | ||
cy.dataCy("operation-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(9); | ||
}); | ||
}); | ||
|
||
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 operation deletion", () => { | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("operation-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(9); | ||
}); | ||
}); | ||
|
||
it("should delete the operation", () => { | ||
cy.dataCy("table-delete-action").first().click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").contains( | ||
"The operation type has been deleted successfully!" | ||
); | ||
cy.dataCy("approve-dialog").last().click(); | ||
cy.dataCy("operation-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(8); | ||
}); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
...ons/admin_activities/types_activities/operations_activities/edit_operation_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 OPERATION_TYPE_START_PATH = "/admin/types/operations"; | ||
|
||
describe("Operation types Edit Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(OPERATION_TYPE_START_PATH); | ||
cy.dataCy("sub-operation-title").contains("Manage operation types"); | ||
}); | ||
|
||
it("should show operation type edit form", () => { | ||
cy.dataCy("table-edit-action").first().click(); | ||
cy.dataCy("sub-operation-title").contains("Edit operation type"); | ||
}); | ||
|
||
it("should fail to edit the operation 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 operation type changes", () => { | ||
cy.byId("description").clear().type("Operation type"); | ||
cy.dataCy("submit-form").click(); | ||
cy.dataCy("dialog-info").contains("has been updated successfully!"); | ||
cy.dataCy("approve-dialog").click(); | ||
}); | ||
|
||
it("should redirect after operation type update", () => { | ||
cy.dataCy("sub-operation-title").contains("Manage operation types"); | ||
}); | ||
|
||
it("should cancel the cancellation of the operation 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 operation type update?" | ||
); | ||
cy.dataCy("close-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
}); | ||
|
||
it("should cancel the operation type update", () => { | ||
cy.dataCy("cancel-form").click(); | ||
cy.dataCy("approve-dialog").click(); | ||
cy.dataCy("dialog-info").should("not.exist"); | ||
cy.dataCy("sub-operation-title").contains("Manage operation types"); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
.../admin_activities/types_activities/operations_activities/manage_operations_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 OPERATION_TYPES_START_PATH = "/admin/types/operations"; | ||
|
||
describe("Operation types Activity specs", () => { | ||
it("should render the ui", () => { | ||
cy.authenticate(OPERATION_TYPES_START_PATH); | ||
cy.dataCy("sub-operation-title").contains("Manage operation types"); | ||
}); | ||
|
||
it("should present the table with four rows", () => { | ||
cy.dataCy("operation-types-table") | ||
.find("table") | ||
.then(($table) => { | ||
const rows = $table.find("tbody tr"); | ||
expect(rows.length).equal(9); | ||
}); | ||
}); | ||
}); |
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