1+ @mod @mod_moodleoverflow @mod_moodleoverflow_search
2+ Feature : Add moodleoverflow activities and discussions
3+ In order to find discussions
4+ I need to be able to search them
5+
6+ Background : : Add a moodleoverflow and a discussion
7+ Given the following config values are set as admin:
8+ | enableglobalsearch | 1 |
9+ | searchengine | simpledb |
10+ And the following "users" exist:
11+ | username | firstname | lastname | email |
12+ | teacher1 | Teacher | 1 | teacher1 @example .com |
13+ | student1 | Student | 1 | student1 @example .com |
14+ | student2 | Student | 2 | student2 @example .com |
15+ And the following "courses" exist:
16+ | fullname | shortname | category |
17+ | Course 1 | C1 | 0 |
18+ And the following "course enrolments" exist:
19+ | user | course | role |
20+ | teacher1 | C1 | editingteacher |
21+ | student1 | C1 | student |
22+ And I log in as "teacher1"
23+ And I am on "Course 1" course homepage
24+ And I turn editing mode on
25+ And I add a "Moodleoverflow" to section "1" and I fill the form with:
26+ | Moodleoverflow name | Test moodleoverflow name |
27+ | Description | Test forum description |
28+ And I log out
29+ And I log in as "student1"
30+ And I am on "Course 1" course homepage
31+ And I add a new discussion to "Test moodleoverflow name" moodleoverflow with:
32+ | Subject | Forum post 1 |
33+ | Message | This is the body |
34+ And I log out
35+ And I log in as "teacher1"
36+ And I update the global search index
37+ And I log out
38+
39+ Scenario : As a teacher I should see all discussions in my course
40+ Given I log in as "teacher1"
41+ And I go to "search/index.php"
42+ And I fill in "id_q" with "Forum post 1"
43+ And I press "id_submitbutton"
44+ Then I should see "Forum post 1"
45+ And I should see "This is the body"
46+
47+ Scenario : As an enrolled student I should see all discussions in my course
48+ Given I log in as "student1"
49+ And I go to "search/index.php"
50+ And I fill in "id_q" with "Forum post 1"
51+ And I press "id_submitbutton"
52+ Then I should see "Forum post 1"
53+ And I should see "This is the body"
54+
55+ @test
56+ Scenario : As an unenrolled student I should see all discussions in my course
57+ Given I log in as "student2"
58+ And I go to "search/index.php"
59+ And I fill in "id_q" with "Forum post 1"
60+ And I press "id_submitbutton"
61+ Then I should not see "Forum post 1"
62+ And I should not see "This is the body"
0 commit comments