refactor and move to selenium

This commit is contained in:
2015-01-21 18:23:47 +01:00
parent c688f0353b
commit 9a8c364d38
24 changed files with 174 additions and 116 deletions
@@ -1,6 +1,8 @@
step "I am signed in as supplier" do
step 'visit the supplier sign in path'
find('#supplier_email').set @supplier.email
find('#supplier_password').set @supplier_password
click_on 'Inloggen'
visit test_login_admin_suppliers_path(email: @supplier.email)
#step 'visit the supplier sign in path'
#find('#supplier_email').set @supplier.email
#find('#supplier_password').set @supplier_password
#click_on 'Inloggen'
end
@@ -1,29 +1,27 @@
step "the section table should be positioned in the section" do
table = page.find(".section-table-#{@table.id}")
left = table['style'].to_s.match(/left:(\d+)/)
left.should be_present
left[1].to_i.should > 10
top = table['style'].to_s.match(/top:(\d+)/)
top.should be_present
top[1].to_i.should > 10
page.find(".section-table-#{@table.id}") # wait for table presence
left = page.evaluate_script("$('.section-table-#{@table.id}').position().left")
left.to_i.should > 0
top = page.evaluate_script("$('.section-table-#{@table.id}').position().top")
top.to_i.should > 0
end
step "the section table should be marked as having an active order" do
table = page.find(".section-table-#{@table.id}")
table['class'].should include 'active_order'
assert_element_class ".section-table-#{@table.id}", 'active_order'
end
step "the section table should still be marked as having an active order" do
step "the section table should be marked as having an active order"
end
step "the section table should be marked as occupied" do
table = page.find(".section-table-#{@table.id}")
table['class'].should include 'occupied'
assert_element_class ".section-table-#{@table.id}", 'occupied'
end
step "the section table should be marked as in need of help" do
table = page.find(".section-table-#{@table.id}")
table['class'].should include 'needs_help'
assert_element_class ".section-table-#{@table.id}", 'needs_help'
end
step "the section table should not be marked as in need of help" do
@@ -97,9 +95,9 @@ step "I click the supplier section normal mode button" do
end
step "I fill in the supplier edit section form with new values" do
find('.section-edit-title-field').set 'RenamedSection'
find('.section-edit-width-field').set '40'
find('.section-edit-height-field').set '52.7'
js_set_field '.section-edit-title-field', 'RenamedSection'
js_set_field '.section-edit-width-field', 40
js_set_field '.section-edit-height-field', 52.7
end
step "the last section tab header should have the newly filled in name" do
@@ -66,6 +66,7 @@ step "the user order :product_name should be in the order list with price" do |p
concerning_product = Product.find_by_name(product_name)
#ember_order = ember_store['product_orders'].find{|po| po['product_id'] == concerning_product.id}
#ember_order = ember_find('product_order', concerning_product.id)
sleep 0.1
ember_order = ember_all('product_order').find{|po| po['product_id'] == concerning_product.id }
quantity = ember_order['quantity']
order_price = quantity * concerning_product.price