This commit is contained in:
Tomanhez 2019-08-29 08:33:02 +02:00
parent a1ff8f0b87
commit 8ee775dabe
No known key found for this signature in database
GPG key ID: 65B2A748D181CFB8
9 changed files with 41 additions and 32 deletions

View file

@ -1,8 +1,8 @@
@checkout
Feature: After completing checkout being able to go on order in my account
In order to managing my new order easily
Feature: Accessing order right after completing checkout
In order to check my order right after I have placed it
As a Customer
I want to being able to go on order in my account after completing checkout
I want to access this order from the thank you page
Background:
Given the store operates on a single channel in "United States"
@ -13,8 +13,8 @@ Feature: After completing checkout being able to go on order in my account
And I am logged in as "john@example.com"
@ui
Scenario: Being able to go on order in my account after completing checkout
Scenario: Being able to access my order right after completing checkout
Given I added product "PHP T-Shirt" to the cart
And I have proceeded selecting "Cash on delivery" payment method
When I have confirmed order
Then I should be able to go to order details in my account
When I confirm my order
Then I should be able to access this order's details

View file

@ -1,7 +1,7 @@
@paying_for_order
Feature: Having good number of items in changing payment method page
In order to verify that I am changing the payment method of correct order
As a Customer
As a Guest
I want to see correct details about my order on changing the payment method page
Background:
@ -17,5 +17,5 @@ Feature: Having good number of items in changing payment method page
And I complete addressing step with email "john@example.com" and "United States" based shipping address
And I have proceeded selecting "Cash on delivery" payment method
And I have confirmed order
When I go to order details
When I go to the change payment method page
Then I should see 2 as number of items

View file

@ -17,7 +17,7 @@ Feature: Changing the method after order confirmation
And I complete addressing step with email "john@example.com" and "United States" based shipping address
And I have proceeded selecting "Cash on delivery" payment method
And I have confirmed order
When I go to order details
When I go to the change payment method page
And I try to pay with "Offline" payment method
Then I should see the thank you page
@ -29,6 +29,6 @@ Feature: Changing the method after order confirmation
And I complete addressing step with email "john@example.com" and "United States" based shipping address
And I have proceeded selecting "Cash on delivery" payment method
And I have confirmed order
When I go to order details
When I go to the change payment method page
And I try to pay with "Offline" payment method
Then I should see the thank you page

View file

@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Sylius\Behat\Context\Ui\Shop\Checkout;
use Behat\Behat\Context\Context;
use Sylius\Behat\Page\Shop\Account\Order\ShowPageInterface;
use Sylius\Behat\Page\Shop\Order\ThankYouPageInterface;
use Sylius\Component\Core\Model\PaymentMethodInterface;
use Webmozart\Assert\Assert;
@ -23,17 +24,21 @@ final class CheckoutThankYouContext implements Context
/** @var ThankYouPageInterface */
private $thankYouPage;
public function __construct(ThankYouPageInterface $thankYouPage)
/** @var ShowPageInterface */
private $orderShowPage;
public function __construct(ThankYouPageInterface $thankYouPage, ShowPageInterface $orderShowPage)
{
$this->thankYouPage = $thankYouPage;
$this->orderShowPage = $orderShowPage;
}
/**
* @When I go to order details
* @When I go to the change payment method page
*/
public function iGoToOrderDetails()
public function iGoToTheChangePaymentMethodPage(): void
{
$this->thankYouPage->goToOrderDetails();
$this->thankYouPage->goToTheChangePaymentMethodPage();
}
/**
@ -45,11 +50,15 @@ final class CheckoutThankYouContext implements Context
}
/**
* @Then I should be able to go to order details in my account
* @Then /^I should be able to access this order's details$/
*/
public function iShouldBeAbleToGoToOrderDetailsInMyAccount(): void
public function iShouldBeAbleToAccessThisOrderDetails(): void
{
$this->thankYouPage->goToOrderDetailsInMyAccount();
$this->thankYouPage->goToOrderDetailsInAccount();
$number = $this->orderShowPage->getNumber();
Assert::true($number !== null ? true : false);
}
/**

View file

@ -20,14 +20,14 @@ class ThankYouPage extends SymfonyPage implements ThankYouPageInterface
/**
* {@inheritdoc}
*/
public function goToOrderDetails()
public function goToTheChangePaymentMethodPage(): void
{
$this->getElement('order_details')->click();
$this->getElement('payment_method_page')->click();
}
public function goToOrderDetailsInMyAccount(): void
public function goToOrderDetailsInAccount(): void
{
$this->getElement('order_details_in_my_account')->click();
$this->getElement('order_details_in_account')->click();
}
/**
@ -61,7 +61,7 @@ class ThankYouPage extends SymfonyPage implements ThankYouPageInterface
*/
public function hasChangePaymentMethodButton()
{
return null !== $this->getDocument()->find('css', '#sylius-show-order');
return null !== $this->getDocument()->find('css', '#payment-method-page');
}
public function hasRegistrationButton(): bool
@ -82,8 +82,8 @@ class ThankYouPage extends SymfonyPage implements ThankYouPageInterface
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
'order_details' => '#sylius-show-order',
'order_details_in_my_account' => '#sylius-show-order-in-account',
'payment_method_page' => '#payment-method-page',
'order_details_in_account' => '#sylius-show-order-in-account',
'instructions' => '#sylius-payment-method-instructions',
'thank_you' => '#sylius-thank-you',
]);

View file

@ -17,9 +17,9 @@ use FriendsOfBehat\PageObjectExtension\Page\SymfonyPageInterface;
interface ThankYouPageInterface extends SymfonyPageInterface
{
public function goToOrderDetails();
public function goToTheChangePaymentMethodPage(): void;
public function goToOrderDetailsInMyAccount(): void;
public function goToOrderDetailsInAccount(): void;
/**
* @return bool

View file

@ -310,6 +310,7 @@
<service id="sylius.behat.context.ui.shop.checkout.thank_you" class="Sylius\Behat\Context\Ui\Shop\Checkout\CheckoutThankYouContext">
<argument type="service" id="sylius.behat.page.shop.order.thank_you" />
<argument type="service" id="sylius.behat.page.shop.account.order.show"></argument>
</service>
<service id="sylius.behat.context.ui.shop.checkout.order_details" class="Sylius\Behat\Context\Ui\Shop\Checkout\CheckoutOrderDetailsContext">

View file

@ -22,13 +22,12 @@
</div>
{% endif %}
<div class="ui hidden divider"></div>
{% if order.customer.user is not null %}
<a href="{{ path('sylius_shop_account_order_show', {'number': order.number}) }}" id="sylius-show-order-in-account" class="ui large blue button">{{ 'sylius.ui.view_your_order'|trans }}</a>
{% endif %}
{% endif %}
{% if order.customer.user is null %}
<a href="{{ path('sylius_shop_order_show', {'tokenValue': order.tokenValue}) }}" id="sylius-show-order" class="ui large blue button">{{ 'sylius.ui.change_payment_method'|trans }}</a>
{% if order.customer.user is not null %}
<a href="{{ path('sylius_shop_account_order_show', {'number': order.number}) }}" id="sylius-show-order-in-account" class="ui large blue button">{{ 'sylius.ui.view_order'|trans }}</a>
{% else %}
<a href="{{ path('sylius_shop_order_show', {'tokenValue': order.tokenValue}) }}" id="payment-method-page" class="ui large blue button">{{ 'sylius.ui.change_payment_method'|trans }}</a>
<a href="{{ path('sylius_shop_register_after_checkout', {'tokenValue': order.tokenValue}) }}" class="ui large green button">
<i class="signup icon"></i>
{{ 'sylius.ui.create_an_account'|trans }}

View file

@ -901,8 +901,8 @@ sylius:
view: 'View'
view_and_edit_cart: 'View and edit cart'
view_more: 'View more'
view_order: 'View order'
view_product_details: 'View %product% details'
view_your_order: 'View order'
view_your_order_or_change_payment_method: 'View order or change payment method'
view_your_store: 'View your store'
void: 'Void'