diff --git a/cypress/e2e/course/createEditAndDeleteCourse.feature b/cypress/e2e/course/createEditAndDeleteCourse.feature index 9aa8a746..6678600b 100644 --- a/cypress/e2e/course/createEditAndDeleteCourse.feature +++ b/cypress/e2e/course/createEditAndDeleteCourse.feature @@ -49,3 +49,79 @@ Feature: Course - To add and delete a course by the teacher Then I see the modal to confirm the deletion When I click on the button delete on the modal to confirm the course deletion Then I do not see the course 'Cypress Testkurs Edit' on the room overview page + + @stable_test + Scenario: as a pre-condition teacher deletes undeleted tests + Given I am logged in as a 'teacher1_nbc' at 'nbc' + When I go to rooms overview + When I delete all courses named 'Cypress Test Creation and Deletion' + Then I do not see the course 'Cypress Test Creation and Deletion' on the room overview page + When I delete all courses named 'Cypress Testkurs Edit' + Then I do not see the course 'Cypress Testkurs Edit' on the room overview page + + @stable_test + Scenario: Create, edit and delete a course with groups of type class in nbc + Given I am logged in as a 'teacher1_nbc' at 'nbc' + When I go to rooms overview + Then I see room search box on the room overview page + When I click on FAB to create a new room + Then I see section one area on the course create page + When I enter the course title 'Cypress Test Creation and Deletion' + When I select room colour as red + Then I see teacher 'Karl Herzog' is selected by default + Then I see substitute teacher selection box + Then I see date pickers to start and end the course as per school year + Then I see button to create a course time table container + When I click on button Next Steps after entering the room detail in section one + Then I see section two area on the course create page + When I click on button Next Steps after selecting room participant details + Then I see the section three area as the finish page + When I click on button To Course Overview on the finish page + Then I see the course 'Cypress Test Creation and Deletion' on the room overview page + + # Editing the course + When I go to room 'Cypress Test Creation and Deletion' + When I open course edit page + Then I can see course edit page + When I edit the title of the room to 'Cypress Testkurs Edit' + When I edit the room description to 'cy edit this is test description' + + # Add groups to course + When I click on the selection box to add a new group with ' Cypress-Test-Group1 | moin.schule ' + When I click on the selection box to add a new group with ' Cypress-Test-Group2 | moin.schule ' + When I click on save changes after editing the course details + Then I see the course 'Cypress Testkurs Edit' on the room overview page + When I open course edit page + Then I see ' Cypress-Test-Group1 | moin.schule ' in the class selection box + Then I see 'Kraft, Herbert' in the student selection box + + # Remove one group from course + When I click on the remove icon of group ' Cypress-Test-Group2 | moin.schule ' + When I click on save changes after editing the course details + Then I see the course 'Cypress Testkurs Edit' on the room overview page + When I open course edit page + Then I see ' Cypress-Test-Group1 | moin.schule ' in the class selection box + Then I do not see ' Cypress-Test-Group2 | moin.schule ' in the group selection box + Then I see 'Kraft, Herbert' in the student selection box + Then I do not see 'Strobl, Amelia' in the student selection box + + # Remove second group from course + When I click on the remove icon of group ' Cypress-Test-Group1 | moin.schule ' + When I click on save changes after editing the course details + Then I see the course 'Cypress Testkurs Edit' on the room overview page + When I open course edit page + Then I do not see ' Cypress-Test-Group1 | moin.schule ' in the group selection box + Then I do not see ' Cypress-Test-Group2 | moin.schule ' in the group selection box + Then I do not see 'Strobl, Amelia' in the student selection box + Then I do not see 'Kraft, Herbert' in the student selection box + When I click on save changes after editing the course details + Then I see the course 'Cypress Testkurs Edit' on the room overview page + + + # Deleting the course/room created in this feature test + When I open course edit page + When I click on the button delete course + Then I see the modal to confirm the deletion + When I click on the button delete on the modal to confirm the course deletion + Then I do not see the course 'Cypress Testkurs Edit' on the room overview page + diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index bf9dc0af..9954b1d0 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -67,7 +67,8 @@ class Courses { static #addToolButton = '[data-testid="add-tool-button"]' static #toolConfigurationSelect = '[data-testid="configuration-select"]' static #contextExternalToolConfiguratorPageTitle = '[data-testid="context-external-tool-configurator-title"]' - + static #groupSelection = '[id="classId_chosen"]' + static #chosenStudents= '[id="studentsId_chosen"] > .chosen-choices' seeSectionOneAreaOnCourseCreatePage () { cy.get(Courses.#sectionOneAreaOnCourseCreationPage).should('exist') } @@ -485,5 +486,31 @@ class Courses { } }) } + + checkIfGroupIsVisible (groupName) { + cy.get(Courses.#groupSelection).find('.chosen-choices').contains(groupName).should('be.visible'); + } + checkIfGroupIsNotVisible (groupName) { + cy.get(Courses.#groupSelection).find('.chosen-choices').contains(groupName).should('not.exist'); + + + } + + checkIfStudentIsVisible (studentName) { + cy.get(Courses.#chosenStudents).find('.search-choice').children('span').should('contain', studentName); + } + + checkIfStudentIsNotVisible (studentName) { + cy.get(Courses.#chosenStudents).should('not.contain', studentName); + } + + addGroup (groupName) { + cy.get(Courses.#groupSelection).find('.chosen-choices').click(); + cy.get(Courses.#groupSelection).find('.chosen-results').contains(groupName).click(); + } + + removeGroup (groupName) { + cy.get(Courses.#groupSelection).find('.chosen-choices').contains(groupName).siblings('a').click(); + } } export default Courses diff --git a/cypress/support/step_definition/course/createEditAndDeleteCourseSteps.spec.js b/cypress/support/step_definition/course/createEditAndDeleteCourseSteps.spec.js index b258d525..da5dbae7 100644 --- a/cypress/support/step_definition/course/createEditAndDeleteCourseSteps.spec.js +++ b/cypress/support/step_definition/course/createEditAndDeleteCourseSteps.spec.js @@ -85,4 +85,28 @@ Then ('I see the modal to confirm the deletion',() =>{ When ('I click on the button delete on the modal to confirm the course deletion',() =>{ courses.confirmCourseDeletionOnModal() -}) \ No newline at end of file +}) + +Then ('I see {string} in the class selection box',(groupName) => { + courses.checkIfGroupIsVisible(groupName); +}) + +Then ('I see {string} in the student selection box',(studentName) => { + courses.checkIfStudentIsVisible(studentName); +}) + +When('I click on the selection box to add a new group with {string}',(groupName) =>{ + courses.addGroup(groupName); +}) + +When('I click on the remove icon of group {string}',(groupName) =>{ + courses.removeGroup(groupName); +}) + +Then('I do not see {string} in the group selection box',(groupName) =>{ + courses.checkIfGroupIsNotVisible(groupName); +}) + +Then('I do not see {string} in the student selection box',(studentName) =>{ + courses.checkIfStudentIsNotVisible(studentName); +})