Commit ddf8ec9d671c8bf7efd22307b93e17252d305c49
1 parent
5be6657f
Exists in
master
and in
7 other branches
orders: move features to shopping_cart
Showing
9 changed files
with
294 additions
and
301 deletions
Show diff stats
plugins/orders/features/purchases.feature
@@ -1,155 +0,0 @@ | @@ -1,155 +0,0 @@ | ||
1 | -Feature: purchases | ||
2 | - As an enterprise's client | ||
3 | - I want to view my purchases | ||
4 | - In order to manage the products I bought | ||
5 | - | ||
6 | - Background: | ||
7 | - Given "ShoppingCart" plugin is enabled | ||
8 | - And "Orders" plugin is enabled | ||
9 | - And "Delivery" plugin is enabled | ||
10 | - And the following users | ||
11 | - | login | name | email | | ||
12 | - | moe | Moe | moe@springfield.com | | ||
13 | - | homer | Homer | homer@springfield.com | | ||
14 | - And the following enterprise | ||
15 | - | identifier | name | owner | | ||
16 | - | moes-tavern | Moes Tavern | moe | | ||
17 | - And the shopping basket is enabled on "Moes Tavern" | ||
18 | - And the following product_categories | ||
19 | - | name | | ||
20 | - | Beer | | ||
21 | - | Snacks | | ||
22 | - And the following products | ||
23 | - | owner | category | name | price | | ||
24 | - | moes-tavern | beer | Duff | 3.00 | | ||
25 | - | moes-tavern | snacks | French fries | 7.00 | | ||
26 | - And feature "products_for_enterprises" is enabled on environment | ||
27 | - And I am logged in as "homer" | ||
28 | - And I am on homer's control panel | ||
29 | - | ||
30 | - @selenium | ||
31 | - Scenario: view orders | ||
32 | - Given the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
33 | - | product | quantity | price | | ||
34 | - | Duff | 3 | 3.50 | | ||
35 | - | French fries | 1 | 7.00 | | ||
36 | - When I follow "Purchases made" | ||
37 | - Then I should see "Moes Tavern" within any ".actor-name" | ||
38 | - And I should see "17.50" within any ".total" | ||
39 | - And I should see "Ordered" within any ".situation" | ||
40 | - | ||
41 | - @selenium | ||
42 | - Scenario: view orders with different status | ||
43 | - Given the following purchase from "homer" on "moes-tavern" that is "accepted" | ||
44 | - | product | quantity | price | | ||
45 | - | Duff | 2 | 3.50 | | ||
46 | - And the following purchase from "homer" on "moes-tavern" that is "delivered" | ||
47 | - | product | quantity | price | | ||
48 | - | French fries | 1 | 7.00 | | ||
49 | - When I follow "Purchases made" | ||
50 | - Then I should see "Accepted" within any ".situation" | ||
51 | - And I should see "Delivered" within any ".situation" | ||
52 | - | ||
53 | - @selenium | ||
54 | - Scenario: filter orders by situation | ||
55 | - Given the following purchase from "homer" on "moes-tavern" that is "accepted" | ||
56 | - | product | quantity | price | | ||
57 | - | Duff | 2 | 3.50 | | ||
58 | - And the following purchase from "homer" on "moes-tavern" that is "delivered" | ||
59 | - | product | quantity | price | | ||
60 | - | French fries | 1 | 7.00 | | ||
61 | - And I follow "Purchases made" | ||
62 | - And I should see "Accepted" within any ".situation" | ||
63 | - And I should see "Delivered" within any ".situation" | ||
64 | - And I select "Delivered" from "Status" | ||
65 | - When I press "Filter" | ||
66 | - Then I should not see "Accepted" within any ".situation" | ||
67 | - And I should see "Delivered" within any ".situation" | ||
68 | - | ||
69 | - | ||
70 | - @selenium | ||
71 | - Scenario: filter orders by code | ||
72 | - Given the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
73 | - | product | quantity | price | | ||
74 | - | Duff | 2 | 3.50 | | ||
75 | - And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
76 | - | product | quantity | price | | ||
77 | - | French fries | 1 | 7.00 | | ||
78 | - And I follow "Purchases made" | ||
79 | - And I should see "1" within any ".code" | ||
80 | - And I should see "2" within any ".code" | ||
81 | - And I fill in "Code" with "2" | ||
82 | - When I press "Filter" | ||
83 | - Then I should not see "1" within any ".code" | ||
84 | - Then I should see "2" within any ".code" | ||
85 | - | ||
86 | - | ||
87 | - @selenium | ||
88 | - Scenario: filter orders by supplier | ||
89 | - Given the following users | ||
90 | - | login | name | email | | ||
91 | - | lovejoy | Reverend Lovejoy | lovejoy@springfield.com | | ||
92 | - And the following enterprise | ||
93 | - | identifier | name | owner | | ||
94 | - | first-church-of-springfield | First Church of Springfield | lovejoy | | ||
95 | - And the shopping basket is enabled on "First Church of Springfield" | ||
96 | - And the following product_categories | ||
97 | - | name | | ||
98 | - | Holy | | ||
99 | - And the following products | ||
100 | - | owner | category | name | price | | ||
101 | - | first-church-of-springfield | holy | Wine | 5.00 | | ||
102 | - And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
103 | - | product | quantity | price | | ||
104 | - | French fries | 1 | 7.00 | | ||
105 | - And the following purchase from "homer" on "first-church-of-springfield" that is "ordered" | ||
106 | - | product | quantity | price | | ||
107 | - | Wine | 5 | 10.50 | | ||
108 | - And I follow "Purchases made" | ||
109 | - And I should see "Moes Tavern" within any ".actor-name" | ||
110 | - And I should see "First Church of Springfield" within any ".actor-name" | ||
111 | - And I select "Moes Tavern" from "Supplier" | ||
112 | - When I press "Filter" | ||
113 | - Then I should see "Moes Tavern" within any ".actor-name" | ||
114 | - And I should not see "First Church of Springfield" within any ".actor-name" | ||
115 | - | ||
116 | - @selenium | ||
117 | - Scenario: products checkout | ||
118 | - Given "moes-tavern" has the following delivery methods | ||
119 | - | delivery_type | name | description | fixed_cost | free_over_price | | ||
120 | - | deliver | Bike | My good old bike. | 8.00 | 10.00 | | ||
121 | - | pickup | Bar | Come to my bar and drink it! | 0.00 | 0.00 | | ||
122 | - And I am on moes-tavern's products page | ||
123 | - And I follow "Add to basket" | ||
124 | - And I follow "Add to basket" | ||
125 | - And I follow "Add to basket" | ||
126 | - And I follow "Show basket" | ||
127 | - And I follow "Shopping checkout" | ||
128 | - And I fill in "Contact phone" with "123456789" | ||
129 | - And I select "Bike ($8.00)" from "Option" | ||
130 | - And I press "Send buy request" | ||
131 | - And I go to homer's control panel | ||
132 | - When I follow "Purchases made" | ||
133 | - Then I should see "Moes Tavern" within any ".actor-name" | ||
134 | - | ||
135 | - | ||
136 | - @selenium | ||
137 | - Scenario: repeat order | ||
138 | - Given "moes-tavern" has the following delivery methods | ||
139 | - | delivery_type | name | description | fixed_cost | free_over_price | | ||
140 | - | deliver | Bike | My good old bike. | 8.00 | 10.00 | | ||
141 | - | pickup | Bar | Come to my bar and drink it! | 0.00 | 0.00 | | ||
142 | - And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
143 | - | product | quantity | price | | ||
144 | - | Duff | 3 | 3.50 | | ||
145 | - | French fries | 1 | 7.00 | | ||
146 | - And I am on moes-tavern's products page | ||
147 | - And I follow "Add to basket" | ||
148 | - And I follow "Add to basket" | ||
149 | - And I follow "Show basket" | ||
150 | - And I follow "Clean basket" | ||
151 | - And I follow "Hide basket" | ||
152 | - When I follow "checkout" | ||
153 | - Then I should see "Shopping checkout" | ||
154 | - And I should see "Duff" | ||
155 | - And I should see "French fries" |
plugins/orders/features/sales.feature
@@ -1,104 +0,0 @@ | @@ -1,104 +0,0 @@ | ||
1 | -Feature: sales | ||
2 | - As an enterprise's administrator | ||
3 | - I want to view my sales | ||
4 | - In order to manage the products I sold | ||
5 | - | ||
6 | - Background: | ||
7 | - Given "ShoppingCart" plugin is enabled | ||
8 | - And "Orders" plugin is enabled | ||
9 | - And the following users | ||
10 | - | login | name | email | | ||
11 | - | moe | Moe | moe@springfield.com | | ||
12 | - | homer | Homer | homer@springfield.com | | ||
13 | - And the following enterprise | ||
14 | - | identifier | name | owner | | ||
15 | - | moes-tavern | Moes Tavern | moe | | ||
16 | - And "Moe" is admin of "Moes Tavern" | ||
17 | - And the shopping basket is enabled on "Moes Tavern" | ||
18 | - And the following product_categories | ||
19 | - | name | | ||
20 | - | Beer | | ||
21 | - | Snacks | | ||
22 | - And the following products | ||
23 | - | owner | category | name | price | | ||
24 | - | moes-tavern | beer | Duff | 3.00 | | ||
25 | - | moes-tavern | snacks | French fries | 7.00 | | ||
26 | - And feature "products_for_enterprises" is enabled on environment | ||
27 | - And I am logged in as "moe" | ||
28 | - And I am on moes-tavern's control panel | ||
29 | - | ||
30 | - @selenium | ||
31 | - Scenario: view orders | ||
32 | - Given the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
33 | - | product | quantity | price | | ||
34 | - | Duff | 3 | 3.50 | | ||
35 | - | French fries | 1 | 7.00 | | ||
36 | - When I follow "Purchases and Sales" | ||
37 | - Then I should see "Homer" within any ".actor-name" | ||
38 | - And I should see "17.50" within any ".total" | ||
39 | - And I should see "Ordered" within any ".situation" | ||
40 | - | ||
41 | - @selenium | ||
42 | - Scenario: view orders with different status | ||
43 | - Given the following purchase from "homer" on "moes-tavern" that is "accepted" | ||
44 | - | product | quantity | price | | ||
45 | - | Duff | 2 | 3.50 | | ||
46 | - And the following purchase from "homer" on "moes-tavern" that is "delivered" | ||
47 | - | product | quantity | price | | ||
48 | - | French fries | 1 | 7.00 | | ||
49 | - When I follow "Purchases and Sales" | ||
50 | - Then I should see "Accepted" within any ".situation" | ||
51 | - And I should see "Delivered" within any ".situation" | ||
52 | - | ||
53 | - @selenium | ||
54 | - Scenario: filter orders by situation | ||
55 | - Given the following purchase from "homer" on "moes-tavern" that is "accepted" | ||
56 | - | product | quantity | price | | ||
57 | - | Duff | 2 | 3.50 | | ||
58 | - And the following purchase from "homer" on "moes-tavern" that is "delivered" | ||
59 | - | product | quantity | price | | ||
60 | - | French fries | 1 | 7.00 | | ||
61 | - And I follow "Purchases and Sales" | ||
62 | - And I should see "Accepted" within any ".situation" | ||
63 | - And I should see "Delivered" within any ".situation" | ||
64 | - And I select "Delivered" from "Status" | ||
65 | - When I press "Filter" | ||
66 | - Then I should not see "Accepted" within any ".situation" | ||
67 | - And I should see "Delivered" within any ".situation" | ||
68 | - | ||
69 | - | ||
70 | - @selenium | ||
71 | - Scenario: filter orders by code | ||
72 | - Given the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
73 | - | product | quantity | price | | ||
74 | - | Duff | 2 | 3.50 | | ||
75 | - And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
76 | - | product | quantity | price | | ||
77 | - | French fries | 1 | 7.00 | | ||
78 | - And I follow "Purchases and Sales" | ||
79 | - And I should see "1" within any ".code" | ||
80 | - And I should see "2" within any ".code" | ||
81 | - And I fill in "Code" with "2" | ||
82 | - When I press "Filter" | ||
83 | - Then I should not see "1" within any ".code" | ||
84 | - Then I should see "2" within any ".code" | ||
85 | - | ||
86 | - | ||
87 | - @selenium | ||
88 | - Scenario: filter orders by consumer | ||
89 | - Given the following users | ||
90 | - | login | name | email | | ||
91 | - | lovejoy | Reverend Lovejoy | lovejoy@springfield.com | | ||
92 | - And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
93 | - | product | quantity | price | | ||
94 | - | Duff | 5 | 10.50 | | ||
95 | - And the following purchase from "lovejoy" on "moes-tavern" that is "ordered" | ||
96 | - | product | quantity | price | | ||
97 | - | French fries | 1 | 7.00 | | ||
98 | - And I follow "Purchases and Sales" | ||
99 | - And I should see "Homer" within any ".actor-name" | ||
100 | - And I should see "Reverend Lovejoy" within any ".actor-name" | ||
101 | - And I select "Homer" from "Consumer" | ||
102 | - When I press "Filter" | ||
103 | - Then I should see "Homer" within any ".actor-name" | ||
104 | - And I should not see "Reverend Lovejoy" within any ".actor-name" |
plugins/orders/features/step_definitions/orders_steps.rb
@@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
1 | -Given /^the shopping basket is (enabled|disabled) on "([^""]*)"$/ do |status, name| | ||
2 | - status = status == 'enabled' | ||
3 | - enterprise = Enterprise.find_by_name(name) || Enterprise[name] | ||
4 | - settings = enterprise.shopping_cart_settings({:enabled => status}) | ||
5 | - settings.save! | ||
6 | -end | ||
7 | - | ||
8 | -Given /^"([^""]*)" has the following delivery methods$/ do |name, table| | ||
9 | - enterprise = Enterprise.find_by_name(name) || Enterprise[name] | ||
10 | - table.hashes.map{|item| item.dup}.each do |item| | ||
11 | - delivery_method = enterprise.delivery_methods.build | ||
12 | - delivery_method.update_attributes(item) | ||
13 | - end | ||
14 | -end | ||
15 | - | ||
16 | -Given /^the following purchase from "([^""]*)" on "([^""]*)" that is "([^""]*)"$/ do |consumer_identifier, enterprise_identifier, status, table| | ||
17 | - consumer = Person.find_by_name(consumer_identifier) || Person[consumer_identifier] | ||
18 | - enterprise = Enterprise.find_by_name(enterprise_identifier) || Enterprise[enterprise_identifier] | ||
19 | - order = OrdersPlugin::Purchase.new(:profile => enterprise, :consumer => consumer, :status => status) | ||
20 | - | ||
21 | - table.hashes.map{|item| item.dup}.each do |item| | ||
22 | - product = enterprise.products.find_by_name item[:product] | ||
23 | - item = order.items.build({:product => product, :name => item[:product], :quantity_consumer_ordered => item[:quantity], :price => item[:price]}) | ||
24 | - item.order = order | ||
25 | - end | ||
26 | - | ||
27 | - order.save! | ||
28 | -end |
@@ -0,0 +1,155 @@ | @@ -0,0 +1,155 @@ | ||
1 | +Feature: purchases | ||
2 | + As an enterprise's client | ||
3 | + I want to view my purchases | ||
4 | + In order to manage the products I bought | ||
5 | + | ||
6 | + Background: | ||
7 | + Given "ShoppingCart" plugin is enabled | ||
8 | + And "Orders" plugin is enabled | ||
9 | + And "Delivery" plugin is enabled | ||
10 | + And the following users | ||
11 | + | login | name | email | | ||
12 | + | moe | Moe | moe@springfield.com | | ||
13 | + | homer | Homer | homer@springfield.com | | ||
14 | + And the following enterprise | ||
15 | + | identifier | name | owner | | ||
16 | + | moes-tavern | Moes Tavern | moe | | ||
17 | + And the shopping basket is enabled on "Moes Tavern" | ||
18 | + And the following product_categories | ||
19 | + | name | | ||
20 | + | Beer | | ||
21 | + | Snacks | | ||
22 | + And the following products | ||
23 | + | owner | category | name | price | | ||
24 | + | moes-tavern | beer | Duff | 3.00 | | ||
25 | + | moes-tavern | snacks | French fries | 7.00 | | ||
26 | + And feature "products_for_enterprises" is enabled on environment | ||
27 | + And I am logged in as "homer" | ||
28 | + And I am on homer's control panel | ||
29 | + | ||
30 | + @selenium | ||
31 | + Scenario: view orders | ||
32 | + Given the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
33 | + | product | quantity | price | | ||
34 | + | Duff | 3 | 3.50 | | ||
35 | + | French fries | 1 | 7.00 | | ||
36 | + When I follow "Purchases made" | ||
37 | + Then I should see "Moes Tavern" within any ".actor-name" | ||
38 | + And I should see "17.50" within any ".total" | ||
39 | + And I should see "Ordered" within any ".situation" | ||
40 | + | ||
41 | + @selenium | ||
42 | + Scenario: view orders with different status | ||
43 | + Given the following purchase from "homer" on "moes-tavern" that is "accepted" | ||
44 | + | product | quantity | price | | ||
45 | + | Duff | 2 | 3.50 | | ||
46 | + And the following purchase from "homer" on "moes-tavern" that is "delivered" | ||
47 | + | product | quantity | price | | ||
48 | + | French fries | 1 | 7.00 | | ||
49 | + When I follow "Purchases made" | ||
50 | + Then I should see "Accepted" within any ".situation" | ||
51 | + And I should see "Delivered" within any ".situation" | ||
52 | + | ||
53 | + @selenium | ||
54 | + Scenario: filter orders by situation | ||
55 | + Given the following purchase from "homer" on "moes-tavern" that is "accepted" | ||
56 | + | product | quantity | price | | ||
57 | + | Duff | 2 | 3.50 | | ||
58 | + And the following purchase from "homer" on "moes-tavern" that is "delivered" | ||
59 | + | product | quantity | price | | ||
60 | + | French fries | 1 | 7.00 | | ||
61 | + And I follow "Purchases made" | ||
62 | + And I should see "Accepted" within any ".situation" | ||
63 | + And I should see "Delivered" within any ".situation" | ||
64 | + And I select "Delivered" from "Status" | ||
65 | + When I press "Filter" | ||
66 | + Then I should not see "Accepted" within any ".situation" | ||
67 | + And I should see "Delivered" within any ".situation" | ||
68 | + | ||
69 | + | ||
70 | + @selenium | ||
71 | + Scenario: filter orders by code | ||
72 | + Given the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
73 | + | product | quantity | price | | ||
74 | + | Duff | 2 | 3.50 | | ||
75 | + And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
76 | + | product | quantity | price | | ||
77 | + | French fries | 1 | 7.00 | | ||
78 | + And I follow "Purchases made" | ||
79 | + And I should see "1" within any ".code" | ||
80 | + And I should see "2" within any ".code" | ||
81 | + And I fill in "Code" with "2" | ||
82 | + When I press "Filter" | ||
83 | + Then I should not see "1" within any ".code" | ||
84 | + Then I should see "2" within any ".code" | ||
85 | + | ||
86 | + | ||
87 | + @selenium | ||
88 | + Scenario: filter orders by supplier | ||
89 | + Given the following users | ||
90 | + | login | name | email | | ||
91 | + | lovejoy | Reverend Lovejoy | lovejoy@springfield.com | | ||
92 | + And the following enterprise | ||
93 | + | identifier | name | owner | | ||
94 | + | first-church-of-springfield | First Church of Springfield | lovejoy | | ||
95 | + And the shopping basket is enabled on "First Church of Springfield" | ||
96 | + And the following product_categories | ||
97 | + | name | | ||
98 | + | Holy | | ||
99 | + And the following products | ||
100 | + | owner | category | name | price | | ||
101 | + | first-church-of-springfield | holy | Wine | 5.00 | | ||
102 | + And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
103 | + | product | quantity | price | | ||
104 | + | French fries | 1 | 7.00 | | ||
105 | + And the following purchase from "homer" on "first-church-of-springfield" that is "ordered" | ||
106 | + | product | quantity | price | | ||
107 | + | Wine | 5 | 10.50 | | ||
108 | + And I follow "Purchases made" | ||
109 | + And I should see "Moes Tavern" within any ".actor-name" | ||
110 | + And I should see "First Church of Springfield" within any ".actor-name" | ||
111 | + And I select "Moes Tavern" from "Supplier" | ||
112 | + When I press "Filter" | ||
113 | + Then I should see "Moes Tavern" within any ".actor-name" | ||
114 | + And I should not see "First Church of Springfield" within any ".actor-name" | ||
115 | + | ||
116 | + @selenium | ||
117 | + Scenario: products checkout | ||
118 | + Given "moes-tavern" has the following delivery methods | ||
119 | + | delivery_type | name | description | fixed_cost | free_over_price | | ||
120 | + | deliver | Bike | My good old bike. | 8.00 | 10.00 | | ||
121 | + | pickup | Bar | Come to my bar and drink it! | 0.00 | 0.00 | | ||
122 | + And I am on moes-tavern's products page | ||
123 | + And I follow "Add to basket" | ||
124 | + And I follow "Add to basket" | ||
125 | + And I follow "Add to basket" | ||
126 | + And I follow "Show basket" | ||
127 | + And I follow "Shopping checkout" | ||
128 | + And I fill in "Contact phone" with "123456789" | ||
129 | + And I select "Bike ($8.00)" from "Option" | ||
130 | + And I press "Send buy request" | ||
131 | + And I go to homer's control panel | ||
132 | + When I follow "Purchases made" | ||
133 | + Then I should see "Moes Tavern" within any ".actor-name" | ||
134 | + | ||
135 | + | ||
136 | + @selenium | ||
137 | + Scenario: repeat order | ||
138 | + Given "moes-tavern" has the following delivery methods | ||
139 | + | delivery_type | name | description | fixed_cost | free_over_price | | ||
140 | + | deliver | Bike | My good old bike. | 8.00 | 10.00 | | ||
141 | + | pickup | Bar | Come to my bar and drink it! | 0.00 | 0.00 | | ||
142 | + And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
143 | + | product | quantity | price | | ||
144 | + | Duff | 3 | 3.50 | | ||
145 | + | French fries | 1 | 7.00 | | ||
146 | + And I am on moes-tavern's products page | ||
147 | + And I follow "Add to basket" | ||
148 | + And I follow "Add to basket" | ||
149 | + And I follow "Show basket" | ||
150 | + And I follow "Clean basket" | ||
151 | + And I follow "Hide basket" | ||
152 | + When I follow "checkout" | ||
153 | + Then I should see "Shopping checkout" | ||
154 | + And I should see "Duff" | ||
155 | + And I should see "French fries" |
@@ -0,0 +1,104 @@ | @@ -0,0 +1,104 @@ | ||
1 | +Feature: sales | ||
2 | + As an enterprise's administrator | ||
3 | + I want to view my sales | ||
4 | + In order to manage the products I sold | ||
5 | + | ||
6 | + Background: | ||
7 | + Given "ShoppingCart" plugin is enabled | ||
8 | + And "Orders" plugin is enabled | ||
9 | + And the following users | ||
10 | + | login | name | email | | ||
11 | + | moe | Moe | moe@springfield.com | | ||
12 | + | homer | Homer | homer@springfield.com | | ||
13 | + And the following enterprise | ||
14 | + | identifier | name | owner | | ||
15 | + | moes-tavern | Moes Tavern | moe | | ||
16 | + And "Moe" is admin of "Moes Tavern" | ||
17 | + And the shopping basket is enabled on "Moes Tavern" | ||
18 | + And the following product_categories | ||
19 | + | name | | ||
20 | + | Beer | | ||
21 | + | Snacks | | ||
22 | + And the following products | ||
23 | + | owner | category | name | price | | ||
24 | + | moes-tavern | beer | Duff | 3.00 | | ||
25 | + | moes-tavern | snacks | French fries | 7.00 | | ||
26 | + And feature "products_for_enterprises" is enabled on environment | ||
27 | + And I am logged in as "moe" | ||
28 | + And I am on moes-tavern's control panel | ||
29 | + | ||
30 | + @selenium | ||
31 | + Scenario: view orders | ||
32 | + Given the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
33 | + | product | quantity | price | | ||
34 | + | Duff | 3 | 3.50 | | ||
35 | + | French fries | 1 | 7.00 | | ||
36 | + When I follow "Purchases and Sales" | ||
37 | + Then I should see "Homer" within any ".actor-name" | ||
38 | + And I should see "17.50" within any ".total" | ||
39 | + And I should see "Ordered" within any ".situation" | ||
40 | + | ||
41 | + @selenium | ||
42 | + Scenario: view orders with different status | ||
43 | + Given the following purchase from "homer" on "moes-tavern" that is "accepted" | ||
44 | + | product | quantity | price | | ||
45 | + | Duff | 2 | 3.50 | | ||
46 | + And the following purchase from "homer" on "moes-tavern" that is "delivered" | ||
47 | + | product | quantity | price | | ||
48 | + | French fries | 1 | 7.00 | | ||
49 | + When I follow "Purchases and Sales" | ||
50 | + Then I should see "Accepted" within any ".situation" | ||
51 | + And I should see "Delivered" within any ".situation" | ||
52 | + | ||
53 | + @selenium | ||
54 | + Scenario: filter orders by situation | ||
55 | + Given the following purchase from "homer" on "moes-tavern" that is "accepted" | ||
56 | + | product | quantity | price | | ||
57 | + | Duff | 2 | 3.50 | | ||
58 | + And the following purchase from "homer" on "moes-tavern" that is "delivered" | ||
59 | + | product | quantity | price | | ||
60 | + | French fries | 1 | 7.00 | | ||
61 | + And I follow "Purchases and Sales" | ||
62 | + And I should see "Accepted" within any ".situation" | ||
63 | + And I should see "Delivered" within any ".situation" | ||
64 | + And I select "Delivered" from "Status" | ||
65 | + When I press "Filter" | ||
66 | + Then I should not see "Accepted" within any ".situation" | ||
67 | + And I should see "Delivered" within any ".situation" | ||
68 | + | ||
69 | + | ||
70 | + @selenium | ||
71 | + Scenario: filter orders by code | ||
72 | + Given the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
73 | + | product | quantity | price | | ||
74 | + | Duff | 2 | 3.50 | | ||
75 | + And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
76 | + | product | quantity | price | | ||
77 | + | French fries | 1 | 7.00 | | ||
78 | + And I follow "Purchases and Sales" | ||
79 | + And I should see "1" within any ".code" | ||
80 | + And I should see "2" within any ".code" | ||
81 | + And I fill in "Code" with "2" | ||
82 | + When I press "Filter" | ||
83 | + Then I should not see "1" within any ".code" | ||
84 | + Then I should see "2" within any ".code" | ||
85 | + | ||
86 | + | ||
87 | + @selenium | ||
88 | + Scenario: filter orders by consumer | ||
89 | + Given the following users | ||
90 | + | login | name | email | | ||
91 | + | lovejoy | Reverend Lovejoy | lovejoy@springfield.com | | ||
92 | + And the following purchase from "homer" on "moes-tavern" that is "ordered" | ||
93 | + | product | quantity | price | | ||
94 | + | Duff | 5 | 10.50 | | ||
95 | + And the following purchase from "lovejoy" on "moes-tavern" that is "ordered" | ||
96 | + | product | quantity | price | | ||
97 | + | French fries | 1 | 7.00 | | ||
98 | + And I follow "Purchases and Sales" | ||
99 | + And I should see "Homer" within any ".actor-name" | ||
100 | + And I should see "Reverend Lovejoy" within any ".actor-name" | ||
101 | + And I select "Homer" from "Consumer" | ||
102 | + When I press "Filter" | ||
103 | + Then I should see "Homer" within any ".actor-name" | ||
104 | + And I should not see "Reverend Lovejoy" within any ".actor-name" |
plugins/shopping_cart/features/step_definitions/delivery_steps.rb
0 → 100644
@@ -0,0 +1,7 @@ | @@ -0,0 +1,7 @@ | ||
1 | +Given /^"([^""]*)" has the following delivery methods$/ do |name, table| | ||
2 | + enterprise = Enterprise.find_by_name(name) || Enterprise[name] | ||
3 | + table.hashes.map{|item| item.dup}.each do |item| | ||
4 | + delivery_method = enterprise.delivery_methods.build | ||
5 | + delivery_method.update_attributes(item) | ||
6 | + end | ||
7 | +end |
plugins/shopping_cart/features/step_definitions/orders_steps.rb
0 → 100644
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +Given /^"([^""]*)" has the following delivery methods$/ do |name, table| | ||
2 | + enterprise = Enterprise.find_by_name(name) || Enterprise[name] | ||
3 | + table.hashes.map{|item| item.dup}.each do |item| | ||
4 | + delivery_method = enterprise.delivery_methods.build | ||
5 | + delivery_method.update_attributes(item) | ||
6 | + end | ||
7 | +end | ||
8 | + | ||
9 | +Given /^the following purchase from "([^""]*)" on "([^""]*)" that is "([^""]*)"$/ do |consumer_identifier, enterprise_identifier, status, table| | ||
10 | + consumer = Person.find_by_name(consumer_identifier) || Person[consumer_identifier] | ||
11 | + enterprise = Enterprise.find_by_name(enterprise_identifier) || Enterprise[enterprise_identifier] | ||
12 | + order = OrdersPlugin::Purchase.new(:profile => enterprise, :consumer => consumer, :status => status) | ||
13 | + | ||
14 | + table.hashes.map{|item| item.dup}.each do |item| | ||
15 | + product = enterprise.products.find_by_name item[:product] | ||
16 | + item = order.items.build({:product => product, :name => item[:product], :quantity_consumer_ordered => item[:quantity], :price => item[:price]}) | ||
17 | + item.order = order | ||
18 | + end | ||
19 | + | ||
20 | + order.save! | ||
21 | +end |
plugins/shopping_cart/features/step_definitions/shopping_cart_steps.rb
0 → 100644
@@ -0,0 +1,7 @@ | @@ -0,0 +1,7 @@ | ||
1 | +Given /^the shopping basket is (enabled|disabled) on "([^""]*)"$/ do |status, name| | ||
2 | + status = status == 'enabled' | ||
3 | + enterprise = Enterprise.find_by_name(name) || Enterprise[name] | ||
4 | + settings = enterprise.shopping_cart_settings({:enabled => status}) | ||
5 | + settings.save! | ||
6 | +end | ||
7 | + |
plugins/shopping_cart/step_definitions/delivery_steps.rb
@@ -1,14 +0,0 @@ | @@ -1,14 +0,0 @@ | ||
1 | -Given /^the shopping basket is (enabled|disabled) on "([^""]*)"$/ do |status, name| | ||
2 | - status = status == 'enabled' | ||
3 | - enterprise = Enterprise.find_by_name(name) || Enterprise[name] | ||
4 | - settings = enterprise.shopping_cart_settings({:enabled => status}) | ||
5 | - settings.save! | ||
6 | -end | ||
7 | - | ||
8 | -Given /^"([^""]*)" has the following delivery methods$/ do |name, table| | ||
9 | - enterprise = Enterprise.find_by_name(name) || Enterprise[name] | ||
10 | - table.hashes.map{|item| item.dup}.each do |item| | ||
11 | - delivery_method = enterprise.delivery_methods.build | ||
12 | - delivery_method.update_attributes(item) | ||
13 | - end | ||
14 | -end |