weekly release 2.6dev
[moodle.git] / admin / tool / behat / tests / behat / data_generators.feature
CommitLineData
550d842e 1@tool @tool_behat
bedc20aa
DM
2Feature: Set up contextual data for tests
3 In order to write tests quickly
5d7b6307 4 As a developer
bedc20aa
DM
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"
4aad6f02
EL
33 When I go to the courses management page
34 And I follow "Cat 1"
35 Then I should see "Cat 2"
36 And I should see "Cat 3"
37 When I follow "Cat 3"
38 Then I should see "Course 1"
39 And I should see "Course 2"
40 When I select "Cat 2" from "Course categories:"
41 Then I should see "No courses in this category"
42 When I select "Miscellaneous" from "Course categories:"
43 Then I should see "Course 3"
bedc20aa
DM
44
45 @javascript
46 Scenario: Add a bunch of groups and groupings
47 Given the following "courses" exists:
48 | fullname | shortname |
49 | Course 1 | C1 |
50 And the following "groups" exists:
51 | name | course | idnumber |
52 | Group 1 | C1 | G1 |
53 | Group 2 | C1 | G2 |
54 And the following "groupings" exists:
55 | name | course | idnumber |
56 | Grouping 1 | C1 | GG1 |
57 | Grouping 2 | C1 | GG2 |
58 When I log in as "admin"
59 And I follow "Course 1"
60 And I expand "Users" node
61 And I follow "Groups"
62 Then I should see "Group 1"
63 And I should see "Group 2"
64 And I follow "Groupings"
65 And I should see "Grouping 1"
66 And I should see "Grouping 2"
67
68 Scenario: Add course enrolments
69 Given the following "users" exists:
70 | username | firstname | lastname | email |
71 | student1 | Student | 1 | student1@asd.com |
72 And the following "courses" exists:
73 | fullname | shortname | format |
74 | Course 1 | C1 | topics |
75 And the following "course enrolments" exists:
76 | user | course | role |
77 | student1 | C1 | student |
78 When I log in as "student1"
79 And I follow "Course 1"
80 Then I should see "Topic 1"
81
82 @javascript
83 Scenario: Add relations between users and groups
84 Given the following "users" exists:
85 | username | firstname | lastname | email |
86 | student1 | Student | 1 | student1@asd.com |
87 | student2 | Student | 2 | student2@asd.com |
88 And the following "courses" exists:
89 | fullname | shortname |
90 | Course 1 | C1 |
91 And the following "groups" exists:
92 | name | course | idnumber |
93 | Group 1 | C1 | G1 |
94 | Group 2 | C1 | G2 |
95 And the following "groupings" exists:
96 | name | course | idnumber |
97 | Grouping 1 | C1 | GG1 |
98 And the following "course enrolments" exists:
99 | user | course | role |
100 | student1 | C1 | student |
101 | student2 | C1 | student |
102 And the following "group members" exists:
103 | user | group |
104 | student1 | G1 |
105 | student2 | G2 |
106 And the following "grouping groups" exists:
107 | grouping | group |
108 | GG1 | G1 |
109 When I log in as "admin"
110 And I follow "Course 1"
111 And I expand "Users" node
112 And I follow "Groups"
113 Then the "groups" select box should contain "Group 1 (1)"
114 And the "groups" select box should contain "Group 2 (1)"
115 And I select "Group 1 (1)" from "groups"
cd65dc32 116 And I wait "5" seconds
bedc20aa
DM
117 And the "members" select box should contain "Student 1"
118 And I select "Group 2 (1)" from "groups"
cd65dc32 119 And I wait "5" seconds
bedc20aa 120 And the "members" select box should contain "Student 2"