MDL-37659 behat: Adding tests for the data generators
[moodle.git] / admin / tool / behat / tests / behat / data_generators.feature
CommitLineData
bedc20aa
DM
1@tool_behat
2Feature: Set up contextual data for tests
3 In order to write tests quickly
4 As a moodle developer
5 I need to fill the database with fixtures
6
7 Scenario: Add a bunch of users
8 Given the following "users" exists:
9 | username | password | firstname | lastname |
10 | testuser | testuser | | |
11 | testuser2 | testuser2 | TestFirstname | TestLastname |
12 And I log in as "testuser"
13 And I log out
14 When I log in as "testuser2"
15 Then I should see "TestFirstname"
16
17 @javascript
18 Scenario: Add a bunch of courses and categories
19 Given the following "categories" exists:
20 | name | category | idnumber |
21 | Cat 1 | 0 | CAT1 |
22 | Cat 2 | CAT1 | CAT2 |
23 | Cat 3 | CAT1 | CAT3 |
24 And the following "courses" exists:
25 | fullname | shortname | category |
26 | Course 1 | COURSE1 | CAT3 |
27 | Course 2 | COURSE2 | CAT3 |
28 | Course 3 | COURSE3 | 0 |
29 When I log in as "admin"
30 Then I should see "Course 1"
31 And I should see "Course 2"
32 And I should see "Course 3"
33
34 @javascript
35 Scenario: Add a bunch of groups and groupings
36 Given the following "courses" exists:
37 | fullname | shortname |
38 | Course 1 | C1 |
39 And the following "groups" exists:
40 | name | course | idnumber |
41 | Group 1 | C1 | G1 |
42 | Group 2 | C1 | G2 |
43 And the following "groupings" exists:
44 | name | course | idnumber |
45 | Grouping 1 | C1 | GG1 |
46 | Grouping 2 | C1 | GG2 |
47 When I log in as "admin"
48 And I follow "Course 1"
49 And I expand "Users" node
50 And I follow "Groups"
51 Then I should see "Group 1"
52 And I should see "Group 2"
53 And I follow "Groupings"
54 And I should see "Grouping 1"
55 And I should see "Grouping 2"
56
57 Scenario: Add course enrolments
58 Given the following "users" exists:
59 | username | firstname | lastname | email |
60 | student1 | Student | 1 | student1@asd.com |
61 And the following "courses" exists:
62 | fullname | shortname | format |
63 | Course 1 | C1 | topics |
64 And the following "course enrolments" exists:
65 | user | course | role |
66 | student1 | C1 | student |
67 When I log in as "student1"
68 And I follow "Course 1"
69 Then I should see "Topic 1"
70
71 @javascript
72 Scenario: Add relations between users and groups
73 Given the following "users" exists:
74 | username | firstname | lastname | email |
75 | student1 | Student | 1 | student1@asd.com |
76 | student2 | Student | 2 | student2@asd.com |
77 And the following "courses" exists:
78 | fullname | shortname |
79 | Course 1 | C1 |
80 And the following "groups" exists:
81 | name | course | idnumber |
82 | Group 1 | C1 | G1 |
83 | Group 2 | C1 | G2 |
84 And the following "groupings" exists:
85 | name | course | idnumber |
86 | Grouping 1 | C1 | GG1 |
87 And the following "course enrolments" exists:
88 | user | course | role |
89 | student1 | C1 | student |
90 | student2 | C1 | student |
91 And the following "group members" exists:
92 | user | group |
93 | student1 | G1 |
94 | student2 | G2 |
95 And the following "grouping groups" exists:
96 | grouping | group |
97 | GG1 | G1 |
98 When I log in as "admin"
99 And I follow "Course 1"
100 And I expand "Users" node
101 And I follow "Groups"
102 Then the "groups" select box should contain "Group 1 (1)"
103 And the "groups" select box should contain "Group 2 (1)"
104 And I select "Group 1 (1)" from "groups"
105 And I wait "1" seconds
106 And the "members" select box should contain "Student 1"
107 And I select "Group 2 (1)" from "groups"
108 And I wait "1" seconds
109 And the "members" select box should contain "Student 2"