Fixes after PR review

This commit is contained in:
Grzegorz Sadowski 2016-07-10 16:10:43 +02:00
parent 51bab2b03d
commit f7a06cedcc
6 changed files with 25 additions and 7 deletions

View file

@ -37,5 +37,5 @@ Feature: Statistics dashboard
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
Then I should see 5 new customers in the list
And I should see 3 new orders in the list

View file

@ -11,7 +11,7 @@ Feature: Editing an administrator
@ui @javascript
Scenario: Changing password and signing again
Given I want to edit the customer of my account
Given I want to change my password
When I change my password to "abcd"
And I save my changes
And I should be notified that it has been successfully edited

View file

@ -82,9 +82,9 @@ final class DashboardContext implements Context
}
/**
* @Then I should see :number customers in the list
* @Then I should see :number new customers in the list
*/
public function iShouldSeeCustomersInTheList2($number)
public function iShouldSeeNewCustomersInTheList($number)
{
Assert::same($this->dashboardPage->getNumberOfNewCustomersInTheList(), $number);
}

View file

@ -16,6 +16,7 @@ use Sylius\Behat\Page\Admin\Crud\IndexPageInterface;
use Sylius\Behat\Page\Admin\Customer\CreatePageInterface;
use Sylius\Behat\Page\Admin\Customer\ShowPageInterface;
use Sylius\Behat\Page\Admin\Customer\UpdatePageInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\User\Model\CustomerInterface;
use Webmozart\Assert\Assert;
@ -24,6 +25,11 @@ use Webmozart\Assert\Assert;
*/
final class ManagingCustomersContext implements Context
{
/**
* @var SharedStorageInterface
*/
private $sharedStorage;
/**
* @var IndexPageInterface
*/
@ -45,17 +51,20 @@ final class ManagingCustomersContext implements Context
private $showPage;
/**
* @param SharedStorageInterface $sharedStorage
* @param CreatePageInterface $createPage
* @param IndexPageInterface $indexPage
* @param UpdatePageInterface $updatePage
* @param ShowPageInterface $showPage
*/
public function __construct(
SharedStorageInterface $sharedStorage,
CreatePageInterface $createPage,
IndexPageInterface $indexPage,
UpdatePageInterface $updatePage,
ShowPageInterface $showPage
) {
$this->sharedStorage = $sharedStorage;
$this->createPage = $createPage;
$this->indexPage = $indexPage;
$this->updatePage = $updatePage;
@ -137,13 +146,22 @@ final class ManagingCustomersContext implements Context
/**
* @Given /^I want to edit (this customer)$/
* @Given I want to edit the customer :customer
* @Given /^I want to edit (the customer of my account)$/
*/
public function iWantToEditThisCustomer(CustomerInterface $customer)
{
$this->updatePage->open(['id' => $customer->getId()]);
}
/**
* @Given I want to change my password
*/
public function iWantToChangeMyPassword()
{
$customer = $this->sharedStorage->get('customer');
$this->updatePage->open(['id' => $customer->getId()]);
}
/**
* @When I save my changes
* @When I try to save my changes

View file

@ -44,6 +44,7 @@
</service>
<service id="sylius.behat.context.ui.admin.managing_customers" class="Sylius\Behat\Context\Ui\Admin\ManagingCustomersContext" scope="scenario">
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="sylius.behat.page.admin.customer.create" />
<argument type="service" id="sylius.behat.page.admin.customer.index" />
<argument type="service" id="sylius.behat.page.admin.customer.update" />

View file

@ -25,8 +25,7 @@
"Please enter your password."
]
},
"enabled": {},
"authorizationRoles": {}
"enabled": {}
}
}
}