MDL-66371 mod_forum: Improving behat tests

This commit is contained in:
Shamim Rezaie 2019-10-09 15:19:11 +11:00
parent 3222469ca8
commit 4f3d1266e3

View File

@ -1,8 +1,8 @@
@mod @mod_forum @javascript
Feature: Export forum
In order to export forum content
In order to parse forum data for linguistic analysis
As a teacher
I need to add a forum activity and discussions
I need to export the forum data for select users
Background: Add a forum and a discussion
Given the following "users" exist:
@ -30,6 +30,7 @@ Feature: Export forum
And I should see "Student 1" in the ".form-autocomplete-suggestions" "css_element"
And I should see "Teacher 1" in the ".form-autocomplete-suggestions" "css_element"
And I should not see "Student 2" in the ".form-autocomplete-suggestions" "css_element"
# This will fail if an exception is thrown. This is the best we can do without the ability to use the download. Hence, there is no "Then" step.
And I click on "Export" "button"
And I log out
@ -39,15 +40,19 @@ Feature: Export forum
When I follow "Test forum 1"
Then "Export" "link" should not exist in current page administration
And I log out
And I log in as "admin"
Scenario: User with the capability can export
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/forum:exportforum | Allow | student | Course | C1 |
When I log in as "student1"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I override the system permissions of "Student" role with:
| capability | permission |
| mod/forum:exportforum | Allow |
And I log out
Given I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test forum 1"
And I follow "Test forum 1"
And I navigate to "Export" in current page administration
And I open the autocomplete suggestions list
And I should see "Student 1" in the ".form-autocomplete-suggestions" "css_element"
And I should see "Teacher 1" in the ".form-autocomplete-suggestions" "css_element"
And I should not see "Student 2" in the ".form-autocomplete-suggestions" "css_element"
# This will fail if an exception is thrown. This is the best we can do without the ability to use the download. Hence, there is no "Then" step.
And I click on "Export" "button"
And I log out