Skip to content

Commit

Permalink
MDL-54115 Behat: tests for the comments block
Browse files Browse the repository at this point in the history
  • Loading branch information
sbourget committed May 9, 2016
1 parent 1e72daa commit bc823ac
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
34 changes: 34 additions & 0 deletions blocks/comments/tests/behat/block_comment_activity.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@block @block_comments
Feature: Enable Block comments on an activity page and view comments
In order to enable the comments block on an activity page
As a teacher
I can add the comments block to an activity page

Scenario: Add the comments block on an activity page and add comments
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@example.com |
| student1 | Student | First | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| page | C1 | page1 | Test page name | Test page description |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I follow "Test page name"
And I add the "Comments" block
And I follow "Show comments"
And I add "I'm a comment from the teacher" comment to comments block
And I log out
When I log in as "student1"
And I follow "Course 1"
And I follow "Test page name"
And I follow "Show comments"
Then I should see "I'm a comment from the teacher"
29 changes: 29 additions & 0 deletions blocks/comments/tests/behat/block_comment_course.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@block @block_comments
Feature: Enable Block comments on a course page and view comments
In order to enable the comments block on a course page
As a teacher
I can add the comments block to the course page

Scenario: Add the comments block on the course page and add comments
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@example.com |
| student1 | Student | First | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Comments" block
And I follow "Show comments"
And I add "I'm a comment from the teacher" comment to comments block
And I log out
When I log in as "student1"
And I follow "Course 1"
And I follow "Show comments"
Then I should see "I'm a comment from the teacher"
21 changes: 21 additions & 0 deletions blocks/comments/tests/behat/block_comment_frontpage.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@block @block_comments
Feature: Enable Block comments on the frontpage and view comments
In order to enable the comments block on the frontpage
As a admin
I can add the comments block to the frontpage

Scenario: Add the comments block on the frontpage and add comments
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
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 "Comments" block
And I follow "Show comments"
And I add "I'm a comment from admin" comment to comments block
And I log out
When I log in as "teacher1"
And I am on site homepage
And I follow "Show comments"
Then I should see "I'm a comment from admin"

0 comments on commit bc823ac

Please sign in to comment.