From 2c9461de2e371416e09d668b0b2661ca5c74909f Mon Sep 17 00:00:00 2001 From: Christian Spohr Date: Mon, 2 Sep 2024 17:17:48 +0200 Subject: [PATCH 1/6] BC-2228 create and publish topic implemented --- .../openDrawingElementOnBoard.feature | 2 +- .../e2e/topics/publishUnpublishTopic.feature | 79 +++++++++++++++++++ cypress/support/pages/course/pageCourses.js | 5 ++ .../course/commonCourseSteps.spec.js | 4 + 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 cypress/e2e/topics/publishUnpublishTopic.feature diff --git a/cypress/e2e/course_board/openDrawingElementOnBoard.feature b/cypress/e2e/course_board/openDrawingElementOnBoard.feature index 72a2c600..b6eb360e 100644 --- a/cypress/e2e/course_board/openDrawingElementOnBoard.feature +++ b/cypress/e2e/course_board/openDrawingElementOnBoard.feature @@ -1,5 +1,5 @@ @regression_test -@stable_test +@unstable_test Feature: Course Board - Opening a drawing element on a course page As a teacher and student I want to open already created drawing element on a course page diff --git a/cypress/e2e/topics/publishUnpublishTopic.feature b/cypress/e2e/topics/publishUnpublishTopic.feature new file mode 100644 index 00000000..8ccb90ef --- /dev/null +++ b/cypress/e2e/topics/publishUnpublishTopic.feature @@ -0,0 +1,79 @@ +@regression_test +@stable_test +Feature: Topics - To publish and unpublish topic by teacher. + + As a teacher I want to create, edit and delete a new topic so that the student can see it + + Scenario: Teacher publishs a topic in the course, student can see this course, then teacher unpublishs topic, student cannot see it + + # pre-condition: teacher and student log in to create their account in a same school + Given I am logged in as a '' at '' + Given I am logged in as a '' at '' + Given I am logged in as a '' at '' + + # pre-condition: teacher creates a course + When I go to rooms overview + When I click on FAB to create a new room depending on sub menu + Then I see section one area on the course create page + When I enter the course title '' + Then I select teacher '' is selected by default + 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 + Then I see class selection box to select the class for the room + Then I see student selection box to select the student for the room + When I select the student '' in the list + When I click on button Next Steps after selecting room participant details + Then I see the section three as the finish page + When I click on button To Course Overview on the finish page + + + # teacher creates topic in a course + Given I am logged in as a '' at '' + When I go to rooms overview + When I go to room '' + When I click on FAB to create new content + When I click on New Topic FAB + Then I can see edit topic page '-' + When I enter topic title '' + When I click on button Add Text to topic + Then I can see form element Text on position '0' + When I enter title 'CypressAut Title for Text Element in Topic' into element Text in element position '0' + When I enter description 'CypressAut this is the description of the topic. It is used for automated Cypress tests.' into element Text in element position '0' + When I click on create button to create topic + Then I can see edit topic page '' + When I click on save button to save changes + + # student does not see topic in a course + Given I am logged in as a '' at '' + When I go to rooms overview + When I go to room '' + Then I can not see topic '' on course page + + # teacher publishs topic + Given I am logged in as a '' at '' + When I go to rooms overview + When I go to room '' + When I click on link Publish for first topic in content list + + # student sees topic in a course + Given I am logged in as a '' at '' + When I go to rooms overview + When I go to room '' + Then I can see topic '' on course page + + # teacher unpublishs topic + + # student does not see topic in a course + + # teacher deletes course + + + @school_api_test + Examples: + | namespace | admin | student | teacher | fullname_teacher | fullname_student | course_title | topic_title | topic_textelement_title | + | brb | admin1_brb | student1_brb | teacher1_brb | cypress teacher_1 | cypress student_1 | CypressAut Test Publish Topic | CypressAut Topic | CypressAut Title for Text Element in Topic | + + @staging_test + Examples: + | namespace | admin | student | teacher | fullname_teacher | fullname_student | course_title | topic_title | topic_textelement_title | + | brb | admin1_brb | student1_brb | teacher1_brb | Karl Herzog | Herbert Kraft | CypressAut Test Publish Topic | CypressAut Topic | CypressAut Title for Text Element in Topic | \ No newline at end of file diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index 982f7097..4ca48770 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -32,6 +32,7 @@ class Courses { static #taskCardTitleInCoursePageWithIndex = '[data-testid="task-title-0"]'; static #taskCardThreeDotMenuInCoursePageWithIndex = '[data-testid="task-card-menu-0"]'; static #taskCardInCoursePageWithIndex = '[data-testid="room-task-card-0"]'; + static #topicCardActions = '[data-testid="lesson-card-actions-0"]' static #dropDownCourse = '[data-testid="room-menu"]'; static #btnCourseEdit = '[data-testid="room-menu-edit-delete"]'; static #pageTitle = '[id="page-title"]'; @@ -596,6 +597,10 @@ class Courses { cy.get(Courses.#pageTitle).should("exist"); } + clickPublishLinkForFirstTopic() { + cy.get(Courses.#topicCardActions).find('button').click(); + } + compareSubmittedTasksInformation(submittedTasks, contentTitle) { cy.get(Courses.#taskCardTitleInCoursePageWithIndex).contains(contentTitle); cy.get(Courses.#contentCardTaskInfoSubmissionsChipWithIndex).should( diff --git a/cypress/support/step_definition/course/commonCourseSteps.spec.js b/cypress/support/step_definition/course/commonCourseSteps.spec.js index 0927e0c2..f571cbb3 100644 --- a/cypress/support/step_definition/course/commonCourseSteps.spec.js +++ b/cypress/support/step_definition/course/commonCourseSteps.spec.js @@ -119,6 +119,10 @@ When("I click on Edit in dot menu of topic", () => { courses.clickEditInDotMenuOfTopic(); }); +When("I click on link Publish for first topic in content list", () => { + courses.clickPublishLinkForFirstTopic(); +}); + When("I click on Cancel in confirmation window", () => { courses.clickOnCancelInConfirmationWindow(); }); From 844a1ebbfbd3edcb5e2cea7dd37568d2824cf0d5 Mon Sep 17 00:00:00 2001 From: Christian Spohr Date: Tue, 3 Sep 2024 11:18:21 +0200 Subject: [PATCH 2/6] BC-2228 include unpublish and finishing steps --- .../e2e/topics/publishUnpublishTopic.feature | 20 +++++++++++++++++++ cypress/support/pages/course/pageCourses.js | 5 +++++ cypress/support/pages/topics/pageTopics.js | 7 ++++++- .../course/commonCourseSteps.spec.js | 4 ++++ .../topics/createEditDeleteTopic.spec.js | 7 ++++++- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/topics/publishUnpublishTopic.feature b/cypress/e2e/topics/publishUnpublishTopic.feature index 8ccb90ef..566300e2 100644 --- a/cypress/e2e/topics/publishUnpublishTopic.feature +++ b/cypress/e2e/topics/publishUnpublishTopic.feature @@ -1,5 +1,6 @@ @regression_test @stable_test +@schedule_run Feature: Topics - To publish and unpublish topic by teacher. As a teacher I want to create, edit and delete a new topic so that the student can see it @@ -60,12 +61,31 @@ Feature: Topics - To publish and unpublish topic by teacher. When I go to rooms overview When I go to room '' Then I can see topic '' on course page + When I click on topic '' on course page + Then I see topic detail page "" # teacher unpublishs topic + Given I am logged in as a '' at '' + When I go to rooms overview + When I go to room '' + When I click on three dot menu of topic '' + When I click on option Back to draft in dot menu of first topic # student does not see topic in a course + Given I am logged in as a '' at '' + When I go to rooms overview + When I go to room '' + Then I can not see topic '' on course page # teacher deletes course + Given I am logged in as a '' at '' + When I go to rooms overview + When I go to room '' + When I open page Edit course + 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 '' on the room overview page @school_api_test diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index 4ca48770..45c5a01c 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -29,6 +29,7 @@ class Courses { '[data-testid="lesson-card-menu-action-remove-0"]'; static #editButtonInDotMenu = '[data-testid="room-task-card-menu-edit-0"]'; static #editButtonInDotMenuOfTopic = '[data-testid="lesson-card-menu-action-edit-0"]'; + static #backToDraftButtonInDotMenuOfTopic = '[data-testid="lesson-card-menu-action-revert-0"]'; static #taskCardTitleInCoursePageWithIndex = '[data-testid="task-title-0"]'; static #taskCardThreeDotMenuInCoursePageWithIndex = '[data-testid="task-card-menu-0"]'; static #taskCardInCoursePageWithIndex = '[data-testid="room-task-card-0"]'; @@ -580,6 +581,10 @@ class Courses { cy.get(Courses.#editButtonInDotMenuOfTopic).click(); } + clickBackToDraftInDotMenuOfTopic() { + cy.get(Courses.#backToDraftButtonInDotMenuOfTopic).click(); + } + clickOnCancelInConfirmationWindow() { cy.get(Courses.#dialogCancelButton).click(); } diff --git a/cypress/support/pages/topics/pageTopics.js b/cypress/support/pages/topics/pageTopics.js index a53b1c74..54eeb461 100644 --- a/cypress/support/pages/topics/pageTopics.js +++ b/cypress/support/pages/topics/pageTopics.js @@ -202,7 +202,7 @@ class Topics { }); } - seeTopicDetailPage( + seeTopicDetailPageWithContent( topicTitle, contentTitle1, contentTitle2, @@ -221,6 +221,11 @@ class Topics { }); } + seeTopicDetailPage(topicTitle) { + cy.get(Topics.#navCourseOverviewLink).should("have.class", "active"); + cy.get(Topics.#titlebar).should("contain", topicTitle); + } + navigateBackToCourseViaBreadcrumb() { cy.get(Topics.#breadcrumbBackToCourse).click(); } diff --git a/cypress/support/step_definition/course/commonCourseSteps.spec.js b/cypress/support/step_definition/course/commonCourseSteps.spec.js index f571cbb3..a0b24174 100644 --- a/cypress/support/step_definition/course/commonCourseSteps.spec.js +++ b/cypress/support/step_definition/course/commonCourseSteps.spec.js @@ -119,6 +119,10 @@ When("I click on Edit in dot menu of topic", () => { courses.clickEditInDotMenuOfTopic(); }); +When("I click on option Back to draft in dot menu of first topic", () => { + courses.clickBackToDraftInDotMenuOfTopic(); +}); + When("I click on link Publish for first topic in content list", () => { courses.clickPublishLinkForFirstTopic(); }); diff --git a/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js b/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js index 146a5cb4..09bc460d 100644 --- a/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js +++ b/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js @@ -118,7 +118,7 @@ Then( contentTitle4, contentTitle5 ) => { - topics.seeTopicDetailPage( + topics.seeTopicDetailPageWithContent( topicTitle, contentTitle1, contentTitle2, @@ -129,6 +129,11 @@ Then( } ); +Then("I see topic detail page {string}", (topicTitle) => { + topics.seeTopicDetailPage(topicTitle); + } +); + When("I navigate back to course detail page via breadcrump menu", () => { topics.navigateBackToCourseViaBreadcrumb(); }); From f6ba2d9973f913520b7ec0416983e4e52e55ea99 Mon Sep 17 00:00:00 2001 From: Christian Spohr Date: Tue, 3 Sep 2024 11:22:55 +0200 Subject: [PATCH 3/6] BC-2228 changed comments --- cypress/e2e/topics/publishUnpublishTopic.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/topics/publishUnpublishTopic.feature b/cypress/e2e/topics/publishUnpublishTopic.feature index 566300e2..64c29d17 100644 --- a/cypress/e2e/topics/publishUnpublishTopic.feature +++ b/cypress/e2e/topics/publishUnpublishTopic.feature @@ -3,7 +3,7 @@ @schedule_run Feature: Topics - To publish and unpublish topic by teacher. - As a teacher I want to create, edit and delete a new topic so that the student can see it + As a teacher I want to publish and unpublish as draft version Scenario: Teacher publishs a topic in the course, student can see this course, then teacher unpublishs topic, student cannot see it @@ -12,7 +12,7 @@ Feature: Topics - To publish and unpublish topic by teacher. Given I am logged in as a '' at '' Given I am logged in as a '' at '' - # pre-condition: teacher creates a course + # pre-condition: admin creates a course When I go to rooms overview When I click on FAB to create a new room depending on sub menu Then I see section one area on the course create page From 41b8fbf3fbc8165e6401e2cac2649b3fbf3e3bb8 Mon Sep 17 00:00:00 2001 From: Christian Spohr Date: Wed, 4 Sep 2024 14:06:56 +0200 Subject: [PATCH 4/6] BC-2228 implemented usage of data-testid --- cypress/support/pages/course/pageCourses.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index 45c5a01c..a3f68d1a 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -33,7 +33,7 @@ class Courses { static #taskCardTitleInCoursePageWithIndex = '[data-testid="task-title-0"]'; static #taskCardThreeDotMenuInCoursePageWithIndex = '[data-testid="task-card-menu-0"]'; static #taskCardInCoursePageWithIndex = '[data-testid="room-task-card-0"]'; - static #topicCardActions = '[data-testid="lesson-card-actions-0"]' + static #topicCardPublishBtn = '[data-testid="lesson-card-action-publish-0"]' static #dropDownCourse = '[data-testid="room-menu"]'; static #btnCourseEdit = '[data-testid="room-menu-edit-delete"]'; static #pageTitle = '[id="page-title"]'; @@ -603,7 +603,7 @@ class Courses { } clickPublishLinkForFirstTopic() { - cy.get(Courses.#topicCardActions).find('button').click(); + cy.get(Courses.#topicCardPublishBtn).click(); } compareSubmittedTasksInformation(submittedTasks, contentTitle) { From 886c698a066d6b4d45394cafecc1cbbe6c6a3704 Mon Sep 17 00:00:00 2001 From: Christian Spohr Date: Thu, 5 Sep 2024 14:28:50 +0200 Subject: [PATCH 5/6] BC-2228 some typo --- cypress/e2e/topics/accessH5PEditor.feature | 2 +- cypress/e2e/topics/createEditDeleteTopic.feature | 4 ++-- cypress/e2e/topics/publishUnpublishTopic.feature | 4 +--- .../step_definition/topics/createEditDeleteTopic.spec.js | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/topics/accessH5PEditor.feature b/cypress/e2e/topics/accessH5PEditor.feature index 4bb8bbcc..ceede9c7 100644 --- a/cypress/e2e/topics/accessH5PEditor.feature +++ b/cypress/e2e/topics/accessH5PEditor.feature @@ -62,7 +62,7 @@ Feature: To access the H5P editor as a teacher. When I click on save button to save changes Then I see topic detail page '' with content elements '', '', '', '' and '' # Note: Below step will not work in dev environments due to new side menu. This needs to adapt in future. - # When I navigate back to course detail page via breadcrump menu + # When I navigate back to course detail page via breadcrumb menu # Then I can see topic '' on course page # teacher can access H5P editor diff --git a/cypress/e2e/topics/createEditDeleteTopic.feature b/cypress/e2e/topics/createEditDeleteTopic.feature index bd5c65b3..fbd25165 100644 --- a/cypress/e2e/topics/createEditDeleteTopic.feature +++ b/cypress/e2e/topics/createEditDeleteTopic.feature @@ -64,7 +64,7 @@ Feature: Topics - To create, edit and delete topics by the teacher. Then I can see edit topic page 'CypressAut Topic Creating and Deleting Test' When I click on save button to save changes Then I see topic detail page "CypressAut Topic Creating and Deleting Test" with content elements "CypressAut Title for Text Element in Topic", "CypressAut Title for GeoGebra Element in Topic", "CypressAut Title for Learning Material Element in Topic", "CypressAut Title for Etherpad Element in Topic" and "CypressAut Title for Task Element in Topic" - When I navigate back to course detail page via breadcrump menu + When I navigate back to course detail page via breadcrumb menu Then I can see topic 'CypressAut Topic Creating and Deleting Test' on course page # teacher edits the topic @@ -106,7 +106,7 @@ Feature: Topics - To create, edit and delete topics by the teacher. # Then I can see form element Task on position '4' # When I click button Cancel # Then I see topic detail page "CypressAut Topic Creating and Deleting Test - Edited topic" with content elements "CypressAut Title for GeoGebra Element in Topic", "CypressAut Title for Learning Material Element in Topic", "CypressAut Title for Etherpad Element in Topic Changed", "CypressAut Title for Task Element in Topic" and "CypressAut New text element Title" - When I navigate back to course detail page via breadcrump menu + When I navigate back to course detail page via breadcrumb menu Then I can see topic 'CypressAut Topic Creating and Deleting Test - Edited topic' on course page # teacher deletes the topic diff --git a/cypress/e2e/topics/publishUnpublishTopic.feature b/cypress/e2e/topics/publishUnpublishTopic.feature index 64c29d17..f34c3a11 100644 --- a/cypress/e2e/topics/publishUnpublishTopic.feature +++ b/cypress/e2e/topics/publishUnpublishTopic.feature @@ -5,7 +5,7 @@ Feature: Topics - To publish and unpublish topic by teacher. As a teacher I want to publish and unpublish as draft version - Scenario: Teacher publishs a topic in the course, student can see this course, then teacher unpublishs topic, student cannot see it + Scenario: Teacher publishes a topic in the course, student can see this course, then teacher unpublishes topic, student cannot see it # pre-condition: teacher and student log in to create their account in a same school Given I am logged in as a '' at '' @@ -27,7 +27,6 @@ Feature: Topics - To publish and unpublish topic by teacher. Then I see the section three as the finish page When I click on button To Course Overview on the finish page - # teacher creates topic in a course Given I am logged in as a '' at '' When I go to rooms overview @@ -87,7 +86,6 @@ Feature: Topics - To publish and unpublish topic by teacher. When I click on the button delete on the modal to confirm the course deletion Then I do not see the course '' on the room overview page - @school_api_test Examples: | namespace | admin | student | teacher | fullname_teacher | fullname_student | course_title | topic_title | topic_textelement_title | diff --git a/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js b/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js index 09bc460d..f93d0386 100644 --- a/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js +++ b/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js @@ -134,7 +134,7 @@ Then("I see topic detail page {string}", (topicTitle) => { } ); -When("I navigate back to course detail page via breadcrump menu", () => { +When("I navigate back to course detail page via breadcrumb menu", () => { topics.navigateBackToCourseViaBreadcrumb(); }); From b25a3cfba28f6247e3f246f4aaa46bbb0120599f Mon Sep 17 00:00:00 2001 From: Christian Spohr Date: Thu, 5 Sep 2024 14:57:11 +0200 Subject: [PATCH 6/6] set TLDraw test to stable --- cypress/e2e/course_board/openDrawingElementOnBoard.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/course_board/openDrawingElementOnBoard.feature b/cypress/e2e/course_board/openDrawingElementOnBoard.feature index b6eb360e..72a2c600 100644 --- a/cypress/e2e/course_board/openDrawingElementOnBoard.feature +++ b/cypress/e2e/course_board/openDrawingElementOnBoard.feature @@ -1,5 +1,5 @@ @regression_test -@unstable_test +@stable_test Feature: Course Board - Opening a drawing element on a course page As a teacher and student I want to open already created drawing element on a course page