Review fixes

This commit is contained in:
Arminek 2016-11-23 18:08:35 +01:00
parent 8bb9c1d7aa
commit bb95a7bff5
3 changed files with 30 additions and 29 deletions

View file

@ -4,32 +4,32 @@ Feature: Statistics dashboard per channel
As an Administrator
I want to see overall statistics on my admin dashboard in specific channel
Background:
Given the store operates on a channel named "Poland"
And there is product "Onion" available in this channel
And the store operates on another channel named "United States"
And there is product "Banana" available in that channel
And the store ships everywhere for free
And the store allows paying offline
And I am logged in as an administrator
Background:
Given the store operates on a channel named "Poland"
And there is product "Onion" available in this channel
And the store operates on another channel named "United States"
And there is product "Banana" available in that channel
And the store ships everywhere for free
And the store allows paying offline
And I am logged in as an administrator
@ui
Scenario: Seeing basic statistics for entire store in channel
Given 3 customers have placed 4 orders for total of "$8566.00" mostly "Onion" product
And then 2 more customers have placed 2 orders for total of "$459.00" mostly "Banana" product
When I open administration dashboard for "Poland" channel
Then I should see 4 new orders
And I should see 5 new customers
And there should be total sales of "$3,426.40"
And the average order value should be "$1,504.17"
@ui
Scenario: Seeing basic statistics for entire store in channel
Given 3 customers have placed 4 orders for total of "$8566.00" mostly "Onion" product
And then 2 more customers have placed 2 orders for total of "$459.00" mostly "Banana" product
When I open administration dashboard for "Poland" channel
Then I should see 4 new orders
And I should see 5 new customers
And there should be total sales of "$8,566.00"
And the average order value should be "$2,141.50"
@ui
Scenario: Changing viewing channel in administration dashboard
Given 4 customers have placed 4 orders for total of "$5241.00" mostly "Onion" product
And then 2 more customers have placed 2 orders for total of "$459.00" mostly "Banana" product
When I open administration dashboard
And I choose "United States" channel
Then I should see 2 new orders
And I should see 6 new customers
And there should be total sales of "$5,241.00"
And the average order value should be "$1,310.25"
@ui
Scenario: Changing viewing channel in administration dashboard
Given 4 customers have placed 4 orders for total of "$5241.00" mostly "Onion" product
And then 2 more customers have placed 2 orders for total of "$459.00" mostly "Banana" product
When I open administration dashboard
And I choose "United States" channel
Then I should see 2 new orders
And I should see 6 new customers
And there should be total sales of "$459.00"
And the average order value should be "$229.50"

View file

@ -6,6 +6,7 @@ Feature: Adding a new administrator
Background:
Given the store has locale "English (United States)"
And the store operates on a single channel in "United States"
And I am logged in as an administrator
@ui

View file

@ -445,8 +445,8 @@ final class OrderContext implements Context
$total = $this->getPriceFromString($total);
for ($i = 0; $i < $numberOfOrders; $i++) {
$order = $this->createOrder($customers[rand(0, $numberOfCustomers - 1)], '#'.uniqid());
$order->setState(OrderInterface::STATE_NEW); // Temporary, we should use checkout to place these orders.
$order = $this->createOrder($customers[rand(0, $numberOfCustomers - 1)], '#'.uniqid(), $product->getChannels()->first());
$order->setState(OrderInterface::STATE_NEW);
$this->applyPaymentTransitionOnOrder($order, PaymentTransitions::TRANSITION_COMPLETE);
$price = $i === ($numberOfOrders - 1) ? $total : rand(1, $total);