mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[Shop] Clearing cart after log out and maintaining cart scenarios
This commit is contained in:
parent
6d3f889d47
commit
e9f41e80dc
4 changed files with 76 additions and 1 deletions
|
|
@ -0,0 +1,17 @@
|
|||
@shopping_cart
|
||||
Feature: Clearing cart after logging out
|
||||
In order to not allow to use my cart by anybody
|
||||
As a Customer
|
||||
I want to be able to have my cart cleared after logging out
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "United States"
|
||||
And the store has a product "Stark T-shirt" priced at "$12.00"
|
||||
And I am a logged in customer
|
||||
And I have product "Stark T-Shirt" in the cart
|
||||
|
||||
@ui
|
||||
Scenario: Clearing cart after logging out
|
||||
When I log out
|
||||
And I see the summary of my cart
|
||||
Then my cart should be empty
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
@shopping_cart
|
||||
Feature: Maintaining previous cart after authorization
|
||||
In order to retrieve my previous unfinished order
|
||||
As a Visitor
|
||||
I want to be able to have my cart previous maintained
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "United States"
|
||||
And the store has a product "Stark T-shirt" priced at "$12.00"
|
||||
And there is a user "robb@stark.com" identified by "KingInTheNorth"
|
||||
And I log in as "robb@stark.com" with "KingInTheNorth" password
|
||||
|
||||
@ui @todo
|
||||
Scenario: Having cart maintained after logging out and next in
|
||||
Given I have product "Stark T-Shirt" in the cart
|
||||
When I log out
|
||||
And I log in as "robb@stark.com" with "KingInTheNorth" password
|
||||
And I see the summary of my cart
|
||||
Then there should be one item in my cart
|
||||
And this item should have name "Stark T-shirt"
|
||||
|
|
@ -15,6 +15,7 @@ use Behat\Behat\Context\Context;
|
|||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Page\Admin\Customer\ShowPageInterface;
|
||||
use Sylius\Behat\Page\Shop\Account\LoginPageInterface;
|
||||
use Sylius\Behat\Page\Shop\HomePageInterface;
|
||||
use Sylius\Behat\Page\Shop\User\RegisterPageInterface;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Sylius\Component\User\Repository\UserRepositoryInterface;
|
||||
|
|
@ -41,19 +42,54 @@ final class UserContext implements Context
|
|||
*/
|
||||
private $customerShowPage;
|
||||
|
||||
/**
|
||||
* @var LoginPageInterface
|
||||
*/
|
||||
private $loginPage;
|
||||
|
||||
/**
|
||||
* @var HomePageInterface
|
||||
*/
|
||||
private $homePage;
|
||||
|
||||
/**
|
||||
* @param SharedStorageInterface $sharedStorage
|
||||
* @param UserRepositoryInterface $userRepository
|
||||
* @param ShowPageInterface $customerShowPage
|
||||
* @param LoginPageInterface $loginPage
|
||||
* @param HomePageInterface $homePage
|
||||
*/
|
||||
public function __construct(
|
||||
SharedStorageInterface $sharedStorage,
|
||||
UserRepositoryInterface $userRepository,
|
||||
ShowPageInterface $customerShowPage
|
||||
ShowPageInterface $customerShowPage,
|
||||
LoginPageInterface $loginPage,
|
||||
HomePageInterface $homePage
|
||||
) {
|
||||
$this->sharedStorage = $sharedStorage;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->customerShowPage = $customerShowPage;
|
||||
$this->loginPage = $loginPage;
|
||||
$this->homePage = $homePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I log in as :email with :password password
|
||||
*/
|
||||
public function iLogInAsWithPassword($email, $password)
|
||||
{
|
||||
$this->loginPage->open();
|
||||
$this->loginPage->specifyUsername($email);
|
||||
$this->loginPage->specifyPassword($password);
|
||||
$this->loginPage->logIn();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I log out
|
||||
*/
|
||||
public function iLogOut()
|
||||
{
|
||||
$this->homePage->logOut();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -312,6 +312,8 @@
|
|||
<argument type="service" id="sylius.behat.shared_storage" />
|
||||
<argument type="service" id="__symfony__.sylius.repository.shop_user" />
|
||||
<argument type="service" id="sylius.behat.page.admin.customer.show" />
|
||||
<argument type="service" id="sylius.behat.page.shop.account.login" />
|
||||
<argument type="service" id="sylius.behat.page.shop.home" />
|
||||
<tag name="fob.context_service" />
|
||||
</service>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue