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 new file mode 100644 index 00000000..f34c3a11 --- /dev/null +++ b/cypress/e2e/topics/publishUnpublishTopic.feature @@ -0,0 +1,97 @@ +@regression_test +@stable_test +@schedule_run +Feature: Topics - To publish and unpublish topic by teacher. + + As a teacher I want to publish and unpublish as draft version + + 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 '' + Given I am logged in as a '' at '' + Given I am logged in as a '' at '' + + # 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 + 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 + 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 + 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 8e6890f4..fb710c8c 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -29,9 +29,11 @@ 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"]'; + 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"]'; @@ -588,6 +590,10 @@ class Courses { cy.get(Courses.#editButtonInDotMenuOfTopic).click(); } + clickBackToDraftInDotMenuOfTopic() { + cy.get(Courses.#backToDraftButtonInDotMenuOfTopic).click(); + } + clickOnCancelInConfirmationWindow() { cy.get(Courses.#dialogCancelButton).click(); } @@ -609,6 +615,10 @@ class Courses { cy.get(Courses.#courseTitle).should("have.value", courseName); } + clickPublishLinkForFirstTopic() { + cy.get(Courses.#topicCardPublishBtn).click(); + } + compareSubmittedTasksInformation(submittedTasks, contentTitle) { cy.get(Courses.#taskCardTitleInCoursePageWithIndex).contains(contentTitle); cy.get(Courses.#contentCardTaskInfoSubmissionsChipWithIndex).should( 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 5cfa4039..1a0becc8 100644 --- a/cypress/support/step_definition/course/commonCourseSteps.spec.js +++ b/cypress/support/step_definition/course/commonCourseSteps.spec.js @@ -130,6 +130,14 @@ 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(); +}); + When("I click on Cancel in confirmation window", () => { courses.clickOnCancelInConfirmationWindow(); }); diff --git a/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js b/cypress/support/step_definition/topics/createEditDeleteTopic.spec.js index 146a5cb4..f93d0386 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,7 +129,12 @@ Then( } ); -When("I navigate back to course detail page via breadcrump menu", () => { +Then("I see topic detail page {string}", (topicTitle) => { + topics.seeTopicDetailPage(topicTitle); + } +); + +When("I navigate back to course detail page via breadcrumb menu", () => { topics.navigateBackToCourseViaBreadcrumb(); });