mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
MDL-52643 block_blog_menu: Add behat tests
This commit is contained in:
parent
7817f82c15
commit
21b17fe49c
3 changed files with 310 additions and 0 deletions
81
blocks/blog_menu/tests/behat/block_blog_menu.feature
Normal file
81
blocks/blog_menu/tests/behat/block_blog_menu.feature
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
@block @block_blog_menu
|
||||||
|
Feature: Enable Block blog menu in a course
|
||||||
|
In order to enable the blog menu in a course
|
||||||
|
As a teacher
|
||||||
|
I can add blog menu block to a course
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "users" exist:
|
||||||
|
| username | firstname | lastname | email | idnumber |
|
||||||
|
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||||
|
And the following "courses" exist:
|
||||||
|
| fullname | shortname | category |
|
||||||
|
| Course 1 | C1 | 0 |
|
||||||
|
And the following "course enrolments" exist:
|
||||||
|
| user | course | role |
|
||||||
|
| teacher1 | C1 | editingteacher |
|
||||||
|
|
||||||
|
Scenario: Add the block to a the course when blogs are disabled
|
||||||
|
Given I log in as "admin"
|
||||||
|
And the following config values are set as admin:
|
||||||
|
| enableblogs | 0 |
|
||||||
|
And I log out
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
When I add the "Blog menu" block
|
||||||
|
Then I should see "Blogging is disabled!" in the "Blog menu" "block"
|
||||||
|
|
||||||
|
Scenario: Add the block to a the course when blog associations are disabled
|
||||||
|
Given I log in as "admin"
|
||||||
|
And the following config values are set as admin:
|
||||||
|
| useblogassociations | 0 |
|
||||||
|
And I log out
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
When I add the "Blog menu" block
|
||||||
|
Then I should see "Blog entries" in the "Blog menu" "block"
|
||||||
|
And I should see "Add a new entry" in the "Blog menu" "block"
|
||||||
|
And I should not see "View all entries for this course" in the "Blog menu" "block"
|
||||||
|
And I should not see "View my entries about this course" in the "Blog menu" "block"
|
||||||
|
And I should not see "Add an entry about this course" in the "Blog menu" "block"
|
||||||
|
|
||||||
|
Scenario: Add the block to a the course when blog associations are enabled
|
||||||
|
Given I log in as "admin"
|
||||||
|
And the following config values are set as admin:
|
||||||
|
| useblogassociations | 1 |
|
||||||
|
And I log out
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
When I add the "Blog menu" block
|
||||||
|
Then I should see "Blog entries" in the "Blog menu" "block"
|
||||||
|
And I should see "Add a new entry" in the "Blog menu" "block"
|
||||||
|
And I should see "View all entries for this course" in the "Blog menu" "block"
|
||||||
|
And I should see "View my entries about this course" in the "Blog menu" "block"
|
||||||
|
And I should see "Add an entry about this course" in the "Blog menu" "block"
|
||||||
|
|
||||||
|
Scenario: Add the block to a the course when RSS is disabled
|
||||||
|
Given I log in as "admin"
|
||||||
|
And the following config values are set as admin:
|
||||||
|
| enablerssfeeds | 0 |
|
||||||
|
And I log out
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
When I add the "Blog menu" block
|
||||||
|
Then I should not see "Blog RSS feed" in the "Blog menu" "block"
|
||||||
|
And I should see "Add a new entry" in the "Blog menu" "block"
|
||||||
|
|
||||||
|
Scenario: Add the block to a the course when RSS is enabled
|
||||||
|
Given I log in as "admin"
|
||||||
|
And the following config values are set as admin:
|
||||||
|
| enablerssfeeds | 1 |
|
||||||
|
And I log out
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
When I add the "Blog menu" block
|
||||||
|
Then I should see "Blog RSS feed" in the "Blog menu" "block"
|
||||||
|
And I should see "Add a new entry" in the "Blog menu" "block"
|
199
blocks/blog_menu/tests/behat/block_blog_menu_course.feature
Normal file
199
blocks/blog_menu/tests/behat/block_blog_menu_course.feature
Normal file
|
@ -0,0 +1,199 @@
|
||||||
|
@block @block_blog_menu
|
||||||
|
Feature: Enable Block blog menu in a course
|
||||||
|
In order to enable the blog menu in a course
|
||||||
|
As a teacher
|
||||||
|
I can add blog menu block to a course
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "users" exist:
|
||||||
|
| username | firstname | lastname | email | idnumber |
|
||||||
|
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||||
|
| student1 | Student | 1 | student1@example.com | S1 |
|
||||||
|
| student2 | Student | 2 | student2@example.com | S2 |
|
||||||
|
And the following "courses" exist:
|
||||||
|
| fullname | shortname | category |
|
||||||
|
| Course 1 | C1 | 0 |
|
||||||
|
And the following "course enrolments" exist:
|
||||||
|
| user | course | role |
|
||||||
|
| teacher1 | C1 | editingteacher |
|
||||||
|
| student1 | C1 | student |
|
||||||
|
| student2 | C1 | student |
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
And I add the "Blog menu" block
|
||||||
|
And I log out
|
||||||
|
|
||||||
|
Scenario: Students use the blog menu block to post blogs
|
||||||
|
Given I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add a new entry"
|
||||||
|
When I set the following fields to these values:
|
||||||
|
| Entry title | S1 First Blog |
|
||||||
|
| Blog entry body | This is my awesome blog! |
|
||||||
|
And I press "Save changes"
|
||||||
|
Then I should see "S1 First Blog"
|
||||||
|
And I should see "This is my awesome blog!"
|
||||||
|
And I follow "Dashboard"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Blog entries"
|
||||||
|
And I should see "S1 First Blog"
|
||||||
|
And I should see "This is my awesome blog!"
|
||||||
|
|
||||||
|
Scenario: Students use the blog menu block to view their blogs about the course
|
||||||
|
Given I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add an entry about this course"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S1 First Blog |
|
||||||
|
| Blog entry body | This is my awesome blog about this course! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S1 First Blog"
|
||||||
|
And I should see "This is my awesome blog about this course!"
|
||||||
|
And I should see "Associated Course: C1"
|
||||||
|
And I log out
|
||||||
|
And I log in as "student2"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add a new entry"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S2 Second Blog |
|
||||||
|
| Blog entry body | My unrelated blog! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S2 Second Blog"
|
||||||
|
And I should see "My unrelated blog!"
|
||||||
|
And I should not see "Associated Course: C1"
|
||||||
|
And I follow "Dashboard"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add an entry about this course"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S2 First Blog |
|
||||||
|
| Blog entry body | My course blog is better! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S2 First Blog"
|
||||||
|
And I should see "My course blog is better!"
|
||||||
|
And I should see "Associated Course: C1"
|
||||||
|
And I follow "Dashboard"
|
||||||
|
And I follow "Course 1"
|
||||||
|
When I follow "View my entries about this course"
|
||||||
|
Then I should see "S2 First Blog"
|
||||||
|
And I should not see "S2 Second Blog"
|
||||||
|
And I should not see "S1 First Blog"
|
||||||
|
|
||||||
|
Scenario: Students use the blog menu block to view all blogs about the course
|
||||||
|
Given I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add an entry about this course"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S1 First Blog |
|
||||||
|
| Blog entry body | This is my awesome blog about this course! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S1 First Blog"
|
||||||
|
And I should see "This is my awesome blog about this course!"
|
||||||
|
And I should see "Associated Course: C1"
|
||||||
|
And I log out
|
||||||
|
And I log in as "student2"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add a new entry"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S2 Second Blog |
|
||||||
|
| Blog entry body | My unrelated blog! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S2 Second Blog"
|
||||||
|
And I should see "My unrelated blog!"
|
||||||
|
And I should not see "Associated Course: C1"
|
||||||
|
And I follow "Dashboard"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add an entry about this course"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S2 First Blog |
|
||||||
|
| Blog entry body | My course blog is better! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S2 First Blog"
|
||||||
|
And I should see "My course blog is better!"
|
||||||
|
And I should see "Associated Course: C1"
|
||||||
|
And I follow "Dashboard"
|
||||||
|
And I follow "Course 1"
|
||||||
|
When I follow "View all entries for this course"
|
||||||
|
Then I should see "S1 First Blog"
|
||||||
|
And I should see "S2 First Blog"
|
||||||
|
And I should not see "S2 Second Blog"
|
||||||
|
|
||||||
|
Scenario: Students use the blog menu block to view all their blog entries
|
||||||
|
Given I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add an entry about this course"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S1 First Blog |
|
||||||
|
| Blog entry body | This is my awesome blog about this course! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S1 First Blog"
|
||||||
|
And I should see "This is my awesome blog about this course!"
|
||||||
|
And I should see "Associated Course: C1"
|
||||||
|
And I log out
|
||||||
|
And I log in as "student2"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add a new entry"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S2 Second Blog |
|
||||||
|
| Blog entry body | My unrelated blog! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S2 Second Blog"
|
||||||
|
And I should see "My unrelated blog!"
|
||||||
|
And I should not see "Associated Course: C1"
|
||||||
|
And I follow "Dashboard"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add an entry about this course"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S2 First Blog |
|
||||||
|
| Blog entry body | My course blog is better! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S2 First Blog"
|
||||||
|
And I should see "My course blog is better!"
|
||||||
|
And I should see "Associated Course: C1"
|
||||||
|
And I follow "Dashboard"
|
||||||
|
And I follow "Course 1"
|
||||||
|
When I follow "Blog entries"
|
||||||
|
Then I should see "S2 First Blog"
|
||||||
|
And I should see "S2 Second Blog"
|
||||||
|
And I should not see "S1 First Blog"
|
||||||
|
|
||||||
|
Scenario: Teacher searches for student blogs
|
||||||
|
Given I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add an entry about this course"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S1 First Blog |
|
||||||
|
| Blog entry body | This is my awesome blog about this course! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S1 First Blog"
|
||||||
|
And I should see "This is my awesome blog about this course!"
|
||||||
|
And I should see "Associated Course: C1"
|
||||||
|
And I log out
|
||||||
|
And I log in as "student2"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add a new entry"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S2 Second Blog |
|
||||||
|
| Blog entry body | My unrelated blog! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S2 Second Blog"
|
||||||
|
And I should see "My unrelated blog!"
|
||||||
|
And I should not see "Associated Course: C1"
|
||||||
|
And I follow "Dashboard"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Add an entry about this course"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Entry title | S2 First Blog |
|
||||||
|
| Blog entry body | My course blog is better! |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "S2 First Blog"
|
||||||
|
And I should see "My course blog is better!"
|
||||||
|
And I should see "Associated Course: C1"
|
||||||
|
And I log out
|
||||||
|
When I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I set the field "blogsearchquery" to "First"
|
||||||
|
And I press "Search"
|
||||||
|
Then I should see "S1 First Blog"
|
||||||
|
And I should see "S2 First Blog"
|
||||||
|
And I should not see "S2 Second Blog"
|
|
@ -0,0 +1,30 @@
|
||||||
|
@block @block_blog_menu
|
||||||
|
Feature: Enable Block blog menu on the frontpage
|
||||||
|
In order to enable the blog menu on the frontpage
|
||||||
|
As an admin
|
||||||
|
I can add blog menu block to the frontpage
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "users" exist:
|
||||||
|
| username | firstname | lastname | email | idnumber |
|
||||||
|
| student1 | Student | 1 | student1@example.com | S1 |
|
||||||
|
And I log in as "admin"
|
||||||
|
And I am on site homepage
|
||||||
|
And I navigate to "Turn editing on" node in "Front page settings"
|
||||||
|
And I add the "Blog menu" block
|
||||||
|
And I log out
|
||||||
|
|
||||||
|
Scenario: Students use the blog menu block to post blogs
|
||||||
|
Given I log in as "student1"
|
||||||
|
And I am on site homepage
|
||||||
|
And I follow "Add a new entry"
|
||||||
|
When I set the following fields to these values:
|
||||||
|
| Entry title | S1 First Blog |
|
||||||
|
| Blog entry body | This is my awesome blog! |
|
||||||
|
And I press "Save changes"
|
||||||
|
Then I should see "S1 First Blog"
|
||||||
|
And I should see "This is my awesome blog!"
|
||||||
|
And I am on site homepage
|
||||||
|
And I follow "Blog entries"
|
||||||
|
And I should see "S1 First Blog"
|
||||||
|
And I should see "This is my awesome blog!"
|
Loading…
Add table
Add a link
Reference in a new issue