Everything is green
This commit is contained in:
@@ -3,6 +3,7 @@ Feature: Supplier main board
|
||||
@javascript
|
||||
Scenario: the active list should be present and contained in row having its id
|
||||
Given there is an active list and order
|
||||
And there is another section with table
|
||||
And I am signed in as supplier
|
||||
|
||||
When I visit the supplier root path
|
||||
@@ -51,13 +52,14 @@ Feature: Supplier main board
|
||||
@javascript
|
||||
Scenario: Selecting a specific section limits the result to the lists and orders of those sections
|
||||
Given there is an active list and order
|
||||
And there is another section with table
|
||||
And I am signed in as supplier
|
||||
And a new order on a table in another section is created
|
||||
Then I should see the list and the new list
|
||||
And I should see the order and the new order
|
||||
When I select the section in the supplier dashboard
|
||||
Then I should see the list and order but not the new list and new order
|
||||
When I select the new section in the supplier dashboard
|
||||
When I select the other section in the supplier dashboard
|
||||
Then I should see the new list and new order but not the list and order
|
||||
When I reset the section selector in the supplier dashboard
|
||||
Then I should see the list and the new list
|
||||
@@ -77,7 +79,7 @@ Feature: Supplier main board
|
||||
Given there is an active list and order
|
||||
And there is another section with table
|
||||
And I am signed in as supplier
|
||||
# wait until page is fully loaded
|
||||
# wait until page is fully loaded, could be a pure ruby command inside a within :selector statement since the browser will wait for the selector to be present and then the lists are loaded
|
||||
And I wait 4 seconds
|
||||
When the active list changes to another table in another section
|
||||
And I wait 2 seconds
|
||||
@@ -92,3 +94,11 @@ Feature: Supplier main board
|
||||
Then the supplier main board order should not be visible anymore
|
||||
And the supplier main board list total should be updated
|
||||
And the supplier placed orders counter should be reduced
|
||||
|
||||
@javascript
|
||||
Scenario: Closing list with active orders updates supplier counters
|
||||
Given there is an active list and order
|
||||
And I am signed in as supplier
|
||||
When I click on the close list button in the supplier dashboard
|
||||
And confirm the supplier close list modal
|
||||
Then the supplier placed orders counter should be reduced
|
||||
|
||||
@@ -42,13 +42,14 @@ Feature: Supplier section view
|
||||
@javascript
|
||||
Scenario: Selecting a specific section limits the result to the lists and orders of those sections
|
||||
Given there is an active list and order
|
||||
And there is another section with table
|
||||
And I am signed in as supplier
|
||||
And a new order on a table in another section is created
|
||||
Then I should see the list and the new list
|
||||
And I should see the order and the new order
|
||||
When I select the section in the supplier dashboard
|
||||
Then I should see the list and order but not the new list and new order
|
||||
When I select the new section in the supplier dashboard
|
||||
When I select the other section in the supplier dashboard
|
||||
Then I should see the new list and new order but not the list and order
|
||||
When I reset the section selector in the supplier dashboard
|
||||
Then I should see the list and the new list
|
||||
|
||||
@@ -27,9 +27,9 @@ step "the list should be marked as closed" do
|
||||
end
|
||||
|
||||
step 'a new order on a table in another section is created' do
|
||||
@new_section = create :section, title: 'Terrace', supplier: @supplier
|
||||
@new_table = create :table, number: 59, section: @new_section, supplier: @supplier
|
||||
@new_list = create :list, section: @new_section, table: @new_table, supplier: @supplier, user_ids: [@user.id]
|
||||
# @new_section = create :section, title: 'Terrace', supplier: @supplier
|
||||
# @new_table = create :table, number: 59, section: @new_section, supplier: @supplier
|
||||
@new_list = create :list, section: @other_section, table: @other_table, supplier: @supplier, user_ids: [@user.id]
|
||||
@new_order = @new_list.place_order(products: {@product.id => 3}, user: @user)
|
||||
end
|
||||
|
||||
|
||||
@@ -67,15 +67,15 @@ end
|
||||
|
||||
step "the new order on a table in another section should be present in the supplier dashboard" do
|
||||
el = find(".order-row-#{@new_order.id}")
|
||||
el.find('.table_number').text.should == @new_table.number.to_s
|
||||
el.find('.section_title').text.should == @new_section.title
|
||||
el.find('.table_number').text.should == @other_table.number.to_s
|
||||
el.find('.section_title').text.should == @other_section.title
|
||||
end
|
||||
|
||||
step "the new list should appear in the supplier dashboard" do
|
||||
el = find(".list-row-#{@new_list.id}")
|
||||
el.find('.total_list_amount').text.should =~ /6.66/
|
||||
el.find('.section_title').text.should == 'Terrace'
|
||||
el.find('.table_number').text.should == @new_table.number.to_s
|
||||
el.find('.section_title').text.should == @other_section.title
|
||||
el.find('.table_number').text.should == @other_table.number.to_s
|
||||
end
|
||||
|
||||
step "I click on the close list button in the supplier dashboard" do
|
||||
@@ -114,8 +114,8 @@ step "I select the section in the supplier dashboard" do
|
||||
find(%|.section_selector option[value="#{@section.id}"]|).select_option
|
||||
end
|
||||
|
||||
step "I select the new section in the supplier dashboard" do
|
||||
find(%|.section_selector option[value="#{@new_section.id}"]|).select_option
|
||||
step "I select the other section in the supplier dashboard" do
|
||||
find(%|.section_selector option[value="#{@other_section.id}"]|).select_option
|
||||
end
|
||||
|
||||
step "I reset the section selector in the supplier dashboard" do
|
||||
|
||||
@@ -129,25 +129,25 @@ describe Order do
|
||||
|
||||
it 'decreases the placed count and communicates it to user when state is placed through the order_cancelled broadcast message' do
|
||||
order_options[:state] = 'placed'
|
||||
expect{ order.cancel! }.to broadcast_to_user(user.id).message( 'order_cancelled' ).with(id: order.id, orders_placed_count: 10)
|
||||
expect{ order.cancel! }.to broadcast_to_user(user.id).message( 'order_cancelled' ).with(id: order.id, supplier_orders_placed_count: 10)
|
||||
supplier.orders_in_process_count.should == 7 # should not be reduced
|
||||
end
|
||||
|
||||
it 'decreases the placed count and communicates it to supplier when the state is placed through the order_cancelled broadcast message' do
|
||||
order_options[:state] = 'placed'
|
||||
expect{ order.cancel! }.to broadcast_to_supplier(supplier.id).message( 'order_cancelled' ).with(id: order.id, orders_placed_count: 10)
|
||||
expect{ order.cancel! }.to broadcast_to_supplier(supplier.id).message( 'order_cancelled' ).with(id: order.id, supplier_orders_placed_count: 10)
|
||||
supplier.orders_in_process_count.should == 7 # should not be reduced
|
||||
end
|
||||
|
||||
it 'decreases the orders_in_process count and communicates it to user when state is active through the order_cancelled broadcast message' do
|
||||
order_options[:state] = 'active'
|
||||
expect{ order.cancel! }.to broadcast_to_user(user.id).message( 'order_cancelled' ).with(id: order.id, orders_in_process_count: 6)
|
||||
expect{ order.cancel! }.to broadcast_to_user(user.id).message( 'order_cancelled' ).with(id: order.id, supplier_orders_in_process_count: 6)
|
||||
supplier.orders_placed_count.should == 11 # should not be reduced
|
||||
end
|
||||
|
||||
it 'decreases the orders_in_process count and communicates it to supplier when the state is active through the order_cancelled broadcast message' do
|
||||
order_options[:state] = 'active'
|
||||
expect{ order.cancel! }.to broadcast_to_supplier(supplier.id).message( 'order_cancelled' ).with(id: order.id, orders_in_process_count: 6)
|
||||
expect{ order.cancel! }.to broadcast_to_supplier(supplier.id).message( 'order_cancelled' ).with(id: order.id, supplier_orders_in_process_count: 6)
|
||||
supplier.orders_placed_count.should == 11 # should not be reduced
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,6 +20,6 @@ module SpecEmberHelpers
|
||||
end
|
||||
|
||||
def faye_log
|
||||
page.evaluate_script(%|window.faye_log|)
|
||||
JSON.parse(page.evaluate_script(%|JSON.stringify(window.faye_log)|))
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user