1 |
efrain |
1 |
@core @javascript
|
|
|
2 |
Feature: Test dropdown output module
|
|
|
3 |
In order to show extra information to the user
|
|
|
4 |
As a user
|
|
|
5 |
I need to interact with the dropdown output modules
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
# Get to the fixture page.
|
|
|
9 |
Given I log in as "admin"
|
|
|
10 |
And I am on fixture page "/lib/tests/behat/fixtures/dropdown_output_testpage.php"
|
|
|
11 |
And I should not see "Dialog content"
|
|
|
12 |
|
|
|
13 |
Scenario: User can open a dropdown dialog
|
|
|
14 |
When I click on "Open dialog" "button" in the "regularscenario" "region"
|
|
|
15 |
Then I should see "Dialog content" in the "regularscenario" "region"
|
|
|
16 |
|
|
|
17 |
Scenario: Dropdown dialog can have rich content inside
|
|
|
18 |
When I click on "Open dialog" "button" in the "richcontent" "region"
|
|
|
19 |
Then I should see "Some rich content" in the "richcontent" "region"
|
|
|
20 |
And "Link 1" "link" should exist in the "richcontent" "region"
|
|
|
21 |
And "Eye icon" "icon" should exist in the "richbutton" "region"
|
|
|
22 |
|
|
|
23 |
Scenario: HTML attributtes can be overriden in dropdowns
|
|
|
24 |
When I click on "Open dialog" "button" in the "cssoverride" "region"
|
|
|
25 |
Then I should see "Dialog content" in the "cssoverride" "region"
|
|
|
26 |
And ".extraclass" "css_element" should exist in the "cssoverride" "region"
|
|
|
27 |
And "[data-foo='bar']" "css_element" should exist in the "extraattributes" "region"
|
|
|
28 |
And I should see "Custom ID button found" in the "customid" "region"
|
|
|
29 |
And "#CustomDropdownButtonId" "css_element" should exist in the "customid" "region"
|
|
|
30 |
And ".dialog-big" "css_element" should exist in the "widths" "region"
|
|
|
31 |
And ".dialog-small" "css_element" should exist in the "widths" "region"
|
|
|
32 |
|
|
|
33 |
Scenario: User can open a dropdown status
|
|
|
34 |
When I click on "Open dialog" "button" in the "statusregularscenario" "region"
|
|
|
35 |
Then I should see "Option 1" in the "statusregularscenario" "region"
|
|
|
36 |
And I should see "Option 1 description" in the "statusregularscenario" "region"
|
|
|
37 |
And I should see "Option 2" in the "statusregularscenario" "region"
|
|
|
38 |
And I should see "Option 2 description" in the "statusregularscenario" "region"
|
|
|
39 |
And "Eye icon 1" "icon" should exist in the "statusregularscenario" "region"
|
|
|
40 |
And "Eye icon 2" "icon" should exist in the "statusregularscenario" "region"
|
|
|
41 |
|
|
|
42 |
Scenario: Dropdown status can have as selected option
|
|
|
43 |
When I click on "Open dialog" "button" in the "statusselectedscenario" "region"
|
|
|
44 |
Then "Selected" "icon" in the "#statusselectedscenario [data-optionnumber='2']" "css_element" should be visible
|
|
|
45 |
And "Selected" "icon" in the "#statusselectedscenario [data-optionnumber='1']" "css_element" should not be visible
|
|
|
46 |
And "Selected" "icon" in the "#statusselectedscenario [data-optionnumber='3']" "css_element" should not be visible
|
|
|
47 |
|
|
|
48 |
Scenario: Dropdown status can have a disabled option
|
|
|
49 |
When I click on "Open dialog" "button" in the "statusdisablescenario" "region"
|
|
|
50 |
Then ".disabled" "css_element" should exist in the "#statusdisablescenario [data-optionnumber='2']" "css_element"
|
|
|
51 |
And ".disabled" "css_element" should not exist in the "#statusdisablescenario [data-optionnumber='1']" "css_element"
|
|
|
52 |
And ".disabled" "css_element" should not exist in the "#statusdisablescenario [data-optionnumber='3']" "css_element"
|
|
|
53 |
|
|
|
54 |
Scenario: Dropdown status can have a extra attribute in the options
|
|
|
55 |
When I click on "Open dialog" "button" in the "statusoptionextrasscenario" "region"
|
|
|
56 |
Then "[data-foo='bar']" "css_element" should exist in the "#statusoptionextrasscenario [data-optionnumber='2']" "css_element"
|
|
|
57 |
And "[data-foo='bar']" "css_element" should not exist in the "#statusoptionextrasscenario [data-optionnumber='1']" "css_element"
|
|
|
58 |
And "[data-foo='bar']" "css_element" should not exist in the "#statusoptionextrasscenario [data-optionnumber='3']" "css_element"
|
|
|
59 |
|
|
|
60 |
Scenario: Dropdown status can define urls in options
|
|
|
61 |
Given I should see "Foo param value: none"
|
|
|
62 |
When I click on "Open dialog" "button" in the "statusoptionurl" "region"
|
|
|
63 |
And I click on "Option 2" "link" in the "statusoptionurl" "region"
|
|
|
64 |
Then I should see "Foo param value: bar"
|
|
|
65 |
|
|
|
66 |
Scenario: Dropdowns dialogs can be controlled via javascript
|
|
|
67 |
Given "Open dialog" "button" should exist in the "dialogjscontrolssection" "region"
|
|
|
68 |
And I should see "The dropdown is hidden" in the "dialogjscontrolssection" "region"
|
|
|
69 |
# Change button text.
|
|
|
70 |
When I click on "Change button text" "button" in the "dialogjscontrolssection" "region"
|
|
|
71 |
Then "New button text" "button" should exist in the "dialogjscontrolssection" "region"
|
|
|
72 |
# Open dropdown.
|
|
|
73 |
And I click on "Open" "button" in the "dialogjscontrolssection" "region"
|
|
|
74 |
And I should see "Dialog content" in the "dialogjscontrolssection" "region"
|
|
|
75 |
And I should see "The dropdown is visible" in the "dialogjscontrolssection" "region"
|
|
|
76 |
# Close dropdown.
|
|
|
77 |
And I click on "Close" "button" in the "dialogjscontrolssection" "region"
|
|
|
78 |
And I should not see "Dialog content" in the "dialogjscontrolssection" "region"
|
|
|
79 |
And I should see "The dropdown is hidden" in the "dialogjscontrolssection" "region"
|
|
|
80 |
|
|
|
81 |
Scenario: Dropdown status can sync the clicked option with the button text
|
|
|
82 |
Given I should see "Option 2" in the "statussyncbutton" "region"
|
|
|
83 |
When I click on "Option 2" "button" in the "statussyncbutton" "region"
|
|
|
84 |
And "Selected" "icon" in the "#statussyncbutton [data-optionnumber='2']" "css_element" should be visible
|
|
|
85 |
And "Selected" "icon" in the "#statussyncbutton [data-optionnumber='3']" "css_element" should not be visible
|
|
|
86 |
And I click on "Option 3" "link" in the "statussyncbutton" "region"
|
|
|
87 |
Then I should see "Option 3" in the "statussyncbutton" "region"
|
|
|
88 |
And I should not see "Option 2" in the "statussyncbutton" "region"
|
|
|
89 |
And I click on "Option 3" "button" in the "statussyncbutton" "region"
|
|
|
90 |
And "Selected" "icon" in the "#statussyncbutton [data-optionnumber='2']" "css_element" should not be visible
|
|
|
91 |
And "Selected" "icon" in the "#statussyncbutton [data-optionnumber='3']" "css_element" should be visible
|
|
|
92 |
|
|
|
93 |
Scenario: Dropdowns status can be controlled via javascript
|
|
|
94 |
Given "Open dialog" "button" should exist in the "statusjscontrolsection" "region"
|
|
|
95 |
And I should see "The status value is option2" in the "statusjscontrolsection" "region"
|
|
|
96 |
# Change value.
|
|
|
97 |
When I click on "Change selected value" "button" in the "statusjscontrolsection" "region"
|
|
|
98 |
Then I should see "The status value is option3" in the "statusjscontrolsection" "region"
|
|
|
99 |
And I click on "Open dialog" "button" in the "statusjscontrolsection" "region"
|
|
|
100 |
And "Selected" "icon" in the "#statusjscontrolsection [data-optionnumber='2']" "css_element" should not be visible
|
|
|
101 |
And "Selected" "icon" in the "#statusjscontrolsection [data-optionnumber='3']" "css_element" should be visible
|
|
|
102 |
# Enable button sync.
|
|
|
103 |
And I click on "Enable sync" "button" in the "statusjscontrolsection" "region"
|
|
|
104 |
And I should see "Option 3" in the "statusjscontrolsection" "region"
|
|
|
105 |
And I click on "Option 3" "button" in the "statusjscontrolsection" "region"
|
|
|
106 |
And I click on "Option 2" "link" in the "statusjscontrolsection" "region"
|
|
|
107 |
And I should see "The status value is option2" in the "statusjscontrolsection" "region"
|
|
|
108 |
And I should see "Option 2" in the "statusjscontrolsection" "region"
|
|
|
109 |
# Trigger change event with button text sync.
|
|
|
110 |
And I click on "Change selected value" "button" in the "statusjscontrolsection" "region"
|
|
|
111 |
And I should see "Option 3" in the "statusjscontrolsection" "region"
|
|
|
112 |
And I should see "The status value is option3" in the "statusjscontrolsection" "region"
|
|
|
113 |
# Disable button text sync.
|
|
|
114 |
And I click on "Disable sync" "button" in the "statusjscontrolsection" "region"
|
|
|
115 |
And I click on "Option 3" "button" in the "statusjscontrolsection" "region"
|
|
|
116 |
And I click on "Option 1" "link" in the "statusjscontrolsection" "region"
|
|
|
117 |
And I should see "Option 3" in the "statusjscontrolsection" "region"
|
|
|
118 |
And I should see "The status value is option1" in the "statusjscontrolsection" "region"
|
|
|
119 |
And I click on "Change selected value" "button" in the "statusjscontrolsection" "region"
|
|
|
120 |
And I should see "Option 3" in the "statusjscontrolsection" "region"
|
|
|
121 |
And I should see "The status value is option2" in the "statusjscontrolsection" "region"
|
|
|
122 |
# Disable update.
|
|
|
123 |
And I click on "Disable update" "button" in the "statusjscontrolsection" "region"
|
|
|
124 |
And I click on "Option 3" "button" in the "statusjscontrolsection" "region"
|
|
|
125 |
And I click on "Option 1" "link" in the "statusjscontrolsection" "region"
|
|
|
126 |
And I should see "The status value is option2" in the "statusjscontrolsection" "region"
|
|
|
127 |
And I click on "Option 3" "button" in the "statusjscontrolsection" "region"
|
|
|
128 |
And "Selected" "icon" in the "#statusjscontrolsection [data-optionnumber='1']" "css_element" should not be visible
|
|
|
129 |
And "Selected" "icon" in the "#statusjscontrolsection [data-optionnumber='2']" "css_element" should be visible
|
|
|
130 |
|
|
|
131 |
Scenario: Dropdown status content is accessible with keyboard
|
|
|
132 |
Given I click on "Focus helper" "button" in the "statussyncbutton" "region"
|
|
|
133 |
When I press the tab key
|
|
|
134 |
# Open and close dropdown with enter key.
|
|
|
135 |
Then I press the enter key
|
|
|
136 |
And the focused element is "[data-for='dropdowndialog_button']" "css_element" in the "statussyncbutton" "region"
|
|
|
137 |
And I should see "Option 1" in the "statussyncbutton" "region"
|
|
|
138 |
And I press the enter key
|
|
|
139 |
And the focused element is "[data-for='dropdowndialog_button']" "css_element" in the "statussyncbutton" "region"
|
|
|
140 |
And I should not see "Option 1" in the "statussyncbutton" "region"
|
|
|
141 |
# Open and close with down and up keys.
|
|
|
142 |
And I press the down key
|
|
|
143 |
And the focused element is "[data-optionnumber='1'] a" "css_element" in the "statussyncbutton" "region"
|
|
|
144 |
And I should see "Option 1" in the "statussyncbutton" "region"
|
|
|
145 |
And I press the up key
|
|
|
146 |
And the focused element is "[data-for='dropdowndialog_button']" "css_element" in the "statussyncbutton" "region"
|
|
|
147 |
And I should see "Option 1" in the "statussyncbutton" "region"
|
|
|
148 |
And I press the up key
|
|
|
149 |
And the focused element is "[data-for='dropdowndialog_button']" "css_element" in the "statussyncbutton" "region"
|
|
|
150 |
And I should not see "Option 1" in the "statussyncbutton" "region"
|
|
|
151 |
# Select to option 3 and check user cannot go beyond that.
|
|
|
152 |
And I press the down key
|
|
|
153 |
And the focused element is "[data-optionnumber='1'] a" "css_element" in the "statussyncbutton" "region"
|
|
|
154 |
And I press the down key
|
|
|
155 |
And the focused element is "[data-optionnumber='2'] a" "css_element" in the "statussyncbutton" "region"
|
|
|
156 |
And I press the down key
|
|
|
157 |
And the focused element is "[data-optionnumber='3'] a" "css_element" in the "statussyncbutton" "region"
|
|
|
158 |
And I press the down key
|
|
|
159 |
And the focused element is "[data-optionnumber='3'] a" "css_element" in the "statussyncbutton" "region"
|
|
|
160 |
And I press the enter key
|
|
|
161 |
And I should see "Option 3" in the "statussyncbutton" "region"
|
|
|
162 |
# Close dropdown with escape key.
|
|
|
163 |
And I press the down key
|
|
|
164 |
And the focused element is "[data-optionnumber='1'] a" "css_element" in the "statussyncbutton" "region"
|
|
|
165 |
And I should see "Option 1" in the "statussyncbutton" "region"
|
|
|
166 |
And I press the escape key
|
|
|
167 |
And the focused element is "[data-for='dropdowndialog_button']" "css_element" in the "statussyncbutton" "region"
|
|
|
168 |
And I should not see "Option 1" in the "statussyncbutton" "region"
|