Skip to content

Commit 9165012

Browse files
authored
Merge pull request #243 from learnweb/tests/behat_cleaning
Simplify behat tests
2 parents 4279427 + e9054ff commit 9165012

11 files changed

+323
-434
lines changed

tests/behat/add_moodleoverflow.feature

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,15 @@ Feature: Add moodleoverflow activities and discussions
55
I need to add forum activities to moodle courses
66

77
Scenario: Add a moodleoverflow and a discussion
8-
Given the following "users" exist:
9-
| username | firstname | lastname | email |
10-
| teacher1 | Teacher | 1 | teacher1@example.com |
11-
| student1 | Student | 1 | student1@example.com |
12-
And the following "courses" exist:
13-
| fullname | shortname | category |
14-
| Course 1 | C1 | 0 |
15-
And the following "course enrolments" exist:
16-
| user | course | role |
17-
| teacher1 | C1 | editingteacher |
18-
| student1 | C1 | student |
8+
Given I prepare a moodleoverflow feature background with users:
9+
| username | firstname | lastname | email | idnumber | role |
10+
| student1 | Student | 1 | student1@mail.com | 10 | student |
11+
| teacher1 | Teacher | 1 | teacher1@mail.com | 11 | editingteacher |
1912
And I log in as "teacher1"
20-
And I am on "Course 1" course homepage
21-
And I turn editing mode on
13+
And I am on "Course 1" course homepage with editing mode "on"
2214
And I add a moodleoverflow to course "C1" section "1" and I fill the form with:
2315
| Moodleoverflow name | Test moodleoverflow name |
2416
| Description | Test forum description |
2517
And I add a new discussion to "Test moodleoverflow name" moodleoverflow with:
2618
| Subject | Forum post 1 |
2719
| Message | This is the body |
28-
And I log out

tests/behat/anonymous.feature

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,30 @@
22
Feature: Use moodleoverflow anonymously
33

44
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 |
5+
Given I prepare a moodleoverflow feature background with users:
6+
| username | firstname | lastname | email | idnumber | role |
7+
| student1 | Student | 1 | student1@mail.com | 10 | student |
8+
| teacher1 | Teacher | 1 | teacher1@mail.com | 11 | editingteacher |
169
And the following "activity" exists:
17-
| activity | moodleoverflow |
18-
| course | C1 |
19-
| name | Test moodleoverflow name |
20-
| anonymous | 2 |
10+
| activity | moodleoverflow |
11+
| course | C1 |
12+
| name | Test moodleoverflow |
13+
| anonymous | 2 |
2114

2215
@_file_upload
2316
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"
17+
Given I navigate as "student1" to "Course 1" "Test moodleoverflow" ""
2518
And I press "Add a new discussion topic"
2619
And I set the following fields to these values:
2720
| Subject | This is Nina |
2821
| Message | She is nice. |
2922
And I upload "mod/moodleoverflow/tests/fixtures/NH.jpg" file to "Attachment" filemanager
3023
And I press "Post to forum"
3124
Then I should see "Anonymous (You)"
32-
When I am on the "Test moodleoverflow name" "Activity" page logged in as "teacher1"
25+
When I navigate as "teacher1" to "Course 1" "Test moodleoverflow" ""
3326
And I follow "This is Nina"
3427
Then I should not see "Student 1"
3528
And I should see "Questioner"
36-
Given I follow "Edit"
37-
And I click on "NH.jpg" "link"
29+
When I click in moodleoverflow on "link" type:
30+
| Edit | NH.jpg |
3831
Then the field "Author" matches value "Anonymous"

0 commit comments

Comments
 (0)