Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N21-1293-remove-groups-from-course #150

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
})
Loading