Name symbols on quantity buttons in specs

This commit is contained in:
Maikel Linke
2020-07-01 11:27:27 +10:00
parent d337561ea8
commit 81cc951ed4
2 changed files with 14 additions and 6 deletions

View File

@@ -311,7 +311,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
within_variant(variant) do
expect(page).to have_content "5 in cart"
expect(page).to have_button "", disabled: true
expect(page).to have_button increase_quantity_symbol, disabled: true
end
end
@@ -364,7 +364,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
# -- Messaging
within(".reveal-modal") do
page.all("button", text: "").last.click
page.all("button", text: increase_quantity_symbol).last.click
end
close_modal
wait_for_cart

View File

@@ -47,14 +47,14 @@ module ShopWorkflow
def click_add_to_cart(variant = nil, quantity = 1)
within_variant(variant) do
click_button "Add"
(quantity - 1).times { click_button "" }
(quantity - 1).times { click_button increase_quantity_symbol }
end
wait_for_cart
end
def click_remove_from_cart(variant = nil, quantity = 1)
within_variant(variant) do
quantity.times { click_button "" }
quantity.times { click_button decrease_quantity_symbol }
end
wait_for_cart
end
@@ -65,7 +65,7 @@ module ShopWorkflow
end
within(".reveal-modal") do
(quantity - 1).times do
first(:button, "").click
first(:button, increase_quantity_symbol).click
end
end
wait_for_cart
@@ -74,7 +74,7 @@ module ShopWorkflow
def click_add_bulk_max_to_cart(variant = nil, quantity = 1)
within(".reveal-modal") do
quantity.times do
page.all("button", text: "").last.click
page.all("button", text: increase_quantity_symbol).last.click
end
end
wait_for_cart
@@ -94,6 +94,14 @@ module ShopWorkflow
end
end
def increase_quantity_symbol
""
end
def decrease_quantity_symbol
""
end
def toggle_accordion(name)
find("dd a", text: name).click
end