mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Review fixes
This commit is contained in:
parent
3ff351f9ac
commit
e16b238a9f
33 changed files with 589 additions and 354 deletions
|
|
@ -1,33 +0,0 @@
|
|||
@customer_account
|
||||
Feature: Account registration
|
||||
In order to order products
|
||||
As a visitor
|
||||
I need to be able to create an account in the store
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "France"
|
||||
|
||||
@ui
|
||||
Scenario: Registering a new account with minimum information
|
||||
Given I want to register a new account
|
||||
When I specify first name with "Saul"
|
||||
And I specify last name with "Goodman"
|
||||
And I specify email with "goodman@gmail.com"
|
||||
And I specify password with "heisenberg"
|
||||
And I confirm this password
|
||||
And I register this account
|
||||
Then I should be notified that new account has been successfully created
|
||||
And I should be logged in
|
||||
|
||||
@ui
|
||||
Scenario: Registering a new account with all details
|
||||
Given I want to register a new account
|
||||
When I specify first name with "Saul"
|
||||
And I specify last name with "Goodman"
|
||||
And I specify email with "goodman@gmail.com"
|
||||
And I specify password with "heisenberg"
|
||||
And I confirm this password
|
||||
And I specify phone number with "123456789"
|
||||
And I register this account
|
||||
Then I should be notified that new account has been successfully created
|
||||
And I should be logged in
|
||||
49
features/account/registration.feature
Normal file
49
features/account/registration.feature
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
@customer_registration
|
||||
Feature: Account registration
|
||||
In order to make future purchases with ease
|
||||
As a Visitor
|
||||
I need to be able to create an account in the store
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "France"
|
||||
|
||||
@ui
|
||||
Scenario: Registering a new account with minimum information
|
||||
Given I want to register a new account
|
||||
When I specify the first name as "Saul"
|
||||
And I specify the last name as "Goodman"
|
||||
And I specify the email as "goodman@gmail.com"
|
||||
And I specify the password as "heisenberg"
|
||||
And I confirm this password
|
||||
And I register this account
|
||||
Then I should be notified that new account has been successfully created
|
||||
And I should be logged in
|
||||
And my email should be "goodman@gmail.com"
|
||||
|
||||
@ui
|
||||
Scenario: Registering a new account with all details
|
||||
Given I want to register a new account
|
||||
When I specify the first name as "Saul"
|
||||
And I specify the last name as "Goodman"
|
||||
And I specify the email as "goodman@gmail.com"
|
||||
And I specify the password as "heisenberg"
|
||||
And I confirm this password
|
||||
And I specify the phone number as "123456789"
|
||||
And I register this account
|
||||
Then I should be notified that new account has been successfully created
|
||||
And I should be logged in
|
||||
And my email should be "goodman@gmail.com"
|
||||
|
||||
@ui
|
||||
Scenario: Registering a guest account
|
||||
Given there is a customer "goodman@gmail.com" that placed an order "#001"
|
||||
And I want to register a new account
|
||||
When I specify the first name as "Saul"
|
||||
And I specify the last name as "Goodman"
|
||||
And I specify the email as "goodman@gmail.com"
|
||||
And I specify the password as "heisenberg"
|
||||
And I confirm this password
|
||||
And I register this account
|
||||
Then I should be notified that new account has been successfully created
|
||||
And I should be logged in
|
||||
And my email should be "goodman@gmail.com"
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
@customer_account
|
||||
@customer_registration
|
||||
Feature: Account registration
|
||||
In order to avoid making mistakes when registering account
|
||||
As a visitor
|
||||
I need to be able to create an account in the store
|
||||
As a Visitor
|
||||
I want to be prevented from creating an account without required fields
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "France"
|
||||
|
|
@ -11,63 +11,63 @@ Feature: Account registration
|
|||
Scenario: Trying to register a new account with email that has been already used
|
||||
Given there is user "goodman@gmail.com" identified by "heisenberg"
|
||||
And I want to register a new account
|
||||
When I specify email with "goodman@gmail.com"
|
||||
When I specify the email as "goodman@gmail.com"
|
||||
And I try to register this account
|
||||
Then I should be notified that email is already used
|
||||
Then I should be notified that the email is already used
|
||||
And I should not be logged in
|
||||
|
||||
@ui
|
||||
Scenario: Trying to register a new account without specifying first name
|
||||
Given I want to register a new account
|
||||
When I do not specify first name
|
||||
And I specify last name with "Goodman"
|
||||
And I specify email with "goodman@gmail.com"
|
||||
And I specify password with "heisenberg"
|
||||
When I do not specify the first name
|
||||
And I specify the last name as "Goodman"
|
||||
And I specify the email as "goodman@gmail.com"
|
||||
And I specify the password as "heisenberg"
|
||||
And I try to register this account
|
||||
Then I should be notified that first name is required
|
||||
Then I should be notified that the first name is required
|
||||
And I should not be logged in
|
||||
|
||||
@ui
|
||||
Scenario: Trying to register a new account without specifying last name
|
||||
Given I want to register a new account
|
||||
When I do not specify last name
|
||||
And I specify first name with "Saul"
|
||||
And I specify email with "goodman@gmail.com"
|
||||
And I specify password with "heisenberg"
|
||||
When I do not specify the last name
|
||||
And I specify the first name as "Saul"
|
||||
And I specify the email as "goodman@gmail.com"
|
||||
And I specify the password as "heisenberg"
|
||||
And I confirm this password
|
||||
And I try to register this account
|
||||
Then I should be notified that last name is required
|
||||
Then I should be notified that the last name is required
|
||||
And I should not be logged in
|
||||
|
||||
@ui
|
||||
Scenario: Trying to register a new account without specifying password
|
||||
Given I want to register a new account
|
||||
When I do not specify password
|
||||
And I specify first name with "Saul"
|
||||
And I specify last name with "Goodman"
|
||||
And I specify email with "goodman@gmail.com"
|
||||
When I do not specify the password
|
||||
And I specify the first name as "Saul"
|
||||
And I specify the last name as "Goodman"
|
||||
And I specify the email as "goodman@gmail.com"
|
||||
And I try to register this account
|
||||
Then I should be notified that password is required
|
||||
Then I should be notified that the password is required
|
||||
And I should not be logged in
|
||||
|
||||
@ui
|
||||
Scenario: Trying to register a new account without confirming password
|
||||
Given I want to register a new account
|
||||
When I specify first name with "Saul"
|
||||
Then I specify last name with "Goodman"
|
||||
And I specify email with "goodman@gmail.com"
|
||||
And I specify password with "heisenberg"
|
||||
And I do not confirm password
|
||||
When I specify the first name as "Saul"
|
||||
Then I specify the last name as "Goodman"
|
||||
And I specify the email as "goodman@gmail.com"
|
||||
And I specify the password as "heisenberg"
|
||||
And I do not confirm the password
|
||||
And I try to register this account
|
||||
Then I should be notified that password do not match
|
||||
Then I should be notified that the password do not match
|
||||
And I should not be logged in
|
||||
|
||||
@ui
|
||||
Scenario: Trying to register a new account without specifying email
|
||||
Given I want to register a new account
|
||||
When I do not specify email
|
||||
And I specify first name with "Saul"
|
||||
And I specify last name with "Goodman"
|
||||
When I do not specify the email
|
||||
And I specify the first name as "Saul"
|
||||
And I specify the last name as "Goodman"
|
||||
And I try to register this account
|
||||
Then I should be notified that email is required
|
||||
Then I should be notified that the email is required
|
||||
And I should not be logged in
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
@customer_account
|
||||
@customer_login
|
||||
Feature: Sign in to the store
|
||||
In order to view my
|
||||
As a visitor
|
||||
In order to view my orders
|
||||
As a Visitor
|
||||
I want to be able to log in to the store
|
||||
|
||||
Background:
|
||||
|
|
@ -11,15 +11,16 @@ Feature: Sign in to the store
|
|||
@ui
|
||||
Scenario: Sign in with email and password
|
||||
Given I want to log in
|
||||
When I specify email with "ted@example.com"
|
||||
And I specify password with "bear"
|
||||
When I specify the user name as "ted@example.com"
|
||||
And I specify the password as "bear"
|
||||
And I log in
|
||||
Then I should be logged in
|
||||
|
||||
@ui
|
||||
Scenario: Sign in with bad credentials
|
||||
Given I want to log in
|
||||
When I specify email with "bear@example.com"
|
||||
And I specify password with "pswd"
|
||||
When I specify the user name as "bear@example.com"
|
||||
And I specify the password as "pswd"
|
||||
And I log in
|
||||
Then I should be notified about bad credentials
|
||||
And I should not be logged in
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Sylius\Behat\Context\Ui;
|
|||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Sylius\Behat\Page\Admin\Channel\CreatePageInterface;
|
||||
use Sylius\Behat\Page\Shop\HomePageInterface;
|
||||
use Sylius\Behat\Page\Shop\LegacyHomePageInterface;
|
||||
use Sylius\Behat\Service\Setter\ChannelContextSetterInterface;
|
||||
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
|
|
@ -45,7 +45,7 @@ final class ChannelContext implements Context
|
|||
private $channelCreatePage;
|
||||
|
||||
/**
|
||||
* @var HomePageInterface
|
||||
* @var LegacyHomePageInterface
|
||||
*/
|
||||
private $homePage;
|
||||
|
||||
|
|
@ -54,14 +54,14 @@ final class ChannelContext implements Context
|
|||
* @param ChannelContextSetterInterface $channelContextSetter
|
||||
* @param ChannelRepositoryInterface $channelRepository
|
||||
* @param CreatePageInterface $channelCreatePage
|
||||
* @param HomePageInterface $homePage
|
||||
* @param LegacyHomePageInterface $homePage
|
||||
*/
|
||||
public function __construct(
|
||||
SharedStorageInterface $sharedStorage,
|
||||
ChannelContextSetterInterface $channelContextSetter,
|
||||
ChannelRepositoryInterface $channelRepository,
|
||||
CreatePageInterface $channelCreatePage,
|
||||
HomePageInterface $homePage
|
||||
LegacyHomePageInterface $homePage
|
||||
) {
|
||||
$this->sharedStorage = $sharedStorage;
|
||||
$this->channelContextSetter = $channelContextSetter;
|
||||
|
|
|
|||
|
|
@ -16,29 +16,13 @@ use Sylius\Behat\NotificationType;
|
|||
use Sylius\Behat\Page\Shop\Account\DashboardPageInterface;
|
||||
use Sylius\Behat\Page\Shop\Account\ProfileUpdatePageInterface;
|
||||
use Sylius\Behat\Service\NotificationCheckerInterface;
|
||||
use Sylius\Behat\Page\Shop\Account\LoginPageInterface;
|
||||
use Sylius\Behat\Page\Shop\Account\RegisterPageInterface;
|
||||
use Sylius\Behat\Page\Shop\ShopHomePageInterface;
|
||||
use Sylius\Behat\Service\Resolver\CurrentPageResolverInterface;
|
||||
use Sylius\Component\Core\Test\Services\SharedStorageInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
*/
|
||||
final class AccountContext implements Context
|
||||
{
|
||||
/**
|
||||
* @var SharedStorageInterface
|
||||
*/
|
||||
private $sharedStorage;
|
||||
|
||||
/**
|
||||
* @var CurrentPageResolverInterface
|
||||
*/
|
||||
private $currentPageResolver;
|
||||
|
||||
/**
|
||||
* @var NotificationCheckerInterface
|
||||
*/
|
||||
|
|
@ -55,48 +39,18 @@ final class AccountContext implements Context
|
|||
private $profileUpdatePage;
|
||||
|
||||
/**
|
||||
* @var LoginPageInterface
|
||||
*/
|
||||
private $loginPage;
|
||||
|
||||
/**
|
||||
* @var RegisterPageInterface
|
||||
*/
|
||||
private $registerPage;
|
||||
|
||||
/**
|
||||
* @var ShopHomePageInterface
|
||||
*/
|
||||
private $shopHomePage;
|
||||
|
||||
/**
|
||||
* @param SharedStorageInterface $sharedStorage
|
||||
* @param CurrentPageResolverInterface $currentPageResolver
|
||||
* @param NotificationCheckerInterface $notificationChecker
|
||||
* @param DashboardPageInterface $dashboardPage
|
||||
* @param ProfileUpdatePageInterface $profileUpdatePage
|
||||
* @param LoginPageInterface $loginPage
|
||||
* @param RegisterPageInterface $registerPage
|
||||
* @param ShopHomePageInterface $shopHomePage
|
||||
*/
|
||||
public function __construct(
|
||||
SharedStorageInterface $sharedStorage,
|
||||
CurrentPageResolverInterface $currentPageResolver,
|
||||
NotificationCheckerInterface $notificationChecker,
|
||||
DashboardPageInterface $dashboardPage,
|
||||
ProfileUpdatePageInterface $profileUpdatePage,
|
||||
LoginPageInterface $loginPage,
|
||||
RegisterPageInterface $registerPage,
|
||||
ShopHomePageInterface $shopHomePage
|
||||
ProfileUpdatePageInterface $profileUpdatePage
|
||||
) {
|
||||
$this->sharedStorage = $sharedStorage;
|
||||
$this->currentPageResolver = $currentPageResolver;
|
||||
$this->notificationChecker = $notificationChecker;
|
||||
$this->dashboardPage = $dashboardPage;
|
||||
$this->profileUpdatePage = $profileUpdatePage;
|
||||
$this->loginPage = $loginPage;
|
||||
$this->registerPage = $registerPage;
|
||||
$this->shopHomePage = $shopHomePage;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -107,30 +61,13 @@ final class AccountContext implements Context
|
|||
$this->profileUpdatePage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I want to log in
|
||||
*/
|
||||
public function iWantToLogIn()
|
||||
{
|
||||
$this->loginPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I want to register a new account
|
||||
*/
|
||||
public function iWantToRegisterANewAccount()
|
||||
{
|
||||
$this->registerPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify the first name as :firstName
|
||||
* @When I remove the first name
|
||||
*/
|
||||
public function iSpecifyTheFirstName($firstName = null)
|
||||
{
|
||||
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->profileUpdatePage, $this->registerPage]);
|
||||
$currentPage->specifyFirstName($firstName);
|
||||
$this->profileUpdatePage->specifyFirstName($firstName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -139,8 +76,7 @@ final class AccountContext implements Context
|
|||
*/
|
||||
public function iSpecifyTheLastName($lastName = null)
|
||||
{
|
||||
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->profileUpdatePage, $this->registerPage]);
|
||||
$currentPage->specifyLastName($lastName);
|
||||
$this->profileUpdatePage->specifyLastName($lastName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -149,43 +85,7 @@ final class AccountContext implements Context
|
|||
*/
|
||||
public function iSpecifyTheEmail($email = null)
|
||||
{
|
||||
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->profileUpdatePage, $this->registerPage]);
|
||||
$currentPage->specifyEmail($email);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify password with :password
|
||||
* @When I do not specify password
|
||||
*/
|
||||
public function iSpecifyPasswordWith($password = null)
|
||||
{
|
||||
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->loginPage, $this->registerPage]);
|
||||
$currentPage->specifyPassword($password);
|
||||
$this->sharedStorage->set('password', $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^I confirm (this password)$/
|
||||
*/
|
||||
public function iConfirmThisPassword($password)
|
||||
{
|
||||
$this->registerPage->verifyPassword($password);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I do not confirm password
|
||||
*/
|
||||
public function iDoNotConfirmPassword()
|
||||
{
|
||||
$this->registerPage->verifyPassword(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify phone number with :phoneNumber
|
||||
*/
|
||||
public function iSpecifyPhoneNumberWith($phoneNumber)
|
||||
{
|
||||
$this->registerPage->specifyPhoneNumber($phoneNumber);
|
||||
$this->profileUpdatePage->specifyEmail($email);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -197,23 +97,6 @@ final class AccountContext implements Context
|
|||
$this->profileUpdatePage->saveChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I log in
|
||||
*/
|
||||
public function iLogIn()
|
||||
{
|
||||
$this->loginPage->logIn();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I register this account
|
||||
* @When I try to register this account
|
||||
*/
|
||||
public function iRegister()
|
||||
{
|
||||
$this->registerPage->register();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that it has been successfully edited
|
||||
*/
|
||||
|
|
@ -250,47 +133,6 @@ final class AccountContext implements Context
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that new account has been successfully created
|
||||
*/
|
||||
public function iShouldBeNotifiedThatNewAccountHasBeenSuccessfullyCreated()
|
||||
{
|
||||
$this->notificationChecker->checkNotification('Customer has been successfully created.', NotificationType::success());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be logged in
|
||||
*/
|
||||
public function iShouldBeLoggedIn()
|
||||
{
|
||||
Assert::true(
|
||||
$this->shopHomePage->hasLogoutButton(),
|
||||
'I should be on home page and, also i should be able to sign out.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should not be logged in
|
||||
*/
|
||||
public function iShouldNotBeLoggedIn()
|
||||
{
|
||||
Assert::false(
|
||||
$this->shopHomePage->hasLogoutButton(),
|
||||
'I should not be logged in.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified about bad credentials
|
||||
*/
|
||||
public function iShouldBeNotifiedAboutBadCredentials()
|
||||
{
|
||||
Assert::true(
|
||||
$this->loginPage->hasValidationErrorWith('Error Invalid credentials.'),
|
||||
'I should see validation error.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should be notified that the ([^"]+) is required$/
|
||||
*/
|
||||
|
|
@ -315,23 +157,14 @@ final class AccountContext implements Context
|
|||
$this->assertFieldValidationMessage('email', 'This email is already used.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that password do not match
|
||||
*/
|
||||
public function iShouldBeNotifiedThatPasswordDoNotMatch()
|
||||
{
|
||||
$this->assertFieldValidationMessage('password', "The entered passwords don't match");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $element
|
||||
* @param string $expectedMessage
|
||||
*/
|
||||
private function assertFieldValidationMessage($element, $expectedMessage)
|
||||
{
|
||||
$currentPage = $this->currentPageResolver->getCurrentPageWithForm($this->profileUpdatePage, $this->registerPage);
|
||||
Assert::true(
|
||||
$currentPage->checkValidationMessageFor($element, $expectedMessage),
|
||||
$this->profileUpdatePage->checkValidationMessageFor($element, $expectedMessage),
|
||||
sprintf('The %s should be required.', $element)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
110
src/Sylius/Behat/Context/Ui/Shop/LoginContext.php
Normal file
110
src/Sylius/Behat/Context/Ui/Shop/LoginContext.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?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\Shop;
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Sylius\Behat\Page\Shop\Account\LoginPageInterface;
|
||||
use Sylius\Behat\Page\Shop\HomePageInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
*/
|
||||
class LoginContext implements Context
|
||||
{
|
||||
/**
|
||||
* @var LoginPageInterface
|
||||
*/
|
||||
private $loginPage;
|
||||
|
||||
/**
|
||||
* @var HomePageInterface
|
||||
*/
|
||||
private $homePage;
|
||||
|
||||
/**
|
||||
* @param LoginPageInterface $loginPage
|
||||
* @param HomePageInterface $homePage
|
||||
*/
|
||||
public function __construct(LoginPageInterface $loginPage, HomePageInterface $homePage)
|
||||
{
|
||||
$this->loginPage = $loginPage;
|
||||
$this->homePage = $homePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I want to log in
|
||||
*/
|
||||
public function iWantToLogIn()
|
||||
{
|
||||
$this->loginPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify the user name as :userName
|
||||
* @When I do not specify the user name
|
||||
*/
|
||||
public function iSpecifyTheUserName($userName = null)
|
||||
{
|
||||
$this->loginPage->specifyUserName($userName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify the password as :password
|
||||
* @When I do not specify the password
|
||||
*/
|
||||
public function iSpecifyThePasswordAs($password = null)
|
||||
{
|
||||
$this->loginPage->specifyPassword($password);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I log in
|
||||
*/
|
||||
public function iLogIn()
|
||||
{
|
||||
$this->loginPage->logIn();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be logged in
|
||||
*/
|
||||
public function iShouldBeLoggedIn()
|
||||
{
|
||||
Assert::true(
|
||||
$this->homePage->hasLogoutButton(),
|
||||
'I should be on home page and, also i should be able to sign out.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should not be logged in
|
||||
*/
|
||||
public function iShouldNotBeLoggedIn()
|
||||
{
|
||||
Assert::false(
|
||||
$this->homePage->hasLogoutButton(),
|
||||
'I should not be logged in.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified about bad credentials
|
||||
*/
|
||||
public function iShouldBeNotifiedAboutBadCredentials()
|
||||
{
|
||||
Assert::true(
|
||||
$this->loginPage->hasValidationErrorWith('Error Invalid credentials.'),
|
||||
'I should see validation error.'
|
||||
);
|
||||
}
|
||||
}
|
||||
240
src/Sylius/Behat/Context/Ui/Shop/RegistrationContext.php
Normal file
240
src/Sylius/Behat/Context/Ui/Shop/RegistrationContext.php
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
<?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\Shop;
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Sylius\Behat\NotificationType;
|
||||
use Sylius\Behat\Page\Shop\Account\DashboardPageInterface;
|
||||
use Sylius\Behat\Page\Shop\Account\RegisterPageInterface;
|
||||
use Sylius\Behat\Page\Shop\HomePageInterface;
|
||||
use Sylius\Behat\Service\NotificationCheckerInterface;
|
||||
use Sylius\Behat\Service\Resolver\CurrentPageResolverInterface;
|
||||
use Sylius\Component\Core\Test\Services\SharedStorageInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
*/
|
||||
class RegistrationContext implements Context
|
||||
{
|
||||
/**
|
||||
* @var CurrentPageResolverInterface
|
||||
*/
|
||||
private $currentPageResolver;
|
||||
|
||||
/**
|
||||
* @var DashboardPageInterface
|
||||
*/
|
||||
private $dashboardPage;
|
||||
|
||||
/**
|
||||
* @var HomePageInterface
|
||||
*/
|
||||
private $homePage;
|
||||
|
||||
/**
|
||||
* @var NotificationCheckerInterface
|
||||
*/
|
||||
private $notificationChecker;
|
||||
|
||||
/**
|
||||
* @var RegisterPageInterface
|
||||
*/
|
||||
private $registerPage;
|
||||
|
||||
/**
|
||||
* @var SharedStorageInterface
|
||||
*/
|
||||
private $sharedStorage;
|
||||
|
||||
/**
|
||||
* @param CurrentPageResolverInterface $currentPageResolver
|
||||
* @param DashboardPageInterface $dashboardPage
|
||||
* @param HomePageInterface $homePage
|
||||
* @param NotificationCheckerInterface $notificationChecker
|
||||
* @param RegisterPageInterface $registerPage
|
||||
* @param SharedStorageInterface $sharedStorage
|
||||
*/
|
||||
public function __construct(
|
||||
CurrentPageResolverInterface $currentPageResolver,
|
||||
DashboardPageInterface $dashboardPage,
|
||||
HomePageInterface $homePage,
|
||||
NotificationCheckerInterface $notificationChecker,
|
||||
RegisterPageInterface $registerPage,
|
||||
SharedStorageInterface $sharedStorage
|
||||
) {
|
||||
$this->currentPageResolver = $currentPageResolver;
|
||||
$this->dashboardPage = $dashboardPage;
|
||||
$this->homePage = $homePage;
|
||||
$this->notificationChecker = $notificationChecker;
|
||||
$this->registerPage = $registerPage;
|
||||
$this->sharedStorage = $sharedStorage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I want to register a new account
|
||||
*/
|
||||
public function iWantToRegisterANewAccount()
|
||||
{
|
||||
$this->registerPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify the first name as :firstName
|
||||
* @When I do not specify the first name
|
||||
*/
|
||||
public function iSpecifyTheFirstName($firstName = null)
|
||||
{
|
||||
$this->registerPage->specifyFirstName($firstName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify the last name as :lastName
|
||||
* @When I do not specify the last name
|
||||
*/
|
||||
public function iSpecifyTheLastName($lastName = null)
|
||||
{
|
||||
$this->registerPage->specifyLastName($lastName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify the email as :email
|
||||
* @When I do not specify the email
|
||||
*/
|
||||
public function iSpecifyTheEmail($email = null)
|
||||
{
|
||||
$this->registerPage->specifyEmail($email);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify the password as :password
|
||||
* @When I do not specify the password
|
||||
*/
|
||||
public function iSpecifyThePasswordAs($password = null)
|
||||
{
|
||||
$this->registerPage->specifyPassword($password);
|
||||
$this->sharedStorage->set('password', $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^I confirm (this password)$/
|
||||
*/
|
||||
public function iConfirmThisPassword($password)
|
||||
{
|
||||
$this->registerPage->verifyPassword($password);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I do not confirm the password
|
||||
*/
|
||||
public function iDoNotConfirmPassword()
|
||||
{
|
||||
$this->registerPage->verifyPassword(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify the phone number as :phoneNumber
|
||||
*/
|
||||
public function iSpecifyThePhoneNumberAS($phoneNumber)
|
||||
{
|
||||
$this->registerPage->specifyPhoneNumber($phoneNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I register this account
|
||||
* @When I try to register this account
|
||||
*/
|
||||
public function iRegisterThisAccount()
|
||||
{
|
||||
$this->registerPage->register();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then my email should be :email
|
||||
* @Then my email should still be :email
|
||||
*/
|
||||
public function myEmailShouldBe($email)
|
||||
{
|
||||
$this->dashboardPage->open();
|
||||
|
||||
Assert::true(
|
||||
$this->dashboardPage->hasCustomerEmail($email),
|
||||
sprintf('Cannot find customer email "%s".', $email)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should be notified that the ([^"]+) is required$/
|
||||
*/
|
||||
public function iShouldBeNotifiedThatElementIsRequired($element)
|
||||
{
|
||||
$this->assertFieldValidationMessage($element, sprintf('Please enter your %s.', $element));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that the email is already used
|
||||
*/
|
||||
public function iShouldBeNotifiedThatTheEmailIsAlreadyUsed()
|
||||
{
|
||||
$this->assertFieldValidationMessage('email', 'This email is already used.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that the password do not match
|
||||
*/
|
||||
public function iShouldBeNotifiedThatThePasswordDoNotMatch()
|
||||
{
|
||||
$this->assertFieldValidationMessage('password', 'The entered passwords don\'t match');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that new account has been successfully created
|
||||
*/
|
||||
public function iShouldBeNotifiedThatNewAccountHasBeenSuccessfullyCreated()
|
||||
{
|
||||
$this->notificationChecker->checkNotification('Customer has been successfully created.', NotificationType::success());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be logged in
|
||||
*/
|
||||
public function iShouldBeLoggedIn()
|
||||
{
|
||||
Assert::true(
|
||||
$this->homePage->hasLogoutButton(),
|
||||
'I should be on home page and, also i should be able to sign out.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should not be logged in
|
||||
*/
|
||||
public function iShouldNotBeLoggedIn()
|
||||
{
|
||||
Assert::false(
|
||||
$this->homePage->hasLogoutButton(),
|
||||
'I should not be logged in.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $element
|
||||
* @param string $expectedMessage
|
||||
*/
|
||||
private function assertFieldValidationMessage($element, $expectedMessage)
|
||||
{
|
||||
Assert::true(
|
||||
$this->registerPage->checkValidationMessageFor($element, $expectedMessage),
|
||||
sprintf('The %s should be required.', $element)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ namespace Sylius\Behat\Context\Ui;
|
|||
use Behat\Behat\Context\Context;
|
||||
use Sylius\Behat\Page\Admin\Channel\IndexPageInterface;
|
||||
use Sylius\Behat\Page\Admin\Channel\UpdatePageInterface;
|
||||
use Sylius\Behat\Page\Shop\HomePageInterface;
|
||||
use Sylius\Behat\Page\Shop\LegacyHomePageInterface;
|
||||
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Sylius\Component\Core\Test\Services\SharedStorageInterface;
|
||||
|
|
@ -40,7 +40,7 @@ final class ThemeContext implements Context
|
|||
private $channelUpdatePage;
|
||||
|
||||
/**
|
||||
* @var HomePageInterface
|
||||
* @var LegacyHomePageInterface
|
||||
*/
|
||||
private $homePage;
|
||||
|
||||
|
|
@ -48,13 +48,13 @@ final class ThemeContext implements Context
|
|||
* @param SharedStorageInterface $sharedStorage
|
||||
* @param IndexPageInterface $channelIndexPage
|
||||
* @param UpdatePageInterface $channelUpdatePage
|
||||
* @param HomePageInterface $homePage
|
||||
* @param LegacyHomePageInterface $homePage
|
||||
*/
|
||||
public function __construct(
|
||||
SharedStorageInterface $sharedStorage,
|
||||
IndexPageInterface $channelIndexPage,
|
||||
UpdatePageInterface $channelUpdatePage,
|
||||
HomePageInterface $homePage
|
||||
LegacyHomePageInterface $homePage
|
||||
) {
|
||||
$this->sharedStorage = $sharedStorage;
|
||||
$this->channelIndexPage = $channelIndexPage;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Sylius\Behat\Context\Ui;
|
|||
use Behat\Behat\Context\Context;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Page\Admin\Customer\ShowPageInterface;
|
||||
use Sylius\Behat\Page\Shop\User\LoginPageInterface;
|
||||
use Sylius\Behat\Page\Shop\Account\LoginPageInterface;
|
||||
use Sylius\Behat\Page\Shop\User\RegisterPageInterface;
|
||||
use Sylius\Component\Core\Test\Services\SharedStorageInterface;
|
||||
use Sylius\Component\User\Repository\UserRepositoryInterface;
|
||||
|
|
@ -40,6 +40,11 @@ final class UserContext implements Context
|
|||
*/
|
||||
private $customerShowPage;
|
||||
|
||||
/**
|
||||
* @var LoginPageInterface
|
||||
*/
|
||||
private $loginPage;
|
||||
|
||||
/**
|
||||
* @var RegisterPageInterface
|
||||
*/
|
||||
|
|
@ -49,20 +54,34 @@ final class UserContext implements Context
|
|||
* @param SharedStorageInterface $sharedStorage
|
||||
* @param UserRepositoryInterface $userRepository
|
||||
* @param ShowPageInterface $customerShowPage
|
||||
* @param LoginPageInterface $loginPage
|
||||
* @param RegisterPageInterface $registerPage
|
||||
*/
|
||||
public function __construct(
|
||||
SharedStorageInterface $sharedStorage,
|
||||
UserRepositoryInterface $userRepository,
|
||||
ShowPageInterface $customerShowPage,
|
||||
LoginPageInterface $loginPage,
|
||||
RegisterPageInterface $registerPage
|
||||
) {
|
||||
$this->sharedStorage = $sharedStorage;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->customerShowPage = $customerShowPage;
|
||||
$this->loginPage = $loginPage;
|
||||
$this->registerPage = $registerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 try to register again with email :email
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,17 +34,17 @@ class LoginPage extends SymfonyPage implements LoginPageInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function specifyEmail($email)
|
||||
public function specifyPassword($password)
|
||||
{
|
||||
$this->getDocument()->fillField('Email', $email);
|
||||
$this->getDocument()->fillField('Password', $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function specifyPassword($password)
|
||||
public function specifyUserName($userName)
|
||||
{
|
||||
$this->getDocument()->fillField('Password', $password);
|
||||
$this->getDocument()->fillField('Username', $userName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ interface LoginPageInterface extends SymfonyPageInterface
|
|||
|
||||
public function logIn();
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
*/
|
||||
public function specifyEmail($email);
|
||||
|
||||
/**
|
||||
* @param string $password
|
||||
*/
|
||||
public function specifyPassword($password);
|
||||
|
||||
/**
|
||||
* @param string $userName
|
||||
*/
|
||||
public function specifyUserName($userName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ use Sylius\Behat\Page\SymfonyPage;
|
|||
*/
|
||||
class RegisterPage extends SymfonyPage implements RegisterPageInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
|
|
@ -27,12 +26,12 @@ class RegisterPage extends SymfonyPage implements RegisterPageInterface
|
|||
*/
|
||||
public function checkValidationMessageFor($element, $message)
|
||||
{
|
||||
$foundedElement = $this->getFieldElement($element);
|
||||
if (null === $foundedElement) {
|
||||
$foundElement = $this->getFieldElement($element);
|
||||
if (null === $foundElement) {
|
||||
throw new ElementNotFoundException($this->getSession(), 'Validation message', 'css', '.form-error');
|
||||
}
|
||||
|
||||
return $message === $foundedElement->find('css', '.form-error')->getText();
|
||||
return $message === $foundElement->find('css', '.form-error')->getText();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -40,7 +39,7 @@ class RegisterPage extends SymfonyPage implements RegisterPageInterface
|
|||
*/
|
||||
public function getRouteName()
|
||||
{
|
||||
return 'sylius_shop_account_registration';
|
||||
return 'sylius_shop_registration';
|
||||
}
|
||||
|
||||
public function register()
|
||||
|
|
|
|||
|
|
@ -21,16 +21,26 @@ class HomePage extends SymfonyPage implements HomePageInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContents()
|
||||
public function getRouteName()
|
||||
{
|
||||
return $this->getDocument()->getContent();
|
||||
return 'sylius_shop_homepage';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRouteName()
|
||||
public function hasLogoutButton()
|
||||
{
|
||||
return 'sylius_homepage';
|
||||
return $this->getElement('right_menu')->hasLink('Logout');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getDefinedElements()
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(),[
|
||||
'right_menu' => '.right.item',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@
|
|||
|
||||
namespace Sylius\Behat\Page\Shop;
|
||||
|
||||
use Sylius\Behat\Page\PageInterface;
|
||||
use Sylius\Behat\Page\SymfonyPageInterface;
|
||||
|
||||
/**
|
||||
* @author Łukasz Chruściel <lukasz.chrusciel@lakion.com>
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
*/
|
||||
interface HomePageInterface extends PageInterface
|
||||
interface HomePageInterface extends SymfonyPageInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
* @return bool
|
||||
*/
|
||||
public function getContents();
|
||||
public function hasLogoutButton();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,31 +16,21 @@ use Sylius\Behat\Page\SymfonyPage;
|
|||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
*/
|
||||
class ShopHomePage extends SymfonyPage implements ShopHomePageInterface
|
||||
class LegacyHomePage extends SymfonyPage implements LegacyHomePageInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContents()
|
||||
{
|
||||
return $this->getDocument()->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRouteName()
|
||||
{
|
||||
return 'sylius_shop_homepage';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasLogoutButton()
|
||||
{
|
||||
return $this->getElement('right_menu')->hasLink('Logout');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getDefinedElements()
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(),[
|
||||
'right_menu' => '.right.item',
|
||||
]);
|
||||
return 'sylius_homepage';
|
||||
}
|
||||
}
|
||||
|
|
@ -11,15 +11,15 @@
|
|||
|
||||
namespace Sylius\Behat\Page\Shop;
|
||||
|
||||
use Sylius\Behat\Page\SymfonyPageInterface;
|
||||
use Sylius\Behat\Page\PageInterface;
|
||||
|
||||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
* @author Łukasz Chruściel <lukasz.chrusciel@lakion.com>
|
||||
*/
|
||||
interface ShopHomePageInterface extends SymfonyPageInterface
|
||||
interface LegacyHomePageInterface extends PageInterface
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
* @return string
|
||||
*/
|
||||
public function hasLogoutButton();
|
||||
public function getContents();
|
||||
}
|
||||
|
|
@ -41,7 +41,9 @@
|
|||
|
||||
<parameter key="sylius.behat.context.ui.shop.account.class">Sylius\Behat\Context\Ui\Shop\AccountContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.shop.cart.class">Sylius\Behat\Context\Ui\Shop\CartContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.shop.login.class">Sylius\Behat\Context\Ui\Shop\LoginContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.shop.product.class">Sylius\Behat\Context\Ui\Shop\ProductContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.shop.registration.class">Sylius\Behat\Context\Ui\Shop\RegistrationContext</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
|
|
@ -198,7 +200,7 @@
|
|||
<argument type="service" id="sylius.behat.channel_context_setter" />
|
||||
<argument type="service" id="sylius.repository.channel" container="symfony"/>
|
||||
<argument type="service" id="sylius.behat.page.admin.channel.create" />
|
||||
<argument type="service" id="sylius.behat.page.shop.home" />
|
||||
<argument type="service" id="sylius.behat.page.shop.legacy_home" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
|
|
@ -235,7 +237,7 @@
|
|||
<argument type="service" id="sylius.behat.shared_storage" container="symfony"/>
|
||||
<argument type="service" id="sylius.behat.page.admin.channel.index" />
|
||||
<argument type="service" id="sylius.behat.page.admin.channel.update" />
|
||||
<argument type="service" id="sylius.behat.page.shop.home" />
|
||||
<argument type="service" id="sylius.behat.page.shop.legacy_home" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
|
|
@ -243,19 +245,15 @@
|
|||
<argument type="service" id="sylius.behat.shared_storage" container="symfony" />
|
||||
<argument type="service" id="sylius.repository.user" container="symfony" />
|
||||
<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.user.register" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.behat.context.ui.shop.account" class="%sylius.behat.context.ui.shop.account.class%" scope="scenario">
|
||||
<argument type="service" id="sylius.behat.shared_storage" container="symfony" />
|
||||
<argument type="service" id="sylius.behat.current_page_resolver" />
|
||||
<argument type="service" id="sylius.behat.notification_checker" />
|
||||
<argument type="service" id="sylius.behat.page.shop.account.dashboard" />
|
||||
<argument type="service" id="sylius.behat.page.shop.account.profile_update" />
|
||||
<argument type="service" id="sylius.behat.page.shop.account.login" />
|
||||
<argument type="service" id="sylius.behat.page.shop.account.register" />
|
||||
<argument type="service" id="sylius.behat.page.shop.shop_home" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
|
|
@ -267,9 +265,25 @@
|
|||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.behat.context.ui.shop.login" class="%sylius.behat.context.ui.shop.login.class%" scope="scenario">
|
||||
<argument type="service" id="sylius.behat.page.shop.account.login" />
|
||||
<argument type="service" id="sylius.behat.page.shop.home" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.behat.context.ui.shop.product" class="%sylius.behat.context.ui.shop.product.class%" scope="scenario">
|
||||
<argument type="service" id="sylius.behat.page.shop.product.show" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.behat.context.ui.shop.registration" class="%sylius.behat.context.ui.shop.registration.class%" scope="scenario">
|
||||
<argument type="service" id="sylius.behat.current_page_resolver" />
|
||||
<argument type="service" id="sylius.behat.page.shop.account.dashboard" />
|
||||
<argument type="service" id="sylius.behat.page.shop.home" />
|
||||
<argument type="service" id="sylius.behat.notification_checker" />
|
||||
<argument type="service" id="sylius.behat.page.shop.account.register" />
|
||||
<argument type="service" id="sylius.behat.shared_storage" container="symfony" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
||||
|
|
|
|||
|
|
@ -19,20 +19,20 @@
|
|||
</imports>
|
||||
|
||||
<parameters>
|
||||
<parameter key="sylius.behat.page.shop.home.class">Sylius\Behat\Page\Shop\HomePage</parameter>
|
||||
<parameter key="sylius.behat.page.shop.cart_summary.class">Sylius\Behat\Page\Shop\Cart\SummaryPage</parameter>
|
||||
<parameter key="sylius.behat.page.shop.home.class">Sylius\Behat\Page\Shop\HomePage</parameter>
|
||||
<parameter key="sylius.behat.page.shop.legacy_home.class">Sylius\Behat\Page\Shop\LegacyHomePage</parameter>
|
||||
<parameter key="sylius.behat.page.shop.product.show.class">Sylius\Behat\Page\Shop\Product\ShowPage</parameter>
|
||||
<parameter key="sylius.behat.page.shop.order.order_payments.class">Sylius\Behat\Page\Shop\Order\OrderPaymentsPage</parameter>
|
||||
<parameter key="sylius.behat.page.shop.shop_home.class">Sylius\Behat\Page\Shop\ShopHomePage</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="sylius.behat.page.shop.home" class="%sylius.behat.page.shop.home.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false" />
|
||||
<service id="sylius.behat.page.shop.cart_summary" class="%sylius.behat.page.shop.cart_summary.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false" />
|
||||
<service id="sylius.behat.page.shop.home" class="%sylius.behat.page.shop.home.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false" />
|
||||
<service id="sylius.behat.page.shop.legacy_home" class="%sylius.behat.page.shop.legacy_home.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false" />
|
||||
<service id="sylius.behat.page.shop.product.show" class="%sylius.behat.page.shop.product.show.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false" />
|
||||
<service id="sylius.behat.page.shop.order.order_payments" class="%sylius.behat.page.shop.order.order_payments.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false">
|
||||
<argument type="service" id="sylius.behat.table_accessor" />
|
||||
</service>
|
||||
<service id="sylius.behat.page.shop.shop_home" class="%sylius.behat.page.shop.shop_home.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false" />
|
||||
</services>
|
||||
</container>
|
||||
|
|
|
|||
|
|
@ -13,12 +13,10 @@
|
|||
|
||||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<parameters>
|
||||
<parameter key="sylius.behat.page.shop.user.login.class">Sylius\Behat\Page\Shop\User\LoginPage</parameter>
|
||||
<parameter key="sylius.behat.page.shop.user.register.class">Sylius\Behat\Page\Shop\User\RegisterPage</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="sylius.behat.page.shop.user.login" class="%sylius.behat.page.shop.user.login.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false" />
|
||||
<service id="sylius.behat.page.shop.user.register" class="%sylius.behat.page.shop.user.register.class%" parent="sylius.behat.symfony_page" scope="scenario" public="false" />
|
||||
</services>
|
||||
</container>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ imports:
|
|||
- suites/legacy/user.yml
|
||||
|
||||
- suites/ui/account/customer.yml
|
||||
- suites/ui/account/login.yml
|
||||
- suites/ui/account/registration.yml
|
||||
- suites/ui/addressing/managing_countries.yml
|
||||
- suites/ui/addressing/managing_zones.yml
|
||||
- suites/ui/cart/shopping_cart.yml
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ default:
|
|||
- sylius.behat.context.transform.shared_storage
|
||||
|
||||
- sylius.behat.context.setup.channel
|
||||
- sylius.behat.context.setup.customer
|
||||
- sylius.behat.context.setup.security
|
||||
- sylius.behat.context.setup.user
|
||||
|
||||
- sylius.behat.context.ui.shop.account
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
default:
|
||||
suites:
|
||||
ui_customer_login:
|
||||
contexts_as_services:
|
||||
- sylius.behat.context.hook.doctrine_orm
|
||||
|
||||
- sylius.behat.context.setup.channel
|
||||
- sylius.behat.context.setup.user
|
||||
|
||||
- sylius.behat.context.ui.shop.login
|
||||
filters:
|
||||
tags: "@customer_login && @ui"
|
||||
|
|
@ -3,15 +3,19 @@
|
|||
|
||||
default:
|
||||
suites:
|
||||
ui_customer_account:
|
||||
ui_customer_registration:
|
||||
contexts_as_services:
|
||||
- sylius.behat.context.hook.doctrine_orm
|
||||
|
||||
- sylius.behat.context.transform.shared_storage
|
||||
- sylius.behat.context.transform.customer
|
||||
|
||||
- sylius.behat.context.setup.channel
|
||||
- sylius.behat.context.setup.customer
|
||||
- sylius.behat.context.setup.order
|
||||
- sylius.behat.context.setup.security
|
||||
- sylius.behat.context.setup.user
|
||||
|
||||
- sylius.behat.context.ui.shop.account
|
||||
- sylius.behat.context.ui.shop.registration
|
||||
filters:
|
||||
tags: "@customer_account && @ui"
|
||||
tags: "@customer_registration && @ui"
|
||||
|
|
@ -21,17 +21,3 @@ sylius_shop_account_profile_update:
|
|||
method: find
|
||||
arguments: [expr:service('sylius.context.customer').getCustomer().getId()]
|
||||
redirect: sylius_shop_account_dashboard
|
||||
|
||||
sylius_shop_account_registration:
|
||||
path: /register
|
||||
methods: [GET, POST]
|
||||
defaults:
|
||||
_controller: sylius.controller.customer:createAction
|
||||
_sylius:
|
||||
form: sylius_customer_registration
|
||||
event: register
|
||||
template: SyliusShopBundle:Account:register.html.twig
|
||||
permission: false
|
||||
redirect:
|
||||
route: sylius_shop_homepage
|
||||
parameters: { email: resource.email }
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ sylius_shop_login:
|
|||
path: /login
|
||||
methods: [GET]
|
||||
defaults:
|
||||
_controller: sylius.controller.user_security:loginAction
|
||||
_controller: sylius.controller.security:loginAction
|
||||
_sylius:
|
||||
template: SyliusShopBundle:Account:login.html.twig
|
||||
|
||||
|
|
@ -17,6 +17,16 @@ sylius_shop_login_check:
|
|||
sylius_shop_logout:
|
||||
path: /logout
|
||||
|
||||
sylius_shop_password_resetting:
|
||||
resource: @SyliusUserBundle/Resources/config/routing/password_reset.yml
|
||||
prefix: /resetting
|
||||
sylius_shop_registration:
|
||||
path: /register
|
||||
methods: [GET, POST]
|
||||
defaults:
|
||||
_controller: sylius.controller.customer:createAction
|
||||
_sylius:
|
||||
form: sylius_customer_registration
|
||||
event: register
|
||||
template: SyliusShopBundle:Account:register.html.twig
|
||||
permission: false
|
||||
redirect:
|
||||
route: sylius_shop_homepage
|
||||
parameters: { email: resource.email }
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="ui column stackable center page grid">
|
||||
{% if error %}
|
||||
{{ messages.error(error.messageKey|trans(error.messageData, 'security')) }}
|
||||
{% if last_error %}
|
||||
{{ messages.error(last_error.messageKey|trans(last_error.messageData, 'security')) }}
|
||||
{% endif %}
|
||||
<div class="five wide column"></div>
|
||||
<form class="ui six wide column form segment" action="{{ path('sylius_shop_login_check') }}" method="post" novalidate>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
{% block content %}
|
||||
<div class="ui column stackable center page grid">
|
||||
<div class="five wide column"></div>
|
||||
<form class="ui six wide column form segment" action="{{ path('sylius_shop_account_registration') }}" method="post" novalidate>
|
||||
<form class="ui six wide column form segment" action="{{ path('sylius_shop_registration') }}" method="post" novalidate>
|
||||
{{ form_errors(form) }}
|
||||
<div class="field">
|
||||
{{ form_row(form.firstName) }}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@
|
|||
<a class="ui inverted button" href="{{ path('sylius_shop_logout') }}">{{ 'sylius.ui.logout'|trans }}</a>
|
||||
{% else %}
|
||||
<a class="ui inverted button" href="{{ path('sylius_shop_login') }}">{{ 'sylius.ui.login'|trans }}</a>
|
||||
<a class="ui inverted button" href="{{ path('sylius_shop_registration') }}">{{ 'sylius.ui.register'|trans }}</a>
|
||||
{% endif %}
|
||||
<a class="ui inverted button">{{ 'sylius.ui.register'|trans }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ class Configuration implements ConfigurationInterface
|
|||
->end()
|
||||
->arrayNode('registration')
|
||||
->prototype('scalar')->end()
|
||||
->defaultValue(['sylius'])
|
||||
->defaultValue(['sylius', 'sylius_user_registration'])
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ class CustomerSimpleRegistrationType extends AbstractResourceType
|
|||
])
|
||||
->add('user', 'sylius_user_registration', [
|
||||
'label' => false,
|
||||
'validation_groups' => $this->validationGroups,
|
||||
'cascade_validation' => true,
|
||||
])
|
||||
->addEventSubscriber(new CustomerRegistrationFormSubscriber($this->customerRepository))
|
||||
->addEventSubscriber(new UserRegistrationFormSubscriber())
|
||||
|
|
|
|||
|
|
@ -35,18 +35,6 @@ class UserRegistrationType extends AbstractResourceType
|
|||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => $this->dataClass,
|
||||
'validation_groups' => $this->validationGroups,
|
||||
'cascade_validation' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@
|
|||
"Please choose your gender."
|
||||
]
|
||||
},
|
||||
"groups": {},
|
||||
"phoneNumber": {},
|
||||
"groups": {},
|
||||
"user": {
|
||||
"children": {
|
||||
"plainPassword": {
|
||||
"errors": [
|
||||
"This value should not be blank."
|
||||
"Please enter your password."
|
||||
]
|
||||
},
|
||||
"enabled": {},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue