From b4db5ba1d465f76f046586277233510646f09f12 Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Wed, 27 Sep 2023 16:35:21 +0200 Subject: [PATCH 01/25] N21-1297 implemented test for autocompletion on external tool configuration page --- cypress/e2e/course/addToolToCourse.feature | 24 ++++++++++++ cypress/support/custom_commands/login.js | 8 ++++ cypress/support/pages/course/pageCourses.js | 39 +++++++++++++++++-- .../course/toolCourseSteps.spec.js | 35 +++++++++++++++++ 4 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 cypress/e2e/course/addToolToCourse.feature create mode 100644 cypress/support/step_definition/course/toolCourseSteps.spec.js diff --git a/cypress/e2e/course/addToolToCourse.feature b/cypress/e2e/course/addToolToCourse.feature new file mode 100644 index 00000000..4c260e01 --- /dev/null +++ b/cypress/e2e/course/addToolToCourse.feature @@ -0,0 +1,24 @@ +@release +Feature: Course - To add a tool to a course + + As a teacher I want to add a new tool to my course. + + @stable_test + Scenario: Student cant see the button to add a tool + Given I am logged in as a 'student2_nbc' at 'nbc' + When I go to rooms overview + When I go to room 'German' + When I click on the tools tab + Then I cant see the button to add a tool + + @stable_test + Scenario: Teacher adds a tool to a course + Given I am logged in as a 'teacher1_nbc' at 'nbc' + When I go to rooms overview + When I go to room 'German' + When I click on the tools tab + Then I can see the button to add a tool + When I click on the button to add a tool + Then I can see the tool configuration page + When I click on the tool configuration selection + Then I can enter 'Test' as tool name diff --git a/cypress/support/custom_commands/login.js b/cypress/support/custom_commands/login.js index 1f0cc7ca..3fab6d79 100644 --- a/cypress/support/custom_commands/login.js +++ b/cypress/support/custom_commands/login.js @@ -57,6 +57,14 @@ Cypress.Commands.add('login', (username, environment) => { userEmail = 'ADMIN_1_BRB_EMAIL' userPassword = 'ADMIN_1_BRB_PASSWORD' break + case 'teacher1_nbc': + userEmail = 'TEACHER_1_NBC_EMAIL' + userPassword = 'TEACHER_1_NBC_PASSWORD' + break + case 'student2_nbc': + userEmail = 'STUDENT_2_NBC_EMAIL' + userPassword = 'STUDENT_2_NBC_PASSWORD' + break case 'admin1_nbc': userEmail = 'ADMIN_1_NBC_EMAIL' userPassword = 'ADMIN_1_NBC_PASSWORD' diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index 93f12191..4a702fd7 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -15,7 +15,7 @@ class Courses { static #mainContent = '[id="main-content"]' static #createCourse = '[data-testid="add-course-button"]' static #createContent = '[data-testid="add-content-button"]' - static #toolsTab = '[data-testid="tools"]' + static #ltiToolsTab = '[data-testid="tools"]' static #toolsList = '[data-testid="course_tool_list_add_tool"]' static #courseOverviewNavigationButton = '[data-testid="Course-Overview"]' static #addNewToolButton = '[data-testid="add_new_tool"]' @@ -63,6 +63,11 @@ class Courses { static #learningContentTab = '[data-testid="learnContent-tab"]' static #courseDetailPageTitle = '[data-testid="courses-course-title"]' + static #toolsTab = '[data-testid="tools-tab"]' + static #addToolButton = '[data-testid="add-tool-button"]' + static #toolConfigurationSelect = '[data-testid="configuration-select"]' + static #contextExternalToolConfiguratorPageTitle = '[data-testid="context-external-tool-configurator-title"]' + seeSectionOneAreaOnCourseCreatePage () { cy.get(Courses.#sectionOneAreaOnCourseCreationPage).should('exist') } @@ -154,12 +159,40 @@ class Courses { cy.get(Courses.#courseDetailPageTitle).should('contain.text', courseName) } + navigateToLtiTools () { + cy.get(Courses.#ltiToolsTab).click() + } + + addNewLtiTool () { + cy.get(Courses.#addNewToolButton).click() + } + navigateToTools () { cy.get(Courses.#toolsTab).click() } - addNewTool () { - cy.get(Courses.#addNewToolButton).click() + clickOnAddNewToolFAB () { + cy.get(Courses.#addToolButton).click() + } + + seeAddNewToolFAB () { + cy.get(Courses.#addToolButton).should('exist') + } + + seeNotAddNewToolFAB () { + cy.get(Courses.#addToolButton).should('not.exist') + } + + seeContextExternalToolConfiguratorPageTitle () { + cy.get(Courses.#contextExternalToolConfiguratorPageTitle).should('exist') + } + + clickOnToolConfigurationSelect () { + cy.get(Courses.#toolConfigurationSelect).click() + } + + enterAnToolName (toolName) { + cy.get(Courses.#toolConfigurationSelect).type(toolName) } courseIsVisibleOnOverviewPage (courseName) { diff --git a/cypress/support/step_definition/course/toolCourseSteps.spec.js b/cypress/support/step_definition/course/toolCourseSteps.spec.js new file mode 100644 index 00000000..95450b9a --- /dev/null +++ b/cypress/support/step_definition/course/toolCourseSteps.spec.js @@ -0,0 +1,35 @@ +const { When, Then } = require('@badeball/cypress-cucumber-preprocessor') +import Courses from '../../pages/course/pageCourses' + +const courses = new Courses() + +When('I click on the tools tab', () => { + courses.navigateToTools() +}) + +Then('I can see the button to add a tool', () => { + courses.seeAddNewToolFAB() +}) + +Then('I cant see the button to add a tool', () => { + courses.seeNotAddNewToolFAB() +}) + +When('I click on the button to add a tool', () => { + courses.clickOnAddNewToolFAB() +}) + +Then('I can see the tool configuration page', () => { + courses.seeContextExternalToolConfiguratorPageTitle() +}) + + +When('I click on the tool configuration selection', () => { + courses.clickOnToolConfigurationSelect() +}) + +Then('I can enter {string} as tool name', toolName => { + courses.enterAnToolName(toolName) +}) + + From d09a0081a93015c2543bc911dee5ba6bd1824169 Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Wed, 4 Oct 2023 15:14:21 +0200 Subject: [PATCH 02/25] N21-1297 review changes --- ...addToolToCourse.feature => addCtlToolToCourse.feature} | 8 ++++---- cypress/support/pages/course/pageCourses.js | 6 +++--- .../step_definition/course/toolCourseSteps.spec.js | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) rename cypress/e2e/course/{addToolToCourse.feature => addCtlToolToCourse.feature} (74%) diff --git a/cypress/e2e/course/addToolToCourse.feature b/cypress/e2e/course/addCtlToolToCourse.feature similarity index 74% rename from cypress/e2e/course/addToolToCourse.feature rename to cypress/e2e/course/addCtlToolToCourse.feature index 4c260e01..56ef562a 100644 --- a/cypress/e2e/course/addToolToCourse.feature +++ b/cypress/e2e/course/addCtlToolToCourse.feature @@ -1,7 +1,7 @@ @release -Feature: Course - To add a tool to a course +Feature: Course - To add a ctl tool to a course - As a teacher I want to add a new tool to my course. + As a teacher I want to add a new ctl tool to my course. @stable_test Scenario: Student cant see the button to add a tool @@ -19,6 +19,6 @@ Feature: Course - To add a tool to a course When I click on the tools tab Then I can see the button to add a tool When I click on the button to add a tool - Then I can see the tool configuration page + Then I can see the tool configuration page title When I click on the tool configuration selection - Then I can enter 'Test' as tool name + Then I can enter 'Test' as tool name in the selection diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index 4a702fd7..bf9dc0af 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -163,11 +163,11 @@ class Courses { cy.get(Courses.#ltiToolsTab).click() } - addNewLtiTool () { + clickOnAddNewLtiToolButton () { cy.get(Courses.#addNewToolButton).click() } - navigateToTools () { + navigateToToolsTab () { cy.get(Courses.#toolsTab).click() } @@ -191,7 +191,7 @@ class Courses { cy.get(Courses.#toolConfigurationSelect).click() } - enterAnToolName (toolName) { + enterAnToolNameInToolConfigurationSelect (toolName) { cy.get(Courses.#toolConfigurationSelect).type(toolName) } diff --git a/cypress/support/step_definition/course/toolCourseSteps.spec.js b/cypress/support/step_definition/course/toolCourseSteps.spec.js index 95450b9a..9ac8a73b 100644 --- a/cypress/support/step_definition/course/toolCourseSteps.spec.js +++ b/cypress/support/step_definition/course/toolCourseSteps.spec.js @@ -4,7 +4,7 @@ import Courses from '../../pages/course/pageCourses' const courses = new Courses() When('I click on the tools tab', () => { - courses.navigateToTools() + courses.navigateToToolsTab() }) Then('I can see the button to add a tool', () => { @@ -19,7 +19,7 @@ When('I click on the button to add a tool', () => { courses.clickOnAddNewToolFAB() }) -Then('I can see the tool configuration page', () => { +Then('I can see the tool configuration page title', () => { courses.seeContextExternalToolConfiguratorPageTitle() }) @@ -28,8 +28,8 @@ When('I click on the tool configuration selection', () => { courses.clickOnToolConfigurationSelect() }) -Then('I can enter {string} as tool name', toolName => { - courses.enterAnToolName(toolName) +Then('I can enter {string} as tool name in the selection', toolName => { + courses.enterAnToolNameInToolConfigurationSelect(toolName) }) From 78f1593342a2c809550c2a3c1e4175dfa702e7b3 Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Tue, 17 Oct 2023 15:52:51 +0200 Subject: [PATCH 03/25] add create class test and the scenarios for new class admin page --- .../group/showGroupsAndClassesInTable.feature | 40 +++++++++++++++++++ .../support/pages/admin/pageAdministration.js | 6 +++ cypress/support/pages/group/pageGroups.js | 28 +++++++++++++ .../group/commonGroupSteps.spec.js | 27 +++++++++++++ .../showGroupsAndClassesInTableSteps.spec.js | 0 5 files changed, 101 insertions(+) create mode 100644 cypress/e2e/group/showGroupsAndClassesInTable.feature create mode 100644 cypress/support/pages/group/pageGroups.js create mode 100644 cypress/support/step_definition/group/commonGroupSteps.spec.js create mode 100644 cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature new file mode 100644 index 00000000..b9053db8 --- /dev/null +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -0,0 +1,40 @@ +@release +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. + + @stable_test + Scenario: As a pre-condition teacher adds 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 + 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 am on the new class administration page + Then I can see the page title + And I can see 1 class and 1 group in the table + And the group does not have any action icons + And the class has 4 enabled action icons + #test And in this context + + Scenario: As a teacher i can manage my classes + When I click the manage icon + Then I can see the manage classes page + When I click the cancel manage 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 the manage icon + Then I can see the manage classes page + When I confirm managing the class + Then I see the new class administration page + + Scenario: As a teacher i can edit my classes + + Scenario: As a teacher i can upgrade my upgradable classes + + Scenario: As a teacher i can delete my classes diff --git a/cypress/support/pages/admin/pageAdministration.js b/cypress/support/pages/admin/pageAdministration.js index addbe8a1..ffe9cca8 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -29,6 +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 #teamAdministrationNavigationButton = '[data-testid="Teams"]' static #schoolAdministrationNavigationButton = '[data-testid="Schule"]' static #studentTeamCheckbox = '[data-testid="student_team_checkbox"]' @@ -124,6 +125,11 @@ class Management { cy.url().should('include', '/administration/classes') } + navigateToNewClassAdministration() { + cy.get(Management.#newClassAdministrationNavigationButton).click() + cy.url().should('include', '/administration/groups/classes') + } + navigateToTeamAdministration() { cy.get(Management.#teamAdministrationNavigationButton).eq(1).click() cy.url().should('include', '/administration/teams') diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js new file mode 100644 index 00000000..19b882ac --- /dev/null +++ b/cypress/support/pages/group/pageGroups.js @@ -0,0 +1,28 @@ +'use strict' + +class Groups { + static #cretaeClass = '[data-testid="createClass"]' + static #confirmClassCreate = '[data-testid="confirmClassCreate"]' + static #manageConfirm = '[data-testid="manage-confirm"]' + + clickCreateClass() { + cy.get(Groups.#cretaeClass) + .click() + } + + clickConfirmCreateClass() { + cy.get(Groups.#confirmClassCreate) + .click() + } + + clickConfirmManageClass() { + cy.get(Groups.#manageConfirm) + .click() + } + + isNewClassAdministrationPage() { + cy.url().should('include', '/administration/groups/classes') + } +} + +export default Groups diff --git a/cypress/support/step_definition/group/commonGroupSteps.spec.js b/cypress/support/step_definition/group/commonGroupSteps.spec.js new file mode 100644 index 00000000..34445078 --- /dev/null +++ b/cypress/support/step_definition/group/commonGroupSteps.spec.js @@ -0,0 +1,27 @@ +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 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() +}) diff --git a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js new file mode 100644 index 00000000..e69de29b From b9b43d2f69c45a28a5ba7e3d9038adae69f37458 Mon Sep 17 00:00:00 2001 From: Caspar Neumann Date: Thu, 19 Oct 2023 16:07:06 +0200 Subject: [PATCH 04/25] first GivenWhenThen Proposal H5P Editor E2E Test --- cypress/e2e/topics/accessH5PEditor.feature | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 cypress/e2e/topics/accessH5PEditor.feature diff --git a/cypress/e2e/topics/accessH5PEditor.feature b/cypress/e2e/topics/accessH5PEditor.feature new file mode 100644 index 00000000..80551b52 --- /dev/null +++ b/cypress/e2e/topics/accessH5PEditor.feature @@ -0,0 +1,14 @@ +@release +Feature: To access the H5P editor as a teacher. + +As a teacher, I want to access the H5P Editor for a topic in my course to create learning content + +@stable_test +Scenario: Access H5P Editor for existing topic + Given I am logged in as a 'teacher_1' at 'thr' + When I go to the courses page + And I click on the existing course 'Mathe' + And I click on the existing topic 'Testthema' + And I enter click on the edit button + And I click on the H5P button + Then a new window with a H5P editor should open \ No newline at end of file From 272da9ef7998430a1eef46b48a3e68e8215b4f3d Mon Sep 17 00:00:00 2001 From: Mrika Llabani Date: Thu, 19 Oct 2023 16:46:28 +0200 Subject: [PATCH 05/25] 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 a591a845820824f6cd78c9ea7cad7ff754726a83 Mon Sep 17 00:00:00 2001 From: Caspar Neumann Date: Thu, 19 Oct 2023 17:31:01 +0200 Subject: [PATCH 06/25] change h5p-editor-test feature file to default instance --- cypress/e2e/topics/accessH5PEditor.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/topics/accessH5PEditor.feature b/cypress/e2e/topics/accessH5PEditor.feature index 80551b52..cd85264a 100644 --- a/cypress/e2e/topics/accessH5PEditor.feature +++ b/cypress/e2e/topics/accessH5PEditor.feature @@ -5,7 +5,7 @@ As a teacher, I want to access the H5P Editor for a topic in my course to create @stable_test Scenario: Access H5P Editor for existing topic - Given I am logged in as a 'teacher_1' at 'thr' + Given I am logged in as a 'teacher1_dbc' at 'default' When I go to the courses page And I click on the existing course 'Mathe' And I click on the existing topic 'Testthema' From f59acb48182154b96f9aaa76d284eb35be674be9 Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Fri, 20 Oct 2023 09:50:02 +0200 Subject: [PATCH 07/25] WIP --- .../group/showGroupsAndClassesInTable.feature | 8 ++- cypress/support/pages/group/pageGroups.js | 64 +++++++++++++++++++ .../group/commonGroupSteps.spec.js | 16 +++++ .../showGroupsAndClassesInTableSteps.spec.js | 20 ++++++ 4 files changed, 105 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature index b9053db8..ddf8edba 100644 --- a/cypress/e2e/group/showGroupsAndClassesInTable.feature +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -13,15 +13,17 @@ Feature: Group - To show groups and classes in one table with respective functio And I confirm managing the class Then I see the new class administration page + #@stable_test Scenario: As a teacher i can see all classes and groups of my school on the new class administration page. - Given I am 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 1 class and 1 group in the table + And I can see at least 1 class and 1 group in the table And the group does not have any action icons And the class has 4 enabled action icons - #test And in this context + @stable_test Scenario: As a teacher i can manage my classes + Given I see the new class administration page When I click the manage icon Then I can see the manage classes page When I click the cancel manage class button diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js index 19b882ac..b2fde2c6 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/group/pageGroups.js @@ -4,6 +4,9 @@ class Groups { static #cretaeClass = '[data-testid="createClass"]' 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 #manageClassIcon = '[data-testid="class-table-manage-btn"]' clickCreateClass() { cy.get(Groups.#cretaeClass) @@ -20,9 +23,70 @@ class Groups { .click() } + clickCancelManageClass() { + cy.get('.btn-cancel') + .click() + } + + clickManageClassIcon() { + cy.get(Groups.#manageClassIcon) + .first().click() + } + isNewClassAdministrationPage() { cy.url().should('include', '/administration/groups/classes') } + + isManageClassPage() { + cy.url().should('include', '/administration/classes') + cy.url().should('include', '/manage') + } + + seeNewClassPageTitle() { + cy.get(Groups.#classTitleNew).should('exist') + } + + newClassTableContainsClassesAndGroups() { + const entries = cy.get(`${Groups.#classTableNew}>div>table>tbody`).children() + let classes = 0 + let groups = 0 + console.log(entries) + entries.each((entry) => { + console.log(entry) + if (entry.find('td').eq(1).innerText === "moin.schule") { + groups = groups + 1 + } + + if (entry.find('td').eq(1).innerText === "") { + classes = classes + 1 + } + console.log(classes, groups) + }) + expect(classes * groups).to.be.greaterThan(0) + } + + groupsHaveNoActionIcons() { + const entries = document.querySelector('[data-testid="admin-class-table"]').firstChild.firstChild.querySelector('tbody').children + const group = entries.filter((entry) => entry.children[1].innerText === "moin.schule") + + expect(group.children[3].children.length).to.equal(0) + } + + classesHave4ActiveActionIcons() { + const entries = document.querySelector('[data-testid="admin-class-table"]').firstChild.firstChild.querySelector('tbody').children + const clazz = entries.filter((entry) => entry.children[1].innerText === "") + const actionIcons = clazz.children[3].children + + expect(actionIcons.length).to.equal(4) + + let activeIcons = 0 + actionIcons.forEach((icon) => { + if (icon.attributes.disabled === false) { + activeIcons = activeIcons + 1 + } + }) + expect(activeIcons).to.equal(4) + } } export default Groups diff --git a/cypress/support/step_definition/group/commonGroupSteps.spec.js b/cypress/support/step_definition/group/commonGroupSteps.spec.js index 34445078..b4356502 100644 --- a/cypress/support/step_definition/group/commonGroupSteps.spec.js +++ b/cypress/support/step_definition/group/commonGroupSteps.spec.js @@ -25,3 +25,19 @@ When('I confirm managing the class', () => { Then('I see the new class administration page', () => { groups.isNewClassAdministrationPage() }) + +Then('I can see the page title', () => { + groups.seeNewClassPageTitle() +}) + +Then('I can see at least 1 class and 1 group in the table', () => { + groups.newClassTableContainsClassesAndGroups() +}) + +Then('the group does not have any action icons', () => { + groups.groupsHaveNoActionIcons() +}) + +Then('the class has 4 enabled action icons', () => { + groups.classesHave4ActiveActionIcons() +}) diff --git a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js index e69de29b..348a6c51 100644 --- a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js +++ b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js @@ -0,0 +1,20 @@ +const { When, Then } = require('@badeball/cypress-cucumber-preprocessor') +import Groups from '../../pages/group/pageGroups'; + +const groups = new Groups() + +When('I click the manage icon', () => { + groups.clickManageClassIcon() +}) + +Then('I can see the manage classes page', () => { + groups.isManageClassPage() +}) + +When('I click the cancel manage class button', () => { + groups.clickCancelManageClass() +}) + +Then('I can see the cancel modal', () => { + +}) From b5b3677f77a8d51d37e59e2b047c310ad781c4f3 Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Fri, 20 Oct 2023 11:29:45 +0200 Subject: [PATCH 08/25] N21-1264 fix test --- .../group/showGroupsAndClassesInTable.feature | 2 +- cypress/support/pages/group/pageGroups.js | 23 +++++++------------ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature index ddf8edba..d0432b1e 100644 --- a/cypress/e2e/group/showGroupsAndClassesInTable.feature +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -13,7 +13,7 @@ Feature: Group - To show groups and classes in one table with respective functio And I confirm managing the class Then I see the new class administration page - #@stable_test + @stable_test 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 diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js index b2fde2c6..a1c75b95 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/group/pageGroups.js @@ -47,24 +47,17 @@ class Groups { } newClassTableContainsClassesAndGroups() { - const entries = cy.get(`${Groups.#classTableNew}>div>table>tbody`).children() - let classes = 0 - let groups = 0 - console.log(entries) - entries.each((entry) => { - console.log(entry) - if (entry.find('td').eq(1).innerText === "moin.schule") { - groups = groups + 1 + cy.get(Groups.#classTableNew) + .find('tbody td:nth-child(2)') + .each(($td) => { + const text = $td.text().trim(); + if (text === '' || text === 'moin.schule') { + cy.wrap($td).should('be.visible'); } - - if (entry.find('td').eq(1).innerText === "") { - classes = classes + 1 - } - console.log(classes, groups) - }) - expect(classes * groups).to.be.greaterThan(0) + }); } + groupsHaveNoActionIcons() { const entries = document.querySelector('[data-testid="admin-class-table"]').firstChild.firstChild.querySelector('tbody').children const group = entries.filter((entry) => entry.children[1].innerText === "moin.schule") From 24eea89568acb249b9188bbc1d738865266c77fb Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Fri, 20 Oct 2023 12:00:42 +0200 Subject: [PATCH 09/25] manage and edit done --- .../group/showGroupsAndClassesInTable.feature | 19 +++++++-- cypress/support/pages/group/pageGroups.js | 41 +++++++++++++++++-- .../showGroupsAndClassesInTableSteps.spec.js | 30 ++++++++++++-- 3 files changed, 79 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature index d0432b1e..4f7bffee 100644 --- a/cypress/e2e/group/showGroupsAndClassesInTable.feature +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -24,18 +24,29 @@ Feature: Group - To show groups and classes in one table with respective functio @stable_test Scenario: As a teacher i can manage my classes Given I see the new class administration page - When I click the manage icon + When I click the manage button Then I can see the manage classes page When I click the cancel manage 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 the manage icon - Then I can see the manage classes page - When I confirm managing the class + When I click the manage button + And I confirm managing the class Then I see the new class administration page + @stable_test Scenario: As a teacher i can edit my classes + Given I see the new class administration page + When I click the edit button + Then I can see the edit classes page + When I click the cancel edit 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 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 Scenario: As a teacher i can upgrade my upgradable classes diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js index a1c75b95..2a96f3fc 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/group/pageGroups.js @@ -6,7 +6,9 @@ class Groups { static #manageConfirm = '[data-testid="manage-confirm"]' static #classTitleNew = '[data-testid="admin-class-title"]' static #classTableNew = '[data-testid="admin-class-table"]' - static #manageClassIcon = '[data-testid="class-table-manage-btn"]' + static #manageClassButton = '[data-testid="class-table-manage-btn"]' + static #cancelModal = '[data-testid="modal_content"]' + static #editClassButton = '[data-testid="class-table-edit-btn"]' clickCreateClass() { cy.get(Groups.#cretaeClass) @@ -23,16 +25,38 @@ class Groups { .click() } - clickCancelManageClass() { + clickCancelButton() { cy.get('.btn-cancel') .click() } - clickManageClassIcon() { - cy.get(Groups.#manageClassIcon) + clickManageClassButton() { + cy.get(Groups.#manageClassButton) .first().click() } + clickConfirmButton() { + cy.get('.historyback') + .click() + } + + clickEditClassButton() { + cy.get(Groups.#editClassButton) + .first().click() + } + + clickNameSuffixField() { + cy.get('[name=classsuffix]') + .click() + } + + clickSaveChangesButton() { + cy.get('.btn-primary') + .eq(0) + .should('not.be.disabled') + .click() + } + isNewClassAdministrationPage() { cy.url().should('include', '/administration/groups/classes') } @@ -42,6 +66,15 @@ class Groups { cy.url().should('include', '/manage') } + isEditClassPage() { + cy.url().should('include', '/administration/classes') + cy.url().should('include', '/edit') + } + + isCancelModal() { + cy.get(Groups.#cancelModal).should('exist') + } + seeNewClassPageTitle() { cy.get(Groups.#classTitleNew).should('exist') } diff --git a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js index 348a6c51..127bcb5f 100644 --- a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js +++ b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js @@ -3,8 +3,8 @@ import Groups from '../../pages/group/pageGroups'; const groups = new Groups() -When('I click the manage icon', () => { - groups.clickManageClassIcon() +When('I click the manage button', () => { + groups.clickManageClassButton() }) Then('I can see the manage classes page', () => { @@ -12,9 +12,33 @@ Then('I can see the manage classes page', () => { }) When('I click the cancel manage class button', () => { - groups.clickCancelManageClass() + groups.clickCancelButton() }) Then('I can see the cancel modal', () => { + groups.isCancelModal() +}) + +When('I click the confirmation button on the cancel modal', () => { + groups.clickConfirmButton() +}) + +When('I click the edit button', () => { + groups.clickEditClassButton() +}) + +Then('I can see the edit classes page', () => { + groups.isEditClassPage() +}) + +When('I click the cancel edit class button', () => { + groups.clickCancelButton() +}) + +When('I click in the name suffix text element', () => { + groups.clickNameSuffixField() +}) +Then('I can click on the save changes button', () => { + groups.clickSaveChangesButton() }) From 60c111dac2f8764361849fadc8ef2efe571f11c8 Mon Sep 17 00:00:00 2001 From: Caspar Neumann Date: Fri, 20 Oct 2023 12:19:40 +0200 Subject: [PATCH 10/25] create H5P Editor accedd test --- cypress/e2e/topics/accessH5PEditor.feature | 20 ++++++++++-------- cypress/support/pages/topics/pageTopics.js | 13 ++++++++++++ .../topics/accessH5PEditor.spec.js | 21 +++++++++++++++++++ 3 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 cypress/support/step_definition/topics/accessH5PEditor.spec.js diff --git a/cypress/e2e/topics/accessH5PEditor.feature b/cypress/e2e/topics/accessH5PEditor.feature index cd85264a..a9fa5a19 100644 --- a/cypress/e2e/topics/accessH5PEditor.feature +++ b/cypress/e2e/topics/accessH5PEditor.feature @@ -1,14 +1,16 @@ -@release -Feature: To access the H5P editor as a teacher. +@release +Feature: To access the H5P editor as a teacher. As a teacher, I want to access the H5P Editor for a topic in my course to create learning content @stable_test -Scenario: Access H5P Editor for existing topic +Scenario: Access H5P Editor Given I am logged in as a 'teacher1_dbc' at 'default' - When I go to the courses page - And I click on the existing course 'Mathe' - And I click on the existing topic 'Testthema' - And I enter click on the edit button - And I click on the H5P button - Then a new window with a H5P editor should open \ No newline at end of file + When I go to rooms overview + When I go to room 'Course with subject and tasks' + When I click on topic 'Statistic' on course page + When I click on the button Edit on topic page + When I click on the Add Content H5P button + Then I can click on the Create H5P button + + diff --git a/cypress/support/pages/topics/pageTopics.js b/cypress/support/pages/topics/pageTopics.js index 6b4130b2..0b772f2f 100644 --- a/cypress/support/pages/topics/pageTopics.js +++ b/cypress/support/pages/topics/pageTopics.js @@ -11,6 +11,8 @@ class Topics { static #addLearningMaterialBtn = '[data-testid="topic-addcontent-material-btn"]' static #addEtherpadBtn = '[data-testid="topic-addcontent-etherpad-btn"]' static #addTaskBtn = '[data-testid="topic-addcontent-task-btn"]' + static #addContentH5pBtn = '[data-testid="topic-addcontent-h5p-btn"]' + static #createH5pBtn = '[data-testid="topic-h5p-create-btn"]' // class is used for cardHeader and cardBlock because the elements are too generic and depend on position of the element, so using data-testid would need much more logic (also in the feature file) and code than using class. static #cardHeader = '[class="card-header"]' static #cardBlock = '[class="card-block"]' @@ -71,11 +73,22 @@ class Topics { cy.get(Topics.#addTaskBtn).click() } + clickOnAddContentH5PToTopic() { + cy.get(Topics.#addContentH5pBtn).click() + } + + seeCreateH5PInTopic() { + cy.get(Topics.#createH5pBtn) + .should('exist') + } + clickOnSubmitChangesInTopicBtn() { cy.get(Topics.#submitChangesInTopicBtn) .click() } + + seeFormElementText(textElementPosition) { if(textElementPosition === '0'){ cy.get(Topics.#textElementPos0).should('exist') diff --git a/cypress/support/step_definition/topics/accessH5PEditor.spec.js b/cypress/support/step_definition/topics/accessH5PEditor.spec.js new file mode 100644 index 00000000..d9d21f2f --- /dev/null +++ b/cypress/support/step_definition/topics/accessH5PEditor.spec.js @@ -0,0 +1,21 @@ +const { When, Then } = require("@badeball/cypress-cucumber-preprocessor") +import Topics from '../../pages/topics/pageTopics' +import Courses from '../../pages/course/pageCourses' + + +const topics = new Topics() +const courses = new Courses() + +When('I click on the Add Content H5P button', () =>{ + topics.clickOnAddContentH5PToTopic(); +}) + +When('I click on the button Edit on topic page', () => { + topics.clickOnButtonEditInTopicPage() + }) + + Then('I can click on the Create H5P button', ()=>{ + topics.seeCreateH5PInTopic(); + }) + + From 8978658e1ff62df24f12eedfaf01df68a4a89512 Mon Sep 17 00:00:00 2001 From: Caspar Neumann Date: Fri, 20 Oct 2023 12:31:21 +0200 Subject: [PATCH 11/25] add click i Then for create h5p button --- cypress/support/pages/topics/pageTopics.js | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/support/pages/topics/pageTopics.js b/cypress/support/pages/topics/pageTopics.js index 0b772f2f..e42b7f7a 100644 --- a/cypress/support/pages/topics/pageTopics.js +++ b/cypress/support/pages/topics/pageTopics.js @@ -80,6 +80,7 @@ class Topics { seeCreateH5PInTopic() { cy.get(Topics.#createH5pBtn) .should('exist') + .click() } clickOnSubmitChangesInTopicBtn() { From c43918fcc35a185b2b29193609af78a571ec57bc Mon Sep 17 00:00:00 2001 From: Caspar Neumann Date: Fri, 20 Oct 2023 12:34:41 +0200 Subject: [PATCH 12/25] Refactor: H5P Editor e2e test --- cypress/e2e/topics/accessH5PEditor.feature | 2 +- .../topics/accessH5PEditor.spec.js | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cypress/e2e/topics/accessH5PEditor.feature b/cypress/e2e/topics/accessH5PEditor.feature index a9fa5a19..19ac2cdc 100644 --- a/cypress/e2e/topics/accessH5PEditor.feature +++ b/cypress/e2e/topics/accessH5PEditor.feature @@ -1,7 +1,7 @@ @release Feature: To access the H5P editor as a teacher. -As a teacher, I want to access the H5P Editor for a topic in my course to create learning content +As a teacher, I want to be able to access the H5P Editor for a topic in my course to create learning content @stable_test Scenario: Access H5P Editor diff --git a/cypress/support/step_definition/topics/accessH5PEditor.spec.js b/cypress/support/step_definition/topics/accessH5PEditor.spec.js index d9d21f2f..110cf070 100644 --- a/cypress/support/step_definition/topics/accessH5PEditor.spec.js +++ b/cypress/support/step_definition/topics/accessH5PEditor.spec.js @@ -1,21 +1,18 @@ const { When, Then } = require("@badeball/cypress-cucumber-preprocessor") import Topics from '../../pages/topics/pageTopics' -import Courses from '../../pages/course/pageCourses' - const topics = new Topics() -const courses = new Courses() + +When('I click on the button Edit on topic page', () => { + topics.clickOnButtonEditInTopicPage() +}) When('I click on the Add Content H5P button', () =>{ topics.clickOnAddContentH5PToTopic(); }) -When('I click on the button Edit on topic page', () => { - topics.clickOnButtonEditInTopicPage() - }) - - Then('I can click on the Create H5P button', ()=>{ +Then('I can click on the Create H5P button', ()=>{ topics.seeCreateH5PInTopic(); - }) +}) From 51dc4e6e22a3a9d69a434f3fbbdc25eca3b06a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20=C3=96hlerking?= Date: Fri, 20 Oct 2023 13:43:08 +0200 Subject: [PATCH 13/25] test display of all groups and classes --- .../group/showGroupsAndClassesInTable.feature | 7 ++-- cypress/support/pages/group/pageGroups.js | 39 +++++++------------ .../group/commonGroupSteps.spec.js | 32 ++++++++------- 3 files changed, 37 insertions(+), 41 deletions(-) diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature index d0432b1e..37d31f60 100644 --- a/cypress/e2e/group/showGroupsAndClassesInTable.feature +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -17,9 +17,10 @@ Feature: Group - To show groups and classes in one table with respective functio 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 at least 1 class and 1 group in the table - And the group does not have any action icons - And the class has 4 enabled action icons + And I can see the group 'TestSchulklasse' with source 'moin.schule' + And I can see the class '1' without source + And the group 'TestSchulklasse' does not have any action items + And the class '1' has 4 enabled action items @stable_test Scenario: As a teacher i can manage my classes diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js index a1c75b95..d368a79a 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/group/pageGroups.js @@ -46,39 +46,30 @@ class Groups { cy.get(Groups.#classTitleNew).should('exist') } - newClassTableContainsClassesAndGroups() { - cy.get(Groups.#classTableNew) - .find('tbody td:nth-child(2)') - .each(($td) => { - const text = $td.text().trim(); - if (text === '' || text === 'moin.schule') { - cy.wrap($td).should('be.visible'); - } + newClassTableContainsClass(className, sourceName) { + const classNameData = cy.get(Groups.#classTableNew).find('td').contains(className); + + classNameData.should('be.visible'); + classNameData.siblings('td').eq(0).should(($td) => { + expect($td.text().trim()).to.equal(sourceName); }); } + groupsHaveNoActionItems(groupName) { + const classNameData = cy.get(Groups.#classTableNew).find('td').contains(groupName); - groupsHaveNoActionIcons() { - const entries = document.querySelector('[data-testid="admin-class-table"]').firstChild.firstChild.querySelector('tbody').children - const group = entries.filter((entry) => entry.children[1].innerText === "moin.schule") - - expect(group.children[3].children.length).to.equal(0) + classNameData.siblings('td').eq(2).should('be.empty'); } - classesHave4ActiveActionIcons() { - const entries = document.querySelector('[data-testid="admin-class-table"]').firstChild.firstChild.querySelector('tbody').children - const clazz = entries.filter((entry) => entry.children[1].innerText === "") - const actionIcons = clazz.children[3].children + classesHave4ActiveActionItems(className) { + const classNameData = cy.get(Groups.#classTableNew).find('td').contains(className); - expect(actionIcons.length).to.equal(4) + const buttons = classNameData.siblings('td').eq(2).find('a, button'); - let activeIcons = 0 - actionIcons.forEach((icon) => { - if (icon.attributes.disabled === false) { - activeIcons = activeIcons + 1 - } + buttons.should('have.length', 4); + buttons.each(($btn) => { + cy.wrap($btn).should('not.be.disabled'); }) - expect(activeIcons).to.equal(4) } } diff --git a/cypress/support/step_definition/group/commonGroupSteps.spec.js b/cypress/support/step_definition/group/commonGroupSteps.spec.js index b4356502..8d2b504b 100644 --- a/cypress/support/step_definition/group/commonGroupSteps.spec.js +++ b/cypress/support/step_definition/group/commonGroupSteps.spec.js @@ -3,41 +3,45 @@ import Groups from '../../pages/group/pageGroups' import Management from '../../pages/admin/pageAdministration'; -const groups = new Groups() -const management = new Management() +const groups = new Groups(); +const management = new Management(); When('I go to class administration', () => { - management.navigateToClassAdministration() + management.navigateToClassAdministration(); }) When('I click on add class', () => { - groups.clickCreateClass() + groups.clickCreateClass(); }) When('I click on the confirm button', () => { - groups.clickConfirmCreateClass() + groups.clickConfirmCreateClass(); }) When('I confirm managing the class', () => { - groups.clickConfirmManageClass() + groups.clickConfirmManageClass(); }) Then('I see the new class administration page', () => { - groups.isNewClassAdministrationPage() + groups.isNewClassAdministrationPage(); }) Then('I can see the page title', () => { - groups.seeNewClassPageTitle() + groups.seeNewClassPageTitle(); }) -Then('I can see at least 1 class and 1 group in the table', () => { - groups.newClassTableContainsClassesAndGroups() +Then('I can see the group {string} with source {string}', (groupName, systemName) => { + groups.newClassTableContainsClass(groupName, systemName); }) -Then('the group does not have any action icons', () => { - groups.groupsHaveNoActionIcons() +Then('I can see the class {string} without source', (className) => { + groups.newClassTableContainsClass(className, ""); }) -Then('the class has 4 enabled action icons', () => { - groups.classesHave4ActiveActionIcons() +Then('the group {string} does not have any action items', (groupName) => { + groups.groupsHaveNoActionItems(groupName); +}) + +Then('the class {string} has 4 enabled action items', (className) => { + groups.classesHave4ActiveActionItems(className); }) From 013b781a566f8739f97c9d5939af1d6553aa169a Mon Sep 17 00:00:00 2001 From: Mrika Llabani Date: Fri, 20 Oct 2023 14:28:19 +0200 Subject: [PATCH 14/25] 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 e5e7dff9f19df8c46771057449a0e3af5ad7eacf Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Fri, 20 Oct 2023 14:31:34 +0200 Subject: [PATCH 15/25] successor and delete --- .../group/showGroupsAndClassesInTable.feature | 23 +++++ cypress/support/pages/group/pageGroups.js | 94 ++++++++++++++----- .../showGroupsAndClassesInTableSteps.spec.js | 55 +++++++++-- 3 files changed, 138 insertions(+), 34 deletions(-) diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature index 3ceedf9d..00c256fc 100644 --- a/cypress/e2e/group/showGroupsAndClassesInTable.feature +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -49,6 +49,29 @@ Feature: Group - To show groups and classes in one table with respective functio Then I can click on the save changes button And I see the new class administration page + @stable_test Scenario: As a teacher i can upgrade my upgradable classes + Given I see the new class administration page + When I click the create successor button + Then I can see the create successor page + When I click the cancel create successor 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 the create successor button + 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 + @stable_test Scenario: As a teacher i can delete my classes + Given I see the new class administration page + When I click the delete button + Then I can see the delete modal + 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 + Then I see the new class administration page + #And diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js index b3808413..1583e418 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/group/pageGroups.js @@ -1,82 +1,128 @@ 'use strict' class Groups { - static #cretaeClass = '[data-testid="createClass"]' - 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 #manageClassButton = '[data-testid="class-table-manage-btn"]' - static #cancelModal = '[data-testid="modal_content"]' - static #editClassButton = '[data-testid="class-table-edit-btn"]' + static #cretaeClass = '[data-testid="createClass"]'; + 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 #manageClassButton = '[data-testid="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 #deleteDialogCancel = '[data-testid="dialog-cancel"]'; + static #deleteDialogConfirm = '[data-testid="dialog-confirm"]'; clickCreateClass() { cy.get(Groups.#cretaeClass) - .click() + .click(); } clickConfirmCreateClass() { cy.get(Groups.#confirmClassCreate) - .click() + .click(); } clickConfirmManageClass() { cy.get(Groups.#manageConfirm) - .click() + .click(); } clickCancelButton() { cy.get('.btn-cancel') - .click() + .click(); } clickManageClassButton() { cy.get(Groups.#manageClassButton) - .first().click() + .first().click(); } clickConfirmButton() { cy.get('.historyback') - .click() + .click(); } clickEditClassButton() { cy.get(Groups.#editClassButton) - .first().click() + .first().click(); } clickNameSuffixField() { cy.get('[name=classsuffix]') - .click() + .click(); + } + + clickCreateSuccessorButton() { + cy.get(Groups.#createSuccessorButton) + .first().click(); } clickSaveChangesButton() { cy.get('.btn-primary') .eq(0) .should('not.be.disabled') - .click() + .click(); + } + + clickConfirmSuccessor() { + cy.get('.btn-primary') + .eq(0) + .click(); + } + + clickDeleteButton() { + cy.get(Groups.#deleteClassButton) + .first().click(); + } + + clickCancelDeleteDialogButton() { + cy.get(Groups.#deleteDialogCancel) + .click(); + } + + clickConfirmDeleteDialogButton() { + cy.get(Groups.#deleteDialogConfirm) + .click(); } isNewClassAdministrationPage() { - cy.url().should('include', '/administration/groups/classes') + cy.url().should('include', '/administration/groups/classes'); } isManageClassPage() { - cy.url().should('include', '/administration/classes') - cy.url().should('include', '/manage') + cy.url().should('include', '/administration/classes'); + cy.url().should('include', '/manage'); } isEditClassPage() { - cy.url().should('include', '/administration/classes') - cy.url().should('include', '/edit') + cy.url().should('include', '/administration/classes'); + cy.url().should('include', '/edit'); } isCancelModal() { - cy.get(Groups.#cancelModal).should('exist') + cy.get(Groups.#cancelModal).should('exist'); + } + + isCreateSuccessorPage() { + cy.url().should('include', '/administration/classes'); + cy.url().should('include', '/createSuccessor'); } seeNewClassPageTitle() { - cy.get(Groups.#classTitleNew).should('exist') + cy.get(Groups.#classTitleNew).should('exist'); + } + + isSuccessorButtonDisabled() { + cy.get(Groups.#createSuccessorButton) + .first().should('have.class', 'v-btn--disabled'); + } + + isDeleteDialog() { + cy.get(Groups.#deleteDialog) + .should('be.visible'); } newClassTableContainsClass(className, sourceName) { diff --git a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js index 127bcb5f..30e29a22 100644 --- a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js +++ b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js @@ -4,41 +4,76 @@ import Groups from '../../pages/group/pageGroups'; const groups = new Groups() When('I click the manage button', () => { - groups.clickManageClassButton() + groups.clickManageClassButton(); }) Then('I can see the manage classes page', () => { - groups.isManageClassPage() + groups.isManageClassPage(); }) When('I click the cancel manage class button', () => { - groups.clickCancelButton() + groups.clickCancelButton(); }) Then('I can see the cancel modal', () => { - groups.isCancelModal() + groups.isCancelModal(); }) When('I click the confirmation button on the cancel modal', () => { - groups.clickConfirmButton() + groups.clickConfirmButton(); }) When('I click the edit button', () => { - groups.clickEditClassButton() + groups.clickEditClassButton(); }) Then('I can see the edit classes page', () => { - groups.isEditClassPage() + groups.isEditClassPage(); }) When('I click the cancel edit class button', () => { - groups.clickCancelButton() + groups.clickCancelButton(); }) When('I click in the name suffix text element', () => { - groups.clickNameSuffixField() + groups.clickNameSuffixField(); }) Then('I can click on the save changes button', () => { - groups.clickSaveChangesButton() + groups.clickSaveChangesButton(); +}) + +When('I click the create successor button', () => { + groups.clickCreateSuccessorButton(); +}) + +Then('I can see the create successor page', () => { + groups.isCreateSuccessorPage(); +}) + +When('I click the cancel create successor button', () => { + groups.clickCancelButton(); +}) + +When('I confirm creating the successor', () => { + groups.clickConfirmSuccessor(); +}) +Then('the create successor button of the original class is disabled', () => { + groups.isSuccessorButtonDisabled(); +}) + +When('I click the delete button', () => { + groups.clickDeleteButton(); +}) + +Then('I can see the delete modal', () => { + groups.isDeleteDialog(); +}) + +When('I click the cancel button on the delete modal', () => { + groups.clickCancelDeleteDialogButton(); +}) + +When('I click the confirmation button on the delete modal', () => { + groups.clickConfirmDeleteDialogButton(); }) From 906f7f5686faebe5f1f31c1c9269a5ded4a98c4a Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Fri, 20 Oct 2023 14:43:40 +0200 Subject: [PATCH 16/25] clean up --- cypress/e2e/group/showGroupsAndClassesInTable.feature | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature index 00c256fc..98f938f3 100644 --- a/cypress/e2e/group/showGroupsAndClassesInTable.feature +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -74,4 +74,10 @@ Feature: Group - To show groups and classes in one table with respective functio When I click the delete button And I click the confirmation button on the delete modal Then I see the new class administration page - #And + + @stable_test + Scenario: As a post-condition teacher deletes the successor class and logs out + Given I see the new class administration page + When I click the delete button + And I click the confirmation button on the delete modal + Then I see the new class administration page From d0cd74a1e3efc149c77c17a42cbe37d1b56c63db Mon Sep 17 00:00:00 2001 From: Mrika Llabani Date: Fri, 20 Oct 2023 15:13:46 +0200 Subject: [PATCH 17/25] 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 e7b900f2f62daa9277c7b30c7284025c6a5891d5 Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Fri, 20 Oct 2023 15:25:19 +0200 Subject: [PATCH 18/25] N21-1207 init --- cypress/e2e/group/groupMembers.feature | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 cypress/e2e/group/groupMembers.feature diff --git a/cypress/e2e/group/groupMembers.feature b/cypress/e2e/group/groupMembers.feature new file mode 100644 index 00000000..c06323dc --- /dev/null +++ b/cypress/e2e/group/groupMembers.feature @@ -0,0 +1,9 @@ +@release +Feature: Group - To show members in a group + + As a teacher i want to see the members in a group + + @stable_test + Scenario: As a teacher i can manage classes from external systems + Given I am logged in as a 'teacher1_nbc' at 'nbc' + # add tests From 0cb54e362e69ca1abadb9bc1152222723542c5d3 Mon Sep 17 00:00:00 2001 From: Mrika Llabani Date: Fri, 20 Oct 2023 15:27:41 +0200 Subject: [PATCH 19/25] 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 From 208a708b7573ed724add83efe78fc76bc3aa2cae Mon Sep 17 00:00:00 2001 From: Marcin Date: Mon, 23 Oct 2023 12:20:22 +0200 Subject: [PATCH 20/25] move file changeLanguage.feature from account folder to dashboard folder --- cypress/e2e/{account => dashboard}/changeLanguage.feature | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cypress/e2e/{account => dashboard}/changeLanguage.feature (100%) diff --git a/cypress/e2e/account/changeLanguage.feature b/cypress/e2e/dashboard/changeLanguage.feature similarity index 100% rename from cypress/e2e/account/changeLanguage.feature rename to cypress/e2e/dashboard/changeLanguage.feature From 07e546a99d28461aa114328623db18b4883a82b0 Mon Sep 17 00:00:00 2001 From: Igor Richter <93926487+IgorCapCoder@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:30:07 +0200 Subject: [PATCH 21/25] N21 1264 new class page extension (#151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - test new class overview page - test all 4 action buttons --------- Co-authored-by: Arne Gnisa Co-authored-by: Marvin Öhlerking --- .../group/showGroupsAndClassesInTable.feature | 83 ++++++++++ .../support/pages/admin/pageAdministration.js | 6 + cypress/support/pages/group/pageGroups.js | 156 ++++++++++++++++++ .../group/commonGroupSteps.spec.js | 47 ++++++ .../showGroupsAndClassesInTableSteps.spec.js | 79 +++++++++ 5 files changed, 371 insertions(+) create mode 100644 cypress/e2e/group/showGroupsAndClassesInTable.feature create mode 100644 cypress/support/pages/group/pageGroups.js create mode 100644 cypress/support/step_definition/group/commonGroupSteps.spec.js create mode 100644 cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js diff --git a/cypress/e2e/group/showGroupsAndClassesInTable.feature b/cypress/e2e/group/showGroupsAndClassesInTable.feature new file mode 100644 index 00000000..faca0496 --- /dev/null +++ b/cypress/e2e/group/showGroupsAndClassesInTable.feature @@ -0,0 +1,83 @@ +@release +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. + + @stable_test + Scenario: As a pre-condition teacher adds 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 + Then I see the new class administration page + + @stable_test + 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 + + @stable_test + Scenario: As a teacher i can manage my classes + Given I see the new class administration page + When I click the manage button + Then I can see the manage classes page + When I click the cancel manage 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 the manage button + And I confirm managing the class + Then I see the new class administration page + + @stable_test + Scenario: As a teacher i can edit my classes + Given I see the new class administration page + When I click the edit button + Then I can see the edit classes page + When I click the cancel edit 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 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 + + @stable_test + Scenario: As a teacher i can upgrade my upgradable classes + Given I see the new class administration page + When I click the create successor button + Then I can see the create successor page + When I click the cancel create successor 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 the create successor button + 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 + + @stable_test + Scenario: As a teacher i can delete my classes + Given I see the new class administration page + When I click the delete button + Then I can see the delete modal + 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 + Then I see the new class administration page + + @stable_test + Scenario: As a post-condition teacher deletes the successor class and logs out + Given I see the new class administration page + When I click the delete button + And I click the confirmation button on the delete modal + Then I see the new class administration page diff --git a/cypress/support/pages/admin/pageAdministration.js b/cypress/support/pages/admin/pageAdministration.js index addbe8a1..ffe9cca8 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -29,6 +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 #teamAdministrationNavigationButton = '[data-testid="Teams"]' static #schoolAdministrationNavigationButton = '[data-testid="Schule"]' static #studentTeamCheckbox = '[data-testid="student_team_checkbox"]' @@ -124,6 +125,11 @@ class Management { cy.url().should('include', '/administration/classes') } + navigateToNewClassAdministration() { + cy.get(Management.#newClassAdministrationNavigationButton).click() + cy.url().should('include', '/administration/groups/classes') + } + navigateToTeamAdministration() { cy.get(Management.#teamAdministrationNavigationButton).eq(1).click() cy.url().should('include', '/administration/teams') diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js new file mode 100644 index 00000000..91df2cae --- /dev/null +++ b/cypress/support/pages/group/pageGroups.js @@ -0,0 +1,156 @@ +'use strict' + +class Groups { + static #createClass = '[data-testid="createClass"]'; + 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 #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 #deleteDialogCancel = '[data-testid="dialog-cancel"]'; + static #deleteDialogConfirm = '[data-testid="dialog-confirm"]'; + + clickCreateClass() { + cy.get(Groups.#createClass) + .click(); + } + + clickConfirmCreateClass() { + cy.get(Groups.#confirmClassCreate) + .click(); + } + + clickConfirmManageClass() { + cy.get(Groups.#manageConfirm) + .click(); + } + + clickCancelButton() { + cy.get('.btn-cancel') + .click(); + } + + clickManageClassButton() { + cy.get(Groups.#manageClassButton) + .first().click(); + } + + clickConfirmButton() { + cy.get('.historyback') + .click(); + } + + clickEditClassButton() { + cy.get(Groups.#editClassButton) + .first().click(); + } + + clickNameSuffixField() { + cy.get('[name=classsuffix]') + .click(); + } + + clickCreateSuccessorButton() { + cy.get(Groups.#createSuccessorButton) + .first().click(); + } + + clickSaveChangesButton() { + cy.get('.btn-primary') + .eq(0) + .should('not.be.disabled') + .click(); + } + + clickConfirmSuccessor() { + cy.get('.btn-primary') + .eq(0) + .click(); + } + + clickDeleteButton() { + cy.get(Groups.#deleteClassButton) + .first().click(); + } + + clickCancelDeleteDialogButton() { + cy.get(Groups.#deleteDialogCancel) + .click(); + } + + clickConfirmDeleteDialogButton() { + cy.get(Groups.#deleteDialogConfirm) + .click(); + } + + isNewClassAdministrationPage() { + cy.url().should('include', '/administration/groups/classes'); + } + + isManageClassPage() { + cy.url().should('include', '/administration/classes'); + cy.url().should('include', '/manage'); + } + + isEditClassPage() { + cy.url().should('include', '/administration/classes'); + cy.url().should('include', '/edit'); + } + + isCancelModal() { + cy.get(Groups.#cancelModal).should('exist'); + } + + isCreateSuccessorPage() { + cy.url().should('include', '/administration/classes'); + cy.url().should('include', '/createSuccessor'); + } + + seeNewClassPageTitle() { + cy.get(Groups.#classTitleNew).should('exist'); + } + + isSuccessorButtonDisabled() { + cy.get(Groups.#createSuccessorButton) + .first().should('have.class', 'v-btn--disabled'); + } + + isDeleteDialog() { + cy.get(Groups.#deleteDialog) + .should('be.visible'); + } + + newClassTableContainsClass(className, sourceName) { + const classNameData = cy.get(Groups.#classTableNew).find('td').contains(className); + + classNameData.should('be.visible'); + classNameData.siblings('td').eq(0).should(($td) => { + expect($td.text().trim()).to.equal(sourceName); + }); + } + + groupsHaveAManageButton(groupName) { + const classNameData = cy.get(Groups.#classTableNew).find('td').contains(groupName); + + classNameData.siblings('td').eq(2).find('a[data-testid="class-table-members-manage-btn"]') + .should('exist'); + } + + classesHave4ActiveActionItems(className) { + const classNameData = cy.get(Groups.#classTableNew).find('td').contains(className); + + const buttons = classNameData.siblings('td').eq(2).find('a, button'); + + buttons.should('have.length', 4); + buttons.each(($btn) => { + cy.wrap($btn).should('not.be.disabled'); + }) + } +} + +export default Groups diff --git a/cypress/support/step_definition/group/commonGroupSteps.spec.js b/cypress/support/step_definition/group/commonGroupSteps.spec.js new file mode 100644 index 00000000..50598920 --- /dev/null +++ b/cypress/support/step_definition/group/commonGroupSteps.spec.js @@ -0,0 +1,47 @@ +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 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); +}) diff --git a/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js new file mode 100644 index 00000000..30e29a22 --- /dev/null +++ b/cypress/support/step_definition/group/showGroupsAndClassesInTableSteps.spec.js @@ -0,0 +1,79 @@ +const { When, Then } = require('@badeball/cypress-cucumber-preprocessor') +import Groups from '../../pages/group/pageGroups'; + +const groups = new Groups() + +When('I click the manage button', () => { + groups.clickManageClassButton(); +}) + +Then('I can see the manage classes page', () => { + groups.isManageClassPage(); +}) + +When('I click the cancel manage class button', () => { + groups.clickCancelButton(); +}) + +Then('I can see the cancel modal', () => { + groups.isCancelModal(); +}) + +When('I click the confirmation button on the cancel modal', () => { + groups.clickConfirmButton(); +}) + +When('I click the edit button', () => { + groups.clickEditClassButton(); +}) + +Then('I can see the edit classes page', () => { + groups.isEditClassPage(); +}) + +When('I click the cancel edit class button', () => { + groups.clickCancelButton(); +}) + +When('I click in the name suffix text element', () => { + groups.clickNameSuffixField(); +}) + +Then('I can click on the save changes button', () => { + groups.clickSaveChangesButton(); +}) + +When('I click the create successor button', () => { + groups.clickCreateSuccessorButton(); +}) + +Then('I can see the create successor page', () => { + groups.isCreateSuccessorPage(); +}) + +When('I click the cancel create successor button', () => { + groups.clickCancelButton(); +}) + +When('I confirm creating the successor', () => { + groups.clickConfirmSuccessor(); +}) +Then('the create successor button of the original class is disabled', () => { + groups.isSuccessorButtonDisabled(); +}) + +When('I click the delete button', () => { + groups.clickDeleteButton(); +}) + +Then('I can see the delete modal', () => { + groups.isDeleteDialog(); +}) + +When('I click the cancel button on the delete modal', () => { + groups.clickCancelDeleteDialogButton(); +}) + +When('I click the confirmation button on the delete modal', () => { + groups.clickConfirmDeleteDialogButton(); +}) From dd40102ff22dc01c94cb52cad07b57fba851cb47 Mon Sep 17 00:00:00 2001 From: Malte Berg Date: Mon, 23 Oct 2023 14:56:14 +0200 Subject: [PATCH 22/25] add test --- cypress/e2e/group/groupMembers.feature | 12 +++++- cypress/support/pages/group/pageGroups.js | 40 +++++++++++++++++++ .../group/commonGroupSteps.spec.js | 4 ++ .../group/manageGroups.spec.js | 32 +++++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 cypress/support/step_definition/group/manageGroups.spec.js diff --git a/cypress/e2e/group/groupMembers.feature b/cypress/e2e/group/groupMembers.feature index c06323dc..d12e8388 100644 --- a/cypress/e2e/group/groupMembers.feature +++ b/cypress/e2e/group/groupMembers.feature @@ -6,4 +6,14 @@ Feature: Group - To show members in a group @stable_test Scenario: As a teacher i can manage classes from external systems Given I am logged in as a 'teacher1_nbc' at 'nbc' - # add tests + 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' + 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/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js index 1583e418..1279eba0 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/group/pageGroups.js @@ -14,6 +14,11 @@ class Groups { static #deleteDialog = '.v-dialog--active'; static #deleteDialogCancel = '[data-testid="dialog-cancel"]'; static #deleteDialogConfirm = '[data-testid="dialog-confirm"]'; + static #adminClassTitle = '[data-testid="admin-class-title"]'; + static #groupMemberTable = '[data-testid="class-members-table"]'; + 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"]'; clickCreateClass() { cy.get(Groups.#cretaeClass) @@ -150,6 +155,41 @@ class Groups { cy.wrap($btn).should('not.be.disabled'); }) } + + seeManageGroupPage(){ + cy.url().should('include', '/administration/groups/classes/'); + } + + seeManageGroupPageTitle() { + cy.get(Groups.#adminClassTitle).should('be.visible') + } + + seeGroupMemberTable() { + cy.get(Groups.#groupMemberTable).should('be.visible') + } + + seeGroupMemberTableContainsMember(role, lastName){ + const groupMemberData = cy.get(Groups.#groupMemberTable).find('td').contains(lastName); + + groupMemberData.should('be.visible'); + groupMemberData.siblings('td').eq(1).should(($td) => { + expect($td.text().trim()).to.equal(role); + }); + } + + seeClassMemberInfoBox() { + cy.get(Groups.#classMemberInfoBox).should('be.visible') + } + + seeClassMemberInfoBoxText() { + cy.get(Groups.#classMemberInfoBoxText).should('be.visible') + } + + clickManageGroupButton(){ + cy.get(Groups.#manageGroupButton) + .first().click(); + } + } export default Groups diff --git a/cypress/support/step_definition/group/commonGroupSteps.spec.js b/cypress/support/step_definition/group/commonGroupSteps.spec.js index 8d2b504b..92d35bab 100644 --- a/cypress/support/step_definition/group/commonGroupSteps.spec.js +++ b/cypress/support/step_definition/group/commonGroupSteps.spec.js @@ -10,6 +10,10 @@ 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(); }) diff --git a/cypress/support/step_definition/group/manageGroups.spec.js b/cypress/support/step_definition/group/manageGroups.spec.js new file mode 100644 index 00000000..9dfd79fe --- /dev/null +++ b/cypress/support/step_definition/group/manageGroups.spec.js @@ -0,0 +1,32 @@ +import Groups from "../../pages/group/pageGroups"; +import {Then, When} from "@badeball/cypress-cucumber-preprocessor"; + +const groups = new Groups(); + +When('I click the manage group button', () => { + groups.clickManageGroupButton(); +}) + +Then('I can see the manage group page', () => { + groups.seeManageGroupPage(); +}) + +Then('I can see the manage group page title', () => { + groups.seeManageGroupPageTitle() +}) + +Then('I can see the group member table', () => { + groups.seeGroupMemberTable() +}) + +Then('I can see the {string} with name {string}', (role, lastName) => { + groups.seeGroupMemberTableContainsMember(role, lastName) +}) + +Then('I can see the infobox', () => { + groups.seeClassMemberInfoBox() +}) + +Then('I can see the infotext', () => { + groups.seeClassMemberInfoBoxText() +}) From 17282c56556cfbc17f4bb32669a5a47f68c8461d Mon Sep 17 00:00:00 2001 From: Malte Berg Date: Mon, 23 Oct 2023 15:07:22 +0200 Subject: [PATCH 23/25] fix --- cypress/support/pages/group/pageGroups.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/support/pages/group/pageGroups.js b/cypress/support/pages/group/pageGroups.js index f62a328e..4e5ca272 100644 --- a/cypress/support/pages/group/pageGroups.js +++ b/cypress/support/pages/group/pageGroups.js @@ -14,7 +14,7 @@ class Groups { static #deleteDialog = '.v-dialog--active'; static #deleteDialogCancel = '[data-testid="dialog-cancel"]'; static #deleteDialogConfirm = '[data-testid="dialog-confirm"]'; - static #adminClassTitle = '[data-testid="admin-class-title"]'; + static #adminGroupTitle = '[data-testid="admin-class-title"]'; static #groupMemberTable = '[data-testid="class-members-table"]'; static #classMemberInfoBox = '[data-testid="class-members-info-box"]'; static #classMemberInfoBoxText = '[data-testid="class-members-info-box-text"]'; @@ -162,7 +162,7 @@ class Groups { } seeManageGroupPageTitle() { - cy.get(Groups.#adminClassTitle).should('be.visible') + cy.get(Groups.#adminGroupTitle).should('be.visible') } seeGroupMemberTable() { From f80674dabc42e2ec944671ac3e7f1167d4782e71 Mon Sep 17 00:00:00 2001 From: Malte Berg Date: Mon, 23 Oct 2023 15:14:30 +0200 Subject: [PATCH 24/25] add test --- cypress/e2e/group/groupMembers.feature | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/group/groupMembers.feature b/cypress/e2e/group/groupMembers.feature index d12e8388..6f7a5ff8 100644 --- a/cypress/e2e/group/groupMembers.feature +++ b/cypress/e2e/group/groupMembers.feature @@ -1,15 +1,16 @@ @release Feature: Group - To show members in a group - As a teacher i want to see the members in a group + As a teacher I want to see the members in a group @stable_test - Scenario: As a teacher i can manage classes from external systems + 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 From 53fa64a461eeab6daa54951fbb3ef541400242c5 Mon Sep 17 00:00:00 2001 From: Marcin Date: Tue, 24 Oct 2023 15:45:39 +0200 Subject: [PATCH 25/25] modified the files that were required --- cypress/support/pages/account/pageAccount.js | 119 ----------------- .../support/pages/dashboard/pageDashboard.js | 121 ++++++++++++++++++ .../changeLanguageSteps.spec.js | 14 +- package-lock.json | 46 +++---- 4 files changed, 151 insertions(+), 149 deletions(-) rename cypress/support/step_definition/{account => dashboard}/changeLanguageSteps.spec.js (55%) diff --git a/cypress/support/pages/account/pageAccount.js b/cypress/support/pages/account/pageAccount.js index fc6eb839..9aab1ff7 100644 --- a/cypress/support/pages/account/pageAccount.js +++ b/cypress/support/pages/account/pageAccount.js @@ -5,25 +5,6 @@ class Account { static #settingsButton = '[data-testid="settings"]' static #email = '[data-testid="user_email"]' static #emailReadOnly = '[data-testid="user_email_readonly"]' - static #languageMenu = '#language-menu' - static #selectedLanguage = '#selected-language' - static #listOfAllLanguages = '#available-languages' - static #germanLanguage = '[data-testid="available-language-de"]' - static #spanishLanguage = '[data-testid="available-language-es"]' - static #ukrainianLanguage = '[data-testid="available-language-uk"]' - static #englishLanguage = '[data-testid="available-language-en"]' - static #pageTitle = '#page-title' - - static #testAssertionData = { - german: 'Deutsch', - spanish: 'Español', - ukrainian: 'Yкраїнська', - english: 'English', - overviewInGerman: 'Übersicht', - overviewInSpanish: 'Panel', - overviewInUkrainian: 'Панель керування', - overviewInEnglish: 'Dashboard' - } navigateToAccountSettingsSection () { cy.get(Account.#initialsButton).click() @@ -40,105 +21,5 @@ class Account { cy.get(Account.#emailReadOnly).should('have.attr', 'readonly') } } - - assertNameInitialsIsVisible () { - cy.get(Account.#initialsButton).should('be.visible') - } - - clickInitialsOfName () { - cy.get(Account.#initialsButton) - .should('be.visible') - .then($btn => { - if ($btn.is(':disabled')) { - cy.log('Button exists and is disabled!') - return - } else { - cy.log('Button exists and is enabled!') - cy.wrap($btn).click() - } - }) - } - - clickLanguagesDropDownMenu () { - cy.get(Account.#languageMenu) - .should('be.visible') - .click() - .then(() => { - cy.get(Account.#selectedLanguage).should('be.visible') - cy.get(Account.#listOfAllLanguages).find('li').each($element => { - cy.get($element).should('have.prop', 'value') - cy.get($element).should('be.visible') - }) - }) - } - - changeLanguage (language) { - if (language === 'german') { - return this.selectLanguage( - Account.#germanLanguage, - Account.#testAssertionData.german - ) - } - - if (language === 'spanish') { - return this.selectLanguage( - Account.#spanishLanguage, - Account.#testAssertionData.spanish - ) - } - - if (language === 'ukrainian') { - return this.selectLanguage( - Account.#ukrainianLanguage, - Account.#testAssertionData.ukrainian - ) - } - - return this.selectLanguage( - Account.#englishLanguage, - Account.#testAssertionData.english - ) - } - - selectLanguage (sel, language) { - return cy.contains(sel, language) - .should('be.visible') - .click() - .wait(['@alerts_api']) - } - - assertLanguageUpdate (updatedText) { - cy.wait(300) - .get(Account.#pageTitle) - .invoke('text') - .should('eq', updatedText) - cy.get(Account.#pageTitle) - .invoke('attr', 'data-testid') - .should('eq', updatedText) - } - - verifyLanguageChanged (language) { - if (language === 'german') { - return this.assertLanguageUpdate( - Account.#testAssertionData.overviewInGerman - ) - } - - if (language === 'spanish') { - return this.assertLanguageUpdate( - Account.#testAssertionData.overviewInSpanish - ) - } - - if (language === 'ukrainian') { - return this.assertLanguageUpdate( - Account.#testAssertionData.overviewInUkrainian - ) - } - - return this.assertLanguageUpdate( - Account.#testAssertionData.overviewInEnglish - ) - } } export default Account diff --git a/cypress/support/pages/dashboard/pageDashboard.js b/cypress/support/pages/dashboard/pageDashboard.js index 41aec8b3..8115c18c 100644 --- a/cypress/support/pages/dashboard/pageDashboard.js +++ b/cypress/support/pages/dashboard/pageDashboard.js @@ -2,6 +2,27 @@ class Dashboard { + static #initialsButton = '[data-testid="initials"]' + static #languageMenu = '#language-menu' + static #selectedLanguage = '#selected-language' + static #listOfAllLanguages = '#available-languages' + static #germanLanguage = '[data-testid="available-language-de"]' + static #spanishLanguage = '[data-testid="available-language-es"]' + static #ukrainianLanguage = '[data-testid="available-language-uk"]' + static #englishLanguage = '[data-testid="available-language-en"]' + static #getPageTitle = '#page-title' + + static #testAssertionData = { + german: 'Deutsch', + spanish: 'Español', + ukrainian: 'Yкраїнська', + english: 'English', + overviewInGerman: 'Übersicht', + overviewInSpanish: 'Panel', + overviewInUkrainian: 'Панель керування', + overviewInEnglish: 'Dashboard' + } + static #welcomeMessage = '[data-testid="welcome-section"]' static #dashboardTasksTitle = '[data-testid="dashboard-tasks-title"]' static #dashboardTaskCourseName = '[data-testid="task-course-name"]' @@ -11,6 +32,106 @@ class Dashboard { static #newsSection = '[data-testid="news-section"]' static #titleOnDashboardPage = '[id="page-title"]' + assertNameInitialsIsVisible () { + cy.get(Dashboard.#initialsButton).should('be.visible') + } + + clickInitialsOfName () { + cy.get(Dashboard.#initialsButton) + .should('be.visible') + .then($btn => { + if ($btn.is(':disabled')) { + cy.log('Button exists and is disabled!') + return + } else { + cy.log('Button exists and is enabled!') + cy.wrap($btn).click() + } + }) + } + + clickLanguagesDropDownMenu () { + cy.get(Dashboard.#languageMenu) + .should('be.visible') + .click() + .then(() => { + cy.get(Dashboard.#selectedLanguage).should('be.visible') + cy.get(Dashboard.#listOfAllLanguages).find('li').each($element => { + cy.get($element).should('have.prop', 'value') + cy.get($element).should('be.visible') + }) + }) + } + + changeLanguage (language) { + if (language === 'german') { + return this.selectLanguage( + Dashboard.#germanLanguage, + Dashboard.#testAssertionData.german + ) + } + + if (language === 'spanish') { + return this.selectLanguage( + Dashboard.#spanishLanguage, + Dashboard.#testAssertionData.spanish + ) + } + + if (language === 'ukrainian') { + return this.selectLanguage( + Dashboard.#ukrainianLanguage, + Dashboard.#testAssertionData.ukrainian + ) + } + + return this.selectLanguage( + Dashboard.#englishLanguage, + Dashboard.#testAssertionData.english + ) + } + + selectLanguage (sel, language) { + return cy.contains(sel, language) + .should('be.visible') + .click() + .wait(['@alerts_api']) + } + + assertLanguageUpdate (updatedText) { + cy.wait(300) + .get(Dashboard.#getPageTitle) + .invoke('text') + .should('eq', updatedText) + cy.get(Dashboard.#getPageTitle) + .invoke('attr', 'data-testid') + .should('eq', updatedText) + } + + verifyLanguageChanged (language) { + if (language === 'german') { + return this.assertLanguageUpdate( + Dashboard.#testAssertionData.overviewInGerman + ) + } + + if (language === 'spanish') { + return this.assertLanguageUpdate( + Dashboard.#testAssertionData.overviewInSpanish + ) + } + + if (language === 'ukrainian') { + return this.assertLanguageUpdate( + Dashboard.#testAssertionData.overviewInUkrainian + ) + } + + return this.assertLanguageUpdate( + Dashboard.#testAssertionData.overviewInEnglish + ) + } + arriveOnDashboard() { cy.visit('/dashboard') cy.url() diff --git a/cypress/support/step_definition/account/changeLanguageSteps.spec.js b/cypress/support/step_definition/dashboard/changeLanguageSteps.spec.js similarity index 55% rename from cypress/support/step_definition/account/changeLanguageSteps.spec.js rename to cypress/support/step_definition/dashboard/changeLanguageSteps.spec.js index ba77f7cf..f11df3ab 100644 --- a/cypress/support/step_definition/account/changeLanguageSteps.spec.js +++ b/cypress/support/step_definition/dashboard/changeLanguageSteps.spec.js @@ -1,24 +1,24 @@ const { When, Then } = require("@badeball/cypress-cucumber-preprocessor") -import Account from '../../pages/account/pageAccount' +import Dashboard from '../../pages/dashboard/pageDashboard' -const account = new Account() +const dashboard = new Dashboard() Then('I can see initials of my name', () => { - account.assertNameInitialsIsVisible() + dashboard.assertNameInitialsIsVisible() }) When('I click on initials of my name', () => { - account.clickInitialsOfName() + dashboard.clickInitialsOfName() }) Then('I click on language drop down menu', () => { - account.clickLanguagesDropDownMenu() + dashboard.clickLanguagesDropDownMenu() }) When('I can change language to {string}', language => { - account.changeLanguage(language) + dashboard.changeLanguage(language) }) Then('I can see title in dashboard is changed to {string}', language => { - account.verifyLanguageChanged(language) + dashboard.verifyLanguageChanged(language) }) diff --git a/package-lock.json b/package-lock.json index 8437ae89..760c9cbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,13 +86,13 @@ } }, "node_modules/@babel/generator": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.15.tgz", - "integrity": "sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "peer": true, "dependencies": { - "@babel/types": "^7.22.15", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -214,14 +214,14 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "peer": true, "dependencies": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" @@ -458,9 +458,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.16", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.16.tgz", - "integrity": "sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1735,20 +1735,20 @@ } }, "node_modules/@babel/traverse": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.20.tgz", - "integrity": "sha512-eU260mPZbU7mZ0N+X10pxXhQFMGTeLb9eFS0mxehS8HZp9o1uSnFeWQuG1UPrlxgA7QoUzFhOnilHDp0AXCyHw==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", "dev": true, "peer": true, "dependencies": { "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.22.15", + "@babel/generator": "^7.23.0", "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.22.5", + "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.16", - "@babel/types": "^7.22.19", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1757,14 +1757,14 @@ } }, "node_modules/@babel/types": { - "version": "7.22.19", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.19.tgz", - "integrity": "sha512-P7LAw/LbojPzkgp5oznjE6tQEIWbp4PkkfrZDINTro9zgBRtI324/EYsiSI7lhPbpIQ+DCeR2NNmMWANGGfZsg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "peer": true, "dependencies": { "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.19", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": {