forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-54115 Behat: tests for the comments block
- Loading branch information
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
blocks/comments/tests/behat/block_comment_activity.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
21
blocks/comments/tests/behat/block_comment_frontpage.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |