diff --git a/cypress/e2e/class_management/groupMembers.feature b/cypress/e2e/class_management/groupMembers.feature new file mode 100644 index 00000000..f69c9bc6 --- /dev/null +++ b/cypress/e2e/class_management/groupMembers.feature @@ -0,0 +1,20 @@ +#@release +@unstable_test +Feature: Group - To show members in a group + + As a teacher I want to see the members in a group + + Scenario: As a teacher I can manage a group of type class from external systems + Given I am logged in as a 'teacher1_nbc' at 'nbc' + When I go to administration page + When I go to new class administration page + Then I see the new class administration page + Then I can see the group 'Cypress-Test-Group' with source 'moin.schule' + Then I can see the manage button for group 'Cypress-Test-Group' + When I click the manage group button + Then I can see the manage group page + Then I can see the manage group page title + Then I can see the group member table + Then I can see the 'Lehrkraft' with name 'Herzog' + Then I can see the infobox + Then I can see the infotext diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/class_management/showGroupsAndClassesInTable.feature similarity index 63% rename from cypress/e2e/group/showGroupsAndClassesInTable.feature rename to cypress/e2e/class_management/showGroupsAndClassesInTable.feature index 7346f233..95ee7347 100644 --- a/cypress/e2e/group/showGroupsAndClassesInTable.feature +++ b/cypress/e2e/class_management/showGroupsAndClassesInTable.feature @@ -1,27 +1,34 @@ +#@release @unstable_test Feature: Group - To show groups and classes in one table with respective functionality As a teacher I want to see all groups and classes belonging to my school. - - Scenario: As a pre-condition teacher adds a class to school + Scenario: As a teacher i can add a class to school Given I am logged in as a 'teacher1_nbc' at 'nbc' When I go to administration page - And I go to class administration - And I click on add class - And I click on the confirm button - And I confirm managing the class + When I go to new class administration page + Then I see the new class administration page + When I click on add class + Then I can see the create class page + When I click the cancel create 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 on add class + When I click on the confirm button + When I confirm managing the class Then I see the new class administration page - Scenario: As a teacher i can see all classes and groups of my school on the new class administration page. Given I see the new class administration page Then I can see the page title - And I can see the group 'Cypress-Test-Group' with source 'moin.schule' - And I can see the class '1' without source - And the group 'Cypress-Test-Group' has a manage button - And the class '1' has 4 enabled action items - + Then I can see 3 tabs + Then I can see 5 columns in the table + Then I can see the group 'Cypress-Test-Group' with source 'moin.schule' + Then I can see the class '1' without source + Then I can see the manage button for group 'Cypress-Test-Group' + Then I can see 4 enabled action items for class '1' Scenario: As a teacher i can manage my classes Given I see the new class administration page @@ -32,10 +39,9 @@ Feature: Group - To show groups and classes in one table with respective functio When I click the confirmation button on the cancel modal Then I see the new class administration page When I click the manage button - And I confirm managing the class + When I confirm managing the class Then I see the new class administration page - Scenario: As a teacher i can edit my classes Given I see the new class administration page When I click the edit button @@ -47,8 +53,7 @@ Feature: Group - To show groups and classes in one table with respective functio 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 - + Then I see the new class administration page Scenario: As a teacher i can upgrade my upgradable classes Given I see the new class administration page @@ -62,8 +67,7 @@ Feature: Group - To show groups and classes in one table with respective functio And I confirm creating the successor And I confirm managing the class Then I see the new class administration page - And the create successor button of the original class is disabled - + Then I can see the disabled create successor button of the original class Scenario: As a teacher i can delete my classes Given I see the new class administration page @@ -72,12 +76,19 @@ Feature: Group - To show groups and classes in one table with respective functio When I click the cancel button on the delete modal Then I see the new class administration page When I click the delete button - And I click the confirmation button on the delete modal + When I click the confirmation button on the delete modal Then I see the new class administration page - Scenario: As a post-condition teacher deletes the successor class and logs out Given I see the new class administration page + When I click on the next year tab When I click the delete button - And I click the confirmation button on the delete modal + When I click the confirmation button on the delete modal Then I see the new class administration page + + Scenario: As a teacher i can not see the new class page, when the feature flag is off + Given I am logged in as a 'teacher1_dbc' at 'default' + When I go to administration page + Then I cannot see the new class administration page + When I navigate to class administration page + Then I cannot see the source header in the table diff --git a/cypress/e2e/group/groupMembers.feature b/cypress/e2e/group/groupMembers.feature index cd39b3d9..e69de29b 100644 --- a/cypress/e2e/group/groupMembers.feature +++ b/cypress/e2e/group/groupMembers.feature @@ -1,20 +0,0 @@ -@unstable_test -Feature: Group - To show members in a group - - As a teacher I want to see the members in a group - - - Scenario: As a teacher I can manage a group of type class from external systems - Given I am logged in as a 'teacher1_nbc' at 'nbc' - When I go to administration page - And I go to new class administration page - Then I see the new class administration page - And I can see the group 'Cypress-Test-Group' with source 'moin.schule' - And the group 'Cypress-Test-Group' has a manage button - When I click the manage group button - Then I can see the manage group page - And I can see the manage group page title - And I can see the group member table - And I can see the 'Lehrkraft' with name 'Herzog' - And I can see the infobox - And I can see the infotext diff --git a/cypress/support/pages/admin/pageAdministration.js b/cypress/support/pages/admin/pageAdministration.js index ffe9cca8..043e5d05 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -29,7 +29,7 @@ class Management { static #teacherAdministrationNavigationButton = '[data-testid="Lehrkräfte"]' static #courseAdministrationNavigationButton = '[data-testid="Kurse"]' static #classAdministrationNavigationButton = '[data-testid="Klassen"]' - static #newClassAdministrationNavigationButton = '[data-testid="administrate_classes_new"]' + static #newClassAdministrationNavigationButton = '[data-testid="administrate_classes"]' static #teamAdministrationNavigationButton = '[data-testid="Teams"]' static #schoolAdministrationNavigationButton = '[data-testid="Schule"]' static #studentTeamCheckbox = '[data-testid="student_team_checkbox"]' diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/class_management/pageClasses.js similarity index 53% rename from cypress/support/pages/group/pageGroups.js rename to cypress/support/pages/class_management/pageClasses.js index 4e5ca272..51132749 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/class_management/pageClasses.js @@ -1,17 +1,20 @@ 'use strict' -class Groups { - static #createClass = '[data-testid="createClass"]'; +class Classes { + static #createClass = '[data-testid="admin-class-add-button"]'; static #confirmClassCreate = '[data-testid="confirmClassCreate"]'; static #manageConfirm = '[data-testid="manage-confirm"]'; static #classTitleNew = '[data-testid="admin-class-title"]'; static #classTableNew = '[data-testid="admin-class-table"]'; + static #nextYearTab = '[data-testid="admin-class-next-year-tab"]' + static #currentYearTab = '[data-testid="admin-class-current-year-tab"]' + static #previousYearsTab = '[data-testid="admin-class-previous-years-tab"]' static #manageClassButton = '[data-testid="legacy-class-table-manage-btn"]'; static #cancelModal = '[data-testid="modal_content"]'; static #editClassButton = '[data-testid="class-table-edit-btn"]'; static #createSuccessorButton = '[data-testid="class-table-successor-btn"]'; static #deleteClassButton = '[data-testid="class-table-delete-btn"]'; - static #deleteDialog = '.v-dialog--active'; + static #deleteDialog = '[data-testid="dialog-title"]'; static #deleteDialogCancel = '[data-testid="dialog-cancel"]'; static #deleteDialogConfirm = '[data-testid="dialog-confirm"]'; static #adminGroupTitle = '[data-testid="admin-class-title"]'; @@ -19,19 +22,22 @@ class Groups { static #classMemberInfoBox = '[data-testid="class-members-info-box"]'; static #classMemberInfoBoxText = '[data-testid="class-members-info-box-text"]'; static #manageGroupButton = '[data-testid="class-table-members-manage-btn"]'; + static #adminClassNavigationSidebarCard = '[data-testid="Klassen"]'; + static #adminClassNavigationCard = '[data-testid="administrate_classes"]' + static #legacyClassTable = '[data-testid="table_container"]' clickCreateClass() { - cy.get(Groups.#createClass) + cy.get(Classes.#createClass) .click(); } clickConfirmCreateClass() { - cy.get(Groups.#confirmClassCreate) + cy.get(Classes.#confirmClassCreate) .click(); } clickConfirmManageClass() { - cy.get(Groups.#manageConfirm) + cy.get(Classes.#manageConfirm) .click(); } @@ -41,7 +47,7 @@ class Groups { } clickManageClassButton() { - cy.get(Groups.#manageClassButton) + cy.get(Classes.#manageClassButton) .first().click(); } @@ -51,7 +57,7 @@ class Groups { } clickEditClassButton() { - cy.get(Groups.#editClassButton) + cy.get(Classes.#editClassButton) .first().click(); } @@ -61,7 +67,7 @@ class Groups { } clickCreateSuccessorButton() { - cy.get(Groups.#createSuccessorButton) + cy.get(Classes.#createSuccessorButton) .first().click(); } @@ -79,17 +85,27 @@ class Groups { } clickDeleteButton() { - cy.get(Groups.#deleteClassButton) + cy.get(Classes.#deleteClassButton) .first().click(); } clickCancelDeleteDialogButton() { - cy.get(Groups.#deleteDialogCancel) + cy.get(Classes.#deleteDialogCancel) .click(); } clickConfirmDeleteDialogButton() { - cy.get(Groups.#deleteDialogConfirm) + cy.get(Classes.#deleteDialogConfirm) + .click(); + } + + clickManageGroupButton() { + cy.get(Classes.#manageGroupButton) + .first().click(); + } + + clickNextYearTab() { + cy.get(Classes.#nextYearTab) .click(); } @@ -108,7 +124,7 @@ class Groups { } isCancelModal() { - cy.get(Groups.#cancelModal).should('exist'); + cy.get(Classes.#cancelModal).should('exist'); } isCreateSuccessorPage() { @@ -117,21 +133,26 @@ class Groups { } seeNewClassPageTitle() { - cy.get(Groups.#classTitleNew).should('exist'); + cy.get(Classes.#classTitleNew).should('exist'); } isSuccessorButtonDisabled() { - cy.get(Groups.#createSuccessorButton) + cy.get(Classes.#createSuccessorButton) .first().should('have.class', 'v-btn--disabled'); } isDeleteDialog() { - cy.get(Groups.#deleteDialog) + cy.get(Classes.#deleteDialog) .should('be.visible'); } - newClassTableContainsClass(className, sourceName) { - const classNameData = cy.get(Groups.#classTableNew).find('td').contains(className); + isCreateClassPage() { + cy.url().should('include', '/administration/classes'); + cy.url().should('include', '/create'); + } + + seeNewClassTableContainsClass(className, sourceName) { + const classNameData = cy.get(Classes.#classTableNew).find('td').contains(className); classNameData.should('be.visible'); classNameData.siblings('td').eq(0).should(($td) => { @@ -139,17 +160,17 @@ class Groups { }); } - groupsHaveAManageButton(groupName) { - const classNameData = cy.get(Groups.#classTableNew).find('td').contains(groupName); + seeGroupsHaveAManageButton(groupName) { + const classNameData = cy.get(Classes.#classTableNew).find('td').contains(groupName); - classNameData.siblings('td').eq(2).find('a[data-testid="class-table-members-manage-btn"]') + classNameData.siblings('td').eq(3).find('a[data-testid="class-table-members-manage-btn"]') .should('exist'); } - classesHave4ActiveActionItems(className) { - const classNameData = cy.get(Groups.#classTableNew).find('td').contains(className); + seeClassesHave4ActiveActionItems(className) { + const classNameData = cy.get(Classes.#classTableNew).find('td').contains(className); - const buttons = classNameData.siblings('td').eq(2).find('a, button'); + const buttons = classNameData.siblings('td').eq(3).find('a, button'); buttons.should('have.length', 4); buttons.each(($btn) => { @@ -157,20 +178,32 @@ class Groups { }) } + seeTableHas5Columns() { + const tableHeader = cy.get(Classes.#classTableNew).find('th') + + tableHeader.should('have.length', 5); + } + + see3Tabs() { + cy.get(Classes.#nextYearTab).should('exist') + cy.get(Classes.#currentYearTab).should('exist').and('have.class', 'v-tab v-tab--active') + cy.get(Classes.#previousYearsTab).should('exist') + } + seeManageGroupPage(){ cy.url().should('include', '/administration/groups/classes/'); } seeManageGroupPageTitle() { - cy.get(Groups.#adminGroupTitle).should('be.visible') + cy.get(Classes.#adminGroupTitle).should('be.visible') } seeGroupMemberTable() { - cy.get(Groups.#groupMemberTable).should('be.visible') + cy.get(Classes.#groupMemberTable).should('be.visible') } seeGroupMemberTableContainsMember(role, lastName){ - const groupMemberData = cy.get(Groups.#groupMemberTable).find('td').contains(lastName); + const groupMemberData = cy.get(Classes.#groupMemberTable).find('td').contains(lastName); groupMemberData.should('be.visible'); groupMemberData.siblings('td').eq(1).should(($td) => { @@ -179,18 +212,21 @@ class Groups { } seeClassMemberInfoBox() { - cy.get(Groups.#classMemberInfoBox).should('be.visible') + cy.get(Classes.#classMemberInfoBox).should('be.visible') } seeClassMemberInfoBoxText() { - cy.get(Groups.#classMemberInfoBoxText).should('be.visible') + cy.get(Classes.#classMemberInfoBoxText).should('be.visible') } - clickManageGroupButton(){ - cy.get(Groups.#manageGroupButton) - .first().click(); + seeNoNewClassAdministrationPage() { + cy.get(Classes.#adminClassNavigationSidebarCard).should('not.have.attr', 'href', '/administration/groups/classes') + cy.get(Classes.#adminClassNavigationCard).should('not.have.attr', 'data-loclink', '/administration/groups/classes') } + seeNoSourceHeader() { + cy.get(Classes.#legacyClassTable).find('th').should('not.contain', 'source'); + } } -export default Groups +export default Classes diff --git a/cypress/support/step_definition/class_management/commonClassesSteps.spec.js b/cypress/support/step_definition/class_management/commonClassesSteps.spec.js new file mode 100644 index 00000000..ee1f0ac9 --- /dev/null +++ b/cypress/support/step_definition/class_management/commonClassesSteps.spec.js @@ -0,0 +1,71 @@ +const { When, Then } = require('@badeball/cypress-cucumber-preprocessor') +import Classes from '../../pages/class_management/pageClasses' +import Management from '../../pages/admin/pageAdministration'; + + +const classes = new Classes(); +const management = new Management(); + +When('I go to class administration', () => { + management.navigateToClassAdministration(); +}) + +When('I go to new class administration page', () => { + management.navigateToNewClassAdministration(); +}) + +When('I click on add class', () => { + classes.clickCreateClass(); +}) + +When('I click on the confirm button', () => { + classes.clickConfirmCreateClass(); +}) + +When('I confirm managing the class', () => { + classes.clickConfirmManageClass(); +}) + +Then('I see the new class administration page', () => { + classes.isNewClassAdministrationPage(); +}) + +Then('I can see the page title', () => { + classes.seeNewClassPageTitle(); +}) + +Then('I can see the group {string} with source {string}', (groupName, systemName) => { + classes.seeNewClassTableContainsClass(groupName, systemName); +}) + +Then('I can see the class {string} without source', (className) => { + classes.seeNewClassTableContainsClass(className, ""); +}) + +Then('I can see the manage button for group {string}', (groupName) => { + classes.seeGroupsHaveAManageButton(groupName); +}) + +Then('I can see 4 enabled action items for class {string}', (className) => { + classes.seeClassesHave4ActiveActionItems(className); +}) + +Then('I can see 5 columns in the table', () => { + classes.seeTableHas5Columns(); +}) + +Then('I can see 3 tabs', () => { + classes.see3Tabs(); +}) + +Then('I cannot see the new class administration page', () => { + classes.seeNoNewClassAdministrationPage(); +}) + +When('I navigate to class administration page', () => { + management.navigateToClassAdministration(); +}) + +Then('I cannot see the source header in the table', () => { + classes.seeNoSourceHeader(); +}) diff --git a/cypress/support/step_definition/group/manageGroups.spec.js b/cypress/support/step_definition/class_management/manageGroups.spec.js similarity index 88% rename from cypress/support/step_definition/group/manageGroups.spec.js rename to cypress/support/step_definition/class_management/manageGroups.spec.js index 9dfd79fe..22bfe50b 100644 --- a/cypress/support/step_definition/group/manageGroups.spec.js +++ b/cypress/support/step_definition/class_management/manageGroups.spec.js @@ -1,7 +1,7 @@ -import Groups from "../../pages/group/pageGroups"; +import Classes from "../../pages/class_management/pageClasses"; import {Then, When} from "@badeball/cypress-cucumber-preprocessor"; -const groups = new Groups(); +const groups = new Classes(); When('I click the manage group button', () => { groups.clickManageGroupButton(); diff --git a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js b/cypress/support/step_definition/class_management/showGroupsAndClassesInTableSteps.spec.js similarity index 50% rename from cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js rename to cypress/support/step_definition/class_management/showGroupsAndClassesInTableSteps.spec.js index 30e29a22..037a9851 100644 --- a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js +++ b/cypress/support/step_definition/class_management/showGroupsAndClassesInTableSteps.spec.js @@ -1,79 +1,91 @@ const { When, Then } = require('@badeball/cypress-cucumber-preprocessor') -import Groups from '../../pages/group/pageGroups'; +import Classes from '../../pages/class_management/pageClasses'; -const groups = new Groups() +const classes = new Classes() When('I click the manage button', () => { - groups.clickManageClassButton(); + classes.clickManageClassButton(); }) Then('I can see the manage classes page', () => { - groups.isManageClassPage(); + classes.isManageClassPage(); }) When('I click the cancel manage class button', () => { - groups.clickCancelButton(); + classes.clickCancelButton(); }) Then('I can see the cancel modal', () => { - groups.isCancelModal(); + classes.isCancelModal(); }) When('I click the confirmation button on the cancel modal', () => { - groups.clickConfirmButton(); + classes.clickConfirmButton(); }) When('I click the edit button', () => { - groups.clickEditClassButton(); + classes.clickEditClassButton(); }) Then('I can see the edit classes page', () => { - groups.isEditClassPage(); + classes.isEditClassPage(); }) When('I click the cancel edit class button', () => { - groups.clickCancelButton(); + classes.clickCancelButton(); }) When('I click in the name suffix text element', () => { - groups.clickNameSuffixField(); + classes.clickNameSuffixField(); }) Then('I can click on the save changes button', () => { - groups.clickSaveChangesButton(); + classes.clickSaveChangesButton(); }) When('I click the create successor button', () => { - groups.clickCreateSuccessorButton(); + classes.clickCreateSuccessorButton(); }) Then('I can see the create successor page', () => { - groups.isCreateSuccessorPage(); + classes.isCreateSuccessorPage(); }) When('I click the cancel create successor button', () => { - groups.clickCancelButton(); + classes.clickCancelButton(); }) When('I confirm creating the successor', () => { - groups.clickConfirmSuccessor(); + classes.clickConfirmSuccessor(); }) -Then('the create successor button of the original class is disabled', () => { - groups.isSuccessorButtonDisabled(); +Then('I can see the disabled create successor button of the original class', () => { + classes.isSuccessorButtonDisabled(); }) When('I click the delete button', () => { - groups.clickDeleteButton(); + classes.clickDeleteButton(); }) Then('I can see the delete modal', () => { - groups.isDeleteDialog(); + classes.isDeleteDialog(); }) When('I click the cancel button on the delete modal', () => { - groups.clickCancelDeleteDialogButton(); + classes.clickCancelDeleteDialogButton(); }) When('I click the confirmation button on the delete modal', () => { - groups.clickConfirmDeleteDialogButton(); + classes.clickConfirmDeleteDialogButton(); +}) + +Then('I can see the create class page', () => { + classes.isCreateClassPage(); +}) + +When('I click the cancel create class button', () => { + classes.clickCancelButton(); +}) + +When('I click on the next year tab', () => { + classes.clickNextYearTab(); }) diff --git a/cypress/support/step_definition/group/commonGroupSteps.spec.js b/cypress/support/step_definition/group/commonGroupSteps.spec.js deleted file mode 100644 index 54e49b31..00000000 --- a/cypress/support/step_definition/group/commonGroupSteps.spec.js +++ /dev/null @@ -1,51 +0,0 @@ -const { When, Then } = require('@badeball/cypress-cucumber-preprocessor') -import Groups from '../../pages/group/pageGroups' -import Management from '../../pages/admin/pageAdministration'; - - -const groups = new Groups(); -const management = new Management(); - -When('I go to class administration', () => { - management.navigateToClassAdministration(); -}) - -When('I go to new class administration page', () => { - management.navigateToNewClassAdministration(); -}) - -When('I click on add class', () => { - groups.clickCreateClass(); -}) - -When('I click on the confirm button', () => { - groups.clickConfirmCreateClass(); -}) - -When('I confirm managing the class', () => { - groups.clickConfirmManageClass(); -}) - -Then('I see the new class administration page', () => { - groups.isNewClassAdministrationPage(); -}) - -Then('I can see the page title', () => { - groups.seeNewClassPageTitle(); -}) - -Then('I can see the group {string} with source {string}', (groupName, systemName) => { - groups.newClassTableContainsClass(groupName, systemName); -}) - -Then('I can see the class {string} without source', (className) => { - groups.newClassTableContainsClass(className, ""); -}) - -Then('the group {string} has a manage button', (groupName) => { - groups.groupsHaveAManageButton(groupName); -}) - -Then('the class {string} has 4 enabled action items', (className) => { - groups.classesHave4ActiveActionItems(className); -})