Fixes for event stream and section view actions

This commit is contained in:
2014-07-28 15:13:18 +02:00
parent 2c4c51fe77
commit 48e1850200
17 changed files with 76 additions and 40 deletions
@@ -30,6 +30,8 @@ Feature: Supplier section view
When the list is marked as in need of payment
Then the section table should be marked as in need of payment
And I wait 0.5 seconds
When I click on the close list button in the section table table popup
And I wait 1 second
Then the section table should not have any active list markings anymore
@@ -64,6 +66,18 @@ Feature: Supplier section view
When I click the supplier section normal mode button
Then the supplier last section properties should be updated to the new values
@javascript
Scenario: A new order is created when the view is already loaded
Given there is a confirmed and open supplier
And there is a table in the section
And there is a product
And I am signed in as supplier
When I visit the supplier section path
And A new order is placed
Then the table should be marked as occupied and having an active order
When the supplier clicks on the table having the new list
Then the supplier table actions of the new list should be visible
# capybara-webkit 1.1.0 drag to is not yet supported it seems
@javascript @broken
Scenario: Dragging a table to another section
@@ -0,0 +1,5 @@
step "A new order is placed" do
@user ||= create :user
@list = create :list, state: 'active', supplier: @supplier, table: @table, section: @section, user_ids: [@user.id]
@order = @list.place_order products: {@product.id => 2}, user: @user
end
@@ -5,3 +5,7 @@ step "the product :product_name has description :product_description" do |produc
product.save or raise "Cannot save product: #{product.errors.full_messages.to_sentence}"
@product ||= product
end
step 'there is a product' do
@product = create :product, price: 2.22, supplier: @supplier
end
@@ -3,6 +3,10 @@ step 'there is a table' do
@table ||= create :table, section: @section, supplier: @supplier
end
step 'there is a table in the section' do
step 'there is a table'
end
step "the other user sees the table menu" do
Capybara.session_name = :other_user
route_should_be 'user#list_products_for_table'
@@ -7,10 +7,6 @@ step "there are :count supplier products" do |count|
@products = create_list :product, count.to_i, supplier: @supplier
end
step 'there is a product' do
@product = create :product, supplier: @supplier
end
step "the supplier fills in the new product form selecting the first product category" do
find('#product_name').set 'New product'
find('#product_code').set 'NL0487'
@@ -31,6 +31,11 @@ step "the section table should not be marked as in need of help" do
table['class'].should_not include 'needs_help'
end
step 'Then the table should be marked as occupied and having an active order' do
classes = find(".section-table-#{@table.id}")['class'].split(/\s+/)
expect(classes & %w[occupied active_order]).to eq & %w[occupied active_order]
end
step "I click on section table as a supplier" do
table = page.find(".section-table-#{@table.id}")
table.click
@@ -41,27 +46,31 @@ step "the section table should be marked as in need of payment" do
end
step "A popup having table options should appear in supplier section area" do
page.should have_selector(".table-actions-#{@table.id}")
page.should have_selector(".section-table-#{@table.id} .table-actions")
end
step "I click on the mark list as helped in the section table popup as supplier" do
btn = page.find(".list-is-helped-button-#{@list.id}")
btn.click
# btn = page.find(".list-is-helped-button-#{@list.id}")
page.find(".section-table-#{@table.id} .mark_list_as_helped").click
# btn.click
end
step "the section table popup should no longer have the mark list as helped button" do
page.should_not have_selector(".list-is-helped-button-#{@list.id}")
page.should_not have_selector(".section-table-#{@table.id} .mark_list_as_helped")
end
step "I click on the close list button in the section table table popup" do
# first click on the table to open the table actions popup
table = page.find(".section-table-#{@table.id}")
table.click
page.find(".table-actions-#{@table.id} .close-list").click
# now click the close list button inside the table actions popup
page.find(".section-table-#{@table.id} .table-actions .close-list-button").click
end
step "the section table should not have any active list markings anymore" do
table = page.find(".section-table-#{@table.id}")
css_class = table['class']
binding.pry
css_class.should_not include 'needs_help'
css_class.should_not include 'occupied'
css_class.should_not include 'active_order'