87f11866c77d174c9ae5f664ef62cf9f77f56330
[moodle.git] / tag / tests / behat / tagindex.feature
1 @core @core_tag
2 Feature: Browsing tagged items
3   In order to search by tag
4   As a user
5   I need to be able to browse tagged items
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email             | interests |
10       | user1    | User      | 1        | user1@example.com | Cat       |
11       | user2    | User      | 2        | user1@example.com | Cat, Dog  |
12       | user3    | User      | 3        | user1@example.com | Dog       |
13     And the following "courses" exist:
14       | fullname  | shortname | tags     |
15       | Course 1  | c1        | Cat, Dog |
16       | Course 2  | c2        | Cat      |
17       | Course 3  | c3        | Cat      |
18       | Course 4  | c4        | Cat      |
19       | Course 5  | c5        | Cat      |
20       | Course 6  | c6        | Cat      |
21       | Course 7  | c7        | Cat      |
23   Scenario: Browse tag index with javascript disabled
24     When I log in as "user1"
25     And I press "Customise this page"
26     # TODO MDL-57120 "Tags" link not accessible without navigation block.
27     And I add the "Navigation" block if not present
28     And I click on "Site pages" "list_item" in the "Navigation" "block"
29     And I click on "Tags" "link" in the "Navigation" "block"
30     And I follow "Cat"
31     Then I should see "Courses" in the ".tag-index-items h3" "css_element"
32     And I should see "User 1" in the "#tagarea-core-user" "css_element"
33     And I should see "Course 7"
34     And I should see "Course 3"
35     And I should not see "Course 2"
36     And I should not see "Course 1"
37     And I should see "User 1" in the "#tagarea-core-user" "css_element"
38     And I should see "User 2"
39     And I should not see "User 3"
40     And I click on "More" "link" in the "#tagarea-core-course" "css_element"
41     And I should see "Courses" in the "#tagarea-core-course" "css_element"
42     And "#tagarea-core-user" "css_element" should not exist
43     And I should not see "Course 7"
44     And I should not see "Course 3"
45     And I should see "Course 2"
46     And I should see "Course 1"
47     And I click on "Back" "link" in the "#tagarea-core-course" "css_element"
48     And I should see "Courses" in the ".tag-index-items h3" "css_element"
49     And "#tagarea-core-user" "css_element" should not exist
50     And I should see "Course 7"
51     And I should see "Course 3"
52     And I should not see "Course 2"
53     And I should not see "Course 1"
54     And I follow "Show only tagged Courses"
55     And I should see "Courses tagged with \"Cat\""
56     And "#tagarea-core-user" "css_element" should not exist
57     And I should see "Course 7"
58     And I should see "Course 3"
59     And I should see "Course 2"
60     And I should see "Course 1"
61     And I follow "Back to all items tagged with \"Cat\""
62     And I should see "Courses" in the "#tagarea-core-course" "css_element"
63     And I should see "User interests" in the "#tagarea-core-user" "css_element"
64     And I should see "Course 7"
65     And I should see "Course 3"
66     And I should not see "Course2"
67     And I should not see "Course1"
68     And I log out
70   @javascript
71   Scenario: Browse tag index with javascript enabled
72     When I log in as "user1"
73     And I press "Customise this page"
74     # TODO MDL-57120 "Tags" link not accessible without navigation block.
75     And I add the "Navigation" block if not present
76     And I click on "Site pages" "list_item" in the "Navigation" "block"
77     And I click on "Tags" "link" in the "Navigation" "block"
78     And I follow "Cat"
79     Then I should see "Courses" in the "#tagarea-core-course" "css_element"
80     And I should see "User interests" in the "#tagarea-core-user" "css_element"
81     And I should see "Course 7"
82     And I should see "Course 3"
83     And I should not see "Course 2"
84     And I should not see "Course 1"
85     And I click on "More" "link" in the "#tagarea-core-course" "css_element"
86     And I should see "Courses" in the "#tagarea-core-course" "css_element"
87     And I should see "User interests" in the "#tagarea-core-user" "css_element"
88     And I should not see "Course 7"
89     And I should not see "Course 3"
90     And I should see "Course 2"
91     And I should see "Course 1"
92     And I click on "Back" "link" in the "#tagarea-core-course" "css_element"
93     And I should see "Courses" in the "#tagarea-core-course" "css_element"
94     And I should see "User interests" in the "#tagarea-core-user" "css_element"
95     And I should see "Course 7"
96     And I should see "Course 3"
97     And I should not see "Course 2"
98     And I should not see "Course 1"
99     And I follow "Show only tagged Courses"
100     And I should see "Courses" in the "#tagarea-core-course" "css_element"
101     And "#tagarea-core-user" "css_element" should not exist
102     And I should see "Course 7"
103     And I should see "Course 3"
104     And I should see "Course 2"
105     And I should see "Course 1"
106     And I follow "Back to all items tagged with \"Cat\""
107     And I should see "Courses" in the "#tagarea-core-course" "css_element"
108     And I should see "User interests" in the "#tagarea-core-user" "css_element"
109     And I should see "Course 7"
110     And I should see "Course 3"
111     And I should not see "Course2"
112     And I should not see "Course1"
113     And I log out