Skip to content

Commit 9967f57

Browse files
Add behat feature for anonymous mode
1 parent adf4ad1 commit 9967f57

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/behat/anonymous.feature

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@mod @mod_moodleoverflow @javascript
2+
Feature: Use moodleoverflow anonymously
3+
4+
Background:
5+
Given the following "users" exist:
6+
| username | firstname | lastname | email |
7+
| teacher1 | Teacher | 1 | teacher1@example.com |
8+
| student1 | Student | 1 | student1@example.com |
9+
And the following "courses" exist:
10+
| fullname | shortname | category |
11+
| Course 1 | C1 | 0 |
12+
And the following "course enrolments" exist:
13+
| user | course | role |
14+
| teacher1 | C1 | editingteacher |
15+
| student1 | C1 | student |
16+
And the following "activity" exists:
17+
| activity | moodleoverflow |
18+
| course | C1 |
19+
| name | Test moodleoverflow name |
20+
| anonymous | 2 |
21+
22+
@_file_upload
23+
Scenario: Other people should not see the questioners name in anonymous mode, not even as file author.
24+
Given I am on the "Test moodleoverflow name" "Activity" page logged in as "student1"
25+
And I press "Add a new discussion topic"
26+
And I set the following fields to these values:
27+
| Subject | This is Nina |
28+
| Message | She is nice. |
29+
And I upload "mod/moodleoverflow/tests/fixtures/NH.jpg" file to "Attachment" filemanager
30+
And I press "Post to forum"
31+
Then I should see "Anonymous (You)"
32+
When I am on the "Test moodleoverflow name" "Activity" page logged in as "teacher1"
33+
And I follow "This is Nina"
34+
Then I should not see "Student 1"
35+
And I should see "Questioner"
36+
Given I follow "Edit"
37+
And I click on "NH.jpg" "link"
38+
Then the field "Author" matches value "Anonymous"

0 commit comments

Comments
 (0)