manage_inputs.feature
9.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
Feature: manage inputs
As an enterprise owner
I want to manage my product's inputs
Background:
Given the following users
| login | name |
| joaosilva | Joao Silva |
And the following enterprises
| identifier | owner | name | enabled |
| redemoinho | joaosilva | Rede Moinho | true |
Given the following product_category
| name |
| Music |
And the following product_categories
| name | parent |
| Rock | music |
| CD Player | music |
And the following product
| owner | category | name |
| redemoinho | rock | Abbey Road |
And feature "products_for_enterprises" is enabled on environment
And the following units
| singular | plural |
| Meter | Meters |
| Litre | Litres |
@selenium
Scenario: add first input to a product
Given I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
Then I should not see "Add new input or raw material"
And I follow "Add the inputs or raw material used by this product"
And I select "Music »" from "category_id" within "#categories_container_level0"
And I select "Rock" from "category_id" within "#categories_container_level1"
And I press "Save and continue"
Then I should see "Rock"
@selenium
Scenario: add input to a product that already has inputs
Given the following input
| product | category |
| Abbey Road | music |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
And I should not see "Add the inputs or raw material used by this product"
And I follow "Add new input or raw material"
And I select "Music »" from "category_id" within "#categories_container_level0"
And I select "Rock" from "category_id" within "#categories_container_level1"
And I press "Save and continue"
Then I should see "Rock"
@selenium
Scenario: cancel addition of a product input
Given I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
And I follow "Add the inputs or raw material used by this product"
And I follow "Cancel" within "#categories_selection_actionbar"
Then I should see "Abbey Road"
And I should see "Add the inputs or raw material used by this product"
Scenario: show input name and link to add details
Given the following input
| product | category |
| Abbey Road | music |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs and raw material"
Then I should see "Music" within ".input-name"
And I should see "Click here to add price and the amount used"
Scenario: Not show input edit button when dont have details yet
Given the following input
| product | category |
| Abbey Road | music |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs and raw material"
Then I should not see "Edit" within ".input-item"
Scenario: Show button to edit input
Given the following input
| product | category | price_per_unit |
| Abbey Road | music | 10.0 |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs and raw material"
Then I should see "Edit" within ".input-item"
@selenium-fixme
Scenario: Order inputs by position
Given the following product_categories
| name |
| Instrumental |
And the following inputs
| product | category | position |
| Abbey Road | Instrumental | 2 |
| Abbey Road | Rock | 1 |
| Abbey Road | CD Player | 3 |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
Then I should see "Rock" above of "Instrumental"
And I should see "Instrumental" above of "CD Player"
@selenium
Scenario: Save price of input
Given the following input
| product | category |
| Abbey Road | music |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
Then I should see "Music"
When I follow "Click here to add price and the amount used"
And I should see "Price"
And I fill in "Price" with "10.50"
And I press "Save"
Then I should not see "Save"
@selenium
Scenario: Update label of input price with selected unit
Given the following input
| product | category |
| Abbey Road | music |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
And I follow "Click here to add price and the amount used"
And I should not see "Price by Meter ($)"
When I select "Meter" from "input_unit_id" within ".edit_input"
Then I should see "Price by Meter ($)"
@selenium
Scenario: Save all price details of input
Given the following input
| product | category |
| Abbey Road | music |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
And I follow "Click here to add price and the amount used"
And I fill in "Amount used" with "2.5"
And I fill in "Price" with "11.50"
And I select "Meter" from "input_unit_id" within ".edit_input"
And I press "Save"
Then I should see "2.5"
And I should see "Meter"
And I should not see "$ 11.50"
@selenium
Scenario: Save and then edit price details of input
Given the following input
| product | category |
| Abbey Road | music |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
And I follow "Click here to add price and the amount used"
And I fill in "Amount used" with "2.5"
And I fill in "Price" with "11.50"
And I select "Meter" from "input_unit_id" within ".edit_input"
And I press "Save"
Then I should see "2.5"
And I should see "Meter"
When I follow "Edit" within ".input-details"
And I fill in "Amount used" with "3.0"
And I fill in "Price" with "23.31"
And I select "Litre" from "input_unit_id" within ".edit_input"
And I press "Save"
Then I should see "3"
And I should see "Litre"
@selenium
Scenario: Cancel edition of a input
Given the following input
| product | category |
| Abbey Road | music |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
And I follow "Click here to add price and the amount used"
Then I should see "Cancel"
And I should see "Amount used"
And I should see "Price"
And I should see "This input or raw material inpact on the final price of the product?"
When I follow "Cancel" within ".edit_input"
Then I should see "Click here to add price and the amount used"
@selenium
Scenario: Cancel edition of an input then edit again
Given the following input
| product | category | price_per_unit | unit |
| Abbey Road | music | 10.0 | Meter |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
And I follow "Edit" within ".input-details"
And I follow "Cancel" within ".edit_input"
And I follow "Edit" within ".input-details"
Then I should see "Amount used"
And I should see "Price by Meter"
@selenium
Scenario: remove input
Given the following input
| product | category |
| Abbey Road | rock |
And I am logged in as "joaosilva"
And I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
Then I should see "Rock"
And I should not see "Add the inputs or raw material used by this product"
When I follow "Remove"
And I confirm the browser dialog
Then I should see "Add the inputs or raw material used by this product"
@selenium
Scenario: Remember in which tab I was
Given the following products
| owner | category | name |
| redemoinho | Music | Depeche Mode |
| redemoinho | Music | Manu Chao |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Depeche Mode
Then I should see "Add some description to your product"
And "Add the inputs or raw material used by this product" should not be visible within "#show_product"
When I follow "Inputs and raw material"
Then I should see "Add the inputs or raw material used by this product"
And "Add some description to your product" should not be visible within "#show_product"
When I go to Rede Moinho's page of product Manu Chao
Then I should see "Add some description to your product"
When I go to Rede Moinho's page of product Depeche Mode
Then I should see "Add the inputs or raw material used by this product"
And "Add some description to your product" should not be visible within "#show_product"
@selenium-fixme
Scenario: Order input list
Given the following product_category
| name |
| Movie |
And the following product
| owner | category | name |
| redemoinho | Movie | Ramones |
And the following inputs
| product | category |
| Ramones | Rock |
| Ramones | Music |
| Ramones | CD Player |
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Ramones
And I follow "Inputs"
Then I should see "Rock" above of "Music"
And I should see "Music" above of "CD Player"
When I drag "Rock" to "Music"
Then I should see "Music" above of "Rock"
And I should see "Rock" above of "CD Player"
When I follow "Back to the product listing"
And I go to Rede Moinho's page of product Ramones
Then I should see "Music" above of "Rock"
And I should see "Rock" above of "CD Player"