MDL-57281 question: Correct path to Quiz admin in test
[moodle.git] / question / tests / behat / move_question_categories.feature
blobd34e9797fd300ceb1a75c0360c2b0d9bb8465d26
1 @core @core_question
2 Feature: A teacher can move question categories in the question bank
3   In order to organize my questions
4   As a teacher
5   I create question categories and move them in the question bank
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email                |
10       | teacher1 | T1        | Teacher1 | teacher1@example.com |
11     And the following "courses" exist:
12       | fullname | shortname | category |
13       | Course 1 | C1        | 0        |
14     And the following "course enrolments" exist:
15       | user     | course | role           |
16       | teacher1 | C1     | editingteacher |
17     And the following "activities" exist:
18       | activity   | name      | course | idnumber |
19       | quiz       | Test quiz | C1     | quiz1    |
20     And I log in as "teacher1"
21     And I am on "Course 1" course homepage
23   Scenario: A question category can be moved to another context
24     When I follow "Test quiz"
25     And I navigate to "Question bank > Categories" in current page administration
26     And I set the following fields to these values:
27       | Name            | Test category         |
28       | Parent category | Top for Test quiz     |
29     And I press "submitbutton"
30     And I click on "Share in context for Course: Course 1" "link" in the "Test category" "list_item"
31     Then I should see "Test category" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' questioncategories ') and contains(concat(' ', normalize-space(@class), ' '), ' contextlevel50 ')]" "xpath_element"
33   Scenario: A question category can be moved to top level
34     When I follow "Test quiz"
35     And I navigate to "Question bank > Categories" in current page administration
36     And I set the following fields to these values:
37       | Name            | Test category         |
38       | Parent category | Default for Test quiz |
39       | Category info   | Created as a test     |
40     And I press "submitbutton"
41     And I click on "Move to top level" "link" in the "Test category" "list_item"
42     Then I should see "Test category" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' questioncategories ') and contains(concat(' ', normalize-space(@class), ' '), ' contextlevel70 ')]" "xpath_element"
43     And "//div[contains(concat(' ', normalize-space(@class), ' '), ' questioncategories ') and contains(concat(' ', normalize-space(@class), ' '), ' contextlevel70 ')]//li//ul" "xpath_element" should not exist