diff --git a/dev/tests/functional/credentials.xml.dist b/dev/tests/functional/credentials.xml.dist index 1cf5152577e622b57382398145b6f0297474eccf..6c23762bae421481ed4608fd8381846539a82e8e 100644 --- a/dev/tests/functional/credentials.xml.dist +++ b/dev/tests/functional/credentials.xml.dist @@ -24,4 +24,18 @@ <field path="section/carriers_usps_userid/value" value="" /> <field path="section/carriers_usps_password/value" value="" /> + + <field path="section/payment_authorizenet_login/value" value="" /> + <field path="section/payment_authorizenet_trans_key/value" value="" /> + + <field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_business_account/value" value="" /> + <field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_api_username/value" value="" /> + <field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_api_password/value" value="" /> + <field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_api_signature/value" value="" /> + + <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_business_account/value" value="" /> + <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_partner/value" value="" /> + <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_user/value" value="" /> + <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_pwd/value" value="" /> + <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_vendor/value" value="" /> </replace> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Methods.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Methods.php index 7ce79345368e4c9fe3bc1d868c039b438ffd989e..7cdc31001f7b279543e6cdcc6dc54a2acda20d37 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Methods.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Methods.php @@ -7,6 +7,7 @@ namespace Magento\Checkout\Test\Block\Onepage\Payment; use Magento\Mtf\Block\Form; +use Magento\Payment\Test\Fixture\CreditCard; /** * Class Methods @@ -61,10 +62,11 @@ class Methods extends Form * Select payment method * * @param array $payment + * @param CreditCard|null $creditCard * @throws \Exception * @return void */ - public function selectPaymentMethod(array $payment) + public function selectPaymentMethod(array $payment, CreditCard $creditCard = null) { $paymentSelector = $this->_rootElement->find(sprintf($this->paymentMethodInput, $payment['method'])); if ($paymentSelector->isVisible()) { @@ -79,14 +81,13 @@ class Methods extends Form if ($payment['method'] == "purchaseorder") { $this->_rootElement->find($this->purchaseOrderNumber)->setValue($payment['po_number']); } - if (isset($payment['dataConfig']['payment_form_class'])) { - $paymentFormClass = $payment['dataConfig']['payment_form_class']; + if ($creditCard !== null) { /** @var \Magento\Payment\Test\Block\Form\Cc $formBlock */ $formBlock = $this->blockFactory->create( - $paymentFormClass, + '\\Magento\\Payment\\Test\\Block\\Form\\Cc', ['element' => $this->_rootElement->find('#payment_form_' . $payment['method'])] ); - $formBlock->fill($payment['credit_card']); + $formBlock->fill($creditCard); } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/EstimateShippingAndTaxStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/EstimateShippingAndTaxStep.php index f5ed8edc86072e82fbb3f3cf68de64c894e959a4..9813b554032d126da7ec78f111d92c6c6fca7918 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/EstimateShippingAndTaxStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/EstimateShippingAndTaxStep.php @@ -75,27 +75,27 @@ class EstimateShippingAndTaxStep implements TestStepInterface * @param CheckoutCart $checkoutCart * @param Address $address * @param AssertEstimateShippingAndTax $assertEstimateShippingAndTax - * @param Cart $cart * @param FixtureFactory $fixtureFactory - * @param array $shipping * @param array $products + * @param array $shipping + * @param Cart|null $cart */ public function __construct( CheckoutCart $checkoutCart, Address $address, AssertEstimateShippingAndTax $assertEstimateShippingAndTax, - Cart $cart, FixtureFactory $fixtureFactory, - array $shipping, - array $products + array $products, + array $shipping = [], + Cart $cart = null ) { $this->checkoutCart = $checkoutCart; $this->address = $address; $this->assertEstimateShippingAndTax = $assertEstimateShippingAndTax; - $this->cart = $cart; $this->fixtureFactory = $fixtureFactory; - $this->shipping = $shipping; $this->products = $products; + $this->shipping = $shipping; + $this->cart = $cart; } /** @@ -106,16 +106,16 @@ class EstimateShippingAndTaxStep implements TestStepInterface public function run() { $this->checkoutCart->open(); - $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($this->address); - if ($this->shipping['shipping_service'] !== '-') { - $this->checkoutCart->getShippingBlock()->selectShippingMethod($this->shipping); - } /** @var \Magento\Checkout\Test\Fixture\Cart $cart */ - if (!empty($this->cart->hasData())) { + if ($this->cart !== null) { $cart = $this->fixtureFactory->createByCode( 'cart', ['data' => array_merge($this->cart->getData(), ['items' => ['products' => $this->products]])] ); + $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($this->address); + if (!empty($this->shipping)) { + $this->checkoutCart->getShippingBlock()->selectShippingMethod($this->shipping); + } $this->assertEstimateShippingAndTax->processAssert($this->checkoutCart, $cart); } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php index df510f1e2e80cee8c1e4efd7f77f42089fc1486c..04580bf1037d0c8a7d8b9c8a1f50499aa494a819 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php @@ -34,7 +34,7 @@ class FillShippingMethodStep implements TestStepInterface * @param CheckoutOnepage $checkoutOnepage * @param array $shipping */ - public function __construct(CheckoutOnepage $checkoutOnepage, array $shipping) + public function __construct(CheckoutOnepage $checkoutOnepage, array $shipping = []) { $this->checkoutOnepage = $checkoutOnepage; $this->shipping = $shipping; @@ -47,7 +47,7 @@ class FillShippingMethodStep implements TestStepInterface */ public function run() { - if ($this->shipping['shipping_service'] !== '-') { + if (!empty($this->shipping)) { $this->checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($this->shipping); $this->checkoutOnepage->getShippingMethodBlock()->clickContinue(); } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php index f17bc063c16bf56c06b74c663f7620888b6720f1..3a65736abdbdc51de26c1aadd85576290397db52 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php @@ -8,6 +8,7 @@ namespace Magento\Checkout\Test\TestStep; use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Mtf\TestStep\TestStepInterface; +use Magento\Payment\Test\Fixture\CreditCard; /** * Class SelectPaymentMethodStep @@ -29,15 +30,27 @@ class SelectPaymentMethodStep implements TestStepInterface */ protected $payment; + /** + * Credit card information + * + * @var string + */ + protected $creditCard; + /** * @constructor * @param CheckoutOnepage $checkoutOnepage * @param array $payment + * @param CreditCard|null $creditCard */ - public function __construct(CheckoutOnepage $checkoutOnepage, array $payment) - { + public function __construct( + CheckoutOnepage $checkoutOnepage, + array $payment, + CreditCard $creditCard = null + ) { $this->checkoutOnepage = $checkoutOnepage; $this->payment = $payment; + $this->creditCard = $creditCard; } /** @@ -48,7 +61,7 @@ class SelectPaymentMethodStep implements TestStepInterface public function run() { if ($this->payment['method'] !== 'free') { - $this->checkoutOnepage->getPaymentMethodsBlock()->selectPaymentMethod($this->payment); + $this->checkoutOnepage->getPaymentMethodsBlock()->selectPaymentMethod($this->payment, $this->creditCard); } $this->checkoutOnepage->getPaymentMethodsBlock()->clickContinue(); } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/testcase.xml index cd33ec8255c05903ea68fe2f1e96c75cac14442c..fb527bf92455a5161ab0cb66ec23c15271a140f2 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/testcase.xml @@ -6,18 +6,18 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> - <scenario name="OnePageCheckoutTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"/> - <step name="createProducts" module="Magento_Catalog" next="createTaxRule"/> - <step name="createTaxRule" module="Magento_Tax" next="addProductsToTheCart"/> - <step name="addProductsToTheCart" module="Magento_Checkout" next="estimateShippingAndTax"/> - <step name="estimateShippingAndTax" module="Magento_Checkout" next="proceedToCheckout"/> - <step name="proceedToCheckout" module="Magento_Checkout" next="selectCheckoutMethod"/> - <step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod"/> - <step name="selectCheckoutMethod" module="Magento_Checkout" next="fillBillingInformation"/> - <step name="fillBillingInformation" module="Magento_Checkout" next="fillShippingMethod"/> - <step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod"/> - <step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrder"/> - <step name="placeOrder" module="Magento_Checkout"/> - </scenario> + <scenario name="OnePageCheckoutTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createProducts"/> + <step name="createProducts" module="Magento_Catalog" next="createTaxRule"/> + <step name="createTaxRule" module="Magento_Tax" next="addProductsToTheCart"/> + <step name="addProductsToTheCart" module="Magento_Checkout" next="estimateShippingAndTax"/> + <step name="estimateShippingAndTax" module="Magento_Checkout" next="proceedToCheckout"/> + <step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer"/> + <step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod"/> + <step name="selectCheckoutMethod" module="Magento_Checkout" next="fillBillingInformation"/> + <step name="fillBillingInformation" module="Magento_Checkout" next="fillShippingMethod"/> + <step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod"/> + <step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrder"/> + <step name="placeOrder" module="Magento_Checkout"/> + </scenario> </config> diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/Curl.php b/dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/Curl.php index 74ddaf0431e629551a7772de35b2127f741d1aed..25be5b6e1ff02b819dc98d9fa7cc7467ce135eae 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/Curl.php @@ -20,7 +20,7 @@ use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; class Curl extends AbstractCurl implements ConfigDataInterface { /** - * Mapping values for data + * Mapping values for data. * * @var array */ @@ -33,7 +33,7 @@ class Curl extends AbstractCurl implements ConfigDataInterface ]; /** - * Post request for setting configuration + * Post request for setting configuration. * * @param FixtureInterface|null $fixture [optional] * @return void @@ -47,29 +47,60 @@ class Curl extends AbstractCurl implements ConfigDataInterface } /** - * Prepare POST data for setting configuration + * Prepare POST data for setting configuration. * * @param FixtureInterface $fixture * @return array */ protected function prepareData(FixtureInterface $fixture) { + $configPath = []; $result = []; $fields = $fixture->getData(); if (isset($fields['section'])) { foreach ($fields['section'] as $itemSection) { - list($scope, $group, $field) = explode('/', $itemSection['path']); - $value = isset($this->mappingData[$field]) - ? $this->mappingData[$field][$itemSection['value']] - : $itemSection['value']; - $result[$scope]['groups'][$group]['fields'][$field]['value'] = $value; + parse_str($this->prepareConfigPath($itemSection), $configPath); + $result = array_merge_recursive($result, $configPath); } } return $result; } /** - * Apply config settings via curl + * Prepare config path. + * + * From payment/cashondelivery/active to ['payment']['groups']['cashondelivery']['fields']['active'] + * + * @param array $input + * @return string + */ + protected function prepareConfigPath(array $input) + { + $resultArray = ''; + $path = explode('/', $input['path']); + foreach ($path as $position => $subPath) { + if ($position === 0) { + $resultArray.= $subPath; + continue; + } elseif ($position === (count($path) - 1)) { + $resultArray.= '[fields]'; + } else { + $resultArray.= '[groups]'; + } + $resultArray.= '[' . $subPath .']'; + } + $resultArray.= '[value]'; + if (is_array($input['value'])) { + $resultArray.= '[' . key($input['value']) . ']'; + $resultArray.= '=' . current($input['value']); + } else { + $resultArray.= '=' . $input['value']; + } + return $resultArray; + } + + /** + * Apply config settings via curl. * * @param array $data * @param string $section @@ -90,7 +121,7 @@ class Curl extends AbstractCurl implements ConfigDataInterface } /** - * Retrieve URL for request + * Retrieve URL for request. * * @param string $section * @return string diff --git a/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml index a71f82990606e165f42b0396792364b71d09dcf6..0e2819446d17c536bc36b2f20dc6444b5f102429 100644 --- a/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml @@ -18,7 +18,9 @@ <dataset name="cashondelivery_specificcountry_gb"> <field path="payment/cashondelivery/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> <field path="payment/cashondelivery/allowspecific" scope="payment" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="payment/cashondelivery/specificcountry/active" scope="payment" scope_id="1" label="United Kingdom" xsi:type="string">GB</field> + <field path="payment/cashondelivery/specificcountry" scope="payment" scope_id="1" xsi:type="array"> + <item label="United Kingdom" xsi:type="string">GB</item> + </field> </dataset> <dataset name="cashondelivery_specificcountry_gb_rollback"> @@ -37,7 +39,9 @@ <dataset name="checkmo_specificcountry_gb"> <field path="payment/checkmo/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> <field path="payment/checkmo/allowspecific" scope="payment" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="payment/checkmo/specificcountry/active" scope="payment" scope_id="1" label="United Kingdom" xsi:type="string">GB</field> + <field path="payment/checkmo/specificcountry" scope="payment" scope_id="1" xsi:type="array"> + <item label="United Kingdom" xsi:type="string">GB</item> + </field> </dataset> <dataset name="checkmo_specificcountry_gb_rollback"> @@ -56,7 +60,9 @@ <dataset name="banktransfer_specificcountry_gb"> <field path="payment/banktransfer/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> <field path="payment/banktransfer/allowspecific" scope="payment" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="payment/banktransfer/specificcountry/active" scope="payment" scope_id="1" label="United Kingdom" xsi:type="string">GB</field> + <field path="payment/banktransfer/specificcountry" scope="payment" scope_id="1" xsi:type="array"> + <item label="United Kingdom" xsi:type="string">GB</item> + </field> </dataset> <dataset name="banktransfer_specificcountry_gb_rollback"> @@ -75,7 +81,9 @@ <dataset name="purchaseorder_specificcountry_gb"> <field path="payment/purchaseorder/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> <field path="payment/purchaseorder/allowspecific" scope="payment" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="payment/purchaseorder/specificcountry/active" scope="payment" scope_id="1" label="United Kingdom" xsi:type="string">GB</field> + <field path="payment/purchaseorder/specificcountry" scope="payment" scope_id="1" xsi:type="array"> + <item label="United Kingdom" xsi:type="string">GB</item> + </field> </dataset> <dataset name="purchaseorder_specificcountry_gb_rollback"> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php new file mode 100644 index 0000000000000000000000000000000000000000..1630e60c334d05e41de2d4e4f2b0aa5003330ceb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Constraint; + +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that comment about authorized amount exist in Comments History section on order page in backend. + */ +class AssertOrderCommentsHistory extends AbstractConstraint +{ + /** + * Message about authorized amount in order. + */ + const AUTHORIZED_AMOUNT = 'Authorized amount of $'; + + /** + * Assert that comment about authorized amount exist in Comments History section on order page in backend. + * + * @param SalesOrderView $salesOrderView + * @param OrderIndex $salesOrder + * @param string $orderId + * @param string $grandTotal + * @return void + */ + public function processAssert( + SalesOrderView $salesOrderView, + OrderIndex $salesOrder, + $orderId, + $grandTotal + ) { + $salesOrder->open(); + $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); + + $actualAuthorizedAmount = $salesOrderView->getOrderHistoryBlock()->getCommentsHistory(); + + \PHPUnit_Framework_Assert::assertContains( + self::AUTHORIZED_AMOUNT . $grandTotal, + $actualAuthorizedAmount, + 'Incorrect authorized amount value for the order #' . $orderId + ); + } + + /** + * Returns string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Message about authorized amount is available in Comments History section."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/di.xml index 2f6ce91b644c34aba335ba6da040ee3eab84d9c0..c7f026085fd80fb5d5595b0084d1ffd636aeca97 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/di.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/di.xml @@ -6,24 +6,29 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> - <type name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid"> - <arguments> - <argument name="severity" xsi:type="string">high</argument> - </arguments> - </type> - <type name="Magento\Sales\Test\Constraint\AssertOrderStatusDuplicateStatus"> - <arguments> - <argument name="severity" xsi:type="string">high</argument> - </arguments> - </type> - <type name="Magento\Sales\Test\Constraint\AssertOrderCancelSuccessMessage"> - <arguments> - <argument name="severity" xsi:type="string">high</argument> - </arguments> - </type> - <type name="Magento\Sales\Test\Constraint\AssertOrderMassOnHoldSuccessMessage"> - <arguments> - <argument name="severity" xsi:type="string">high</argument> - </arguments> - </type> + <type name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Sales\Test\Constraint\AssertOrderStatusDuplicateStatus"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Sales\Test\Constraint\AssertOrderCancelSuccessMessage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Sales\Test\Constraint\AssertOrderMassOnHoldSuccessMessage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Sales\Test\Constraint\AssertOrderCommentsHistory"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> </config>