solidus_backend 1.1.4 → 1.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_backend might be problematic. Click here for more details.

Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/solidus-style-guide-logo.png +0 -0
  3. data/app/assets/javascripts/spree/backend/admin.js.erb +1 -7
  4. data/app/assets/javascripts/spree/backend/checkouts/edit.js +2 -2
  5. data/app/assets/javascripts/spree/backend/navigation.coffee +10 -0
  6. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
  7. data/app/assets/javascripts/spree/backend/option_value_picker.js +6 -6
  8. data/app/assets/javascripts/spree/backend/product_picker.js +6 -6
  9. data/app/assets/javascripts/spree/backend/shipments.js.erb +17 -3
  10. data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
  11. data/app/assets/javascripts/spree/backend/style_guide.coffee +2 -0
  12. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
  13. data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +82 -109
  14. data/app/assets/javascripts/spree/backend/taxons.js.coffee +4 -5
  15. data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
  16. data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +3 -3
  17. data/app/assets/javascripts/spree/backend.js +3 -6
  18. data/app/assets/stylesheets/spree/backend/components/_messages.scss +1 -4
  19. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +99 -115
  20. data/app/assets/stylesheets/spree/backend/components/_progress.scss +1 -1
  21. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +6 -0
  22. data/app/assets/stylesheets/spree/backend/globals/_variables.scss +18 -0
  23. data/app/assets/stylesheets/spree/backend/globals/mixins/_caret.scss +35 -0
  24. data/app/assets/stylesheets/spree/backend/plugins/_powertip.scss +1 -0
  25. data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +132 -0
  26. data/app/assets/stylesheets/spree/backend/sections/_taxonomies.scss +60 -0
  27. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +2 -0
  28. data/app/assets/stylesheets/spree/backend/shared/_layout.scss +36 -4
  29. data/app/assets/stylesheets/spree/backend/shared/_typography.scss +3 -6
  30. data/app/assets/stylesheets/spree/backend/spree_admin.scss +4 -1
  31. data/app/assets/stylesheets/spree/backend.css +1 -1
  32. data/app/controllers/spree/admin/orders_controller.rb +6 -6
  33. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  34. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  35. data/app/controllers/spree/admin/products_controller.rb +0 -1
  36. data/app/controllers/spree/admin/reports_controller.rb +2 -2
  37. data/app/controllers/spree/admin/search_controller.rb +9 -7
  38. data/app/controllers/spree/admin/stock_transfers_controller.rb +6 -14
  39. data/app/controllers/spree/admin/style_guide_controller.rb +33 -0
  40. data/app/helpers/spree/admin/adjustments_helper.rb +2 -6
  41. data/app/helpers/spree/admin/base_helper.rb +7 -6
  42. data/app/helpers/spree/admin/navigation_helper.rb +12 -5
  43. data/app/helpers/spree/admin/orders_helper.rb +1 -1
  44. data/app/helpers/spree/admin/products_helper.rb +2 -4
  45. data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
  46. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  47. data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +1 -1
  48. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +1 -1
  49. data/app/views/spree/admin/customer_returns/edit.html.erb +1 -1
  50. data/app/views/spree/admin/images/edit.html.erb +1 -3
  51. data/app/views/spree/admin/images/index.html.erb +0 -2
  52. data/app/views/spree/admin/option_types/edit.html.erb +2 -4
  53. data/app/views/spree/admin/option_types/index.html.erb +0 -2
  54. data/app/views/spree/admin/option_types/new.html.erb +0 -2
  55. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
  56. data/app/views/spree/admin/orders/index.html.erb +1 -1
  57. data/app/views/spree/admin/product_properties/index.html.erb +0 -1
  58. data/app/views/spree/admin/products/edit.html.erb +0 -2
  59. data/app/views/spree/admin/products/index.html.erb +2 -4
  60. data/app/views/spree/admin/products/new.html.erb +0 -2
  61. data/app/views/spree/admin/promotion_categories/edit.html.erb +0 -2
  62. data/app/views/spree/admin/promotion_categories/index.html.erb +0 -2
  63. data/app/views/spree/admin/promotion_categories/new.html.erb +0 -2
  64. data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +2 -28
  65. data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +2 -26
  66. data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +28 -0
  67. data/app/views/spree/admin/promotions/edit.html.erb +0 -2
  68. data/app/views/spree/admin/promotions/index.html.erb +0 -2
  69. data/app/views/spree/admin/promotions/new.html.erb +0 -2
  70. data/app/views/spree/admin/properties/edit.html.erb +0 -2
  71. data/app/views/spree/admin/properties/index.html.erb +2 -4
  72. data/app/views/spree/admin/properties/new.html.erb +0 -2
  73. data/app/views/spree/admin/properties/new.js.erb +1 -1
  74. data/app/views/spree/admin/prototypes/edit.html.erb +0 -2
  75. data/app/views/spree/admin/prototypes/index.html.erb +0 -2
  76. data/app/views/spree/admin/prototypes/new.html.erb +0 -2
  77. data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
  78. data/app/views/spree/admin/reimbursements/show.html.erb +9 -9
  79. data/app/views/spree/admin/return_authorizations/_form.html.erb +16 -16
  80. data/app/views/spree/admin/search/users.rabl +1 -1
  81. data/app/views/spree/admin/shared/_head.html.erb +11 -0
  82. data/app/views/spree/admin/shared/_header.html.erb +4 -8
  83. data/app/views/spree/admin/shared/_menu.html.erb +4 -8
  84. data/app/views/spree/admin/shared/_navigation.html.erb +9 -0
  85. data/app/views/spree/admin/shared/_navigation_footer.html.erb +3 -0
  86. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +20 -22
  87. data/app/views/spree/admin/shared/_promotion_sub_menu.html.erb +8 -10
  88. data/app/views/spree/admin/shared/_stock_sub_menu.html.erb +8 -10
  89. data/app/views/spree/admin/shared/_tabs.html.erb +9 -3
  90. data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
  91. data/app/views/spree/admin/stock_items/index.html.erb +1 -2
  92. data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -1
  93. data/app/views/spree/admin/stock_transfers/index.html.erb +0 -3
  94. data/app/views/spree/admin/stock_transfers/new.html.erb +0 -2
  95. data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
  96. data/app/views/spree/admin/stock_transfers/show.html.erb +0 -2
  97. data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +0 -2
  98. data/app/views/spree/admin/style_guide/index.html.erb +5 -0
  99. data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +79 -0
  100. data/app/views/spree/admin/style_guide/topics/forms/_validation.html.erb +14 -0
  101. data/app/views/spree/admin/style_guide/topics/messaging/_flashes.html.erb +13 -0
  102. data/app/views/spree/admin/style_guide/topics/messaging/_loading.html.erb +20 -0
  103. data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +16 -0
  104. data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +44 -0
  105. data/app/views/spree/admin/style_guide/topics/tables/_pagination.html.erb +11 -0
  106. data/app/views/spree/admin/style_guide/topics/typography/_colors.html.erb +64 -0
  107. data/app/views/spree/admin/style_guide/topics/typography/_fonts.html.erb +19 -0
  108. data/app/views/spree/admin/style_guide/topics/typography/_icons.html.erb +13 -0
  109. data/app/views/spree/admin/style_guide/topics/typography/_lists.html.erb +25 -0
  110. data/app/views/spree/admin/style_guide/topics/typography/_tags.html.erb +25 -0
  111. data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -0
  112. data/app/views/spree/admin/taxonomies/edit.erb +5 -6
  113. data/app/views/spree/admin/taxonomies/index.html.erb +0 -2
  114. data/app/views/spree/admin/taxonomies/new.html.erb +0 -2
  115. data/app/views/spree/admin/taxons/_form.html.erb +1 -1
  116. data/app/views/spree/admin/taxons/_list_template.html.erb +17 -0
  117. data/app/views/spree/admin/taxons/index.html.erb +0 -3
  118. data/app/views/spree/admin/users/orders.html.erb +1 -1
  119. data/app/views/spree/admin/variants/edit.html.erb +0 -2
  120. data/app/views/spree/admin/variants/index.html.erb +0 -2
  121. data/app/views/spree/layouts/admin.html.erb +3 -4
  122. data/app/views/spree/layouts/admin_style_guide.html.erb +58 -0
  123. data/config/routes.rb +4 -2
  124. data/lib/spree/backend/engine.rb +0 -1
  125. data/lib/spree/backend.rb +0 -3
  126. data/solidus_backend.gemspec +5 -7
  127. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +1 -1
  128. data/spec/controllers/spree/admin/orders_controller_spec.rb +14 -14
  129. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +2 -4
  130. data/spec/controllers/spree/admin/payments_controller_spec.rb +2 -2
  131. data/spec/controllers/spree/admin/products_controller_spec.rb +3 -3
  132. data/spec/controllers/spree/admin/reports_controller_spec.rb +4 -4
  133. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +1 -1
  134. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +1 -1
  135. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +1 -1
  136. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +13 -11
  137. data/spec/features/admin/configuration/general_settings_spec.rb +10 -7
  138. data/spec/features/admin/configuration/payment_methods_spec.rb +1 -1
  139. data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
  140. data/spec/features/admin/configuration/states_spec.rb +1 -1
  141. data/spec/features/admin/configuration/tax_rates_spec.rb +6 -7
  142. data/spec/features/admin/configuration/taxonomies_spec.rb +3 -3
  143. data/spec/features/admin/homepage_spec.rb +6 -6
  144. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +4 -8
  145. data/spec/features/admin/orders/customer_details_spec.rb +9 -8
  146. data/spec/features/admin/orders/line_items_spec.rb +1 -1
  147. data/spec/features/admin/orders/listing_spec.rb +2 -2
  148. data/spec/features/admin/orders/log_entries_spec.rb +3 -3
  149. data/spec/features/admin/orders/new_order_spec.rb +3 -15
  150. data/spec/features/admin/orders/order_details_spec.rb +17 -20
  151. data/spec/features/admin/orders/payments_spec.rb +10 -10
  152. data/spec/features/admin/orders/shipments_spec.rb +2 -2
  153. data/spec/features/admin/products/edit/images_spec.rb +5 -3
  154. data/spec/features/admin/products/edit/products_spec.rb +11 -11
  155. data/spec/features/admin/products/edit/taxons_spec.rb +14 -38
  156. data/spec/features/admin/products/edit/variants_spec.rb +3 -3
  157. data/spec/features/admin/products/option_types_spec.rb +22 -21
  158. data/spec/features/admin/products/products_spec.rb +15 -12
  159. data/spec/features/admin/products/properties_spec.rb +3 -3
  160. data/spec/features/admin/products/prototypes_spec.rb +4 -4
  161. data/spec/features/admin/products/stock_management_spec.rb +5 -5
  162. data/spec/features/admin/products/variant_spec.rb +8 -8
  163. data/spec/features/admin/promotion_adjustments_spec.rb +6 -13
  164. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -20
  165. data/spec/features/admin/reports_spec.rb +2 -2
  166. data/spec/features/admin/stock_transfer_spec.rb +3 -3
  167. data/spec/features/admin/store_credits_spec.rb +2 -2
  168. data/spec/features/admin/users_spec.rb +6 -6
  169. data/spec/helpers/admin/navigation_helper_spec.rb +5 -0
  170. data/spec/helpers/admin/reimbursements_helper_spec.rb +1 -1
  171. data/spec/helpers/admin/store_credit_events_helper_spec.rb +1 -1
  172. data/spec/spec_helper.rb +3 -1
  173. data/spec/support/feature/base_feature_helper.rb +10 -0
  174. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  175. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  176. data/vendor/assets/images/jquery-ui/ui-bg_flat_55_ffffff_40x100.png +0 -0
  177. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  178. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  179. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
  180. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
  181. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
  182. data/vendor/assets/images/jquery-ui/ui-icons_0073ea_256x240.png +0 -0
  183. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  184. data/vendor/assets/images/jquery-ui/ui-icons_666666_256x240.png +0 -0
  185. data/vendor/assets/images/jquery-ui/ui-icons_ff0084_256x240.png +0 -0
  186. data/vendor/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  187. data/vendor/assets/javascripts/jquery.powertip.js +792 -423
  188. data/vendor/assets/javascripts/jquery.sticky-kit.min.js +10 -0
  189. data/vendor/assets/javascripts/prism.js +7 -0
  190. data/vendor/assets/stylesheets/prism.css +139 -0
  191. metadata +44 -51
  192. data/app/assets/stylesheets/spree/backend/plugins/_jstree.scss +0 -135
  193. data/app/views/spree/admin/shared/_sub_menu.html.erb +0 -9
  194. data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
  195. data/vendor/assets/javascripts/equalize.js +0 -41
  196. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +0 -4540
  197. data/vendor/assets/javascripts/jquery.jstree/themes/apple/bg.jpg +0 -0
  198. data/vendor/assets/javascripts/jquery.jstree/themes/apple/d.png +0 -0
  199. data/vendor/assets/javascripts/jquery.jstree/themes/apple/dot_for_ie.gif +0 -0
  200. data/vendor/assets/javascripts/jquery.jstree/themes/apple/style.scss +0 -61
  201. data/vendor/assets/javascripts/jquery.jstree/themes/apple/throbber.gif +0 -0
  202. data/vendor/assets/javascripts/jquery.vAlign.js +0 -11
  203. data/vendor/assets/javascripts/modernizr.js +0 -4
  204. data/vendor/assets/javascripts/responsive-tables.js +0 -42
  205. data/vendor/assets/stylesheets/responsive-tables.css +0 -21
@@ -30,7 +30,7 @@ describe 'Payments', :type => :feature do
30
30
  visit current_path
31
31
  end
32
32
 
33
- # Regression tests for #1453
33
+ # Regression tests for https://github.com/spree/spree/issues/1453
34
34
  context 'with a check payment' do
35
35
  let(:order) { create(:completed_order_with_totals, number: 'R100') }
36
36
  let!(:payment) do
@@ -80,7 +80,7 @@ describe 'Payments', :type => :feature do
80
80
  end
81
81
 
82
82
  click_icon :void
83
- expect(find('#payment_status').text).to eq('BALANCE DUE')
83
+ expect(page).to have_css('#payment_status', text: 'BALANCE DUE')
84
84
  expect(page).to have_content('Payment Updated')
85
85
 
86
86
  within_row(1) do
@@ -95,12 +95,12 @@ describe 'Payments', :type => :feature do
95
95
  expect(page).to have_content('successfully created!')
96
96
 
97
97
  click_icon(:capture)
98
- expect(find('#payment_status').text).to eq('PAID')
99
98
 
99
+ expect(page).to have_selector('#payment_status', text: 'PAID')
100
100
  expect(page).not_to have_selector('#new_payment_section')
101
101
  end
102
102
 
103
- # Regression test for #1269
103
+ # Regression test for https://github.com/spree/spree/issues/1269
104
104
  it 'cannot create a payment for an order with no payment methods' do
105
105
  Spree::PaymentMethod.delete_all
106
106
  order.payments.delete_all
@@ -150,10 +150,10 @@ describe 'Payments', :type => :feature do
150
150
  within_row(1) do
151
151
  click_icon(:edit)
152
152
  fill_in('amount', with: 'invalid')
153
- expect(find('td.amount input').value).to eq('invalid')
154
- expect(payment.reload.amount).to eq(150.00)
155
153
  end
156
154
  expect(page).to have_selector('.flash.error', text: 'Invalid resource. Please fix errors and try again.')
155
+ expect(page).to have_field('amount', with: 'invalid')
156
+ expect(payment.reload.amount).to eq(150.00)
157
157
  end
158
158
  end
159
159
 
@@ -173,7 +173,7 @@ describe 'Payments', :type => :feature do
173
173
  let(:order) { create(:order_with_line_items, :line_items_count => 1) }
174
174
  let!(:payment_method) { create(:credit_card_payment_method)}
175
175
 
176
- # Regression tests for #4129
176
+ # Regression tests for https://github.com/spree/spree/issues/4129
177
177
  context "with a credit card payment method" do
178
178
  before do
179
179
  visit spree.admin_order_payments_path(order)
@@ -181,10 +181,10 @@ describe 'Payments', :type => :feature do
181
181
 
182
182
  it "is able to create a new credit card payment with valid information", :js => true do
183
183
  fill_in "Card Number", :with => "4111 1111 1111 1111"
184
- fill_in "Name", :with => "Test User"
185
- fill_in "Expiration", :with => "09 / #{Time.now.year + 1}"
184
+ fill_in "Name *", :with => "Test User"
185
+ fill_in "Expiration", :with => "09 / #{Time.current.year + 1}"
186
186
  fill_in "Card Code", :with => "007"
187
- # Regression test for #4277
187
+ # Regression test for https://github.com/spree/spree/issues/4277
188
188
  expect(page).to have_css('.ccType[value="visa"]', visible: false)
189
189
  click_button "Continue"
190
190
  expect(page).to have_content("Payment has been successfully created!")
@@ -5,7 +5,7 @@ describe "Shipments", :type => :feature do
5
5
 
6
6
  let!(:order) { create(:order_ready_to_ship, :number => "R100", :state => "complete", :line_items_count => 5) }
7
7
 
8
- # Regression test for #4025
8
+ # Regression test for https://github.com/spree/spree/issues/4025
9
9
  context "a shipment without a shipping method" do
10
10
  before do
11
11
  order.shipments.each do |s|
@@ -15,7 +15,7 @@ describe "Shipments", :type => :feature do
15
15
  end
16
16
 
17
17
  it "can still be displayed" do
18
- expect { visit spree.edit_admin_order_path(order) }.not_to raise_error
18
+ visit spree.edit_admin_order_path(order)
19
19
  end
20
20
  end
21
21
 
@@ -19,7 +19,7 @@ describe "Product Images", :type => :feature do
19
19
  create(:product)
20
20
 
21
21
  visit spree.admin_path
22
- click_link "Products"
22
+ click_nav "Products"
23
23
  click_icon(:edit)
24
24
  click_link "Images"
25
25
  click_link "new_image_link"
@@ -27,7 +27,9 @@ describe "Product Images", :type => :feature do
27
27
  click_button "Update"
28
28
  expect(page).to have_content("successfully created!")
29
29
 
30
- click_icon(:edit)
30
+ within_row(1) do
31
+ click_icon(:edit)
32
+ end
31
33
  fill_in "image_alt", :with => "ruby on rails t-shirt"
32
34
  click_button "Update"
33
35
  expect(page).to have_content("successfully updated!")
@@ -40,7 +42,7 @@ describe "Product Images", :type => :feature do
40
42
  end
41
43
  end
42
44
 
43
- # Regression test for #2228
45
+ # Regression test for https://github.com/spree/spree/issues/2228
44
46
  it "should see variant images" do
45
47
  variant = create(:variant)
46
48
  variant.images.create!(:attachment => File.open(file_path))
@@ -10,19 +10,19 @@ describe 'Product Details', :type => :feature do
10
10
  :description => 'lorem ipsum', :available_on => '2013-08-14 01:02:03')
11
11
 
12
12
  visit spree.admin_path
13
- click_link 'Products'
13
+ click_nav "Products"
14
14
  within_row(1) { click_icon :edit }
15
15
 
16
16
  click_link 'Product Details'
17
17
 
18
- expect(find('.page-title').text.strip).to eq('Editing Product “Bún thịt nướng”')
19
- expect(find('input#product_name').value).to eq('Bún thịt nướng')
20
- expect(find('input#product_slug').value).to eq('bun-th-t-n-ng')
21
- expect(find('textarea#product_description').text.strip).to eq('lorem ipsum')
22
- expect(find('input#product_price').value).to eq('19.99')
23
- expect(find('input#product_cost_price').value).to eq('17.00')
24
- expect(find('input#product_available_on').value).to eq("2013/08/14")
25
- expect(find('input#product_sku').value).to eq('A100')
18
+ expect(page).to have_css('.page-title', text: 'Editing Product “Bún thịt nướng”')
19
+ expect(page).to have_field('product_name', with: 'Bún thịt nướng')
20
+ expect(page).to have_field('product_slug', with: 'bun-th-t-n-ng')
21
+ expect(page).to have_field('product_description', with: 'lorem ipsum')
22
+ expect(page).to have_field('product_price', with: '19.99')
23
+ expect(page).to have_field('product_cost_price', with: '17.00')
24
+ expect(page).to have_field('product_available_on', with: "2013/08/14")
25
+ expect(page).to have_field('product_sku', with: 'A100')
26
26
  end
27
27
 
28
28
  it "should handle slug changes" do
@@ -30,7 +30,7 @@ describe 'Product Details', :type => :feature do
30
30
  :description => 'lorem ipsum', :available_on => '2011-01-01 01:01:01')
31
31
 
32
32
  visit spree.admin_path
33
- click_link 'Products'
33
+ click_nav "Products"
34
34
  within('table.index tbody tr:nth-child(1)') do
35
35
  click_icon(:edit)
36
36
  end
@@ -49,7 +49,7 @@ describe 'Product Details', :type => :feature do
49
49
  end
50
50
  end
51
51
 
52
- # Regression test for #3385
52
+ # Regression test for https://github.com/spree/spree/issues/3385
53
53
  context "deleting a product", :js => true do
54
54
  it "is still able to find the master variant" do
55
55
  create(:product)
@@ -3,54 +3,30 @@ require 'spec_helper'
3
3
  describe "Product Taxons", :type => :feature do
4
4
  stub_authorization!
5
5
 
6
- after do
7
- Capybara.ignore_hidden_elements = true
8
- end
9
-
10
- before do
11
- Capybara.ignore_hidden_elements = false
12
- end
6
+ context "managing taxons" do
7
+ def assert_selected_taxons(taxons)
8
+ # Regression test for https://github.com/spree/spree/issues/2139
9
+ taxons.each do |taxon|
10
+ expect(page).to have_css(".select2-search-choice", text: taxon.name)
11
+ end
13
12
 
14
- context "managing taxons", js: true do
15
- def selected_taxons
16
- find("#product_taxon_ids").value.split(',').map(&:to_i).uniq
13
+ expected_value = taxons.map(&:id).join(",")
14
+ expect(page).to have_xpath("//*[@id = 'product_taxon_ids' and @value = '#{expected_value}']", visible: :all)
17
15
  end
18
16
 
19
- let(:product) { create(:product) }
20
-
21
- it "should allow an admin to manage taxons" do
17
+ it "should allow an admin to manage taxons", :js => true do
22
18
  taxon_1 = create(:taxon)
23
- taxon_2 = create(:taxon, name: 'Clothing')
19
+ taxon_2 = create(:taxon, :name => 'Clothing')
20
+ product = create(:product)
24
21
  product.taxons << taxon_1
25
22
 
26
- visit spree.admin_path
27
- click_link "Products"
28
- within("table.index") do
29
- click_icon :edit
30
- end
23
+ visit spree.edit_admin_product_path(product)
31
24
 
32
- expect(find(".select2-search-choice").text).to eq(taxon_1.name)
33
- expect(selected_taxons).to match_array([taxon_1.id])
25
+ assert_selected_taxons([taxon_1])
34
26
 
35
27
  select2_search "Clothing", :from => "Taxons"
36
28
  click_button "Update"
37
- expect(selected_taxons).to match_array([taxon_1.id, taxon_2.id])
38
-
39
- # Regression test for #2139
40
- expect(page).to have_css(".select2-search-choice", text: taxon_1.name)
41
- expect(page).to have_css(".select2-search-choice", text: taxon_2.name)
42
- end
43
-
44
- context "with an XSS attempt" do
45
- let(:taxon_name) { %(<script>throw("XSS")</script>) }
46
- let!(:taxon) { create(:taxon, name: taxon_name) }
47
- it "displays the escaped HTML without executing it" do
48
- visit spree.edit_admin_product_path(product)
49
-
50
- select2_search "<script>", from: "Taxons"
51
-
52
- expect(page).to have_content(taxon_name)
53
- end
29
+ assert_selected_taxons([taxon_1, taxon_2])
54
30
  end
55
31
  end
56
32
  end
@@ -11,7 +11,7 @@ describe "Product Variants", :type => :feature do
11
11
  let!(:product) { create(:product) }
12
12
 
13
13
  it "should allow an admin to create option types for a variant" do
14
- click_link "Products"
14
+ click_nav "Products"
15
15
 
16
16
  within_row(1) { click_icon :edit }
17
17
 
@@ -20,7 +20,7 @@ describe "Product Variants", :type => :feature do
20
20
  end
21
21
 
22
22
  it "allows admin to create a variant if there are option types" do
23
- click_link "Products"
23
+ click_nav "Products"
24
24
  click_link "Option Types"
25
25
  click_link "new_option_type_link"
26
26
  fill_in "option_type_name", :with => "shirt colors"
@@ -34,7 +34,7 @@ describe "Product Variants", :type => :feature do
34
34
  expect(page).to have_content("successfully updated!")
35
35
 
36
36
  visit spree.admin_path
37
- click_link "Products"
37
+ click_nav "Products"
38
38
  within('table.index tbody tr:nth-child(1)') do
39
39
  click_icon :edit
40
40
  end
@@ -5,7 +5,7 @@ describe "Option Types", :type => :feature do
5
5
 
6
6
  before(:each) do
7
7
  visit spree.admin_path
8
- click_link "Products"
8
+ click_nav "Products"
9
9
  end
10
10
 
11
11
  context "listing option types" do
@@ -46,7 +46,9 @@ describe "Option Types", :type => :feature do
46
46
  create(:option_type, :name => "tshirt-color", :presentation => "Color")
47
47
  create(:option_type, :name => "tshirt-size", :presentation => "Size")
48
48
  click_link "Option Types"
49
- within('table#listing_option_types') { click_link "Edit" }
49
+ within('table#listing_option_types') do
50
+ find('tr', text: 'Size').click_link "Edit"
51
+ end
50
52
  fill_in "option_type_name", :with => "foo-size 99"
51
53
  click_button "Update"
52
54
  expect(page).to have_content("successfully updated!")
@@ -54,18 +56,21 @@ describe "Option Types", :type => :feature do
54
56
  end
55
57
  end
56
58
 
57
- # Regression test for #2277
59
+ # Regression test for https://github.com/spree/spree/issues/2277
58
60
  it "can remove an option value from an option type", :js => true do
59
61
  create(:option_value)
60
62
  click_link "Option Types"
61
63
  within('table#listing_option_types') { click_icon :edit }
62
64
  expect(page).to have_content("Editing Option Type")
63
- expect(all("tbody#option_values tr").count).to eq(1)
65
+ expect(page).to have_css("tbody#option_values tr", count: 1)
64
66
  within("tbody#option_values") do
65
67
  find('.spree_remove_fields').click
66
68
  end
67
69
  # Assert that the field is hidden automatically
68
- expect(all("tbody#option_values tr").select(&:visible?).count).to eq(0)
70
+ expect(page).to have_no_css("tbody#option_values tr")
71
+
72
+ # Ensure the DELETE request finishes
73
+ expect(page).to have_no_css("#progress")
69
74
 
70
75
  # Then assert that on a page refresh that it's still not visible
71
76
  visit page.current_url
@@ -73,42 +78,38 @@ describe "Option Types", :type => :feature do
73
78
  # Sometimes the page doesn't load before the all check is done
74
79
  # lazily finding the element gives the page 10 seconds
75
80
  expect(page).to have_css("tbody#option_values")
76
- all("tbody#option_values tr input").all? { |input| input.value.blank? }
81
+ all("tbody#option_values tr input", count: 2).each do |input|
82
+ expect(input.value).to be_blank
83
+ end
77
84
  end
78
-
79
- # Regression test for #3204
85
+
86
+ # Regression test for https://github.com/spree/spree/issues/3204
80
87
  it "can remove a non-persisted option value from an option type", :js => true do
81
88
  create(:option_type)
82
89
  click_link "Option Types"
83
90
  within('table#listing_option_types') { click_icon :edit }
84
91
 
85
- wait_for_ajax
86
- page.find("tbody#option_values", :visible => true)
87
-
88
- expect(all("tbody#option_values tr").select(&:visible?).count).to eq(1)
92
+ expect(page).to have_css("tbody#option_values tr", count: 1)
89
93
 
90
94
  # Add a new option type
91
95
  click_link "Add Option Value"
92
- expect(all("tbody#option_values tr").select(&:visible?).count).to eq(2)
96
+ expect(page).to have_css("tbody#option_values tr", count: 2)
93
97
 
94
98
  # Remove default option type
95
99
  within("tbody#option_values") do
96
- find('.fa-trash').click
100
+ within_row(1) do
101
+ find('.fa-trash').click
102
+ end
97
103
  end
98
- # Check that there was no HTTP request
99
- expect(all("div#progress[style]").count).to eq(0)
100
104
  # Assert that the field is hidden automatically
101
- expect(all("tbody#option_values tr").select(&:visible?).count).to eq(1)
105
+ expect(page).to have_css("tbody#option_values tr", count: 1)
102
106
 
103
107
  # Remove added option type
104
108
  within("tbody#option_values") do
105
109
  find('.fa-trash').click
106
110
  end
107
- # Check that there was no HTTP request
108
- expect(all("div#progress[style]").count).to eq(0)
109
111
  # Assert that the field is hidden automatically
110
- expect(all("tbody#option_values tr").select(&:visible?).count).to eq(0)
111
-
112
+ expect(page).to have_css("tbody#option_values tr", count: 0)
112
113
  end
113
114
 
114
115
  end
@@ -25,7 +25,7 @@ describe "Products", :type => :feature do
25
25
  end
26
26
 
27
27
  it "should list existing products with correct sorting by name" do
28
- click_link "Products"
28
+ click_nav "Products"
29
29
  # Name ASC
30
30
  within_row(1) { expect(page).to have_content('apache baseball cap') }
31
31
  within_row(2) { expect(page).to have_content("zomg shirt") }
@@ -37,7 +37,7 @@ describe "Products", :type => :feature do
37
37
  end
38
38
 
39
39
  it "should list existing products with correct sorting by price" do
40
- click_link "Products"
40
+ click_nav "Products"
41
41
 
42
42
  # Name ASC (default)
43
43
  within_row(1) { expect(page).to have_content('apache baseball cap') }
@@ -60,7 +60,7 @@ describe "Products", :type => :feature do
60
60
  create(:product, :name => "Just a product", :price => 19.99)
61
61
  end
62
62
 
63
- # Regression test for #2737
63
+ # Regression test for https://github.com/spree/spree/issues/2737
64
64
  context "uses руб as the currency symbol" do
65
65
  it "on the products listing page" do
66
66
  visit spree.admin_products_path
@@ -76,7 +76,7 @@ describe "Products", :type => :feature do
76
76
  create(:product, :name => 'apache baseball cap', :deleted_at => "2011-01-06 18:21:13")
77
77
  create(:product, :name => 'zomg shirt')
78
78
 
79
- click_link "Products"
79
+ click_nav "Products"
80
80
  expect(page).to have_content("zomg shirt")
81
81
  expect(page).not_to have_content("apache baseball cap")
82
82
  check "Show Deleted"
@@ -94,7 +94,7 @@ describe "Products", :type => :feature do
94
94
  create(:product, :name => 'apache baseball cap2', :sku => "B100")
95
95
  create(:product, :name => 'zomg shirt')
96
96
 
97
- click_link "Products"
97
+ click_nav "Products"
98
98
  fill_in "q_name_cont", :with => "ap"
99
99
  click_icon :search
100
100
  expect(page).to have_content("apache baseball cap")
@@ -141,7 +141,7 @@ describe "Products", :type => :feature do
141
141
  @option_type_prototype = prototype
142
142
  @property_prototype = create(:prototype, :name => "Random")
143
143
  @shipping_category = create(:shipping_category)
144
- click_link "Products"
144
+ click_nav "Products"
145
145
  click_link "admin_new_product"
146
146
  within('#new_product') do
147
147
  expect(page).to have_content("SKU")
@@ -186,7 +186,7 @@ describe "Products", :type => :feature do
186
186
  context "creating a new product" do
187
187
  before(:each) do
188
188
  @shipping_category = create(:shipping_category)
189
- click_link "Products"
189
+ click_nav "Products"
190
190
  click_link "admin_new_product"
191
191
  within('#new_product') do
192
192
  expect(page).to have_content("SKU")
@@ -241,13 +241,16 @@ describe "Products", :type => :feature do
241
241
  end
242
242
 
243
243
  it "should show localized price value on validation errors", :js => true do
244
+ fill_in "Name", :with => " "
245
+ select @shipping_category.name, from: "product_shipping_category_id"
244
246
  fill_in "product_price", :with => "19,99"
245
247
  click_button "Create"
246
- expect(find('input#product_price').value).to eq('19,99')
248
+ expect(page).to have_content("Name can't be blank")
249
+ expect(page).to have_field('product_price', with: '19,99')
247
250
  end
248
251
  end
249
252
 
250
- # Regression test for #2097
253
+ # Regression test for https://github.com/spree/spree/issues/2097
251
254
  it "can set the count on hand to a null value", :js => true do
252
255
  fill_in "product_name", :with => "Baseball Cap"
253
256
  fill_in "product_price", :with => "100"
@@ -264,7 +267,7 @@ describe "Products", :type => :feature do
264
267
  it "should allow an admin to clone a product" do
265
268
  create(:product)
266
269
 
267
- click_link "Products"
270
+ click_nav "Products"
268
271
  within_row(1) do
269
272
  click_icon :copy
270
273
  end
@@ -276,7 +279,7 @@ describe "Products", :type => :feature do
276
279
  it "should allow an admin to clone a deleted product" do
277
280
  create(:product, :name => "apache baseball cap")
278
281
 
279
- click_link "Products"
282
+ click_nav "Products"
280
283
  check "Show Deleted"
281
284
  click_button "Search"
282
285
 
@@ -327,7 +330,7 @@ describe "Products", :type => :feature do
327
330
  # inspect the first one.
328
331
  expect(page).to have_css('#product_properties .product_property', count: 2)
329
332
  within('#product_properties .product_property:nth-child(1)') do
330
- expect(find('input[type=text]').value).to eq('baseball_cap_color')
333
+ expect(find('input[type=text]', match: :first).value).to eq('baseball_cap_color')
331
334
  end
332
335
  end
333
336
  end
@@ -5,7 +5,7 @@ describe "Properties", :type => :feature do
5
5
 
6
6
  before(:each) do
7
7
  visit spree.admin_path
8
- click_link "Products"
8
+ click_nav "Products"
9
9
  end
10
10
 
11
11
  context "Property index" do
@@ -82,7 +82,7 @@ describe "Properties", :type => :feature do
82
82
  click_link "Product Properties"
83
83
  end
84
84
 
85
- # Regression test for #2279
85
+ # Regression test for https://github.com/spree/spree/issues/2279
86
86
  it "successfully create and then remove product property" do
87
87
  fill_in_property
88
88
 
@@ -93,7 +93,7 @@ describe "Properties", :type => :feature do
93
93
  check_property_row_count(1)
94
94
  end
95
95
 
96
- # Regression test for #4466
96
+ # Regression test for https://github.com/spree/spree/issues/4466
97
97
  it "successfully remove and create a product property at the same time" do
98
98
  fill_in_property
99
99
 
@@ -32,7 +32,7 @@ describe "Prototypes", :type => :feature do
32
32
  end
33
33
 
34
34
  visit spree.admin_path
35
- click_link "Products"
35
+ click_nav "Products"
36
36
  click_link "Prototypes"
37
37
 
38
38
  within_row(1) { expect(column_text(1)).to eq "Shirt" }
@@ -44,7 +44,7 @@ describe "Prototypes", :type => :feature do
44
44
  context "creating a prototype" do
45
45
  it "should allow an admin to create a new product prototype", :js => true do
46
46
  visit spree.admin_path
47
- click_link "Products"
47
+ click_nav "Products"
48
48
  click_link "Prototypes"
49
49
  click_link "new_prototype_link"
50
50
  within('#new_prototype') do
@@ -73,7 +73,7 @@ describe "Prototypes", :type => :feature do
73
73
  end
74
74
 
75
75
  visit spree.admin_path
76
- click_link "Products"
76
+ click_nav "Products"
77
77
  click_link "Prototypes"
78
78
 
79
79
  click_on "Edit"
@@ -96,7 +96,7 @@ describe "Prototypes", :type => :feature do
96
96
  shirt_prototype.taxons << create(:taxon)
97
97
 
98
98
  visit spree.admin_path
99
- click_link "Products"
99
+ click_nav "Products"
100
100
  click_link "Prototypes"
101
101
 
102
102
  within("#spree_prototype_#{shirt_prototype.id}") do
@@ -16,19 +16,19 @@ describe "Stock Management", :type => :feature do
16
16
  before do
17
17
  stock_location.stock_item(variant).update_column(:count_on_hand, 10)
18
18
 
19
- click_link "Products"
19
+ click_nav "Products"
20
20
  within_row(1) { click_icon :edit }
21
21
  click_link "Stock Management"
22
22
  end
23
23
 
24
- # Regression test for #3304
24
+ # Regression test for https://github.com/spree/spree/issues/3304
25
25
  # It is OK to still render the stock page, ensure no errors in this case
26
26
  context "with no stock location" do
27
27
  before do
28
28
  @product = create(:product, name: 'apache baseball cap', price: 10)
29
29
  v = @product.variants.create!(sku: 'FOOBAR')
30
30
  Spree::StockLocation.destroy_all
31
- click_link "Products"
31
+ click_link "Back To Products List"
32
32
  within_row(1) do
33
33
  click_icon :edit
34
34
  end
@@ -58,9 +58,9 @@ describe "Stock Management", :type => :feature do
58
58
  end
59
59
 
60
60
  def adjust_count_on_hand(count_on_hand)
61
- find(:css, ".fa-edit[data-id='#{stock_item.id}']").click
61
+ find(:css, ".fa-edit[data-id='#{stock_item.id}']").trigger('click')
62
62
  find(:css, "[data-variant-id='#{variant.id}'] input[type='number']").set(count_on_hand)
63
- find(:css, ".fa-check[data-id='#{stock_item.id}']").click
63
+ find(:css, ".fa-check[data-id='#{stock_item.id}']").trigger('click')
64
64
  expect(page).to have_content('Updated successfully')
65
65
  end
66
66
 
@@ -13,16 +13,16 @@ describe "Variants", :type => :feature do
13
13
  end
14
14
 
15
15
  visit spree.admin_path
16
- click_link "Products"
16
+ click_nav "Products"
17
17
  within_row(1) { click_icon :edit }
18
18
  click_link "Variants"
19
19
  click_on "New Variant"
20
- expect(find('input#variant_price').value).to eq("1.99")
21
- expect(find('input#variant_cost_price').value).to eq("1.00")
22
- expect(find('input#variant_weight').value).to eq("2.50")
23
- expect(find('input#variant_height').value).to eq("3.00")
24
- expect(find('input#variant_width').value).to eq("1.00")
25
- expect(find('input#variant_depth').value).to eq("1.50")
20
+ expect(page).to have_field('variant_price', with: "1.99")
21
+ expect(page).to have_field('variant_cost_price', with: "1.00")
22
+ expect(page).to have_field('variant_weight', with: "2.50")
23
+ expect(page).to have_field('variant_height', with: "3.00")
24
+ expect(page).to have_field('variant_width', with: "1.00")
25
+ expect(page).to have_field('variant_depth', with: "1.50")
26
26
  expect(page).to have_select('variant[tax_category_id]')
27
27
  end
28
28
  end
@@ -38,7 +38,7 @@ describe "Variants", :type => :feature do
38
38
  create(:variant, :product => product, :price => 19.99)
39
39
  end
40
40
 
41
- # Regression test for #2737
41
+ # Regression test for https://github.com/spree/spree/issues/2737
42
42
  context "uses руб as the currency symbol" do
43
43
  it "on the products listing page" do
44
44
  visit spree.admin_product_variants_path(product)
@@ -136,7 +136,7 @@ describe "Promotion Adjustments", :type => :feature do
136
136
  expect(first_action_calculator.preferred_percent).to eq(10)
137
137
  end
138
138
 
139
- xit "should allow an admin to create an automatic promotion with free shipping (no code)" do
139
+ it "should allow an admin to create an automatic promotion with free shipping (no code)" do
140
140
  fill_in "Name", :with => "Promotion"
141
141
  click_button "Create"
142
142
  expect(page).to have_content("Editing Promotion")
@@ -146,21 +146,14 @@ describe "Promotion Adjustments", :type => :feature do
146
146
  find('[id$=_preferred_amount]').set(30)
147
147
  within('#rule_fields') { click_button "Update" }
148
148
 
149
- select2 "Create whole-order adjustment", :from => "Add action of type"
149
+ select2 "Free shipping", :from => "Add action of type"
150
150
  within('#action_fields') { click_button "Add" }
151
- select2 "Free Shipping", :from => "Calculator"
152
- within('#actions_container') { click_button "Update" }
151
+ expect(page).to have_content('MAKES ALL SHIPMENTS FOR THE ORDER FREE')
153
152
 
154
153
  promotion = Spree::Promotion.find_by_name("Promotion")
155
- expect(promotion.code.first.value).to be_blank
156
-
157
- first_rule = promotion.rules.first
158
- expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
159
-
160
- first_action = promotion.actions.first
161
- expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
162
- first_action_calculator = first_action.calculator
163
- expect(first_action_calculator.class).to eq(Spree::Calculator::FreeShipping)
154
+ expect(promotion.codes).to be_empty
155
+ expect(promotion.rules.first).to be_a(Spree::Promotion::Rules::ItemTotal)
156
+ expect(promotion.actions.first).to be_a(Spree::Promotion::Actions::FreeShipping)
164
157
  end
165
158
 
166
159
  it "should allow an admin to create an automatic promo requiring a landing page to be visited" do