Skip to content

Commit

Permalink
Merge branch 'main' into N21-1207-show-group-members
Browse files Browse the repository at this point in the history
  • Loading branch information
MBergCap committed Oct 23, 2023
2 parents e7b900f + 7606e5e commit b5daf81
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 2 deletions.
76 changes: 76 additions & 0 deletions cypress/e2e/course/createEditAndDeleteCourse.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

29 changes: 28 additions & 1 deletion cypress/support/pages/course/pageCourses.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
})

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);
})

0 comments on commit b5daf81

Please sign in to comment.