-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5086 from pjedrzejewski/admin/dashboard-prototype
[Admin] Add single channel dashboard
- Loading branch information
Showing
38 changed files
with
1,095 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@admin_dashboard | ||
Feature: Statistics dashboard | ||
In order to have an overview of my sales | ||
As an Administrator | ||
I want to see overall statistics on my admin dashboard | ||
|
||
Background: | ||
Given the store operates on a single channel in "France" | ||
And the store ships everywhere for free | ||
And the store allows paying offline | ||
And the store has a product "Sylius T-Shirt" | ||
And this product has "Red XL" variant priced at "€40" | ||
And I am logged in as an administrator | ||
|
||
@ui | ||
Scenario: Seeing basic statistics for entire store | ||
Given 3 customers have placed 4 orders for total of "€8566.00" | ||
And then 2 more customers have placed 2 orders for total of "€459.00" | ||
When I open administration dashboard | ||
Then I should see 6 new orders | ||
And I should see 6 new customers | ||
And there should be total sales of "€9,025.00" | ||
And the average order value should be "€1,504.17" | ||
|
||
@ui | ||
Scenario: Statistics include only completed orders | ||
Given 4 customers have placed 4 orders for total of "€5241.00" | ||
And 2 customers have added products to the cart for total of "€3450.00" | ||
When I open administration dashboard | ||
Then I should see 4 new orders | ||
And I should see 7 new customers | ||
And there should be total sales of "€5,241.00" | ||
And the average order value should be "€1,310.25" | ||
|
||
@ui | ||
Scenario: Seeing recent orders and customers | ||
Given 2 customers have placed 3 orders for total of "€340.00" | ||
And 2 customers have added products to the cart for total of "€424.00" | ||
When I open administration dashboard | ||
Then I should see 5 customers in the list | ||
And I should see 3 new orders in the list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Behat\Context\Ui\Admin; | ||
|
||
use Behat\Behat\Context\Context; | ||
use Sylius\Behat\Page\Admin\DashboardPageInterface; | ||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* @author Paweł Jędrzejewski <pawel@sylius.org> | ||
*/ | ||
final class DashboardContext implements Context | ||
{ | ||
/** | ||
* @var DashboardPageInterface | ||
*/ | ||
private $dashboardPage; | ||
|
||
/** | ||
* @param DashboardPageInterface $dashboardPage | ||
*/ | ||
public function __construct(DashboardPageInterface $dashboardPage) | ||
{ | ||
$this->dashboardPage = $dashboardPage; | ||
} | ||
|
||
/** | ||
* @When I open administration dashboard | ||
*/ | ||
public function iOpenAdministrationDashboard() | ||
{ | ||
$this->dashboardPage->open(); | ||
} | ||
|
||
/** | ||
* @Then I should see :number new orders | ||
*/ | ||
public function iShouldSeeNewOrders($number) | ||
{ | ||
Assert::same($this->dashboardPage->getNumberOfNewOrders(), $number); | ||
} | ||
|
||
/** | ||
* @Then I should see :number new customers | ||
*/ | ||
public function iShouldSeeNewCustomers($number) | ||
{ | ||
Assert::same($this->dashboardPage->getNumberOfNewCustomers(), $number); | ||
} | ||
|
||
/** | ||
* @Then there should be total sales of :total | ||
*/ | ||
public function thereShouldBeTotalSalesOf($total) | ||
{ | ||
Assert::same($this->dashboardPage->getTotalSales(), $total); | ||
} | ||
|
||
/** | ||
* @Then the average order value should be :value | ||
*/ | ||
public function myAverageOrderValueShouldBe($value) | ||
{ | ||
Assert::same($this->dashboardPage->getAverageOrderValue(), $value); | ||
} | ||
|
||
/** | ||
* @Then I should see :number customers in the list | ||
*/ | ||
public function iShouldSeeCustomersInTheList2($number) | ||
{ | ||
Assert::same($this->dashboardPage->getNumberOfNewCustomersInTheList(), $number); | ||
} | ||
|
||
/** | ||
* @Then I should see :number new orders in the list | ||
*/ | ||
public function iShouldSeeNewOrdersInTheList($number) | ||
{ | ||
Assert::same($this->dashboardPage->getNumberOfNewOrdersInTheList(), $number); | ||
} | ||
} |
Oops, something went wrong.