diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature index 37d31f60..3ceedf9d 100644 --- a/cypress/e2e/group/showGroupsAndClassesInTable.feature +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -25,18 +25,29 @@ Feature: Group - To show groups and classes in one table with respective functio @stable_test Scenario: As a teacher i can manage my classes Given I see the new class administration page - When I click the manage icon + When I click the manage button Then I can see the manage classes page When I click the cancel manage class button Then I can see the cancel modal When I click the confirmation button on the cancel modal Then I see the new class administration page - When I click the manage icon - Then I can see the manage classes page - When I confirm managing the class + When I click the manage button + And I confirm managing the class Then I see the new class administration page + @stable_test Scenario: As a teacher i can edit my classes + Given I see the new class administration page + When I click the edit button + Then I can see the edit classes page + When I click the cancel edit class button + Then I can see the cancel modal + When I click the confirmation button on the cancel modal + Then I see the new class administration page + When I click the edit button + When I click in the name suffix text element + Then I can click on the save changes button + And I see the new class administration page Scenario: As a teacher i can upgrade my upgradable classes diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js index d368a79a..b3808413 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/group/pageGroups.js @@ -6,7 +6,9 @@ class Groups { static #manageConfirm = '[data-testid="manage-confirm"]' static #classTitleNew = '[data-testid="admin-class-title"]' static #classTableNew = '[data-testid="admin-class-table"]' - static #manageClassIcon = '[data-testid="class-table-manage-btn"]' + static #manageClassButton = '[data-testid="class-table-manage-btn"]' + static #cancelModal = '[data-testid="modal_content"]' + static #editClassButton = '[data-testid="class-table-edit-btn"]' clickCreateClass() { cy.get(Groups.#cretaeClass) @@ -23,16 +25,38 @@ class Groups { .click() } - clickCancelManageClass() { + clickCancelButton() { cy.get('.btn-cancel') .click() } - clickManageClassIcon() { - cy.get(Groups.#manageClassIcon) + clickManageClassButton() { + cy.get(Groups.#manageClassButton) .first().click() } + clickConfirmButton() { + cy.get('.historyback') + .click() + } + + clickEditClassButton() { + cy.get(Groups.#editClassButton) + .first().click() + } + + clickNameSuffixField() { + cy.get('[name=classsuffix]') + .click() + } + + clickSaveChangesButton() { + cy.get('.btn-primary') + .eq(0) + .should('not.be.disabled') + .click() + } + isNewClassAdministrationPage() { cy.url().should('include', '/administration/groups/classes') } @@ -42,6 +66,15 @@ class Groups { cy.url().should('include', '/manage') } + isEditClassPage() { + cy.url().should('include', '/administration/classes') + cy.url().should('include', '/edit') + } + + isCancelModal() { + cy.get(Groups.#cancelModal).should('exist') + } + seeNewClassPageTitle() { cy.get(Groups.#classTitleNew).should('exist') } diff --git a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js index 348a6c51..127bcb5f 100644 --- a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js +++ b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js @@ -3,8 +3,8 @@ import Groups from '../../pages/group/pageGroups'; const groups = new Groups() -When('I click the manage icon', () => { - groups.clickManageClassIcon() +When('I click the manage button', () => { + groups.clickManageClassButton() }) Then('I can see the manage classes page', () => { @@ -12,9 +12,33 @@ Then('I can see the manage classes page', () => { }) When('I click the cancel manage class button', () => { - groups.clickCancelManageClass() + groups.clickCancelButton() }) Then('I can see the cancel modal', () => { + groups.isCancelModal() +}) + +When('I click the confirmation button on the cancel modal', () => { + groups.clickConfirmButton() +}) + +When('I click the edit button', () => { + groups.clickEditClassButton() +}) + +Then('I can see the edit classes page', () => { + groups.isEditClassPage() +}) + +When('I click the cancel edit class button', () => { + groups.clickCancelButton() +}) + +When('I click in the name suffix text element', () => { + groups.clickNameSuffixField() +}) +Then('I can click on the save changes button', () => { + groups.clickSaveChangesButton() })