mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MDL-54656_m30v3' of https://github.com/sbourget/moodle …
…into MOODLE_30_STABLE
- Loading branch information
Showing
3 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
blocks/search_forums/tests/behat/block_search_forums_course.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,69 @@ | ||
@block @block_search_forums @mod_forum | ||
Feature: The search forums block allows users to search for forum posts | ||
In order to search for a forum post | ||
As a user | ||
I can use the search forums block | ||
|
||
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 | | ||
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 | | ||
And I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I navigate to "Edit settings" node in "Course administration" | ||
And I set the field "id_newsitems" to "1" | ||
And I press "Save and display" | ||
And I log out | ||
|
||
Scenario: Use the search forum block in a course without any forum posts | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
When I set the following fields to these values: | ||
| searchform_search | Moodle | | ||
And I press "Go" | ||
Then I should see "No posts" | ||
|
||
Scenario: Use the search forum block in a course with a hidden forum and search for posts | ||
Given I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I add a new topic to "News forum" forum with: | ||
| Subject | My subject | | ||
| Message | My message | | ||
And I follow "Course 1" | ||
And I turn editing mode on | ||
And I follow "News forum" | ||
And I navigate to "Edit settings" node in "Forum administration" | ||
And I expand all fieldsets | ||
And I set the field "id_visible" to "0" | ||
And I press "Save and return to course" | ||
And I log out | ||
When I log in as "student1" | ||
And I follow "Course 1" | ||
And "Search forums" "block" should exist | ||
And I set the following fields to these values: | ||
| searchform_search | message | | ||
And I press "Go" | ||
Then I should see "No posts" | ||
|
||
Scenario: Use the search forum block in a course and search for posts | ||
Given I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I add a new topic to "News forum" forum with: | ||
| Subject | My subject | | ||
| Message | My message | | ||
And I log out | ||
When I log in as "student1" | ||
And I follow "Course 1" | ||
And "Search forums" "block" should exist | ||
And I set the following fields to these values: | ||
| searchform_search | message | | ||
And I press "Go" | ||
Then I should see "My subject" |
31 changes: 31 additions & 0 deletions
31
blocks/search_forums/tests/behat/block_search_forums_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,31 @@ | ||
@block @block_search_forums @mod_forum | ||
Feature: The search forums block allows users to search for forum posts | ||
In order to search for a forum post | ||
As an administrator | ||
I can add the search forums block | ||
|
||
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 "Search forums" block | ||
And I log out | ||
|
||
Scenario: Use the search forum block on the frontpage and search for posts as a user | ||
Given I log in as "student1" | ||
And I am on site homepage | ||
When I set the following fields to these values: | ||
| searchform_search | Moodle | | ||
And I press "Go" | ||
Then I should see "No posts" | ||
|
||
Scenario: Use the search forum block on the frontpage and search for posts as a guest | ||
Given I log in as "guest" | ||
And I am on site homepage | ||
When I set the following fields to these values: | ||
| searchform_search | Moodle | | ||
And I press "Go" | ||
Then I should see "No posts" |
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,106 @@ | ||
@mod @mod_forum | ||
Feature: The forum search allows users to perform advanced searches for forum posts | ||
In order to perform an advanced search for a forum post | ||
As a teacher | ||
I can use the search feature | ||
|
||
Background: | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | idnumber | | ||
| teacher1 | Teacher | ONE | teacher1@example.com | T1 | | ||
| teacher2 | Teacher | TWO | teacher2@example.com | T1 | | ||
| student1 | Student | 1 | student1@example.com | S1 | | ||
And the following "courses" exist: | ||
| fullname | shortname | category | | ||
| Course 1 | C1 | 0 | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| teacher2 | C1 | editingteacher | | ||
| student1 | C1 | student | | ||
And I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I navigate to "Edit settings" node in "Course administration" | ||
And I set the field "id_newsitems" to "1" | ||
And I press "Save and display" | ||
And I add a new topic to "News forum" forum with: | ||
| Subject | My subject | | ||
| Message | My message | | ||
And I follow "Course 1" | ||
And I add a new topic to "News forum" forum with: | ||
| Subject | My subjective| | ||
| Message | My long message | | ||
And I log out | ||
|
||
Scenario: Perform an advanced search using any term | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "News forum" | ||
And I press "Search forums" | ||
And I should see "Advanced search" | ||
And I set the field "words" to "subject" | ||
When I press "Search forums" | ||
Then I should see "My subject" | ||
And I should see "My subjective" | ||
|
||
Scenario: Perform an advanced search avoiding words | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "News forum" | ||
And I press "Search forums" | ||
And I should see "Advanced search" | ||
And I set the field "words" to "My" | ||
And I set the field "notwords" to "subjective" | ||
When I press "Search forums" | ||
Then I should see "My subject" | ||
And I should not see "My subjective" | ||
|
||
Scenario: Perform an advanced search using whole words | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "News forum" | ||
And I press "Search forums" | ||
And I should see "Advanced search" | ||
And I set the field "fullwords" to "subject" | ||
When I press "Search forums" | ||
Then I should see "My subject" | ||
And I should not see "My subjective" | ||
|
||
Scenario: Perform an advanced search matching the subject | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "News forum" | ||
And I press "Search forums" | ||
And I should see "Advanced search" | ||
And I set the field "subject" to "subjective" | ||
When I press "Search forums" | ||
Then I should not see "My message" | ||
And I should see "My subjective" | ||
|
||
Scenario: Perform an advanced search matching the author | ||
Given I log in as "teacher2" | ||
And I follow "Course 1" | ||
And I add a new topic to "News forum" forum with: | ||
| Subject | My Subjects | | ||
| Message | My message | | ||
And I log out | ||
When I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "News forum" | ||
And I press "Search forums" | ||
And I should see "Advanced search" | ||
And I set the field "user" to "TWO" | ||
And I press "Search forums" | ||
Then I should see "Teacher TWO" | ||
And I should not see "Teacher ONE" | ||
|
||
Scenario: Perform an advanced search with multiple words | ||
Given I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "News forum" | ||
And I press "Search forums" | ||
And I should see "Advanced search" | ||
And I set the field "subject" to "my subjective" | ||
When I press "Search forums" | ||
Then I should not see "My message" | ||
And I should see "My subjective" |