MDL-66553 question: Behat fixes
[moodle.git] / question / tests / behat / sort_questions.feature
CommitLineData
550d842e 1@core @core_question
df44db5b
TH
2Feature: The questions in the question bank can be sorted in various ways
3 In order to see what questions I have
d72a1836 4 As a teacher
df44db5b 5 I want to view them in different orders
d72a1836 6
df44db5b 7 Background:
759b323e 8 Given the following "users" exist:
d72a1836 9 | username | firstname | lastname | email |
0fe86bbd 10 | teacher1 | Teacher | 1 | teacher1@example.com |
759b323e 11 And the following "courses" exist:
d72a1836
DM
12 | fullname | shortname | format |
13 | Course 1 | C1 | weeks |
759b323e 14 And the following "course enrolments" exist:
d72a1836
DM
15 | user | course | role |
16 | teacher1 | C1 | editingteacher |
df44db5b
TH
17 And the following "question categories" exist:
18 | contextlevel | reference | name |
19 | Course | C1 | Test questions |
20 And the following "questions" exist:
0aa17f26
JP
21 | questioncategory | qtype | name | user | questiontext | idnumber |
22 | Test questions | essay | A question 1 name | admin | Question 1 text | numidnuma |
23 | Test questions | essay | B question 2 name | teacher1 | Question 2 text | |
24 | Test questions | numerical | C question 3 name | teacher1 | Question 3 text | numidnumc |
d72a1836 25 And I log in as "teacher1"
fdeeaff9 26 And I am on "Course 1" course homepage
02fda279 27 And I navigate to "Question bank > Questions" in current page administration
df44db5b
TH
28
29 @javascript
30 Scenario: The questions are sorted by type by default
31 Then "A question 1 name" "checkbox" should appear before "C question 3 name" "checkbox"
32
61cc1e64
TH
33 @javascript
34 Scenario: The questions can be sorted by idnumber
35 When I follow "Sort by ID number ascending"
0aa17f26
JP
36 Then "C question 3 name" "checkbox" should appear after "A question 1 name" "checkbox"
37 And I should see "numidnumc" in the "C question 3 name" "table_row"
38 And I follow "Sort by ID number descending"
39 And "C question 3 name" "checkbox" should appear before "A question 1 name" "checkbox"
61cc1e64 40
df44db5b
TH
41 @javascript
42 Scenario: The questions can be sorted in reverse order by type
43 When I follow "Sort by Question type descending"
44 Then "C question 3 name" "checkbox" should appear before "A question 1 name" "checkbox"
45
46 @javascript
47 Scenario: The questions can be sorted by name
61cc1e64 48 When I follow "Sort by Question name ascending"
d72a1836
DM
49 Then "A question 1 name" "checkbox" should appear before "B question 2 name" "checkbox"
50 And "B question 2 name" "checkbox" should appear before "C question 3 name" "checkbox"
df44db5b
TH
51
52 @javascript
53 Scenario: The questions can be sorted in reverse order by name
61cc1e64
TH
54 When I follow "Sort by Question name ascending"
55 And I follow "Sort by Question name descending"
df44db5b 56 Then "C question 3 name" "checkbox" should appear before "B question 2 name" "checkbox"
d72a1836 57 And "B question 2 name" "checkbox" should appear before "A question 1 name" "checkbox"
df44db5b
TH
58
59 @javascript
60 Scenario: The questions can be sorted by creator name
61 When I follow "Sort by First name ascending"
62 Then "A question 1 name" "checkbox" should appear before "B question 2 name" "checkbox"
63
64 @javascript
65 Scenario: The questions can be sorted in reverse order by creator name
66 When I follow "Sort by First name ascending"
d72a1836 67 And I follow "Sort by First name descending"
df44db5b
TH
68 Then "B question 2 name" "checkbox" should appear before "A question 1 name" "checkbox"
69
70 @javascript
71 Scenario: The question text can be shown in the list of questions
72 When I click on "Show question text in the question list" "checkbox"
73 Then I should see "Question 1 text"
74 And I should see "Question 2 text"
75 And I should see "Question 3 text"