Permalink
Browse files

Mark scenario for add line items action as @wip, commented why

  • Loading branch information...
1 parent b1eab3b commit eb75e582c793e0de44f639cf2f9695c7ca9e1800 @davidnorth davidnorth committed Jun 10, 2011
Showing with 32 additions and 0 deletions.
  1. +15 −0 features/step_definitions/checkout_steps.rb
  2. +17 −0 promo/features/promotion_adjustments.feature
View
15 features/step_definitions/checkout_steps.rb
@@ -16,6 +16,21 @@
When %{I select "#{address.state.name}" from "order_#{str_addr}_attributes_state_id"}
end
+Given /^a product with (.*?)? exists$/ do |captured_fields|
+ fields = {'name' => "RoR Mug", 'count_on_hand' => '10', 'price' => "14.99"}
+ captured_fields.split(/,\s+/).each do |field|
+ (name, value) = field.split(/:\s*/, 2)
+ fields[name] = value.delete('"')
+ end
+
+ price = fields.delete('price')
+
+ if Product.search.master_price_equals(price).count(:conditions => fields) == 0
+ Factory(:product, fields.merge('price' => price, :sku => 'ABC',
+ :available_on => (Time.now - 100.days)))
+ end
+end
+
When /^(?:|I )add a product with (.*?)? to cart$/ do |captured_fields|
fields = {'name' => "RoR Mug", 'count_on_hand' => '10', 'price' => "14.99"}
captured_fields.split(/,\s+/).each do |field|
View
17 promo/features/promotion_adjustments.feature
@@ -5,6 +5,23 @@ Feature: Promotions which add adjustments to orders
Given a payment method exists
Given a shipping method exists
+ @selenium_with_chrome @wip
+ Scenario: Managing promotion action for creating line items
+ Given a product with name: "RoR Mug", price: "40" exists
+ When I log in as an admin user and go to the new promotion form
+ And I fill in "Name" with "Order's total > $30"
+ And I fill in "Usage Limit" with "100"
+ And I press "Create"
+ Then I should see "Editing Promotion"
+ And I select "Create line items" from "Add action of type"
+ And I press "Add" within "#action_fields"
+ And I fill in "Name or SKU" with "RoR Mug"
+ # For this to work we need to simulate pressing tab to select the autocomplete item
+ And I fill in "Qty" with "2"
+ # Allow the variant select to populate
+ And I wait for 5 seconds
+ And I press "Add" within ".add-line-item"
+
@selenium
Scenario: A coupon promotion with flat rate discount
When I log in as an admin user and go to the new promotion form

0 comments on commit eb75e58

Please sign in to comment.