Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

BC 2228 publish unpublish topic #231

Merged
merged 7 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/topics/accessH5PEditor.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<topic_title>' with content elements '<topic_text_element_title>', '<topic_geogebra_title>', '<topic_learning_store_title>', '<topic_etherpad_title>' and '<topic_task_title>'
# 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 '<topic_title>' on course page

# teacher can access H5P editor
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/topics/createEditDeleteTopic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
97 changes: 97 additions & 0 deletions cypress/e2e/topics/publishUnpublishTopic.feature
Original file line number Diff line number Diff line change
@@ -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 '<student>' at '<namespace>'
Given I am logged in as a '<teacher>' at '<namespace>'
Given I am logged in as a '<admin>' at '<namespace>'

# 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 '<course_title>'
Then I select teacher '<fullname_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 '<fullname_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 '<teacher>' at '<namespace>'
When I go to rooms overview
When I go to room '<course_title>'
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 '<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 '<topic_title>'
When I click on save button to save changes

# student does not see topic in a course
Given I am logged in as a '<student>' at '<namespace>'
When I go to rooms overview
When I go to room '<course_title>'
Then I can not see topic '<topic_title>' on course page

# teacher publishs topic
Given I am logged in as a '<teacher>' at '<namespace>'
When I go to rooms overview
When I go to room '<course_title>'
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 '<student>' at '<namespace>'
When I go to rooms overview
When I go to room '<course_title>'
Then I can see topic '<topic_title>' on course page
When I click on topic '<topic_title>' on course page
Then I see topic detail page "<topic_title>"

# teacher unpublishs topic
Given I am logged in as a '<teacher>' at '<namespace>'
When I go to rooms overview
When I go to room '<course_title>'
When I click on three dot menu of topic '<topic_title>'
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 '<student>' at '<namespace>'
When I go to rooms overview
When I go to room '<course_title>'
Then I can not see topic '<topic_title>' on course page

# teacher deletes course
Given I am logged in as a '<teacher>' at '<namespace>'
When I go to rooms overview
When I go to room '<course_title>'
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 '<course_title>' 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 |
10 changes: 10 additions & 0 deletions cypress/support/pages/course/pageCourses.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]';
Expand Down Expand Up @@ -588,6 +590,10 @@ class Courses {
cy.get(Courses.#editButtonInDotMenuOfTopic).click();
}

clickBackToDraftInDotMenuOfTopic() {
cy.get(Courses.#backToDraftButtonInDotMenuOfTopic).click();
}

clickOnCancelInConfirmationWindow() {
cy.get(Courses.#dialogCancelButton).click();
}
Expand All @@ -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(
Expand Down
7 changes: 6 additions & 1 deletion cypress/support/pages/topics/pageTopics.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class Topics {
});
}

seeTopicDetailPage(
seeTopicDetailPageWithContent(
topicTitle,
contentTitle1,
contentTitle2,
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Then(
contentTitle4,
contentTitle5
) => {
topics.seeTopicDetailPage(
topics.seeTopicDetailPageWithContent(
topicTitle,
contentTitle1,
contentTitle2,
Expand All @@ -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();
});

Expand Down
Loading