From 4aa3ccfddf0b722ee3a448cd14a70a9449855863 Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko <iivashchenko@magento.com> Date: Mon, 14 Nov 2016 15:30:00 +0200 Subject: [PATCH] MAGETWO-60572: [GitHub] PayPal.js error on checkout downloadable product #7000 - static tests fix --- .../TestStep/PlaceOrderWithPaypalStep.php | 40 +------------------ .../Checkout/Test/Block/Onepage/Login.php | 3 +- .../TestStep/SelectCheckoutMethodStep.php | 16 +++++++- 3 files changed, 18 insertions(+), 41 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php index cae85fea49c..d61e2fff633 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php @@ -10,7 +10,6 @@ use Magento\Checkout\Test\Constraint\AssertBillingAddressAbsentInPayment; use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Checkout\Test\Page\CheckoutOnepageSuccess; use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\TestStep\TestStepInterface; /** @@ -53,39 +52,14 @@ class PlaceOrderWithPaypalStep implements TestStepInterface */ private $products; - /** - * Customer fixture. - * - * @var Customer - */ - protected $customer; - - /** - * Checkout method. - * - * @var string - */ - protected $checkoutMethod; - - /** - * Shipping carrier and method. - * - * @var array - */ - protected $shipping; - /** * @param CheckoutOnepage $checkoutOnepage * @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview * @param AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment * @param CheckoutOnepageSuccess $checkoutOnepageSuccess * @param FixtureFactory $fixtureFactory - * @param Customer $customer - * @param string $checkoutMethod * @param array $products * @param array $prices - * @param array $shipping - * */ public function __construct( CheckoutOnepage $checkoutOnepage, @@ -93,24 +67,16 @@ class PlaceOrderWithPaypalStep implements TestStepInterface AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment, CheckoutOnepageSuccess $checkoutOnepageSuccess, FixtureFactory $fixtureFactory, - Customer $customer = null, - $checkoutMethod, - array $products, - array $prices = [], - array $shipping = [] - + array $prices = [] ) { $this->checkoutOnepage = $checkoutOnepage; $this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview; $this->assertBillingAddressAbsentInPayment = $assertBillingAddressAbsentInPayment; $this->checkoutOnepageSuccess = $checkoutOnepageSuccess; $this->fixtureFactory = $fixtureFactory; - $this->customer = $customer; - $this->checkoutMethod = $checkoutMethod; $this->products = $products; $this->prices = $prices; - $this->shipping = $shipping; } /** @@ -124,10 +90,6 @@ class PlaceOrderWithPaypalStep implements TestStepInterface $this->assertBillingAddressAbsentInPayment->processAssert($this->checkoutOnepage); - if ($this->checkoutMethod === 'guest' && empty($this->shipping)) { - $this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer); - } - $parentWindow = $this->checkoutOnepage->getPaymentBlock() ->getSelectedPaymentMethodBlock() ->clickPayWithPaypal(); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php index fe1eda33758..49b900e4eed 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php @@ -99,7 +99,8 @@ class Login extends Form public function fillGuestFields(FixtureInterface $customer) { $mapping = $this->dataMapping(); - $this->_rootElement->find($mapping['email']['selector'], $mapping['email']['strategy'])->setValue($customer->getEmail()); + $this->_rootElement->find($mapping['email']['selector'], $mapping['email']['strategy']) + ->setValue($customer->getEmail()); } /** diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php index 444b98adb7f..eef5f2fbdd0 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php @@ -51,6 +51,13 @@ class SelectCheckoutMethodStep implements TestStepInterface */ private $clickProceedToCheckoutStep; + /** + * Shipping carrier and method. + * + * @var array + */ + protected $shipping; + /** * @constructor * @param CheckoutOnepage $checkoutOnepage @@ -58,19 +65,22 @@ class SelectCheckoutMethodStep implements TestStepInterface * @param LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend * @param ClickProceedToCheckoutStep $clickProceedToCheckoutStep * @param string $checkoutMethod + * @param array $shipping */ public function __construct( CheckoutOnepage $checkoutOnepage, Customer $customer, LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend, ClickProceedToCheckoutStep $clickProceedToCheckoutStep, - $checkoutMethod + $checkoutMethod, + array $shipping = [] ) { $this->checkoutOnepage = $checkoutOnepage; $this->customer = $customer; $this->logoutCustomerOnFrontend = $logoutCustomerOnFrontend; $this->clickProceedToCheckoutStep = $clickProceedToCheckoutStep; $this->checkoutMethod = $checkoutMethod; + $this->shipping = $shipping; } /** @@ -87,6 +97,10 @@ class SelectCheckoutMethodStep implements TestStepInterface } else { $this->checkoutOnepage->getLoginBlock()->loginCustomer($this->customer); } + } elseif ($this->checkoutMethod === 'guest') { + if (empty($this->shipping)) { + $this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer); + } } } -- GitLab