From 272da9ef7998430a1eef46b48a3e68e8215b4f3d Mon Sep 17 00:00:00 2001 From: Mrika Llabani Date: Thu, 19 Oct 2023 16:46:28 +0200 Subject: [PATCH 1/4] N21-1293 add + remove one group --- .../course/createEditAndDeleteCourse.feature | 60 +++++++++++++++++++ cypress/support/pages/course/pageCourses.js | 35 ++++++++++- .../createEditAndDeleteCourseSteps.spec.js | 26 +++++++- 3 files changed, 119 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/course/createEditAndDeleteCourse.feature b/cypress/e2e/course/createEditAndDeleteCourse.feature index 9aa8a746..127d5c8e 100644 --- a/cypress/e2e/course/createEditAndDeleteCourse.feature +++ b/cypress/e2e/course/createEditAndDeleteCourse.feature @@ -49,3 +49,63 @@ 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 + + @only + 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 + + @only + 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 + + #add group to 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' + When I click on the selection box to add a new group with ' Cypress-Test-Group | 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-Group | moin.schule ' in the class selection box | NOT WORKING + Then I see 'Kraft, Herbert' in the student selection box + + #remove group from course + When I click on the remove icon of group ' Cypress-Test-Group | 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-Group | moin.schule ' in the group selection box + Then I do not see 'Kraft, Herbert' in the student selection box + + + #Deleting the course/room created in this feature test + When I go to room 'Cypress Test Creation and Deletion' + 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..fc021325 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -67,7 +67,11 @@ 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 #classAndGroupSelection = '[data-testid="select-classes-and-groups"]' + static #groupSelection = '[id="classId_chosen"]' + static #chosenGroups = '[id="classId_chosen"] > .chosen-choices > .search-choice > span' + static #chosenStudents= '[id="studentsId_chosen"] > .chosen-choices' + static #removeGroup = '[id="classId_chosen"] > .chosen-choices > .search-choice a' seeSectionOneAreaOnCourseCreatePage () { cy.get(Courses.#sectionOneAreaOnCourseCreationPage).should('exist') } @@ -485,5 +489,34 @@ class Courses { } }) } + + checkIfGroupsIsEmpty(){ + cy.get(Courses.#classAndGroupSelection).should('not.contain','Cypress-Test-Group'); + + } + + checkIfGroupIsVisible (groupName) { + cy.get(Courses.#chosenGroups).should('contain', groupName); + } + checkIfGroupIsNotVisible (groupName) { + cy.get(Courses.#chosenGroups).should('not.contain', groupName); + } + + checkIfStudentIsVisible (studentName) { + cy.get(Courses.#chosenStudents).find('.search-choice').children('span').should('contain', studentName); + } + + checkIfStudentIsNotVisible (studentName) { + cy.get(Courses.#chosenStudents).should('not.contain', studentName); + } + + selectGroup (groupName) { + cy.get(Courses.#groupSelection).click().type('{selectall}{backspace}').contains(groupName).click() + } + + removeGroup (groupName) { + cy.get(Courses.#chosenGroups).contains(groupName); + cy.get(Courses.#removeGroup).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..a9562756 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.selectGroup(groupName); +}) + +When('I click on the remove icon of group {string}',(groupName) =>{ + courses.removeGroup(groupName); +}) + +Then('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); +}) From 013b781a566f8739f97c9d5939af1d6553aa169a Mon Sep 17 00:00:00 2001 From: Mrika Llabani Date: Fri, 20 Oct 2023 14:28:19 +0200 Subject: [PATCH 2/4] N21-1293 fix tests --- .../course/createEditAndDeleteCourse.feature | 28 +++++++++++++++---- cypress/support/pages/course/pageCourses.js | 18 ++++++------ .../createEditAndDeleteCourseSteps.spec.js | 4 +-- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/cypress/e2e/course/createEditAndDeleteCourse.feature b/cypress/e2e/course/createEditAndDeleteCourse.feature index 127d5c8e..fd23ed70 100644 --- a/cypress/e2e/course/createEditAndDeleteCourse.feature +++ b/cypress/e2e/course/createEditAndDeleteCourse.feature @@ -79,26 +79,42 @@ Feature: Course - To add and delete a course by the teacher 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 - #add group to course + #add groups to 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' - When I click on the selection box to add a new group with ' Cypress-Test-Group | moin.schule ' + 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-Group | moin.schule ' in the class selection box | NOT WORKING + 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 group from course - When I click on the remove icon of group ' Cypress-Test-Group | moin.schule ' + #remove second group + 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-Group | moin.schule ' in the group selection box + 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 diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index fc021325..9454b770 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -69,9 +69,9 @@ class Courses { static #contextExternalToolConfiguratorPageTitle = '[data-testid="context-external-tool-configurator-title"]' static #classAndGroupSelection = '[data-testid="select-classes-and-groups"]' static #groupSelection = '[id="classId_chosen"]' - static #chosenGroups = '[id="classId_chosen"] > .chosen-choices > .search-choice > span' + static #chosenGroups = '[id="classId_chosen"] > .chosen-choices .search-choice' static #chosenStudents= '[id="studentsId_chosen"] > .chosen-choices' - static #removeGroup = '[id="classId_chosen"] > .chosen-choices > .search-choice a' + static #removeGroup = '[id="classId_chosen"] > .chosen-choices > .search-choice' seeSectionOneAreaOnCourseCreatePage () { cy.get(Courses.#sectionOneAreaOnCourseCreationPage).should('exist') } @@ -496,10 +496,12 @@ class Courses { } checkIfGroupIsVisible (groupName) { - cy.get(Courses.#chosenGroups).should('contain', groupName); + cy.get(Courses.#groupSelection).find('.chosen-choices').contains(groupName).should('be.visible'); } checkIfGroupIsNotVisible (groupName) { - cy.get(Courses.#chosenGroups).should('not.contain', groupName); + cy.get(Courses.#groupSelection).find('.chosen-choices').contains(groupName).should('not.exist'); + + } checkIfStudentIsVisible (studentName) { @@ -510,13 +512,13 @@ class Courses { cy.get(Courses.#chosenStudents).should('not.contain', studentName); } - selectGroup (groupName) { - cy.get(Courses.#groupSelection).click().type('{selectall}{backspace}').contains(groupName).click() + 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.#chosenGroups).contains(groupName); - cy.get(Courses.#removeGroup).click() + 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 a9562756..da5dbae7 100644 --- a/cypress/support/step_definition/course/createEditAndDeleteCourseSteps.spec.js +++ b/cypress/support/step_definition/course/createEditAndDeleteCourseSteps.spec.js @@ -96,14 +96,14 @@ Then ('I see {string} in the student selection box',(studentName) => { }) When('I click on the selection box to add a new group with {string}',(groupName) =>{ - courses.selectGroup(groupName); + courses.addGroup(groupName); }) When('I click on the remove icon of group {string}',(groupName) =>{ courses.removeGroup(groupName); }) -Then('Then I do not see {string} in the group selection box',(groupName) =>{ +Then('I do not see {string} in the group selection box',(groupName) =>{ courses.checkIfGroupIsNotVisible(groupName); }) From d0cd74a1e3efc149c77c17a42cbe37d1b56c63db Mon Sep 17 00:00:00 2001 From: Mrika Llabani Date: Fri, 20 Oct 2023 15:13:46 +0200 Subject: [PATCH 3/4] N21-1293 fix --- .../e2e/course/createEditAndDeleteCourse.feature | 14 ++++++++------ cypress/support/pages/course/pageCourses.js | 8 -------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/cypress/e2e/course/createEditAndDeleteCourse.feature b/cypress/e2e/course/createEditAndDeleteCourse.feature index fd23ed70..d2a8a9ca 100644 --- a/cypress/e2e/course/createEditAndDeleteCourse.feature +++ b/cypress/e2e/course/createEditAndDeleteCourse.feature @@ -51,6 +51,7 @@ Feature: Course - To add and delete a course by the teacher Then I do not see the course 'Cypress Testkurs Edit' on the room overview page @only + @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 @@ -60,6 +61,7 @@ Feature: Course - To add and delete a course by the teacher Then I do not see the course 'Cypress Testkurs Edit' on the room overview page @only + @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 @@ -79,22 +81,23 @@ Feature: Course - To add and delete a course by the teacher 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 - #add groups to course + # 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 + # 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 @@ -104,7 +107,7 @@ Feature: Course - To add and delete a course by the teacher 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 + # 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 @@ -117,8 +120,7 @@ Feature: Course - To add and delete a course by the teacher Then I see the course 'Cypress Testkurs Edit' on the room overview page - #Deleting the course/room created in this feature test - When I go to room 'Cypress Test Creation and Deletion' + # 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 diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index 9454b770..9954b1d0 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -67,11 +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 #classAndGroupSelection = '[data-testid="select-classes-and-groups"]' static #groupSelection = '[id="classId_chosen"]' - static #chosenGroups = '[id="classId_chosen"] > .chosen-choices .search-choice' static #chosenStudents= '[id="studentsId_chosen"] > .chosen-choices' - static #removeGroup = '[id="classId_chosen"] > .chosen-choices > .search-choice' seeSectionOneAreaOnCourseCreatePage () { cy.get(Courses.#sectionOneAreaOnCourseCreationPage).should('exist') } @@ -490,11 +487,6 @@ class Courses { }) } - checkIfGroupsIsEmpty(){ - cy.get(Courses.#classAndGroupSelection).should('not.contain','Cypress-Test-Group'); - - } - checkIfGroupIsVisible (groupName) { cy.get(Courses.#groupSelection).find('.chosen-choices').contains(groupName).should('be.visible'); } From 0cb54e362e69ca1abadb9bc1152222723542c5d3 Mon Sep 17 00:00:00 2001 From: Mrika Llabani Date: Fri, 20 Oct 2023 15:27:41 +0200 Subject: [PATCH 4/4] N21-1293 fix --- cypress/e2e/course/createEditAndDeleteCourse.feature | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/course/createEditAndDeleteCourse.feature b/cypress/e2e/course/createEditAndDeleteCourse.feature index d2a8a9ca..6678600b 100644 --- a/cypress/e2e/course/createEditAndDeleteCourse.feature +++ b/cypress/e2e/course/createEditAndDeleteCourse.feature @@ -50,8 +50,7 @@ Feature: Course - To add and delete a course by the teacher 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 - @only - @stable_test + @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 @@ -60,8 +59,7 @@ Feature: Course - To add and delete a course by the teacher When I delete all courses named 'Cypress Testkurs Edit' Then I do not see the course 'Cypress Testkurs Edit' on the room overview page - @only - @stable_test + @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