diff --git a/dev/tests/functional/composer.json b/dev/tests/functional/composer.json index e4a9bd10fa65832e7fdc4ae01f10578056b55a47..f170114a4ea8348714531af55ca805bb5e3442fe 100644 --- a/dev/tests/functional/composer.json +++ b/dev/tests/functional/composer.json @@ -1,6 +1,6 @@ { "require": { - "magento/mtf": "1.0.0-rc49", + "magento/mtf": "1.0.0-rc50", "php": "~5.6.5|7.0.2|~7.0.6", "phpunit/phpunit": "~4.8.0|~5.5.0", "phpunit/phpunit-selenium": ">=1.2" diff --git a/dev/tests/functional/credentials.xml.dist b/dev/tests/functional/credentials.xml.dist index 78186091a568ddba7368126c4b9217714e35d127..1061ca183f7f9e6ef4d4c1f740159423729e7c75 100644 --- a/dev/tests/functional/credentials.xml.dist +++ b/dev/tests/functional/credentials.xml.dist @@ -48,20 +48,32 @@ <field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_signature" value="" /> <field path="payment/paypal_express/merchant_id" value="" /> - <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/business_account" value="" /> - <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/partner" value="" /> - <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/user" value="" /> - <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/pwd" value="" /> - <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/vendor" value="" /> + <field replace="payflow_pro_fraud_protection_enabled_business_account" value="" /> + <field replace="payflow_pro_fraud_protection_enabled_partner" value="" /> + <field replace="payflow_pro_fraud_protection_enabled_user" value="" /> + <field replace="payflow_pro_fraud_protection_enabled_pwd" value="" /> + <field replace="payflow_pro_fraud_protection_enabled_vendor" value="" /> + + <field replace="payflow_pro_business_account" value="" /> + <field replace="payflow_pro_partner" value="" /> + <field replace="payflow_pro_user" value="" /> + <field replace="payflow_pro_pwd" value="" /> + <field replace="payflow_pro_vendor" value="" /> + + <field replace="payflow_link_business_account_email" value="" /> + <field replace="payflow_link_partner" value="" /> + <field replace="payflow_link_user" value="" /> + <field replace="payflow_link_password" value="" /> + <field replace="payflow_link_vendor" value="" /> + + <field path="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/business_account" value="" /> + <field path="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/api_username" value="" /> + <field path="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/api_password" value="" /> + <field path="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/api_signature" value="" /> <field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/business_account" value="" /> <field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_username" value="" /> <field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_password" value="" /> <field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_signature" value="" /> - <field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/business_account" value="" /> - <field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/partner" value="" /> - <field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/user" value="" /> - <field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/pwd" value="" /> - <field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/vendor" value="" /> </replace> diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/DatepickerElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/DatepickerElement.php index e09ca5647cf590831e10b47ce8f86e20ef670ef3..07ac39363119094f9da91ab2b3d4dda8aa5129c3 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/DatepickerElement.php +++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/DatepickerElement.php @@ -67,8 +67,8 @@ class DatepickerElement extends SimpleElement $date[1] = ltrim($date[1], '0'); $this->find($this->datePickerButton, Locator::SELECTOR_XPATH)->click(); $datapicker = $this->find($this->datePickerBlock, Locator::SELECTOR_XPATH); - $datapicker->find($this->datePickerMonth, Locator::SELECTOR_XPATH, 'select')->setValue($date[0]); $datapicker->find($this->datePickerYear, Locator::SELECTOR_XPATH, 'select')->setValue($date[2]); + $datapicker->find($this->datePickerMonth, Locator::SELECTOR_XPATH, 'select')->setValue($date[0]); $datapicker->find(sprintf($this->datePickerCalendar, $date[1]), Locator::SELECTOR_XPATH)->click(); if ($datapicker->isVisible()) { $datapicker->find($this->datePickerButtonClose, Locator::SELECTOR_XPATH)->click(); diff --git a/dev/tests/functional/lib/Magento/Mtf/Constraint/AbstractAssertForm.php b/dev/tests/functional/lib/Magento/Mtf/Constraint/AbstractAssertForm.php index ba1eca68a2436d1be756d82542ec412c95858e42..7114ec405ea28f4afd48537523ee9725e6058639 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Constraint/AbstractAssertForm.php +++ b/dev/tests/functional/lib/Magento/Mtf/Constraint/AbstractAssertForm.php @@ -118,8 +118,8 @@ abstract class AbstractAssertForm extends AbstractConstraint /** * Sort multidimensional array by paths. - * Pattern path: key/subKey::sorkKey. - * Exapmle: + * Pattern path: key/subKey::sortKey. + * Example: * $data = [ * 'custom_options' => [ * 'options' => [ diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.php b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.php deleted file mode 100644 index 7918859e53715c5215f772d988d91ac475a6150d..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Authorizenet\Test\Block\Form; - -use Magento\Payment\Test\Block\Form\Cc as CreditCard; - -/** - * Class Cc - * Form for filling credit card data for Authorize.Net payment method - */ -class Cc extends CreditCard -{ - // -} diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.xml deleted file mode 100755 index a7d2ae40b89c527f1d6bd5bcc1b55a9c0a8a4f03..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" ?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<mapping strict="0"> - <wrapper>payment</wrapper> - <fields> - <cc_number /> - <cc_exp_month> - <input>select</input> - </cc_exp_month> - <cc_exp_year> - <input>select</input> - </cc_exp_year> - <cc_cid /> - </fields> -</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Fixture/CreditCardAuthorizenet.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Fixture/CreditCardAuthorizenet.xml deleted file mode 100644 index 2777d09b4f16336c3b49a68fc6bdb1e47fe1d186..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Fixture/CreditCardAuthorizenet.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="credit_card_authorizenet" - module="Magento_Authorizenet" - type="virtual" - entity_type="credit_card_authorizenet" - repository_class="Magento\Authorizenet\Test\Repository\CreditCard" - class="Magento\Authorizenet\Test\Fixture\CreditCardAuthorizenet"> - <field name="cc_number" /> - <field name="cc_exp_month" /> - <field name="cc_exp_year" /> - <field name="cc_cid" /> - </fixture> -</config> diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml index d629bcba9e174251a1bc1e4c8fff6cc664911598..d25149f645f056d7f6e47e10706de3a0bc27e831 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml @@ -17,9 +17,8 @@ <data name="prices" xsi:type="array"> <item name="grandTotal" xsi:type="string">15.00</item> </data> - <data name="creditCardClass" xsi:type="string">credit_card_authorizenet</data> <data name="payment/method" xsi:type="string">authorizenet_directpost</data> - <data name="creditCard/dataset" xsi:type="string">visa_authorizenet</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> <data name="configData" xsi:type="string">authorizenet</data> <data name="status" xsi:type="string">Processing</data> <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S0</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/BraintreeCc.php similarity index 65% rename from dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.php rename to dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/BraintreeCc.php index 2179efc0d5bf16c1299fba2439ddf415b3f575f7..60354b0f9ca28ae680039ecef9ce9cd47fd309e1 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/BraintreeCc.php @@ -9,26 +9,33 @@ namespace Magento\Braintree\Test\Block\Form; use Magento\Mtf\Client\Locator; use Magento\Mtf\Client\Element\SimpleElement; use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Payment\Test\Block\Form\Cc as CreditCard; +use Magento\Mtf\ObjectManager; +use Magento\Payment\Test\Block\Form\PaymentCc; /** - * Class Cc - * Form for filling credit card data for Braintree payment method + * Form for filling credit card data for Braintree payment method. */ -class Cc extends CreditCard +class BraintreeCc extends PaymentCc { /** - * Braintree iFrame locator + * Braintree iFrame locator. * * @var array */ protected $braintreeForm = [ - "credit_card_number" => "#braintree-hosted-field-number", - "credit_card_exp_month" => "#braintree-hosted-field-expirationMonth", - "credit_card_exp_year" => "#braintree-hosted-field-expirationYear", - "cvv" => "#braintree-hosted-field-cvv", + "cc_number" => "#braintree-hosted-field-number", + "cc_exp_month" => "#braintree-hosted-field-expirationMonth", + "cc_exp_year" => "#braintree-hosted-field-expirationYear", + "cc_cid" => "#braintree-hosted-field-cvv", ]; + /** + * Fill Braintree credit card form. + * + * @param FixtureInterface $fixture + * @param SimpleElement|null $element + * @return void + */ public function fill(FixtureInterface $fixture, SimpleElement $element = null) { $mapping = $this->dataMapping($fixture->getData()); @@ -40,7 +47,8 @@ class Cc extends CreditCard return $fieldElement->isVisible() ? true : null; } ); - $this->browser->switchToFrame(new Locator($iframe)); + $iframeLocator = ObjectManager::getInstance()->create(Locator::class, ['value' => $iframe]); + $this->browser->switchToFrame($iframeLocator); $element = $this->browser->find('body'); $this->browser->waitUntil( function () use ($element) { diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/BraintreeCc.xml similarity index 63% rename from dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.xml rename to dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/BraintreeCc.xml index 6ea1ba9ee6e15ffe8d86aea81f8dc46aa5abc79d..d1d09ec7b1dd70bfa6413afe00bfff4ae95d735e 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/BraintreeCc.xml @@ -7,17 +7,17 @@ --> <mapping strict="0"> <fields> - <credit_card_number> + <cc_number> <selector>#credit-card-number</selector> - </credit_card_number> - <credit_card_exp_month> + </cc_number> + <cc_exp_month> <selector>#expiration-month</selector> - </credit_card_exp_month> - <credit_card_exp_year> + </cc_exp_month> + <cc_exp_year> <selector>#expiration-year</selector> - </credit_card_exp_year> - <cvv> + </cc_exp_year> + <cc_cid> <selector>#cvv</selector> - </cvv> + </cc_cid> </fields> </mapping> \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Info.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Info.php deleted file mode 100644 index 32dfb8f40fe87695cbe251048757385dc8310116..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Info.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Braintree\Test\Block; - -use Magento\Mtf\Block\Block; -use Magento\Mtf\Client\Locator; - -/** - * Payment information block. - */ -class Info extends Block -{ - /** - * Braintree Payment information block locator. - */ - private $info = './/tr'; - - /** - * Get Braintree payment information block data. - * - * @return array - */ - public function getPaymentInfo() - { - $result = []; - $elements = $this->_rootElement->getElements($this->info, Locator::SELECTOR_XPATH); - foreach ($elements as $row) { - $key = rtrim($row->find('./th', Locator::SELECTOR_XPATH)->getText(), ':'); - $value = $row->find('./td', Locator::SELECTOR_XPATH)->getText(); - $result[$key] = $value; - } - return $result; - } -} diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Constraint/Assert3dSecureInfoIsPresent.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/Constraint/Assert3dSecureInfoIsPresent.php index bb1e0670231574d4e6c53eaf483e419e0ecab0ae..29af7632f7fd748a82e359164c80098c0fd59941 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Constraint/Assert3dSecureInfoIsPresent.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Constraint/Assert3dSecureInfoIsPresent.php @@ -6,13 +6,16 @@ namespace Magento\Braintree\Test\Constraint; -use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +/** + * Assert that 3D Secure information is present on order page in Admin. + */ class Assert3dSecureInfoIsPresent extends AbstractConstraint { /** - * Assert that 3D Secure information is present on order page in Admin. + * Assert that 3D Secure information is present on order page in Admin. * * @param SalesOrderView $salesOrderView * @param array $paymentInformation @@ -20,7 +23,9 @@ class Assert3dSecureInfoIsPresent extends AbstractConstraint */ public function processAssert(SalesOrderView $salesOrderView, array $paymentInformation) { - $actualPaymentInformation = $salesOrderView->getBraintreeInfoBlock()->getPaymentInfo(); + /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */ + $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info'); + $actualPaymentInformation = $infoTab->getPaymentInfoBlock()->getData(); foreach ($paymentInformation as $key => $value) { \PHPUnit_Framework_Assert::assertArrayHasKey( $key, diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/CreditCardBraintree.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/CreditCardBraintree.xml deleted file mode 100644 index e9baa301509ce6212e0374dd26c8442157cb6cbf..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/CreditCardBraintree.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="credit_card_braintree" - module="Magento_Braintree" - type="virtual" - entity_type="credit_card_braintree" - repository_class="Magento\Braintree\Test\Repository\CreditCard" - class="Magento\Braintree\Test\Fixture\CreditCardBraintree"> - <field name="credit_card_number" /> - <field name="credit_card_exp_month" /> - <field name="credit_card_exp_year" /> - <field name="cvv" /> - </fixture> -</config> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Page/Adminhtml/SalesOrderView.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Page/Adminhtml/SalesOrderView.xml deleted file mode 100644 index be96e88c35f81a40cc384d4fb137effe58261e53..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Page/Adminhtml/SalesOrderView.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="SalesOrderView" area="Adminhtml" mca="sales/order/view" module="Magento_Sales"> - <block name="BraintreeInfoBlock" class="Magento\Braintree\Test\Block\Info" locator="//div[contains(@class, 'admin__page-section-item order-payment-method')]" strategy="xpath"/> - </page> -</config> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/CreditCard.xml index 6aa9383ff2bd1051364b1498d799ebb681714aca..e780ece1ab971ef3edeb89fed253db6b1cd93a8c 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/CreditCard.xml @@ -6,33 +6,29 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Braintree\Test\Repository\CreditCard"> - <dataset name="visa_braintree"> - <field name="credit_card_number" xsi:type="string">4111111111111111</field> - <field name="credit_card_exp_month" xsi:type="string">01</field> - <field name="credit_card_exp_year" xsi:type="string">2020</field> - <field name="cvv" xsi:type="string">123</field> - </dataset> - + <repository class="Magento\Payment\Test\Repository\CreditCard"> <dataset name="visa_braintree_3dsecure"> - <field name="credit_card_number" xsi:type="string">4000000000000002</field> - <field name="credit_card_exp_month" xsi:type="string">01</field> - <field name="credit_card_exp_year" xsi:type="string">20</field> - <field name="cvv" xsi:type="string">123</field> + <field name="payment_code" xsi:type="string">braintree</field> + <field name="cc_number" xsi:type="string">4000000000000002</field> + <field name="cc_exp_month" xsi:type="string">01</field> + <field name="cc_exp_year" xsi:type="string">20</field> + <field name="cc_cid" xsi:type="string">123</field> </dataset> <dataset name="visa_braintree_3dsecure_failed"> - <field name="credit_card_number" xsi:type="string">4000000000000028</field> - <field name="credit_card_exp_month" xsi:type="string">01</field> - <field name="credit_card_exp_year" xsi:type="string">2020</field> - <field name="cvv" xsi:type="string">123</field> + <field name="payment_code" xsi:type="string">braintree</field> + <field name="cc_number" xsi:type="string">4000000000000028</field> + <field name="cc_exp_month" xsi:type="string">01</field> + <field name="cc_exp_year" xsi:type="string">2020</field> + <field name="cc_cid" xsi:type="string">123</field> </dataset> <dataset name="visa_braintree_fraud_rejected"> - <field name="credit_card_number" xsi:type="string">4000111111111511</field> - <field name="credit_card_exp_month" xsi:type="string">01</field> - <field name="credit_card_exp_year" xsi:type="string">2020</field> - <field name="cvv" xsi:type="string">123</field> + <field name="payment_code" xsi:type="string">braintree</field> + <field name="cc_number" xsi:type="string">4000111111111511</field> + <field name="cc_exp_month" xsi:type="string">01</field> + <field name="cc_exp_year" xsi:type="string">2020</field> + <field name="cc_cid" xsi:type="string">123</field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/BraintreeSettlementReportTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/BraintreeSettlementReportTest.xml index e80f6071ae5d1d33b37bb7c26c7389ed08aa8962..dba818e57659d86757a11c213c70e314ead2b0c7 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/BraintreeSettlementReportTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/BraintreeSettlementReportTest.xml @@ -18,8 +18,8 @@ <item name="grandTotal" xsi:type="string">15.00</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> <data name="tag" xsi:type="string">test_type:extended_acceptance_test, test_type:3rd_party_test, severity:S1</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml index 53847e55fd9f91e29fbeeb6c71a0402a1fb6a6f6..2f14871eda96e102a51ed4ceefd4578af49967b8 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml @@ -14,7 +14,7 @@ <data name="checkoutMethod" xsi:type="string">login</data> <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> <data name="refundedPrices" xsi:type="array"> - <item name="0" xsi:type="string">139.9</item> + <item name="0" xsi:type="string">139.90</item> </data> <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> @@ -34,7 +34,7 @@ <data name="checkoutMethod" xsi:type="string">login</data> <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> <data name="refundedPrices" xsi:type="array"> - <item name="0" xsi:type="string">621.2</item> + <item name="0" xsi:type="string">621.20</item> </data> <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineInvoiceEntityTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineInvoiceEntityTest.xml index d9f382e4b650e5ce48955e264c67b36c893dbb84..da73da001338ade7fdd655609ff4b04d0f8602db 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineInvoiceEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineInvoiceEntityTest.xml @@ -18,11 +18,11 @@ <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="capturedPrices" xsi:type="array"> - <item name="0" xsi:type="string">139.9</item> + <item name="0" xsi:type="string">139.90</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Credit Memo, Hold, Ship, Reorder</data> @@ -50,8 +50,8 @@ <item name="1" xsi:type="string">118.25</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Credit Memo, Hold, Ship, Reorder</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml index 083bd33feca7b133903b9f83eb12c4d5b3f1fcfa..7e010fc4d1f0d31a9e735386ab36a47a5828d6da 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml @@ -22,8 +22,8 @@ <item name="grandTotal" xsi:type="string">145.98</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Ship, Reorder, Edit</data> @@ -52,8 +52,8 @@ <item name="0" xsi:type="string">145.98</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree, braintree_sale</data> <data name="status" xsi:type="string">Processing</data> <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Hold, Ship, Reorder</data> @@ -79,7 +79,6 @@ <item name="grandTotal" xsi:type="string">145.98</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> <data name="creditCard/dataset" xsi:type="string">visa_braintree_fraud_rejected</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateVaultOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateVaultOrderBackendTest.xml index c9b26df050cfc9cf9ef4913a4f538459cee1923f..123a453a921d648fa3a5e2d579904d3373c5e1db 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateVaultOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateVaultOrderBackendTest.xml @@ -20,8 +20,8 @@ </data> <data name="payment/method" xsi:type="string">braintree</data> <data name="vault/method" xsi:type="string">braintree_cc_vault</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="creditCardSave" xsi:type="string">Yes</data> <data name="configData" xsi:type="string">braintree, braintree_use_vault</data> <data name="status" xsi:type="string">Processing</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/InvoicePaypalBraintreeTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/InvoicePaypalBraintreeTest.xml index 352e0ed684919a43df66b429d5b8250d90cae351..23985d208e5a675b997d330e792eb58f1045d7d9 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/InvoicePaypalBraintreeTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/InvoicePaypalBraintreeTest.xml @@ -15,10 +15,10 @@ <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="prices" xsi:type="array"> - <item name="grandTotal" xsi:type="string">139.9</item> + <item name="grandTotal" xsi:type="string">139.90</item> </data> <data name="capturedPrices" xsi:type="array"> - <item name="0" xsi:type="string">139.9</item> + <item name="0" xsi:type="string">139.90</item> </data> <data name="payment/method" xsi:type="string">braintree_paypal</data> <data name="configData" xsi:type="string">braintree, braintree_paypal, braintree_paypal_skip_order_review</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutAcceptPaymentTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutAcceptPaymentTest.xml index 841145d7a5fdfaa92f1a82ac00c9bf51f0601643..1b9540c443650216b2288dedab699f292f20aa77 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutAcceptPaymentTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutAcceptPaymentTest.xml @@ -17,8 +17,8 @@ <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree,braintree_fraudprotection</data> <data name="status" xsi:type="string">Processing</data> <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S2</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutDeclinedTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutDeclinedTest.xml index 4a2aa551a18170002045f821de2d492ddb7a2082..510d27d324f928e46571708ea457256be5ad93a8 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutDeclinedTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutDeclinedTest.xml @@ -15,7 +15,6 @@ <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> <data name="creditCard/dataset" xsi:type="string">visa_braintree_fraud_rejected</data> <data name="expectedErrorMessage" xsi:type="string">Transaction has been declined. Please try again later.</data> <data name="configData" xsi:type="string">braintree_fraud_tool_enabled_account, braintree_fraudprotection</data> @@ -31,8 +30,8 @@ <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="expectedErrorMessage" xsi:type="string">Sorry, but something went wrong</data> <data name="configData" xsi:type="string">braintree, braintree_incorrect_merchant_account_id</data> <data name="status" xsi:type="string">Processing</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutDenyPaymentTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutDenyPaymentTest.xml index 95d07079ef36c9ae66672ec8cc465325273ecda4..8d16fcc3fcae11aa51f45c426406d842804fe936 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutDenyPaymentTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutDenyPaymentTest.xml @@ -17,8 +17,8 @@ <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree,braintree_fraudprotection</data> <data name="status" xsi:type="string">Canceled</data> <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S2</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml index 54fdfc96dc947db330c37b701132bfc0e3fcbeb0..c99a855b236a5ee45f7eba8d604bd3c0db50bb7a 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml @@ -21,7 +21,6 @@ <item name="grandTotal" xsi:type="string">145.98</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> <data name="creditCard/dataset" xsi:type="string">visa_braintree_3dsecure</data> <data name="isVaultPresent" xsi:type="boolean">false</data> <data name="configData" xsi:type="string">braintree, braintree_3d_secure_not_triggered_due_threshold</data> @@ -45,7 +44,6 @@ <item name="grandTotal" xsi:type="string">145.98</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> <data name="creditCard/dataset" xsi:type="string">visa_braintree_3dsecure</data> <data name="isVaultPresent" xsi:type="boolean">false</data> <data name="configData" xsi:type="string">braintree, braintree_3d_secure_uk</data> @@ -69,8 +67,8 @@ <item name="grandTotal" xsi:type="string">145.98</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="isVaultPresent" xsi:type="boolean">false</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> @@ -97,8 +95,8 @@ <item name="0" xsi:type="string">145.98</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="isVaultPresent" xsi:type="boolean">false</data> <data name="configData" xsi:type="string">braintree, braintree_sale</data> <data name="status" xsi:type="string">Processing</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureFailedTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureFailedTest.xml index 2a17d1496a72dfb1bb63073ccd982abf3522ca9f..12cde9b6233a96f0ff94396adf9e42e057af883b 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureFailedTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureFailedTest.xml @@ -15,7 +15,6 @@ <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> <data name="creditCard/dataset" xsi:type="string">visa_braintree_3dsecure_failed</data> <data name="secure3d/dataset" xsi:type="string">secure3d_braintree</data> <data name="configData" xsi:type="string">braintree, braintree_3d_secure</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureTest.xml index 295a9dcd5c5332dce7d6e5fad9dfcdc6f5352596..051700480fcb3f49f551190d557f210b3686e719 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureTest.xml @@ -22,7 +22,6 @@ <item name="grandTotal" xsi:type="string">145.98</item> </data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> <data name="creditCard/dataset" xsi:type="string">visa_braintree_3dsecure</data> <data name="paymentInformation" xsi:type="array"> <item name="Liability Shifted" xsi:type="string">1</item> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithDiscountTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithDiscountTest.xml index f8ffa51982f1fae4d34a6290e1bebce28ba85712..06299e2e5a10c3ea7658ff3e06c42861820edc13 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithDiscountTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithDiscountTest.xml @@ -17,8 +17,8 @@ <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">braintree</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="prices" xsi:type="array"> <item name="grandTotal" xsi:type="string">10.00</item> </data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml index 5f5e2f50594bf8d0473b65ee584e50f47bc852a4..1b7d248d537dc839ae258f3a1d16040d12f95fd1 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml @@ -21,8 +21,8 @@ <data name="payment/method" xsi:type="string">braintree</data> <data name="vault/method" xsi:type="string">braintree_cc_vault</data> <data name="isVaultPresent" xsi:type="boolean">false</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree, braintree_use_vault</data> <data name="status" xsi:type="string">Processing</data> <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultOnCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultOnCheckoutTest.xml index 35d55784b676236d808cf0f54fc969fc65193b0b..327a1f8eb2ca2b9db845f7c78a98db11feb047ef 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultOnCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultOnCheckoutTest.xml @@ -17,8 +17,8 @@ <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">braintree</data> <data name="vault/method" xsi:type="string">braintree_cc_vault</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> - <data name="creditCard/dataset" xsi:type="string">visa_braintree</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="creditCardSave" xsi:type="string">Yes</data> <data name="configData" xsi:type="string">braintree, braintree_use_vault</data> <data name="status" xsi:type="string">Processing</data> diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultWith3dSecureOnCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultWith3dSecureOnCheckoutTest.xml index a5aa7645148e158ad62a174bc26d08abfd037192..8dd9239d38526622b5facb9ab71b1c9e3e1511b3 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultWith3dSecureOnCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultWith3dSecureOnCheckoutTest.xml @@ -17,7 +17,6 @@ <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">braintree</data> <data name="vault/method" xsi:type="string">braintree_cc_vault</data> - <data name="creditCardClass" xsi:type="string">credit_card_braintree</data> <data name="creditCard/dataset" xsi:type="string">visa_braintree_3dsecure</data> <data name="paymentInformation" xsi:type="array"> <item name="Liability Shifted" xsi:type="string">1</item> diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/Cart/Item.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/Cart/Item.php index cb46e728191bffb5a770a2809019fb2833f9f0d3..be3abf935c5a42557bea3b6feea86e4301b001f1 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/Cart/Item.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/Cart/Item.php @@ -6,9 +6,6 @@ namespace Magento\Bundle\Test\Fixture\Cart; -use Magento\Bundle\Test\Fixture\BundleProduct; -use Magento\Mtf\Fixture\FixtureInterface; - /** * Data for verify cart item block on checkout page. * @@ -18,42 +15,32 @@ use Magento\Mtf\Fixture\FixtureInterface; class Item extends \Magento\Catalog\Test\Fixture\Cart\Item { /** - * @constructor - * @param FixtureInterface $product + * Return prepared dataset. + * + * @param null|string $key + * @return array */ - public function __construct(FixtureInterface $product) + public function getData($key = null) { - parent::__construct($product); - - /** @var BundleProduct $product */ - $bundleSelection = $product->getBundleSelections(); - $checkoutData = $product->getCheckoutData(); + parent::getData($key); + $bundleSelection = $this->product->getBundleSelections(); + $checkoutData = $this->product->getCheckoutData(); $checkoutBundleOptions = isset($checkoutData['options']['bundle_options']) ? $checkoutData['options']['bundle_options'] : []; + $productSku = [$this->product->getSku()]; foreach ($checkoutBundleOptions as $checkoutOptionKey => $checkoutOption) { - // Find option and value keys - $attributeKey = null; - $optionKey = null; - foreach ($bundleSelection['bundle_options'] as $key => $option) { - if ($option['title'] == $checkoutOption['title']) { - $attributeKey = $key; - - foreach ($option['assigned_products'] as $valueKey => $value) { - if (false !== strpos($value['search_data']['name'], $checkoutOption['value']['name'])) { - $optionKey = $valueKey; - } - } - } - } - + $keys = $this->getKeys($bundleSelection['bundle_options'], $checkoutOption); + $attributeKey = $keys['attribute']; + $optionKey = $keys['option']; // Prepare option data $bundleSelectionAttribute = $bundleSelection['products'][$attributeKey]; $bundleOptions = $bundleSelection['bundle_options'][$attributeKey]; $value = $bundleSelectionAttribute[$optionKey]->getName(); + $this->product->getSkuType() == 'No' ?: $productSku[] = $bundleSelectionAttribute[$optionKey]->getSku(); $qty = $bundleOptions['assigned_products'][$optionKey]['data']['selection_qty']; - $price = $product->getPriceType() == 'Yes' + $price = $this->product->getPriceType() == 'Yes' ? number_format($bundleSelectionAttribute[$optionKey]->getPrice(), 2) : number_format($bundleOptions['assigned_products'][$optionKey]['data']['selection_price_value'], 2); $optionData = [ @@ -64,6 +51,47 @@ class Item extends \Magento\Catalog\Test\Fixture\Cart\Item $checkoutBundleOptions[$checkoutOptionKey] = $optionData; } + $this->data['sku'] = implode('-', $productSku); $this->data['options'] += $checkoutBundleOptions; + + return $this->data; + } + + /** + * Get option key. + * + * @param array $assignedProducts + * @param string $checkoutOption + * @return null|string + */ + private function getOptionKey(array $assignedProducts, $checkoutOption) + { + foreach ($assignedProducts as $key => $value) { + if (false !== strpos($value['search_data']['name'], $checkoutOption)) { + return $key; + } + } + + return null; + } + + /** + * Find option and attribute keys. + * + * @param array $bundleOptions + * @param string $checkoutOption + * @return array + */ + private function getKeys(array $bundleOptions, $checkoutOption) + { + $keys = []; + foreach ($bundleOptions as $key => $option) { + if ($option['title'] == $checkoutOption['title']) { + $keys['attribute'] = $key; + $keys['option'] = $this->getOptionKey($option['assigned_products'], $checkoutOption['value']['name']); + } + } + + return $keys; } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Cart/Item.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Cart/Item.php index c7dbba386958a30f19ec9001add2566da76a7b7f..fb0ecca863582cd50f619320f62d0b4ffc1f1a58 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Cart/Item.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Cart/Item.php @@ -8,7 +8,6 @@ namespace Magento\Catalog\Test\Fixture\Cart; use Magento\Mtf\Fixture\DataSource; use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; /** * Data for verify cart item block on checkout page. @@ -21,15 +20,31 @@ use Magento\Catalog\Test\Fixture\CatalogProductSimple; class Item extends DataSource { /** - * @constructor + * Product fixture. + * + * @var FixtureInterface + */ + protected $product; + + /** * @param FixtureInterface $product */ public function __construct(FixtureInterface $product) { - /** @var CatalogProductSimple $product */ - $checkoutData = $product->getCheckoutData(); + $this->product = $product; + } + + /** + * Return prepared dataset. + * + * @param null|string $key + * @return array + */ + public function getData($key = null) + { + $checkoutData = $this->product->getCheckoutData(); $cartItem = isset($checkoutData['cartItem']) ? $checkoutData['cartItem'] : []; - $customOptions = $product->hasData('custom_options') ? $product->getCustomOptions() : []; + $customOptions = $this->product->hasData('custom_options') ? $this->product->getCustomOptions() : []; $checkoutCustomOptions = isset($checkoutData['options']['custom_options']) ? $checkoutData['options']['custom_options'] : []; @@ -52,9 +67,12 @@ class Item extends DataSource ? $cartItem['options'] + $checkoutCustomOptions : $checkoutCustomOptions; $cartItem['qty'] = isset($checkoutData['qty']) - ? $checkoutData['qty'] - : 1; - + ? $checkoutData['qty'] + : 1; + $cartItem['sku'] = $this->product->getSku(); + $cartItem['name'] = $this->product->getName(); $this->data = $cartItem; + + return parent::getData($key); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml index 2fd8c04d1d80dfe643616ee7c550699da91aeece..dc5e9c12ebcaebc1e49c8394f4d4308a11762309 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml @@ -72,5 +72,18 @@ <field name="is_active" xsi:type="string">Yes</field> <field name="include_in_menu" xsi:type="string">Yes</field> </dataset> + + <dataset name="default_subcategory_with_assigned_simple_product"> + <field name="name" xsi:type="string">Category%isolation%</field> + <field name="url_key" xsi:type="string">category%isolation%</field> + <field name="is_active" xsi:type="string">Yes</field> + <field name="include_in_menu" xsi:type="string">Yes</field> + <field name="parent_id" xsi:type="array"> + <item name="dataset" xsi:type="string">default_category</item> + </field> + <field name="category_products" xsi:type="array"> + <item name="dataset" xsi:type="string">catalogProductSimple::default</item> + </field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php index ce8f5a4cbfd99b41e990a11fc89527f28b0fec5f..31002bd8129c4f39d6a2ffd670f70af7fcf48da2 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php @@ -7,7 +7,7 @@ namespace Magento\Checkout\Test\Block\Onepage; use Magento\Mtf\Block\Block; -use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Payment\Test\Fixture\CreditCard; /** * Checkout payment block. @@ -47,7 +47,7 @@ class Payment extends Block * * @var string */ - protected $placeOrder = '.action.primary.checkout'; + protected $placeOrder = '.payment-method._active .action.primary.checkout'; /** * Wait element. @@ -74,14 +74,19 @@ class Payment extends Block * Select payment method. * * @param array $payment - * @param InjectableFixture|null $creditCard + * @param CreditCard|null $creditCard + * @param bool $fillCreditCardOn3rdParty * @throws \Exception * @return void */ - public function selectPaymentMethod(array $payment, InjectableFixture $creditCard = null) - { - $paymentSelector = sprintf($this->paymentMethodInput, $payment['method']); - $paymentLabelSelector = sprintf($this->paymentMethodLabel, $payment['method']); + public function selectPaymentMethod( + array $payment, + CreditCard $creditCard = null, + $fillCreditCardOn3rdParty = false + ) { + $paymentMethod = $payment['method']; + $paymentSelector = sprintf($this->paymentMethodInput, $paymentMethod); + $paymentLabelSelector = sprintf($this->paymentMethodLabel, $paymentMethod); try { $this->waitForElementNotVisible($this->waitElement); @@ -100,16 +105,15 @@ class Payment extends Block $paymentRadioButton->click(); } - if ($payment['method'] == "purchaseorder") { + if ($paymentMethod == "purchaseorder") { $this->_rootElement->find($this->purchaseOrderNumber)->setValue($payment['po_number']); } - if ($creditCard !== null) { - $class = explode('\\', get_class($creditCard)); - $module = $class[1]; - /** @var \Magento\Payment\Test\Block\Form\Cc $formBlock */ + if ($creditCard !== null && $fillCreditCardOn3rdParty === false) { + $module = $creditCard->hasData('payment_code') ? ucfirst($creditCard->getPaymentCode()) : 'Payment'; + /** @var \Magento\Payment\Test\Block\Form\PaymentCc $formBlock */ $formBlock = $this->blockFactory->create( - "\\Magento\\{$module}\\Test\\Block\\Form\\Cc", - ['element' => $this->_rootElement->find('#payment_form_' . $payment['method'])] + "\\Magento\\{$module}\\Test\\Block\\Form\\{$module}Cc", + ['element' => $this->_rootElement->find('#payment_form_' . $paymentMethod)] ); $formBlock->fill($creditCard); } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart.xml index 04b191b2b65834a0786510a61fd4c3170530476b..5286881980704c62438816aa23155f092a6eb56c 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart.xml @@ -10,7 +10,6 @@ module="Magento_Checkout" type="flat" entity_type="quote" - repository_class="Magento\Checkout\Test\Repository\Cart" handler_interface="Magento\Checkout\Test\Handler\Cart\CartInterface" class="Magento\Checkout\Test\Fixture\Cart"> <field name="entity_id" is_required="1" /> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddProductsToTheCartStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddProductsToTheCartStep.php index 37df8ea8b89255ca5a1d522b1b0c7c6bc6ffcf5c..d6fb3a272b4290f50a32c88a739f5620c0066c99 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddProductsToTheCartStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddProductsToTheCartStep.php @@ -10,6 +10,7 @@ use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Cms\Test\Page\CmsIndex; use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestStep\TestStepInterface; /** @@ -18,46 +19,53 @@ use Magento\Mtf\TestStep\TestStepInterface; class AddProductsToTheCartStep implements TestStepInterface { /** - * Array with products + * Array with products. * * @var array */ - protected $products; + private $products; /** - * Frontend product view page + * Storefront product view page. * * @var CatalogProductView */ - protected $catalogProductView; + private $catalogProductView; /** - * Page of checkout page + * Page of checkout page. * * @var CheckoutCart */ - protected $checkoutCart; + private $checkoutCart; /** - * Cms index page + * Cms index page. * * @var CmsIndex */ - protected $cmsIndex; + private $cmsIndex; /** - * Interface Browser + * Client Browser instance. * * @var BrowserInterface */ - protected $browser; + private $browser; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + private $fixtureFactory; /** - * @constructor * @param CatalogProductView $catalogProductView * @param CheckoutCart $checkoutCart * @param CmsIndex $cmsIndex * @param BrowserInterface $browser + * @param FixtureFactory $fixtureFactory * @param array $products */ public function __construct( @@ -65,19 +73,21 @@ class AddProductsToTheCartStep implements TestStepInterface CheckoutCart $checkoutCart, CmsIndex $cmsIndex, BrowserInterface $browser, + FixtureFactory $fixtureFactory, array $products ) { - $this->products = $products; $this->catalogProductView = $catalogProductView; $this->checkoutCart = $checkoutCart; $this->cmsIndex = $cmsIndex; $this->browser = $browser; + $this->fixtureFactory = $fixtureFactory; + $this->products = $products; } /** - * Add products to the cart + * Add products to the cart. * - * @return void + * @return array */ public function run() { @@ -89,5 +99,7 @@ class AddProductsToTheCartStep implements TestStepInterface $this->catalogProductView->getViewBlock()->addToCart($product); $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); } + $cart['data']['items'] = ['products' => $this->products]; + return ['cart' => $this->fixtureFactory->createByCode('cart', $cart)]; } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/GetPlacedOrderIdStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/GetPlacedOrderIdStep.php new file mode 100644 index 0000000000000000000000000000000000000000..8d4fa8e471fbc18519f9c9cc3a5917c51789a066 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/GetPlacedOrderIdStep.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Checkout\Test\TestStep; + +use Magento\Mtf\TestStep\TestStepInterface; +use Magento\Checkout\Test\Page\CheckoutOnepageSuccess; +use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; + +/** + * Get successfully placed order id. + */ +class GetPlacedOrderIdStep implements TestStepInterface +{ + /** + * Order success page. + * + * @var CheckoutOnepageSuccess + */ + private $checkoutOnepageSuccess; + + /** + * Curl transport on webapi. + * + * @var WebapiDecorator + */ + private $decorator; + + /** + * @param CheckoutOnepageSuccess $checkoutOnepageSuccess + * @param WebapiDecorator $decorator + */ + public function __construct( + CheckoutOnepageSuccess $checkoutOnepageSuccess, + WebapiDecorator $decorator + ) { + $this->checkoutOnepageSuccess = $checkoutOnepageSuccess; + $this->decorator = $decorator; + } + + /** + * Get success placed order id. + * + * @return array + */ + public function run() + { + $incrementId = $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(); + return [ + 'entityId' => $this->getEntityId($incrementId), + 'orderId' => $incrementId + ]; + } + + /** + * Get order entity id by increment id. + * + * @param string $incrementId + * @return string + */ + private function getEntityId($incrementId) + { + $url = $_ENV['app_frontend_url'] . 'rest/V1/orders/'; + $url .= '?searchCriteria[filterGroups][0][filters][0][field]=increment_id'; + $url .= '&searchCriteria[filterGroups][0][filters][0][value]=' . $incrementId; + $this->decorator->write($url, [], WebapiDecorator::GET); + $response = json_decode($this->decorator->read(), true); + $this->decorator->close(); + return $response['items'][0]['entity_id']; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php index 2bfd346fbcaebe0545a3b65ce76af7a8bc52de25..8beada29036b8a3cf2ff367a0b30b59b78faf0e8 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php @@ -22,41 +22,44 @@ class PlaceOrderStep implements TestStepInterface * * @var CheckoutOnepage */ - protected $checkoutOnepage; + private $checkoutOnepage; /** * Assert that Order Grand Total is correct on checkout page review block. * * @var AssertGrandTotalOrderReview */ - protected $assertGrandTotalOrderReview; + private $assertGrandTotalOrderReview; /** * One page checkout success page. * * @var CheckoutOnepageSuccess */ - protected $checkoutOnepageSuccess; + private $checkoutOnepageSuccess; /** * Price array. * * @var array */ - protected $prices; + private $prices; /** + * Factory for fixtures. + * * @var FixtureFactory */ private $fixtureFactory; /** + * Array of product entities. + * * @var array */ private $products; /** - * @construct * @param CheckoutOnepage $checkoutOnepage * @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview * @param CheckoutOnepageSuccess $checkoutOnepageSuccess @@ -74,10 +77,10 @@ class PlaceOrderStep implements TestStepInterface ) { $this->checkoutOnepage = $checkoutOnepage; $this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview; - $this->prices = $prices; $this->checkoutOnepageSuccess = $checkoutOnepageSuccess; $this->fixtureFactory = $fixtureFactory; $this->products = $products; + $this->prices = $prices; } /** @@ -91,18 +94,20 @@ class PlaceOrderStep implements TestStepInterface $this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']); } $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder(); + $orderId = $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(); $order = $this->fixtureFactory->createByCode( 'orderInjectable', [ 'data' => [ - 'entity_id' => ['products' => $this->products] + 'id' => $orderId, + 'entity_id' => ['products' => $this->products], ] ] ); return [ - 'orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(), - 'order' => $order + 'orderId' => $orderId, + 'order' => $order, ]; } } 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 1f5d80bdbde49f35a62dad5dd9fbefb326107b45..5eea876f02b40c6dd93de18d9f7c378179772756 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 @@ -7,68 +7,73 @@ namespace Magento\Checkout\Test\TestStep; use Magento\Checkout\Test\Page\CheckoutOnepage; -use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestStep\TestStepInterface; use Magento\Payment\Test\Fixture\CreditCard; /** - * Class SelectPaymentMethodStep - * Selecting payment method + * Select payment method step. */ class SelectPaymentMethodStep implements TestStepInterface { /** - * Onepage checkout page + * Onepage checkout page. * * @var CheckoutOnepage */ protected $checkoutOnepage; /** - * Payment information + * Payment information. * * @var string */ protected $payment; /** - * Credit card information + * Credit card information. * * @var string */ protected $creditCard; /** - * @constructor + * If fill credit card data should be filled on 3rd party side. + * + * @var bool + */ + private $fillCreditCardOn3rdParty; + + /** * @param CheckoutOnepage $checkoutOnepage * @param array $payment - * @param FixtureFactory $fixtureFactory - * @param string $creditCardClass - * @param array|CreditCard|null $creditCard + * @param CreditCard|null $creditCard + * @param bool $fillCreditCardOn3rdParty */ public function __construct( CheckoutOnepage $checkoutOnepage, array $payment, - FixtureFactory $fixtureFactory, - $creditCardClass = 'credit_card', - $creditCard = null + CreditCard $creditCard = null, + $fillCreditCardOn3rdParty = false ) { $this->checkoutOnepage = $checkoutOnepage; $this->payment = $payment; - if (isset($creditCard['dataset'])) { - $this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]); - } + $this->creditCard = $creditCard; + $this->fillCreditCardOn3rdParty = $fillCreditCardOn3rdParty; } /** - * Run step that selecting payment method + * Run step that selecting payment method. * * @return void */ public function run() { if ($this->payment['method'] !== 'free') { - $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod($this->payment, $this->creditCard); + $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod( + $this->payment, + $this->creditCard, + $this->fillCreditCardOn3rdParty + ); } } } diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/Cart/Item.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/Cart/Item.php index d2a999627cb95d8336314bc643e194e5fb3461c8..46cf2ceefe8ac9e830b029e0357c0735465503b2 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/Cart/Item.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/Cart/Item.php @@ -6,9 +6,6 @@ namespace Magento\ConfigurableProduct\Test\Fixture\Cart; -use Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct; -use Magento\Mtf\Fixture\FixtureInterface; - /** * Data for verify cart item block on checkout page. * @@ -20,25 +17,27 @@ use Magento\Mtf\Fixture\FixtureInterface; class Item extends \Magento\Catalog\Test\Fixture\Cart\Item { /** - * @constructor - * @param FixtureInterface $product + * Return prepared dataset. + * + * @param null|string $key + * @return array */ - public function __construct(FixtureInterface $product) + public function getData($key = null) { - parent::__construct($product); - - /** @var ConfigurableProduct $product */ - $checkoutData = $product->getCheckoutData(); + parent::getData($key); + $productData = $this->product->getData(); + $checkoutData = $this->product->getCheckoutData(); $cartItem = isset($checkoutData['cartItem']) ? $checkoutData['cartItem'] : []; - $attributesData = $product->getConfigurableAttributesData()['attributes_data']; + $attributesData = $this->product->getConfigurableAttributesData()['attributes_data']; $checkoutConfigurableOptions = isset($checkoutData['options']['configurable_options']) ? $checkoutData['options']['configurable_options'] : []; + $attributeKey = []; foreach ($checkoutConfigurableOptions as $key => $checkoutConfigurableOption) { $attribute = $checkoutConfigurableOption['title']; $option = $checkoutConfigurableOption['value']; - + $attributeKey[] = "$attribute:$option"; $checkoutConfigurableOptions[$key] = [ 'title' => isset($attributesData[$attribute]['label']) ? $attributesData[$attribute]['label'] @@ -48,10 +47,15 @@ class Item extends \Magento\Catalog\Test\Fixture\Cart\Item : $option, ]; } + $attributeKey = implode(' ', $attributeKey); + $cartItem['sku'] = $productData['configurable_attributes_data']['matrix'][$attributeKey]['sku']; + $cartItem['name'] = $productData['name']; $cartItem['options'] = isset($cartItem['options']) ? $cartItem['options'] + $checkoutConfigurableOptions : $checkoutConfigurableOptions; $this->data = $cartItem; + + return $this->data; } } diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml index 3a099d79d370a97b9d75afb419bd36860e559a1a..77b311bd7a51f80b0347ba092dc700e467c2cf84 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml @@ -17,7 +17,6 @@ </item> </field> </dataset> - <dataset name="config_currency_symbols_usd_and_uah_rollback"> <field name="currency/options/allow" xsi:type="array"> <item name="scope" xsi:type="string">currency</item> @@ -83,7 +82,6 @@ <item name="value" xsi:type="string">CHF</item> </field> </dataset> - <dataset name="config_base_currency_ch_rollback"> <field name="currency/options/allow" xsi:type="array"> <item name="scope" xsi:type="string">currency</item> @@ -127,7 +125,6 @@ <item name="value" xsi:type="string">GBP</item> </field> </dataset> - <dataset name="config_base_currency_gb_rollback"> <field name="currency/options/allow" xsi:type="array"> <item name="scope" xsi:type="string">currency</item> @@ -150,6 +147,49 @@ </field> </dataset> + <dataset name="config_base_currency_aud"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="Australian Dollar" xsi:type="string">AUD</item> + </item> + </field> + <field name="currency/options/base" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">Australian Dollar</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">AUD</item> + </field> + <field name="currency/options/default" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">Australian Dollar</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">AUD</item> + </field> + </dataset> + <dataset name="config_base_currency_aud_rollback"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="US Dollar" xsi:type="string">USD</item> + </item> + </field> + <field name="currency/options/base" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">US Dollar</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">USD</item> + </field> + <field name="currency/options/default" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">US Dollar</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">USD</item> + </field> + </dataset> + <dataset name="config_currency_symbols_usd_and_eur"> <field name="currency/options/allow" xsi:type="array"> <item name="scope" xsi:type="string">currency</item> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index ba85d0d13bfc68761ea562802f259dcda28ff738..2edc328b5c5df40df321e66a34fa1ee7c6d4e835 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -285,5 +285,17 @@ <item name="dataset" xsi:type="string">UK_address_default_billing, US_address_default_shipping</item> </field> </dataset> + + <dataset name="AVS_street_match_address"> + <field name="firstname" xsi:type="string">John</field> + <field name="lastname" xsi:type="string">Doe</field> + <field name="company" xsi:type="string">Magento %isolation%</field> + <field name="city" xsi:type="string">Culver City</field> + <field name="street" xsi:type="string">24285 Elm</field> + <field name="telephone" xsi:type="string">555-55-555-55</field> + <field name="country_id" xsi:type="string">United States</field> + <field name="region_id" xsi:type="string">California</field> + <field name="postcode" xsi:type="string">90230</field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/Cart/Item.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/Cart/Item.php index dd388ae11d2f66990e3f2bb54e83399ec7562d5c..1d0fabeceb771ebd61d73ee16bed79ba91efcc3a 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/Cart/Item.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/Cart/Item.php @@ -6,9 +6,6 @@ namespace Magento\Downloadable\Test\Fixture\Cart; -use Magento\Downloadable\Test\Fixture\DownloadableProduct; -use Magento\Mtf\Fixture\FixtureInterface; - /** * Data for verify cart item block on checkout page. * @@ -18,17 +15,17 @@ use Magento\Mtf\Fixture\FixtureInterface; class Item extends \Magento\Catalog\Test\Fixture\Cart\Item { /** - * @constructor - * @param FixtureInterface $product + * Return prepared dataset. + * + * @param null|string $key + * @return array */ - public function __construct(FixtureInterface $product) + public function getData($key = null) { - parent::__construct($product); - - /** @var DownloadableProduct $product */ + parent::getData($key); $checkoutDownloadableOptions = []; - $checkoutData = $product->getCheckoutData(); - $downloadableOptions = $product->getDownloadableLinks(); + $checkoutData = $this->product->getCheckoutData(); + $downloadableOptions = $this->product->getDownloadableLinks(); foreach ($checkoutData['options']['links'] as $link) { $keyLink = str_replace('link_', '', $link['label']); $checkoutDownloadableOptions[] = [ @@ -38,5 +35,7 @@ class Item extends \Magento\Catalog\Test\Fixture\Cart\Item } $this->data['options'] += $checkoutDownloadableOptions; + + return $this->data; } } diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/Cart/Item.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/Cart/Item.php index cc0cd2e9f09a49b04de46062905406bba68b7916..2aaf1253885a158f63a3a2aaf2df049d2c1ab105 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/Cart/Item.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/Cart/Item.php @@ -6,9 +6,6 @@ namespace Magento\GroupedProduct\Test\Fixture\Cart; -use Magento\GroupedProduct\Test\Fixture\GroupedProduct; -use Magento\Mtf\Fixture\FixtureInterface; - /** * Data for verify cart item block on checkout page. * @@ -18,18 +15,19 @@ use Magento\Mtf\Fixture\FixtureInterface; class Item extends \Magento\Catalog\Test\Fixture\Cart\Item { /** - * @constructor - * @param FixtureInterface $product + * Return prepared dataset. + * + * @param null|string $key + * @return array */ - public function __construct(FixtureInterface $product) + public function getData($key = null) { - /** @var GroupedProduct $product */ - $checkoutData = $product->getCheckoutData(); + $checkoutData = $this->product->getCheckoutData(); $this->data = isset($checkoutData['cartItem']) ? $checkoutData['cartItem'] : []; $associatedProducts = []; $cartItem = []; - foreach ($product->getAssociated()['products'] as $key => $product) { + foreach ($this->product->getAssociated()['products'] as $key => $product) { $key = 'product_key_' . $key; $associatedProducts[$key] = $product; } @@ -51,5 +49,7 @@ class Item extends \Magento\Catalog\Test\Fixture\Cart\Item } $this->data = $cartItem; + + return $this->data; } } diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml index 7648899060f8f3314d1a33b26082724ae1495fa8..7f1fd69d8e784d08363b07837c35e9ec30c54ea0 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml @@ -33,6 +33,9 @@ <field name="attribute_set_id" xsi:type="array"> <item name="dataset" xsi:type="string">default</item> </field> + <field name="checkout_data" xsi:type="array"> + <item name="dataset" xsi:type="string">default</item> + </field> </dataset> <dataset name="grouped_product_out_of_stock"> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct/CheckoutData.xml index e6529d1afe6778f9c97396c20186be44f110545d..e2e17977b7dd6f43f68de86f0bfc2b060693a50e 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct/CheckoutData.xml @@ -7,6 +7,33 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> <repository class="Magento\GroupedProduct\Test\Repository\GroupedProduct\CheckoutData"> + <dataset name="default"> + <field name="options" xsi:type="array"> + <item name="0" xsi:type="array"> + <item name="name" xsi:type="string">product_key_0</item> + <item name="qty" xsi:type="string">2</item> + </item> + <item name="1" xsi:type="array"> + <item name="name" xsi:type="string">product_key_1</item> + <item name="qty" xsi:type="string">1</item> + </item> + </field> + <field name="cartItem" xsi:type="array"> + <item name="price" xsi:type="array"> + <item name="product_key_0" xsi:type="string">100</item> + <item name="product_key_1" xsi:type="string">560</item> + </item> + <item name="qty" xsi:type="array"> + <item name="product_key_0" xsi:type="string">2</item> + <item name="product_key_1" xsi:type="string">1</item> + </item> + <item name="subtotal" xsi:type="array"> + <item name="product_key_0" xsi:type="string">200</item> + <item name="product_key_1" xsi:type="string">560</item> + </item> + </field> + </dataset> + <dataset name="grouped_three_simple_products"> <field name="options" xsi:type="array"> <item name="0" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/DeleteIntegrationEntityTest.xml b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/DeleteIntegrationEntityTest.xml index 56431ee145d18d1fcae4df990a0a388a9e7f99f0..6594757fe15ee54f2d2b2e0f34344a3b40812a0b 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/DeleteIntegrationEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/DeleteIntegrationEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Integration\Test\TestCase\DeleteIntegrationEntityTest" summary="Delete Integration" ticketId="MAGETWO-26058"> <variation name="DeleteIntegrationEntityTestVariation1"> + <data name="integration/dataset" xsi:type="string">default</data> <constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessDeleteMessage" /> <constraint name="Magento\Integration\Test\Constraint\AssertIntegrationNotInGrid" /> </variation> diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.php b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.php deleted file mode 100644 index 3e8226d371ff4546d7b243834485d2b0dff37d8a..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Payment\Test\Block\Form; - -use Magento\Mtf\Block\Form; - -/** - * Form for filling credit card data. - */ -class Cc extends Form -{ - // -} diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/PaymentCc.php b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/PaymentCc.php new file mode 100644 index 0000000000000000000000000000000000000000..474052114c4d396476f5c5083c53e42109f662e6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/PaymentCc.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Payment\Test\Block\Form; + +use Magento\Mtf\Block\Form; +use Magento\Mtf\Client\Element\SimpleElement; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Form for filling credit card data. + */ +class PaymentCc extends Form +{ + /** + * Fill credit card form. + * + * @param FixtureInterface $fixture + * @param SimpleElement|null $element + * @return $this + */ + public function fill(FixtureInterface $fixture, SimpleElement $element = null) + { + $data = $fixture->getData(); + unset($data['payment_code']); + $mapping = $this->dataMapping($data); + $this->_fill($mapping, $element); + + return $this; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/PaymentCc.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml rename to dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/PaymentCc.xml diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Constraint/AssertCardRequiredFields.php b/dev/tests/functional/tests/app/Magento/Payment/Test/Constraint/AssertCardRequiredFields.php index 2b1d9bdcf2df8fdb32869731b7b3af05d47bc417..c8b52ed317d0fe7454277464d638c63209556298 100644 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Constraint/AssertCardRequiredFields.php +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Constraint/AssertCardRequiredFields.php @@ -7,7 +7,7 @@ namespace Magento\Payment\Test\Constraint; use Magento\Mtf\Constraint\AbstractConstraint; -use Magento\Payment\Test\Repository\CreditCardAdmin; +use Magento\Payment\Test\Repository\CreditCard; use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; /** @@ -30,10 +30,10 @@ class AssertCardRequiredFields extends AbstractConstraint /** * Assert required fields on credit card payment method in backend. * @param OrderCreateIndex $orderCreateIndex - * @param CreditCardAdmin $creditCard + * @param CreditCard $creditCard * @return void */ - public function processAssert(OrderCreateIndex $orderCreateIndex, CreditCardAdmin $creditCard) + public function processAssert(OrderCreateIndex $orderCreateIndex, CreditCard $creditCard) { $actualRequiredFields = $orderCreateIndex->getCreateBlock()->getBillingMethodBlock() ->getJsErrors(); diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCard.xml index 6fd5d8675b8b0f38d929d1372dbde9b3aeb601b7..2fe0da150438a784742c3930a41ad5e0362e40a1 100644 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCard.xml @@ -12,6 +12,8 @@ entity_type="credit_card" repository_class="Magento\Payment\Test\Repository\CreditCard" class="Magento\Payment\Test\Fixture\CreditCard"> + <field name="payment_code" /> + <field name="cc_type" /> <field name="cc_number" /> <field name="cc_exp_month" /> <field name="cc_exp_year" /> diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCardAdmin.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCardAdmin.xml deleted file mode 100644 index 87e69cee86addd91d612fb66c594b1bfb89c2638..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCardAdmin.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="credit_card_admin" - module="Magento_Payment" - type="virtual" - entity_type="credit_card_admin" - repository_class="Magento\Payment\Test\Repository\CreditCardAdmin" - class="Magento\Payment\Test\Fixture\CreditCardAdmin"> - <field name="cc_type" /> - <field name="cc_number" /> - <field name="cc_exp_month" /> - <field name="cc_exp_year" /> - <field name="cc_cid" /> - </fixture> -</config> diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml index 8e742ab30ba960dd022870fea86e08c74d71c3fd..80c337d0a8578fb9115ff6382fabba5f6b1b844b 100644 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml @@ -14,6 +14,14 @@ <field name="cc_cid" xsi:type="string">123</field> </dataset> + <dataset name="visa_default_admin"> + <field name="cc_type" xsi:type="string">Visa</field> + <field name="cc_number" xsi:type="string">4111111111111111</field> + <field name="cc_exp_month" xsi:type="string">01 - January</field> + <field name="cc_exp_year" xsi:type="string">2020</field> + <field name="cc_cid" xsi:type="string">123</field> + </dataset> + <dataset name="visa_alt"> <field name="cc_number" xsi:type="string">4012888888881881</field> <field name="cc_exp_month" xsi:type="string">02 - February</field> @@ -34,5 +42,13 @@ <field name="cc_exp_year" xsi:type="string">2020</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> + + <dataset name="visa_empty"> + <field name="cc_type" xsi:type="string" /> + <field name="cc_number" xsi:type="string" /> + <field name="cc_exp_month" xsi:type="string" /> + <field name="cc_exp_year" xsi:type="string" /> + <field name="cc_cid" xsi:type="string" /> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCardAdmin.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCardAdmin.xml deleted file mode 100644 index 371c8f350c6af028ddc544c23142f2886d699dbd..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCardAdmin.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" ?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Payment\Test\Repository\CreditCardAdmin"> - <dataset name="visa_default"> - <field name="cc_type" xsi:type="string">Visa</field> - <field name="cc_number" xsi:type="string">4111111111111111</field> - <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2020</field> - <field name="cc_cid" xsi:type="string">123</field> - </dataset> - - <dataset name="visa_direct"> - <field name="cc_type" xsi:type="string">Visa</field> - <field name="cc_number" xsi:type="string">4617747819866651</field> - <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2020</field> - <field name="cc_cid" xsi:type="string">123</field> - </dataset> - <dataset name="visa_empty"> - <field name="cc_type" xsi:type="string">Please Select</field> - <field name="cc_number" xsi:type="string" /> - <field name="cc_exp_month" xsi:type="string">Month</field> - <field name="cc_cid" xsi:type="string" /> - </dataset> - </repository> -</config> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/HostedPro/Cc.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/HostedPro/Cc.php new file mode 100644 index 0000000000000000000000000000000000000000..53fd258b84cbb0ca65b588672eaeeaaf21f43041 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/HostedPro/Cc.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\Block\Form\HostedPro; + +use Magento\Payment\Test\Block\Form\PaymentCc as CreditCard; + +/** + * Form for filling credit card data for Hosted Pro payment method. + */ +class Cc extends CreditCard +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/HostedPro/Cc.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/HostedPro/Cc.xml new file mode 100644 index 0000000000000000000000000000000000000000..b6a0945a693a954bd2602031ebf0ae4f94b81beb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/HostedPro/Cc.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <fields> + <cc_type> + <input>select</input> + <selector>#credit_card_type</selector> + </cc_type> + <cc_number> + <selector>#credit_card_number</selector> + </cc_number> + <cc_exp_month> + <selector>[name=expiryMonth]</selector> + </cc_exp_month> + <cc_exp_year> + <selector>[name=expiryYear]</selector> + </cc_exp_year> + <cc_cid> + <selector>[name=cvv2]</selector> + </cc_cid> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PayflowLink/Cc.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PayflowLink/Cc.php new file mode 100644 index 0000000000000000000000000000000000000000..3f369efc7e829c2e427e883320183a51565006d4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PayflowLink/Cc.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\Block\Form\PayflowLink; + +use Magento\Payment\Test\Block\Form\PaymentCc as CreditCard; + +/** + * Form for filling credit card data for Payflow Link payment method. + */ +class Cc extends CreditCard +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PayflowLink/Cc.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PayflowLink/Cc.xml new file mode 100644 index 0000000000000000000000000000000000000000..1eaabeede0d49c5dc1387e7e27c560510e6db0a3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PayflowLink/Cc.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" ?> +<!-- +/** +* Copyright © 2016 Magento. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<mapping strict="0"> + <fields> + <cc_number> + <selector>#cc_number</selector> + </cc_number> + <cc_exp_month> + <selector>#expdate_month</selector> + </cc_exp_month> + <cc_exp_year> + <selector>#expdate_year</selector> + </cc_exp_year> + <cc_cid> + <selector>#cvv2_number</selector> + </cc_cid> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PaymentsAdvanced/Cc.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PaymentsAdvanced/Cc.php new file mode 100644 index 0000000000000000000000000000000000000000..a990a41cd69afa9e9969ed6668e17125647aee77 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PaymentsAdvanced/Cc.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\Block\Form\PaymentsAdvanced; + +use Magento\Payment\Test\Block\Form\PaymentCc as CreditCard; + +/** + * Form for filling credit card data for Payments Advanced payment method. + */ +class Cc extends CreditCard +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PaymentsAdvanced/Cc.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PaymentsAdvanced/Cc.xml new file mode 100644 index 0000000000000000000000000000000000000000..1eaabeede0d49c5dc1387e7e27c560510e6db0a3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Form/PaymentsAdvanced/Cc.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" ?> +<!-- +/** +* Copyright © 2016 Magento. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<mapping strict="0"> + <fields> + <cc_number> + <selector>#cc_number</selector> + </cc_number> + <cc_exp_month> + <selector>#expdate_month</selector> + </cc_exp_month> + <cc_exp_year> + <selector>#expdate_year</selector> + </cc_exp_year> + <cc_cid> + <selector>#cvv2_number</selector> + </cc_cid> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/HostedPro.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/HostedPro.php new file mode 100644 index 0000000000000000000000000000000000000000..f7ee9fc20947e5c4a7bf0acc5bf2ff829aad87c0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/HostedPro.php @@ -0,0 +1,20 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\Block\Onepage\Payment; + +/** + * Hosted Pro credit card block. + */ +class HostedPro extends PaypalIframe +{ + /** + * Block for filling credit card data for Hosted Pro payment method. + * + * @var string + */ + protected $formBlockCc = \Magento\Paypal\Test\Block\Form\HostedPro\Cc::class; +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PayflowLink.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PayflowLink.php new file mode 100644 index 0000000000000000000000000000000000000000..c6b8d37dc3faa1634450e9152636171e44ec9139 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PayflowLink.php @@ -0,0 +1,20 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\Block\Onepage\Payment; + +/** + * Payflow Link credit card block. + */ +class PayflowLink extends PaypalIframe +{ + /** + * Block for filling credit card data for Payflow Link payment method. + * + * @var string + */ + protected $formBlockCc = \Magento\Paypal\Test\Block\Form\PayflowLink\Cc::class; +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PaymentsAdvanced.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PaymentsAdvanced.php new file mode 100644 index 0000000000000000000000000000000000000000..bb80ab1ccfc3be3892813f744da23f56a0f11ac3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PaymentsAdvanced.php @@ -0,0 +1,20 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\Block\Onepage\Payment; + +/** + * Payments Advanced credit card block. + */ +class PaymentsAdvanced extends PaypalIframe +{ + /** + * Block for filling credit card data for Payments Advanced payment method. + * + * @var string + */ + protected $formBlockCc = \Magento\Paypal\Test\Block\Form\PaymentsAdvanced\Cc::class; +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PaypalIframe.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PaypalIframe.php new file mode 100644 index 0000000000000000000000000000000000000000..574dc256589b6afec1ea5d4f2252bf390b31a7e5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/Onepage/Payment/PaypalIframe.php @@ -0,0 +1,98 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\Block\Onepage\Payment; + +use Magento\Checkout\Test\Block\Onepage\Payment\Method; +use Magento\Mtf\Client\ElementInterface; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Paypal Iframe block. + */ +class PaypalIframe extends Method +{ + /** + * 'Pay Now' button selector. + * + * @var string + */ + private $payNowButton = '#btn_pay_cc'; + + /** + * PayPal iframe selector. + * + * @var string + */ + private $paypalIframe = '.paypal.iframe'; + + /** + * Credit card form selector. + * + * @var string + */ + private $creditCardForm = '#formCreditCard'; + + /** + * Error message selector. + * + * @var string + */ + private $errorMessage = '#messageBox'; + + /** + * Block for filling credit card data for payment method. + * + * @var string + */ + protected $formBlockCc; + + /** + * Fill credit card data in PayPal iframe form. + * + * @param FixtureInterface $creditCard + * @return void + */ + public function fillPaymentData(FixtureInterface $creditCard) + { + $iframeRootElement = $this->switchToPaypalFrame(); + $formBlock = $this->blockFactory->create( + $this->formBlockCc, + ['element' => $this->_rootElement->find($this->creditCardForm)] + ); + $formBlock->fill($creditCard, $iframeRootElement); + $iframeRootElement->find($this->payNowButton)->click(); + $this->browser->switchToFrame(); + } + + /** + * Check if error message is appeared. + * + * @return bool + */ + public function isErrorMessageVisible() + { + $isErrorMessageVisible = false; + if ($this->_rootElement->find($this->paypalIframe)->isPresent()) { + $iframeRootElement = $this->switchToPaypalFrame(); + $isErrorMessageVisible = $iframeRootElement->find($this->errorMessage)->isVisible(); + $this->browser->switchToFrame(); + } + return $isErrorMessageVisible; + } + + /** + * Change the focus to a PayPal frame. + * + * @return ElementInterface + */ + private function switchToPaypalFrame() + { + $iframeLocator = $this->browser->find($this->paypalIframe)->getLocator(); + $this->browser->switchToFrame($iframeLocator); + return $this->browser->find('body'); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Page/CheckoutOnepage.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/Page/CheckoutOnepage.xml new file mode 100644 index 0000000000000000000000000000000000000000..da37a44f9bf3db04ff42c1a14a0f36e0e499b9c7 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Page/CheckoutOnepage.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CheckoutOnepage" mca="checkout" module="Magento_Checkout"> + <block name="payflowLinkBlock" class="Magento\Paypal\Test\Block\Onepage\Payment\PayflowLink" locator="#checkout-step-payment" strategy="css selector" /> + <block name="paymentsAdvancedBlock" class="Magento\Paypal\Test\Block\Onepage\Payment\PaymentsAdvanced" locator="#checkout-step-payment" strategy="css selector" /> + <block name="hostedProBlock" class="Magento\Paypal\Test\Block\Onepage\Payment\HostedPro" locator="#checkout-step-payment" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/ConfigData.xml index 0706f45beeb4bdfa39bfd65f6a76094ef77574e7..1669352dc026ef02c295fce1153f63e3beabf225 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/ConfigData.xml @@ -7,6 +7,23 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> <repository class="Magento\Config\Test\Repository\ConfigData"> + <dataset name="merchant_country_gb"> + <field name="paypal/general/merchant_country" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">United Kingdom</item> + <item name="value" xsi:type="string">GB</item> + </field> + </dataset> + <dataset name="merchant_country_gb_rollback"> + <field name="paypal/general/merchant_country" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">United States</item> + <item name="value" xsi:type="string">US</item> + </field> + </dataset> + <dataset name="paypal_direct"> <field name="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/business_account" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> @@ -64,32 +81,32 @@ <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/business_account" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string">Yes</item> - <item name="value" xsi:type="string">PAYPAL_BUSINESS_ACCOUNT</item> + <item name="label" xsi:type="string">Email Associated with PayPal Merchant Account (Optional)</item> + <item name="value" xsi:type="string">%payflow_pro_business_account%</item> </field> <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/partner" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> - <item name="value" xsi:type="string">PAYMENT_PAYFLOWPRO_PARTNER</item> + <item name="label" xsi:type="string">Partner</item> + <item name="value" xsi:type="string">%payflow_pro_partner%</item> </field> <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/user" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> - <item name="value" xsi:type="string">PAYMENT_PAYFLOWPRO_USER</item> + <item name="label" xsi:type="string">User</item> + <item name="value" xsi:type="string">%payflow_pro_user%</item> </field> <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/pwd" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> - <item name="value" xsi:type="string">PAYMENT_PAYFLOWPRO_PWD</item> + <item name="label" xsi:type="string">Password</item> + <item name="value" xsi:type="string">%payflow_pro_pwd%</item> </field> <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/vendor" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> - <item name="value" xsi:type="string">PAYMENT_PAYFLOWPRO_VENDOR</item> + <item name="label" xsi:type="string">Vendor</item> + <item name="value" xsi:type="string">%payflow_pro_vendor%</item> </field> <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/sandbox_flag" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> @@ -124,9 +141,133 @@ </dataset> <dataset name="payflowpro_rollback"> <field name="payment/payflowpro/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + </dataset> + + <dataset name="payflowpro_fraud_filters_enabled"> + <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/business_account" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Email Associated with PayPal Merchant Account (Optional)</item> + <item name="value" xsi:type="string">%payflow_pro_fraud_protection_enabled_business_account%</item> + </field> + <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/partner" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Partner</item> + <item name="value" xsi:type="string">%payflow_pro_fraud_protection_enabled_partner%</item> + </field> + <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/user" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">User</item> + <item name="value" xsi:type="string">%payflow_pro_fraud_protection_enabled_user%</item> + </field> + <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/pwd" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Password</item> + <item name="value" xsi:type="string">%payflow_pro_fraud_protection_enabled_pwd%</item> + </field> + <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/vendor" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Vendor</item> + <item name="value" xsi:type="string">%payflow_pro_fraud_protection_enabled_vendor%</item> + </field> + <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/sandbox_flag" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/payflowpro/debug" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/payflowpro/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/payflow_express/debug" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/payflow_express/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + <dataset name="payflowpro_fraud_filters_enabled_rollback"> + <field name="payment/payflowpro/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + </dataset> + + <dataset name="hosted_pro"> + <field name="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/business_account" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="string">HOSTED_PRO_BUSINESS_ACCOUNT</item> + </field> + <field name="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/api_username" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">HOSTED_PRO_API_USERNAME</item> + </field> + <field name="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/api_password" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">HOSTED_PRO_API_PASSWORD</item> + </field> + <field name="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/api_signature" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">HOSTED_PRO_API_SIGNATURE</item> + </field> + <field name="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/sandbox_flag" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/hosted_pro/debug" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/hosted_pro/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + <dataset name="hosted_pro_rollback"> + <field name="payment/hosted_pro/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> <item name="value" xsi:type="number">0</item> </field> </dataset> @@ -184,41 +325,100 @@ </field> </dataset> + <dataset name="payments_advanced"> + <field name="payment/paypal_group_all_in_one/payflow_advanced/required_settings/payments_advanced/business_account" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Email Associated with PayPal Merchant Account</item> + <item name="value" xsi:type="string">%payflow_link_business_account_email%</item> + </field> + <field name="payment/paypal_group_all_in_one/payflow_advanced/required_settings/payments_advanced/partner" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Partner</item> + <item name="value" xsi:type="string">%payflow_link_partner%</item> + </field> + <field name="payment/paypal_group_all_in_one/payflow_advanced/required_settings/payments_advanced/user" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">User</item> + <item name="value" xsi:type="string">%payflow_link_user%</item> + </field> + <field name="payment/paypal_group_all_in_one/payflow_advanced/required_settings/payments_advanced/pwd" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Password</item> + <item name="value" xsi:type="string">%payflow_link_password%</item> + </field> + <field name="payment/paypal_group_all_in_one/payflow_advanced/required_settings/payments_advanced/vendor" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Vendor</item> + <item name="value" xsi:type="string">%payflow_link_vendor%</item> + </field> + <field name="payment/paypal_group_all_in_one/payflow_advanced/required_settings/payments_advanced/sandbox_flag" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/payflow_advanced/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + <dataset name="payments_advanced_rollback"> + <field name="payment/payflow_advanced/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + </dataset> + <dataset name="payflowlink"> <field name="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/business_account" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string">Yes</item> - <item name="value" xsi:type="string">PAYPAL_BUSINESS_ACCOUNT</item> + <item name="label" xsi:type="string">Email Associated with PayPal Merchant Account</item> + <item name="value" xsi:type="string">%payflow_link_business_account_email%</item> </field> <field name="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/partner" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> - <item name="value" xsi:type="string">PAYMENT_PAYFLOWLINK_PARTNER</item> + <item name="label" xsi:type="string">Partner</item> + <item name="value" xsi:type="string">%payflow_link_partner%</item> </field> <field name="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/user" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> - <item name="value" xsi:type="string">PAYMENT_PAYFLOWLINK_USER</item> + <item name="label" xsi:type="string">User</item> + <item name="value" xsi:type="string">%payflow_link_user%</item> </field> <field name="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/pwd" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> - <item name="value" xsi:type="string">PAYMENT_PAYFLOWLINK_PWD</item> + <item name="label" xsi:type="string">Password</item> + <item name="value" xsi:type="string">%payflow_link_password%</item> </field> <field name="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/vendor" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> - <item name="value" xsi:type="string">PAYMENT_PAYFLOWLINK_VENDOR</item> + <item name="label" xsi:type="string">Vendor</item> + <item name="value" xsi:type="string">%payflow_link_vendor%</item> </field> <field name="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/sandbox_flag" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string"/> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/enable_payflow_link" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> <item name="value" xsi:type="number">1</item> </field> <field name="payment/payflowlink/debug" xsi:type="array"> @@ -250,7 +450,7 @@ <field name="payment/payflowlink/active" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string">Yes</item> + <item name="label" xsi:type="string">No</item> <item name="value" xsi:type="number">0</item> </field> </dataset> diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/CreditCard.xml similarity index 60% rename from dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/CreditCard.xml rename to dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/CreditCard.xml index c6b8eab58205e649e87e0acb760339bb9aafc273..9383dcd3faf4b40b23e665c4fb243cd45954e215 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/CreditCard.xml @@ -6,10 +6,11 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Authorizenet\Test\Repository\CreditCard"> - <dataset name="visa_authorizenet"> - <field name="cc_number" xsi:type="string">4111111111111111</field> - <field name="cc_exp_month" xsi:type="string">01 - January</field> + <repository class="Magento\Payment\Test\Repository\CreditCard"> + <dataset name="visa_hosted_pro"> + <field name="cc_type" xsi:type="string">V</field> + <field name="cc_number" xsi:type="string">4032034402702800</field> + <field name="cc_exp_month" xsi:type="string">01</field> <field name="cc_exp_year" xsi:type="string">2020</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CloseSalesWithHostedProTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CloseSalesWithHostedProTest.php new file mode 100644 index 0000000000000000000000000000000000000000..11acf819c992692a856cf93c679c79a5c7a1aa8b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CloseSalesWithHostedProTest.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\TestCase; + +use Magento\Mtf\TestCase\Scenario; + +/** + * Preconditions: + * 1. Order is placed via WPPHS. + * + * Steps: + * 1. Log in to Admin. + * 2. Go to Sales > Orders page. + * 3. Open order. + * 4. Click 'Ship' button and submit shipment. + * 5. Click 'Invoice' button. + * 6. Select Amount=Capture Online. + * 7. Click 'Submit Invoice' button. + * 11. Perform assertions. + * + * @group Paypal + * @ZephyrId MAGETWO-13016 + */ +class CloseSalesWithHostedProTest extends Scenario +{ + /* tags */ + const MVP = 'yes'; + const TEST_TYPE = '3rd_party_test'; + /* end tags */ + + /** + * Complete order paid PayPal Payments Pro Hosted Solution. + * + * @return void + */ + public function test() + { + $this->executeScenario(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CloseSalesWithHostedProTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CloseSalesWithHostedProTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..a7e058b4fba445c74febc19a71f7962c3b4af3b6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CloseSalesWithHostedProTest.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Paypal\Test\TestCase\CloseSalesWithHostedProTest" summary="Complete order paid with PayPal Payments Pro Hosted Solution"> + <variation name="CloseSalesWithHostedProVariation1" summary="Complete order paid with PayPal Payments Pro Hosted Solution" ticketId="MAGETWO-13016"> + <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data> + <data name="products/1" xsi:type="string">configurableProduct::with_one_option</data> + <data name="products/2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data> + <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> + <data name="customer/dataset" xsi:type="string">default</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="payment/method" xsi:type="string">hosted_pro</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">145.98</item> + </data> + <data name="capturedPrices" xsi:type="array"> + <item name="0" xsi:type="string">145.98</item> + </data> + <data name="creditCardClass" xsi:type="string">credit_card_hostedpro</data> + <data name="creditCard/dataset" xsi:type="string">visa_hosted_pro</data> + <data name="isVaultPresent" xsi:type="boolean">false</data> + <data name="status" xsi:type="string">Complete</data> + <data name="configData" xsi:type="string">merchant_country_gb, hosted_pro, config_base_currency_gb</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S0</data> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceItems" /> + <constraint name="Magento\Sales\Test\Constraint\AssertCaptureInCommentsHistory" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreatePayFlowOrderBackendNegativeTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreatePayFlowOrderBackendNegativeTest.xml index 4ad751de68a71f0330aa547bf74481c3e306f379..ea4dc7b7231466e1473fe4690d73a5ffe3af376b 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreatePayFlowOrderBackendNegativeTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreatePayFlowOrderBackendNegativeTest.xml @@ -19,7 +19,6 @@ <item name="grandTotal" xsi:type="string">15.00</item> </data> <data name="payment/method" xsi:type="string">payflowpro</data> - <data name="creditCardClass" xsi:type="string">credit_card_admin</data> <data name="creditCard/dataset" xsi:type="string">visa_empty</data> <data name="creditCardSave" xsi:type="string">Yes</data> <data name="configData" xsi:type="string">payflowpro, payflowpro_use_vault</data> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreateVaultOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreateVaultOrderBackendTest.xml index ca26ad42a020c80ab0540c21a2928b8a1874cae7..53e9c7b83900ac1c9422d0ed52ce761b05e24dc0 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreateVaultOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreateVaultOrderBackendTest.xml @@ -20,8 +20,7 @@ </data> <data name="payment/method" xsi:type="string">payflowpro</data> <data name="vault/method" xsi:type="string">payflowpro_cc_vault</data> - <data name="creditCardClass" xsi:type="string">credit_card_admin</data> - <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="creditCard/dataset" xsi:type="string">visa_default_admin</data> <data name="creditCardSave" xsi:type="string">Yes</data> <data name="configData" xsi:type="string">payflowpro, payflowpro_use_vault</data> <data name="status" xsi:type="string">Processing</data> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutHostedProTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutHostedProTest.php new file mode 100644 index 0000000000000000000000000000000000000000..12cedd4ffa458d3418f6834ea330a12c9b0c3c6b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutHostedProTest.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\TestCase; + +use Magento\Mtf\TestCase\Scenario; + +/** + * Preconditions: + * 1. Configure shipping method. + * 2. Configure payment method. + * 3. Create products. + * 4. Create sales rule according to dataset. + * + * Steps: + * 1. Go to Storefront. + * 2. Add products to the cart. + * 3. Click the 'Go to Checkout' button. + * 4. Fill shipping information. + * 5. Select shipping method. + * 6. Click 'Next' button. + * 7. Select Hosted Pro method. + * 8. Click 'Continue' button. + * 9. Specify credit card data in Paypal iframe. + * 10. Click 'Pay Now' button. + * 11. Perform assertions. + * + * @group Paypal + * @ZephyrId MAGETWO-12971 + */ +class OnePageCheckoutHostedProTest extends Scenario +{ + /* tags */ + const MVP = 'yes'; + const TEST_TYPE = '3rd_party_test'; + const SEVERITY = 'S0'; + /* end tags */ + + /** + * Place order using PayPal Payments Pro Hosted Solution. + * + * @return void + */ + public function test() + { + $this->executeScenario(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutHostedProTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutHostedProTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..6583aa9cc873c9e3c8fc17255127a1fc62680cb5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutHostedProTest.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Paypal\Test\TestCase\OnePageCheckoutHostedProTest" summary="Guest Checkout using PayPal Payments Pro Hosted Solution and Offline Shipping Method"> + <variation name="OnePageCheckoutHostedProVariation1" summary="Guest Checkout using PayPal Payments Pro Hosted Solution and Offline Shipping Method" ticketId="MAGETWO-12971"> + <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data> + <data name="products/1" xsi:type="string">configurableProduct::with_one_option</data> + <data name="products/2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data> + <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> + <data name="customer/dataset" xsi:type="string">default</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="payment/method" xsi:type="string">hosted_pro</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">145.98</item> + </data> + <data name="creditCardClass" xsi:type="string">credit_card_hostedpro</data> + <data name="creditCard/dataset" xsi:type="string">visa_hosted_pro</data> + <data name="isVaultPresent" xsi:type="boolean">false</data> + <data name="configData" xsi:type="string">merchant_country_gb, hosted_pro, config_base_currency_gb</data> + <data name="status" xsi:type="string">Processing</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S0</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPayflowLinkTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPayflowLinkTest.php new file mode 100644 index 0000000000000000000000000000000000000000..726d6833660be0cfd2c838985724a88f680cea44 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPayflowLinkTest.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\TestCase; + +use Magento\Mtf\TestCase\Scenario; + +/** + * Preconditions: + * 1. Configure shipping method. + * 2. Configure payment method. + * 3. Create products. + * 4. Create tax rule according to dataset. + * + * Steps: + * 1. Go to Storefront. + * 2. Add products to the cart. + * 3. Click the 'Go to Checkout' button. + * 4. Fill shipping information. + * 5. Select shipping method. + * 6. Click 'Next' button. + * 7. Select 'Credit Card' method. + * 8. Click 'Continue' button. + * 9. Specify credit card data in Paypal iframe. + * 10. Click 'Pay Now' button. + * 11. Perform assertions. + * + * @group Paypal + * @ZephyrId MAGETWO-12974 + */ +class OnePageCheckoutPayflowLinkTest extends Scenario +{ + /* tags */ + const MVP = 'yes'; + const TEST_TYPE = '3rd_party_test'; + const SEVERITY = 'S0'; + /* end tags */ + + /** + * Place order using PayPal Payflow Link Solution. + * + * @return void + */ + public function test() + { + $this->executeScenario(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPayflowLinkTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPayflowLinkTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..b23a1c6ae9d79e20bee3af1fcd81f2e116fd6d8e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPayflowLinkTest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Paypal\Test\TestCase\OnePageCheckoutPayflowLinkTest" summary="Guest Checkout using PayPal Payflow Link and Flat Rate"> + <variation name="OnePageCheckoutPayflowLinkVariation1" summary="Guest Checkout using PayPal Payflow Link and Flat Rate" ticketId="MAGETWO-12974"> + <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data> + <data name="products/1" xsi:type="string">configurableProduct::with_one_option</data> + <data name="products/2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data> + <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> + <data name="customer/dataset" xsi:type="string">default</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="payment/method" xsi:type="string">payflow_link</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">145.98</item> + </data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="isVaultPresent" xsi:type="boolean">false</data> + <data name="configData" xsi:type="string">payflowlink</data> + <data name="status" xsi:type="string">Processing</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S0</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPaymentsAdvancedTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPaymentsAdvancedTest.php new file mode 100644 index 0000000000000000000000000000000000000000..789b5ddd27faaf2723e0feb909e1561e164df56d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPaymentsAdvancedTest.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\TestCase; + +use Magento\Mtf\TestCase\Scenario; + +/** + * Preconditions: + * 1. Configure shipping method. + * 2. Configure payment method. + * 3. Create products. + * 4. Create tax rule according to dataset. + * + * Steps: + * 1. Go to Storefront. + * 2. Add products to the cart. + * 3. Click the 'Go to Checkout' button. + * 4. Fill shipping information. + * 5. Select shipping method. + * 6. Click 'Next' button. + * 7. Select 'Credit Card' method. + * 8. Click 'Continue' button. + * 9. Specify credit card data in Paypal iframe. + * 10. Click 'Pay Now' button. + * 11. Perform assertions. + * + * @group Paypal + * @ZephyrId MAGETWO-12991 + */ +class OnePageCheckoutPaymentsAdvancedTest extends Scenario +{ + /* tags */ + const MVP = 'yes'; + const TEST_TYPE = '3rd_party_test'; + const SEVERITY = 'S0'; + /* end tags */ + + /** + * Place order using PayPal Payments Advanced Solution. + * + * @return void + */ + public function test() + { + $this->executeScenario(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPaymentsAdvancedTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPaymentsAdvancedTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..279a47689548ba0e3a08ba0d8070490bb417e09a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutPaymentsAdvancedTest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Paypal\Test\TestCase\OnePageCheckoutPaymentsAdvancedTest" summary="Guest Checkout using PayPal Payments Advanced and Flat Rate"> + <variation name="OnePageCheckoutPaymentsAdvancedVariation1" summary="Guest Checkout using PayPal Payments Advanced and Flat Rate" ticketId="MAGETWO-12991"> + <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data> + <data name="products/1" xsi:type="string">configurableProduct::with_one_option</data> + <data name="products/2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data> + <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> + <data name="customer/dataset" xsi:type="string">default</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="payment/method" xsi:type="string">payflow_advanced</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">145.98</item> + </data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="isVaultPresent" xsi:type="boolean">false</data> + <data name="configData" xsi:type="string">payments_advanced</data> + <data name="status" xsi:type="string">Processing</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S0</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" /> + </variation> + </testCase> +</config> \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml index 11f9d9d5270e679df9cd5237b4a51139cb51475e..655b2f5f9d3fb83eaca544d74db4e9adf0732bbe 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml @@ -19,7 +19,6 @@ <data name="prices" xsi:type="array"> <item name="grandTotal" xsi:type="string">15.83</item> </data> - <data name="creditCardClass" xsi:type="string">credit_card</data> <data name="creditCard/dataset" xsi:type="string">visa_default</data> <data name="isVaultPresent" xsi:type="boolean">false</data> <data name="configData" xsi:type="string">payflowpro</data> @@ -28,5 +27,58 @@ <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" /> </variation> + <variation name="OnePageCheckoutPayflowProWithInternationalAVSFilter" summary="Place order via Payflow Pro with fraud filters triggering" ticketId="MAGETWO-37476"> + <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data> + <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data> + <data name="customer/dataset" xsi:type="string">default</data> + <data name="billingAddress/dataset" xsi:type="string">US_address_1_without_email</data> + <data name="shippingAddress/dataset" xsi:type="string">UK_address_without_email</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="payment/method" xsi:type="string">payflowpro</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">15.00</item> + </data> + <data name="creditCardClass" xsi:type="string">credit_card</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="isVaultPresent" xsi:type="boolean">false</data> + <data name="configData" xsi:type="string">payflowpro_fraud_filters_enabled</data> + <data name="paymentInfo" xsi:type="array"> + <item name="Triggered Fraud Filters" xsi:type="string">Under review by Fraud Service</item> + <item name="International AVS response" xsi:type="string">#N: No Details matched</item> + </data> + <data name="status" xsi:type="string">Processing</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderPaymentInformation" /> + </variation> + <variation name="OnePageCheckoutPayflowProWithAVSStreetMatches" summary="Place Order via Payflow Pro with success AVS Street verification" ticketId="MAGETWO-37479"> + <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data> + <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data> + <data name="customer/dataset" xsi:type="string">default</data> + <data name="shippingAddress/dataset" xsi:type="string">AVS_street_match_address</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="payment/method" xsi:type="string">payflowpro</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">15.00</item> + </data> + <data name="creditCardClass" xsi:type="string">credit_card</data> + <data name="creditCard/dataset" xsi:type="string">visa_default</data> + <data name="isVaultPresent" xsi:type="boolean">false</data> + <data name="configData" xsi:type="string">payflowpro_fraud_filters_enabled</data> + <data name="paymentInfo" xsi:type="array"> + <item name="AVS Street Match" xsi:type="string">#Y: Yes. Matched Address and five-didgit ZIP</item> + </data> + <data name="status" xsi:type="string">Processing</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderPaymentInformation" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml index ad937cf472de7145429b16983288df69bb851134..f5dd4b9604e0a1843c67cc470d607aaf93684eec 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml @@ -20,7 +20,6 @@ </data> <data name="payment/method" xsi:type="string">payflowpro</data> <data name="vault/method" xsi:type="string">payflowpro_cc_vault</data> - <data name="creditCardClass" xsi:type="string">credit_card</data> <data name="creditCard/dataset" xsi:type="string">visa_default</data> <data name="configData" xsi:type="string">payflowpro, payflowpro_use_vault</data> <data name="status" xsi:type="string">Processing</data> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/UseVaultOnCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/UseVaultOnCheckoutTest.xml index 92b4be03b5937ffa318f9d3cd05f6e6d2290f6bc..b81d36ad33038279d0563ca704098b759e93773e 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/UseVaultOnCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/UseVaultOnCheckoutTest.xml @@ -16,7 +16,6 @@ <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">payflowpro</data> <data name="vault/method" xsi:type="string">payflowpro_cc_vault</data> - <data name="creditCardClass" xsi:type="string">credit_card</data> <data name="creditCard/dataset" xsi:type="string">visa_default</data> <data name="creditCardSave" xsi:type="string">Yes</data> <data name="configData" xsi:type="string">payflowpro, payflowpro_use_vault</data> diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/GetPlacedOrderIdStep.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/GetPlacedOrderIdStep.php deleted file mode 100644 index bb1e1416dc9339498c35fda85d1703b5fe62d69b..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/GetPlacedOrderIdStep.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Paypal\Test\TestStep; - -use Magento\Mtf\TestStep\TestStepInterface; -use Magento\Checkout\Test\Page\CheckoutOnepageSuccess; - -/** - * Get success placed order id. - */ -class GetPlacedOrderIdStep implements TestStepInterface -{ - /** - * Order success page. - * - * @var CheckoutOnepageSuccess - */ - protected $checkoutOnepageSuccess; - - /** - * @constructor - * @param CheckoutOnepageSuccess $checkoutOnepageSuccess - */ - public function __construct(CheckoutOnepageSuccess $checkoutOnepageSuccess) - { - $this->checkoutOnepageSuccess = $checkoutOnepageSuccess; - } - - /** - * Get success placed order id. - * - * @return array - */ - public function run() - { - return [ - 'orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(), - ]; - } -} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithHostedProStep.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithHostedProStep.php new file mode 100644 index 0000000000000000000000000000000000000000..cf602190a6286d30a860633fc3fb61fca718fe3a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithHostedProStep.php @@ -0,0 +1,104 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\TestStep; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\TestStep\TestStepInterface; +use Magento\Payment\Test\Fixture\CreditCard; +use Magento\Sales\Test\Fixture\OrderInjectable; + +/** + * Place order using PayPal Payments Pro Hosted Solution during one page checkout. + */ +class PlaceOrderWithHostedProStep implements TestStepInterface +{ + /** + * Onepage checkout page. + * + * @var CheckoutOnepage + */ + private $checkoutOnepage; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + private $fixtureFactory; + + /** + * Products fixtures. + * + * @var FixtureInterface[] + */ + private $products; + + /** + * Payment information. + * + * @var string + */ + private $payment; + + /** + * Credit card information. + * + * @var string + */ + private $creditCard; + + /** + * @param CheckoutOnepage $checkoutOnepage + * @param FixtureFactory $fixtureFactory + * @param CreditCard $creditCard + * @param array $payment + * @param array $products + */ + public function __construct( + CheckoutOnepage $checkoutOnepage, + FixtureFactory $fixtureFactory, + CreditCard $creditCard, + array $payment, + array $products + ) { + $this->checkoutOnepage = $checkoutOnepage; + $this->fixtureFactory = $fixtureFactory; + $this->creditCard = $creditCard; + $this->payment = $payment; + $this->products = $products; + } + + /** + * Place order with Hosted Pro. + * + * @return array + */ + public function run() + { + $attempts = 1; + $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod($this->payment); + $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder(); + $this->checkoutOnepage->getHostedProBlock()->fillPaymentData($this->creditCard); + // As Paypal Sandbox is not stable there are three attempts given to place order + while ($this->checkoutOnepage->getHostedProBlock()->isErrorMessageVisible() && $attempts <= 3) { + $this->checkoutOnepage->getHostedProBlock()->fillPaymentData($this->creditCard); + $attempts++; + } + /** @var OrderInjectable $order */ + $order = $this->fixtureFactory->createByCode( + 'orderInjectable', + [ + 'data' => [ + 'entity_id' => ['products' => $this->products] + ] + ] + ); + return ['order' => $order]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithPayflowLinkStep.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithPayflowLinkStep.php new file mode 100644 index 0000000000000000000000000000000000000000..926dabe9722b65e8c906cb18fb1a1e9df462dc4a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithPayflowLinkStep.php @@ -0,0 +1,98 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\TestStep; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestStep\TestStepInterface; +use Magento\Payment\Test\Fixture\CreditCard; +use Magento\Sales\Test\Fixture\OrderInjectable; + +/** + * Place order using PayPal Payflow Link Solution during one page checkout. + */ +class PlaceOrderWithPayflowLinkStep implements TestStepInterface +{ + /** + * Onepage checkout page. + * + * @var CheckoutOnepage + */ + private $checkoutOnepage; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + private $fixtureFactory; + + /** + * Products fixtures. + * + * @var array + */ + private $products; + + /** + * Payment information. + * + * @var array + */ + private $payment; + + /** + * Credit card information. + * + * @var CreditCard + */ + private $creditCard; + + /** + * @param CheckoutOnepage $checkoutOnepage + * @param FixtureFactory $fixtureFactory + * @param CreditCard $creditCard + * @param array $payment + * @param array $products + */ + public function __construct( + CheckoutOnepage $checkoutOnepage, + FixtureFactory $fixtureFactory, + CreditCard $creditCard, + array $payment, + array $products + ) { + $this->checkoutOnepage = $checkoutOnepage; + $this->fixtureFactory = $fixtureFactory; + $this->creditCard = $creditCard; + $this->payment = $payment; + $this->products = $products; + } + + /** + * Place order with Payflow Link. + * + * @return array + */ + public function run() + { + $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod($this->payment); + $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder(); + $this->checkoutOnepage->getPayflowLinkBlock()->fillPaymentData($this->creditCard); + + /** @var OrderInjectable $order */ + $order = $this->fixtureFactory->createByCode( + 'orderInjectable', + [ + 'data' => [ + 'entity_id' => ['products' => $this->products] + ] + ] + ); + return ['order' => $order]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithPaymentsAdvancedStep.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithPaymentsAdvancedStep.php new file mode 100644 index 0000000000000000000000000000000000000000..c39a742c07c091cad853bdf716e7e3122f7c0965 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/PlaceOrderWithPaymentsAdvancedStep.php @@ -0,0 +1,98 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Paypal\Test\TestStep; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestStep\TestStepInterface; +use Magento\Payment\Test\Fixture\CreditCard; +use Magento\Sales\Test\Fixture\OrderInjectable; + +/** + * Place order using PayPal Payments Advanced Solution during one page checkout. + */ +class PlaceOrderWithPaymentsAdvancedStep implements TestStepInterface +{ + /** + * Onepage checkout page. + * + * @var CheckoutOnepage + */ + private $checkoutOnepage; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + private $fixtureFactory; + + /** + * Products fixtures. + * + * @var array + */ + private $products; + + /** + * Payment information. + * + * @var array + */ + private $payment; + + /** + * Credit card information. + * + * @var CreditCard + */ + private $creditCard; + + /** + * @param CheckoutOnepage $checkoutOnepage + * @param FixtureFactory $fixtureFactory + * @param CreditCard $creditCard + * @param array $payment + * @param array $products + */ + public function __construct( + CheckoutOnepage $checkoutOnepage, + FixtureFactory $fixtureFactory, + CreditCard $creditCard, + array $payment, + array $products + ) { + $this->checkoutOnepage = $checkoutOnepage; + $this->fixtureFactory = $fixtureFactory; + $this->creditCard = $creditCard; + $this->payment = $payment; + $this->products = $products; + } + + /** + * Place order with Payments Advanced. + * + * @return array + */ + public function run() + { + $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod($this->payment); + $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder(); + $this->checkoutOnepage->getPaymentsAdvancedBlock()->fillPaymentData($this->creditCard); + + /** @var OrderInjectable $order */ + $order = $this->fixtureFactory->createByCode( + 'orderInjectable', + [ + 'data' => [ + 'entity_id' => ['products' => $this->products] + ] + ] + ); + return ['order' => $order]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/etc/testcase.xml index 89cf35b73bc3ed292a152358fd5265a71d566983..e333b4b4ffefcf02ce59d632b9346831d974fb0b 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/etc/testcase.xml @@ -13,7 +13,7 @@ <step name="addProductsToTheCart" 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="fillShippingAddress"/> + <step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress" /> <step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" /> <step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod" /> <step name="selectPaymentMethod" module="Magento_Checkout" next="continueToPaypalInContext" /> @@ -59,7 +59,7 @@ <step name="selectPaymentMethod" module="Magento_Checkout" next="continueToPaypal" /> <step name="continueToPaypal" module="Magento_Paypal" next="continuePaypalCheckout" /> <step name="continuePaypalCheckout" module="Magento_Paypal" next="getPlacedOrderId" /> - <step name="getPlacedOrderId" module="Magento_Paypal" /> + <step name="getPlacedOrderId" module="Magento_Checkout" /> </scenario> <scenario name="ConflictResolutionTest" firstStep="checkExpressConfig"> <step name="checkExpressConfig" module="Magento_Paypal" next="checkBraintreeConfig" /> @@ -85,4 +85,58 @@ <step name="saveCreditCardOnBackend" module="Magento_Vault" next="submitOrderNegative" /> <step name="submitOrderNegative" module="Magento_Sales" /> </scenario> + <scenario name="OnePageCheckoutHostedProTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Config" 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="proceedToCheckout" /> + <step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod" /> + <step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress" /> + <step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" /> + <step name="fillShippingMethod" module="Magento_Checkout" next="placeOrderWithHostedPro" /> + <step name="placeOrderWithHostedPro" module="Magento_Paypal" next="getPlacedOrderId" /> + <step name="getPlacedOrderId" module="Magento_Checkout" /> + </scenario> + <scenario name="CloseSalesWithHostedProTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Config" 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="proceedToCheckout" /> + <step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod" /> + <step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress"/> + <step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" /> + <step name="fillShippingMethod" module="Magento_Checkout" next="placeOrderWithHostedPro" /> + <step name="placeOrderWithHostedPro" module="Magento_Paypal" next="getPlacedOrderId" /> + <step name="getPlacedOrderId" module="Magento_Checkout" next="createInvoice" /> + <step name="createInvoice" module="Magento_Sales" next="createShipment" /> + <step name="createShipment" module="Magento_Sales" /> + </scenario> + <scenario name="OnePageCheckoutPaymentsAdvancedTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Config" 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="proceedToCheckout" /> + <step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod" /> + <step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress" /> + <step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" /> + <step name="fillShippingMethod" module="Magento_Checkout" next="placeOrderWithPaymentsAdvanced" /> + <step name="placeOrderWithPaymentsAdvanced" module="Magento_Paypal" next="getPlacedOrderId" /> + <step name="getPlacedOrderId" module="Magento_Checkout" /> + </scenario> + <scenario name="OnePageCheckoutPayflowLinkTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Config" 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="proceedToCheckout" /> + <step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod" /> + <step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress" /> + <step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" /> + <step name="fillShippingMethod" module="Magento_Checkout" next="placeOrderWithPayflowLink" /> + <step name="placeOrderWithPayflowLink" module="Magento_Paypal" next="getPlacedOrderId" /> + <step name="getPlacedOrderId" module="Magento_Checkout" /> + </scenario> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItems.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItems.php index d76461b9ae5f071d8dcdddc2c473ebba01698bfc..d7a89b68c553808cfdbb7de9854ce37e82464618 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItems.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItems.php @@ -7,6 +7,7 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order; use Magento\Mtf\Block\Block; +use Magento\Mtf\Client\ElementInterface; /** * Base Items block on Credit Memo, Invoice, Shipment view page. @@ -18,56 +19,63 @@ class AbstractItems extends Block * * @var string */ - protected $rowItem = 'tbody'; + private $rowItem = 'tbody'; /** - * Locator for "Product" column. + * Locator for product sku column. * * @var string */ - protected $product = '.col-product'; + private $sku = '.col-product .product-sku-block'; + + /** + * Locator for product title column. + * + * @var string + */ + private $title = '.col-product .product-title'; /** * Locator for "Price" column. * * @var string */ - protected $price = '.col-price .price'; + private $price = '.col-price .price'; /** * Locator for "Qty" column. * * @var string */ - protected $qty = '.col-qty'; + private $qty = '.col-qty'; /** * Locator for "Subtotal" column. * * @var string */ - protected $subtotal = '.col-subtotal .price'; + private $subtotal = '.col-subtotal .price'; /** * Locator for "Tax Amount" column. * * @var string */ - protected $taxAmount = '.col-tax .price'; + private $taxAmount = '.col-tax .price'; /** * Locator for "Discount Amount" column. * * @var string */ - protected $discountAmount = '.col-discount .price'; + private $discountAmount = '.col-discount .price'; /** * Locator for "Row total" column. * * @var string */ - protected $rowTotal = '.col-total .price'; + private $rowTotal = '.col-total .price'; /** * Get items data. @@ -82,9 +90,10 @@ class AbstractItems extends Block foreach ($items as $item) { $itemData = []; - $itemData += $this->parseProductName($item->find($this->product)->getText()); + $itemData['product'] = preg_replace('/\n|\r/', '', $item->find($this->title)->getText()); + $itemData['sku'] = $this->getSku($item); $itemData['price'] = $this->escapePrice($item->find($this->price)->getText()); - $itemData['qty'] = $item->find($this->qty)->getText(); + $itemData['qty'] = $this->getQty($item); $itemData['subtotal'] = $this->escapePrice($item->find($this->subtotal)->getText()); $itemData['tax'] = $this->escapePrice($item->find($this->taxAmount)->getText()); $itemData['discount'] = $this->escapePrice($item->find($this->discountAmount)->getText()); @@ -97,18 +106,33 @@ class AbstractItems extends Block } /** - * Parse product name to title and sku product. + * Get product quantity. * - * @param string $product - * @return array + * @param ElementInterface $item + * @return null|int + */ + private function getQty(ElementInterface $item) + { + $qty = null; + $elements = $item->getElements($this->qty); + foreach ($elements as $element) { + $qty += (int) $element->getText(); + } + return $qty; + } + + /** + * Get product SKU. + * + * @param ElementInterface $item + * @return string */ - protected function parseProductName($product) + private function getSku(ElementInterface $item) { - $data = array_map('trim', explode('SKU:', str_replace("\n", '', $product))); - return [ - 'product' => $data[0], - 'sku' => isset($data[1]) ? $data[1] : '' - ]; + $itemContent = $item->find($this->sku)->getText(); + $itemContent = preg_replace('/\n|\r/', '', $itemContent); + $itemContent = str_replace('SKU: ', '', $itemContent); + return $itemContent; } /** @@ -117,7 +141,7 @@ class AbstractItems extends Block * @var string $price * @return string */ - protected function escapePrice($price) + private function escapePrice($price) { return preg_replace('[^0-9\.]', '', $price); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Billing/Method.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Billing/Method.php index 8477af0087fd47e07b8fee3e6c5138c690369d05..0d443eb1db9ff3c5e3eee8a4efcaffbea5d44df9 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Billing/Method.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Billing/Method.php @@ -7,8 +7,8 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\Create\Billing; use Magento\Mtf\Block\Block; -use Magento\Mtf\Fixture\InjectableFixture; use Magento\Mtf\Client\Locator; +use Magento\Payment\Test\Fixture\CreditCard; /** * Adminhtml sales order create payment method block. @@ -20,66 +20,60 @@ class Method extends Block * * @var string */ - protected $paymentMethod = '#p_method_%s'; + private $paymentMethod = '#p_method_%s'; /** * Purchase order number selector. * * @var string */ - protected $purchaseOrderNumber = '#po_number'; - - /** - * Payment form. - * - * @var string - */ - protected $paymentForm = '#payment_form_%s'; + private $purchaseOrderNumber = '#po_number'; /** * Magento loader selector. * * @var string */ - protected $loader = '[data-role=loader]'; + private $loader = '[data-role=loader]'; /** * Field with Mage error. * * @var string */ - protected $mageErrorField = '//fieldset/*[contains(@class,"field ")][.//*[contains(@class,"error")]]'; + private $mageErrorField = './/*[contains(@name, "payment[")]/following-sibling::label[@class="mage-error"]'; /** - * Mage error text. + * Error label preceding field of credit card form. * * @var string */ - protected $mageErrorText = './/label[contains(@class,"error")]'; + private $errorLabelPrecedingField = './preceding-sibling::*[1][contains(@name, "payment")]'; /** * Select payment method. * - * @param array $paymentCode - * @param InjectableFixture|null $creditCard + * @param array $payment + * @param CreditCard|null $creditCard + * @return void */ - public function selectPaymentMethod(array $paymentCode, InjectableFixture $creditCard = null) + public function selectPaymentMethod(array $payment, CreditCard $creditCard = null) { - $paymentInput = $this->_rootElement->find(sprintf($this->paymentMethod, $paymentCode['method'])); + $paymentMethod = $payment['method']; + $paymentInput = $this->_rootElement->find(sprintf($this->paymentMethod, $paymentMethod)); if ($paymentInput->isVisible()) { $paymentInput->click(); $this->waitForElementNotVisible($this->loader); } - if (isset($paymentCode['po_number'])) { - $this->_rootElement->find($this->purchaseOrderNumber)->setValue($paymentCode['po_number']); + if (isset($payment['po_number'])) { + $this->_rootElement->find($this->purchaseOrderNumber)->setValue($payment['po_number']); } if ($creditCard !== null) { - $class = explode('\\', get_class($creditCard)); - $module = $class[1]; - /** @var \Magento\Payment\Test\Block\Form\Cc $formBlock */ + $module = $creditCard->hasData('payment_code') ? ucfirst($creditCard->getPaymentCode()) : 'Payment'; + /** @var \Magento\Payment\Test\Block\Form\PaymentCc $formBlock */ $formBlock = $this->blockFactory->create( - "\\Magento\\{$module}\\Test\\Block\\Form\\Cc", - ['element' => $this->_rootElement->find('#payment_form_' . $paymentCode['method'])] + "\\Magento\\{$module}\\Test\\Block\\Form\\{$module}Cc", + ['element' => $this->_rootElement->find('#payment_form_' . $paymentMethod)] ); $formBlock->fill($creditCard); } @@ -92,10 +86,9 @@ class Method extends Block { $data = []; $elements = $this->_rootElement->getElements($this->mageErrorField, Locator::SELECTOR_XPATH); - foreach ($elements as $element) { - $error = $element->find($this->mageErrorText, Locator::SELECTOR_XPATH); + foreach ($elements as $error) { if ($error->isVisible()) { - $label = $element->find('.//*[contains(@name,"payment")]', Locator::SELECTOR_XPATH); + $label = $error->find($this->errorLabelPrecedingField, Locator::SELECTOR_XPATH); $label = $label->getAttribute('name'); $label = preg_replace('/payment\[(.*)\]/u', '$1', $label); $data[$label] = $error->getText(); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Totals.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Totals.php index b6b14670c0f56ce8c6439c26fb606b2c35e85dc9..3433447222ccbbd92ee75f161c2c4f24dfb453c1 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Totals.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Totals.php @@ -28,6 +28,13 @@ class Totals extends \Magento\Sales\Test\Block\Adminhtml\Order\Totals */ protected $capture = '[name="invoice[capture_case]"]'; + /** + * Offline capture text message selector. + * + * @var string + */ + private $captureOfflineMessage = './/input[@value="offline"]/following-sibling::div[1]'; + /** * Submit invoice * @@ -58,4 +65,15 @@ class Totals extends \Magento\Sales\Test\Block\Adminhtml\Order\Totals { $this->_rootElement->find($this->capture, Locator::SELECTOR_CSS, 'select')->setValue($option); } + + /** + * Get message that invoice can be created only offline. + * + * @return null|string + */ + public function getCaptureOfflineMessage() + { + $captureCaseMessage = $this->_rootElement->find($this->captureOfflineMessage, Locator::SELECTOR_XPATH); + return $captureCaseMessage->isVisible() ? $captureCaseMessage->getText() : null; + } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/OrderForm.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/OrderForm.php index 757a025605b9b69271e33848a019dd299f6034d9..2261257ca70fe093db941bca8a693d34ce813ae4 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/OrderForm.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/OrderForm.php @@ -7,30 +7,11 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\View; use Magento\Backend\Test\Block\Widget\FormTabs; -use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info as OrderInformationBlock; /** - * Order view tabs + * Order view tabs. */ class OrderForm extends FormTabs { - /** - * Order information block. - * - * @var string - */ - protected $orderInfoBlock = '[data-ui-id="sales-order-tabs-tab-content-order-info"]'; - - /** - * Get order information block. - * - * @return OrderInformationBlock - */ - public function getOrderInfoBlock() - { - return $this->blockFactory->create( - \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info::class, - ['element' => $this->_rootElement->find($this->orderInfoBlock)] - ); - } + // } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/OrderForm.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/OrderForm.xml index 383dfb8b7b6aade39bf531312101387fc5c9bac7..0a5aa8e1993a8e84963b981849f18b19a8a22372 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/OrderForm.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/OrderForm.xml @@ -6,6 +6,11 @@ */ --> <tabs> + <info> + <class>Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info</class> + <selector>#sales_order_view_tabs_order_info</selector> + <strategy>css selector</strategy> + </info> <invoices> <class>Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Invoices</class> <selector>#sales_order_view_tabs_order_invoices</selector> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php index 50c5a077e9b5511bd98d15306a5f3de15f6ad6a0..146e3facccb6196f154af1487053f8e8b17e1991 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php @@ -6,22 +6,30 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\View\Tab; -use Magento\Mtf\Block\Block; +use Magento\Backend\Test\Block\Widget\Tab; +use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info\PaymentInfoBlock; /** * Order information tab block. */ -class Info extends Block +class Info extends Tab { /** - * Order status selector + * Order status selector. * * @var string */ protected $orderStatus = '#order_status'; /** - * Get order status from info block + * Selector for 'Payment Information' block. + * + * @var string + */ + private $paymentInfoBlockSelector = '.order-payment-method'; + + /** + * Get order status from info block. * * @return array|string */ @@ -29,4 +37,17 @@ class Info extends Block { return $this->_rootElement->find($this->orderStatus)->getText(); } + + /** + * Returns Payment Information block. + * + * @return PaymentInfoBlock + */ + public function getPaymentInfoBlock() + { + return $this->blockFactory->create( + PaymentInfoBlock::class, + ['element' => $this->_rootElement->find($this->paymentInfoBlockSelector)] + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/PaymentInfoBlock.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/PaymentInfoBlock.php new file mode 100644 index 0000000000000000000000000000000000000000..818a9b9717cb989c5b352dfed121525f2b7bc4c3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/PaymentInfoBlock.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info; + +use Magento\Mtf\Block\Block; + +/** + * Order payment information block. + */ +class PaymentInfoBlock extends Block +{ + /** + * Payment info row selector. + * + * @var string + */ + private $info = 'tr'; + + /** + * Get payment information block data. + * + * @return array + */ + public function getData() + { + $result = []; + $elements = $this->_rootElement->getElements($this->info); + foreach ($elements as $row) { + $key = rtrim($row->find('th')->getText(), ':'); + $value = $row->find('td')->getText(); + $result[$key] = $value; + } + + return $result; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Invoices/Grid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Invoices/Grid.php index 4b3768295799695fbb45db1a17e75acb193b91f7..41fbd8979b58df8fb58f000e3ea79e0f289344c4 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Invoices/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Invoices/Grid.php @@ -25,6 +25,13 @@ class Grid extends \Magento\Ui\Test\Block\Adminhtml\DataGrid */ protected $invoiceId = 'tbody td:nth-child(2)'; + /** + * Invoices data grid loader locator. + * + * @var string + */ + protected $loader = '[data-component="sales_order_view_invoice_grid"]'; + /** * Filters array mapping. * @@ -57,6 +64,7 @@ class Grid extends \Magento\Ui\Test\Block\Adminhtml\DataGrid public function getIds() { $result = []; + $this->waitForElementNotVisible($this->loader); $invoiceIds = $this->_rootElement->getElements($this->invoiceId); foreach ($invoiceIds as $invoiceId) { $result[] = trim($invoiceId->getText()); @@ -72,6 +80,7 @@ class Grid extends \Magento\Ui\Test\Block\Adminhtml\DataGrid */ public function viewInvoice() { + $this->waitForElementNotVisible($this->loader); $this->_rootElement->find($this->invoiceId)->click(); } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AbstractAssertItems.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AbstractAssertItems.php index 26978343fb2c26336e3e9902f46ca730a54ce6d8..fc9bd8275d650f19bedfebec0fe3f52c836d0623 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AbstractAssertItems.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AbstractAssertItems.php @@ -6,25 +6,25 @@ namespace Magento\Sales\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Checkout\Test\Fixture\Cart; use Magento\Mtf\Constraint\AbstractAssertForm; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Sales\Test\Fixture\OrderInjectable; /** - * Class AbstractAssertArchiveItems - * Assert items represented in order's entity view page + * Assert items represented in order's entity view page. */ abstract class AbstractAssertItems extends AbstractAssertForm { /** - * Key for sort data + * Key for sort data. * * @var string */ protected $sortKey = "::sku"; /** - * List compare fields + * List compare fields. * * @var array */ @@ -35,25 +35,29 @@ abstract class AbstractAssertItems extends AbstractAssertForm ]; /** - * Prepare order products + * Prepare order products. * * @param OrderInjectable $order * @param array|null $data [optional] + * @param Cart|null $cart [optional] * @return array */ - protected function prepareOrderProducts(OrderInjectable $order, array $data = null) + protected function prepareOrderProducts(OrderInjectable $order, array $data = null, Cart $cart = null) { - $products = $order->getEntityId()['products']; $productsData = []; - - /** @var CatalogProductSimple $product */ - foreach ($products as $key => $product) { + if ($cart === null) { + $cart['data']['items'] = ['products' => $order->getEntityId()['products']]; + $fixtureFactory = $this->objectManager->create(FixtureFactory::class); + $cart = $fixtureFactory->createByCode('cart', $cart); + } + /** @var \Magento\Catalog\Test\Fixture\Cart\Item $item */ + foreach ($cart->getItems() as $key => $item) { $productsData[] = [ - 'product' => $product->getName(), - 'sku' => $product->getSku(), + 'product' => $item->getData()['name'], + 'sku' => $item->getData()['sku'], 'qty' => (isset($data[$key]['qty']) && $data[$key]['qty'] != '-') ? $data[$key]['qty'] - : $product->getCheckoutData()['qty'], + : $item->getData()['qty'], ]; } @@ -61,7 +65,7 @@ abstract class AbstractAssertItems extends AbstractAssertForm } /** - * Prepare invoice data + * Prepare invoice data. * * @param array $itemsData * @return array diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php index a6b8e8983d2b617953b93490dc4c3a3e1079cec2..8b34837bc8df3efe77a348070abdcf12de71ac7f 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php @@ -6,8 +6,8 @@ namespace Magento\Sales\Test\Constraint; -use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Mtf\Constraint\AbstractConstraint; /** @@ -16,9 +16,9 @@ use Magento\Mtf\Constraint\AbstractConstraint; class AssertAuthorizationInCommentsHistory extends AbstractConstraint { /** - * Message about authorized amount in order. + * Pattern of message about authorized amount in order. */ - const AUTHORIZED_AMOUNT = 'Authorized amount of $'; + const AUTHORIZED_AMOUNT_PATTERN = '/(IPN "Pending" )*Authorized amount of \w*\W{1,2}%s. Transaction ID: "[\w\-]*"/'; /** * Assert that comment about authorized amount exist in Comments History section on order page in Admin. @@ -37,11 +37,10 @@ class AssertAuthorizationInCommentsHistory extends AbstractConstraint ) { $salesOrder->open(); $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); - $actualAuthorizedAmount = $salesOrderView->getOrderHistoryBlock()->getAuthorizedAmount(); - \PHPUnit_Framework_Assert::assertContains( - self::AUTHORIZED_AMOUNT . $prices['grandTotal'], + \PHPUnit_Framework_Assert::assertRegExp( + sprintf(self::AUTHORIZED_AMOUNT_PATTERN, $prices['grandTotal']), $actualAuthorizedAmount, 'Incorrect authorized amount value for the order #' . $orderId ); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php index c46a161cc63723b6fc4d2376e6f3160ed5e7eb54..90e0e7b091a11f51c04e8f719b3e1b4382080d61 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php @@ -6,6 +6,7 @@ namespace Magento\Sales\Test\Constraint; +use Magento\Sales\Test\Fixture\OrderInjectable; use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Sales\Test\Page\Adminhtml\OrderIndex; use Magento\Mtf\Constraint\AbstractConstraint; @@ -16,9 +17,9 @@ use Magento\Mtf\Constraint\AbstractConstraint; class AssertCaptureInCommentsHistory extends AbstractConstraint { /** - * Message about captured amount in order. + * Pattern of message about captured amount in order. */ - const CAPTURED_AMOUNT = 'Captured amount of $'; + const CAPTURED_AMOUNT_PATTERN = '/^Captured amount of \w*\W{1,2}%s online. Transaction ID: "[\w\-]*"/'; /** * Assert that comment about captured amount exist in Comments History section on order page in Admin. @@ -40,8 +41,8 @@ class AssertCaptureInCommentsHistory extends AbstractConstraint $actualCapturedAmount = $salesOrderView->getOrderHistoryBlock()->getCapturedAmount(); foreach ($capturedPrices as $key => $capturedPrice) { - \PHPUnit_Framework_Assert::assertContains( - self::CAPTURED_AMOUNT . $capturedPrice, + \PHPUnit_Framework_Assert::assertRegExp( + sprintf(self::CAPTURED_AMOUNT_PATTERN, $capturedPrice), $actualCapturedAmount[$key], 'Incorrect captured amount value for the order #' . $orderId ); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertInvoiceItems.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertInvoiceItems.php index 9b43a3917aac199a5dc2e2255f6db5e2eb615dc6..cbcb725df05ffb0516497847f26440ee3f0790d7 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertInvoiceItems.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertInvoiceItems.php @@ -6,6 +6,7 @@ namespace Magento\Sales\Test\Constraint; +use Magento\Checkout\Test\Fixture\Cart; use Magento\Sales\Test\Fixture\OrderInjectable; use Magento\Sales\Test\Page\Adminhtml\InvoiceIndex; use Magento\Sales\Test\Page\Adminhtml\SalesInvoiceView; @@ -23,6 +24,7 @@ class AssertInvoiceItems extends AbstractAssertItems * @param OrderInjectable $order * @param array $ids * @param array|null $data [optional] + * @param Cart|null $cart [optional] * @return void */ public function processAssert( @@ -30,10 +32,11 @@ class AssertInvoiceItems extends AbstractAssertItems SalesInvoiceView $salesInvoiceView, OrderInjectable $order, array $ids, - array $data = null + array $data = null, + Cart $cart = null ) { $orderId = $order->getId(); - $productsData = $this->prepareOrderProducts($order, $data['items_data']); + $productsData = $this->prepareOrderProducts($order, $data['items_data'], $cart); foreach ($ids['invoiceIds'] as $invoiceId) { $filter = [ 'order_id' => $orderId, diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOnlineInvoiceCannotBeCreated.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOnlineInvoiceCannotBeCreated.php new file mode 100644 index 0000000000000000000000000000000000000000..437dc8cc1be280f2edfd46baac79cad24e5748c0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOnlineInvoiceCannotBeCreated.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Constraint; + +use Magento\Sales\Test\Page\Adminhtml\OrderInvoiceNew; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert message that invoice can be created only offline is present. + */ +class AssertOnlineInvoiceCannotBeCreated extends AbstractConstraint +{ + /** + * Message that invoice can be created only offline. + */ + const OFFLINE_INVOICE_MESSAGE = 'The invoice will be created offline without the payment gateway.'; + + /** + * Assert message that invoice can be created only offline is present. + * + * @param SalesOrderView $salesOrderView + * @param OrderIndex $salesOrder + * @param OrderInvoiceNew $orderInvoiceNew + * @param string $orderId + * @return void + */ + public function processAssert( + SalesOrderView $salesOrderView, + OrderIndex $salesOrder, + OrderInvoiceNew $orderInvoiceNew, + $orderId + ) { + $salesOrder->open(); + $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); + $salesOrderView->getPageActions()->invoice(); + + \PHPUnit_Framework_Assert::assertEquals( + self::OFFLINE_INVOICE_MESSAGE, + $orderInvoiceNew->getTotalsBlock()->getCaptureOfflineMessage(), + 'Message incorrect or is not present.' + ); + } + + /** + * Returns string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Message that invoice can be created only offline is present."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderGrandTotal.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderGrandTotal.php index 4c30d5f68d208a2b53f54fd7607f7fec276c7c63..1de6de50612481e6bd90b209fcef59e5b3f68706 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderGrandTotal.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderGrandTotal.php @@ -6,29 +6,29 @@ namespace Magento\Sales\Test\Constraint; -use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Assert that Order Grand Total is correct on order page in backend + * Assert that Order Grand Total is correct on order page in Admin. */ class AssertOrderGrandTotal extends AbstractConstraint { /** - * Assert that Order Grand Total is correct on order page in backend + * Assert that Order Grand Total is correct on order page in Admin. * * @param SalesOrderView $salesOrderView - * @param string $orderId * @param OrderIndex $salesOrder * @param array $prices + * @param string $orderId * @return void */ public function processAssert( SalesOrderView $salesOrderView, OrderIndex $salesOrder, - $orderId, - array $prices + array $prices, + $orderId ) { $salesOrder->open(); $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); @@ -41,7 +41,7 @@ class AssertOrderGrandTotal extends AbstractConstraint } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderPaymentInformation.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderPaymentInformation.php new file mode 100644 index 0000000000000000000000000000000000000000..18119ddbf95d6864311e750bd6844ba43062c73b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderPaymentInformation.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Constraint; + +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; + +/** + * Assert that payment information is valid and matches with expected values. + */ +class AssertOrderPaymentInformation extends AbstractConstraint +{ + /** + * Assert that payment information is valid and matches with expected values. + * + * @param OrderInjectable $order + * @param OrderIndex $orderIndex + * @param SalesOrderView $salesOrderView + * @param array $paymentInfo + * @return void + */ + public function processAssert( + OrderInjectable $order, + OrderIndex $orderIndex, + SalesOrderView $salesOrderView, + array $paymentInfo + ) { + $orderIndex->open(); + $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); + /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */ + $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info'); + $actualPaymentInformation = $infoTab->getPaymentInfoBlock()->getData(); + + \PHPUnit_Framework_Assert::assertEmpty( + array_diff($paymentInfo, $actualPaymentInformation), + 'Payment Information missmatch with expected values.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Payment Information valid and matches with expected values.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderStatusIsCorrect.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderStatusIsCorrect.php index 056e97c1b62626e0e10352d1bae9a078dea9021d..3623de40b06f165bf4f891d19d379f4d9104f336 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderStatusIsCorrect.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderStatusIsCorrect.php @@ -11,13 +11,12 @@ use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertOrderStatusIsCorrect - * Assert that status is correct on order page in backend (same with value of orderStatus variable) + * Assert that status is correct on order page in admin panel (same with value of orderStatus variable). */ class AssertOrderStatusIsCorrect extends AbstractConstraint { /** - * Assert that status is correct on order page in backend (same with value of orderStatus variable) + * Assert that status is correct on order page in admin panel (same with value of orderStatus variable). * * @param string $status * @param string $orderId @@ -37,14 +36,16 @@ class AssertOrderStatusIsCorrect extends AbstractConstraint $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); $orderStatus = $statusToCheck == null ? $status : $statusToCheck; + /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */ + $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info'); \PHPUnit_Framework_Assert::assertEquals( - $salesOrderView->getOrderForm()->getOrderInfoBlock()->getOrderStatus(), + $infoTab->getOrderStatus(), $orderStatus ); } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCommentsHistory.php index 9cbb7b2c9ebbb684fcccbde61c7fc5e9bf82cee4..c0ce2a87fc1c3f62b1a934852c206358a3e76760 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCommentsHistory.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCommentsHistory.php @@ -16,9 +16,9 @@ use Magento\Mtf\Constraint\AbstractConstraint; class AssertRefundInCommentsHistory extends AbstractConstraint { /** - * Message about refunded amount in order. + * Pattern of message about refunded amount in order. */ - const REFUNDED_AMOUNT = 'We refunded $'; + const REFUNDED_AMOUNT_PATTERN = '/^We refunded \w*\W{1,2}%s online. Transaction ID: "[\w\-]*"/'; /** * Assert that comment about refunded amount exist in Comments History section on order page in Admin. @@ -40,8 +40,8 @@ class AssertRefundInCommentsHistory extends AbstractConstraint $actualRefundedAmount = $salesOrderView->getOrderHistoryBlock()->getRefundedAmount(); foreach ($refundedPrices as $key => $refundedPrice) { - \PHPUnit_Framework_Assert::assertContains( - self::REFUNDED_AMOUNT . $refundedPrice, + \PHPUnit_Framework_Assert::assertRegExp( + sprintf(self::REFUNDED_AMOUNT_PATTERN, $refundedPrice), $actualRefundedAmount[$key], 'Incorrect refunded amount value for the order #' . $orderId ); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundOrderStatusInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundOrderStatusInCommentsHistory.php index 89faffc8ec0729082c81839ccd4762fdc335a8f3..557e29a0b9830200381f7651e3807cff39247040 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundOrderStatusInCommentsHistory.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundOrderStatusInCommentsHistory.php @@ -11,7 +11,7 @@ use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Sales\Test\Fixture\OrderInjectable; /** - * Class AssertRefundOrderStatusInCommentsHistory + * Assert that comment about refunded amount exist in Comments History section on order page in Admin. */ class AssertRefundOrderStatusInCommentsHistory extends AbstractConstraint { @@ -30,8 +30,11 @@ class AssertRefundOrderStatusInCommentsHistory extends AbstractConstraint ) { $salesOrder->open(); $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); + + /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */ + $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info'); \PHPUnit_Framework_Assert::assertContains( - $salesOrderView->getOrderForm()->getOrderInfoBlock()->getOrderStatus(), + $infoTab->getOrderStatus(), $salesOrderView->getOrderHistoryBlock()->getStatus() ); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php index 804c607814a3da0cf081cbd9b5fa1b34617d0988..9c034d2ea7085d3aa35bfe5cf06af42edcd672a1 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php @@ -12,13 +12,12 @@ use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertReorderStatusIsCorrect - * Assert that status is correct on order page in backend + * Assert that status is correct on order page in admin panel. */ class AssertReorderStatusIsCorrect extends AbstractConstraint { /** - * Assert that status is correct on order page in backend (same with value of orderStatus variable) + * Assert that status is correct on order page in admin panel (same with value of orderStatus variable). * * @param string $previousOrderStatus * @param OrderInjectable $order @@ -35,15 +34,17 @@ class AssertReorderStatusIsCorrect extends AbstractConstraint $salesOrder->open(); $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); + /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */ + $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info'); \PHPUnit_Framework_Assert::assertEquals( $previousOrderStatus, - $salesOrderView->getOrderForm()->getOrderInfoBlock()->getOrderStatus(), + $infoTab->getOrderStatus(), 'Order status is incorrect on order page in backend.' ); } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/AddProductsStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/AddProductsStep.php index 594f7098e45592f61ba83544f80a742f9eeb5b2e..0caeb235119c86debf0cc6de86e69cbb0f6b3883 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/AddProductsStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/AddProductsStep.php @@ -6,44 +6,55 @@ namespace Magento\Sales\Test\TestStep; +use Magento\Mtf\Fixture\FixtureFactory; use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; use Magento\Mtf\TestStep\TestStepInterface; /** - * Class AddProductsStep - * Add Products Step + * Add Products Step. */ class AddProductsStep implements TestStepInterface { /** - * Sales order create index page + * Sales order create index page. * * @var OrderCreateIndex */ - protected $orderCreateIndex; + private $orderCreateIndex; /** - * Array products + * Array products. * * @var array */ - protected $products; + private $products; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + private $fixtureFactory; /** - * @constructor * @param OrderCreateIndex $orderCreateIndex + * @param FixtureFactory $fixtureFactory * @param array $products */ - public function __construct(OrderCreateIndex $orderCreateIndex, array $products) - { + public function __construct( + OrderCreateIndex $orderCreateIndex, + FixtureFactory $fixtureFactory, + array $products + ) { $this->orderCreateIndex = $orderCreateIndex; $this->products = $products; + $this->fixtureFactory = $fixtureFactory; } /** - * Add product to sales + * Add product to sales. * - * @return void + * @return array */ public function run() { @@ -58,5 +69,8 @@ class AddProductsStep implements TestStepInterface } $createBlock->addSelectedProductsToOrder(); $createBlock->getTemplateBlock()->waitLoader(); + + $cart['data']['items'] = ['products' => $this->products]; + return ['cart' => $this->fixtureFactory->createByCode('cart', $cart)]; } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SelectPaymentMethodForOrderStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SelectPaymentMethodForOrderStep.php index c05dfc4fac2dcbb8bea98ec39c705c9ff419e559..fa0a62d79625e1e23602aed9f37ab153f8d2ee76 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SelectPaymentMethodForOrderStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SelectPaymentMethodForOrderStep.php @@ -6,7 +6,6 @@ namespace Magento\Sales\Test\TestStep; -use Magento\Mtf\Fixture\FixtureFactory; use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; use Magento\Mtf\TestStep\TestStepInterface; use Magento\Payment\Test\Fixture\CreditCard; @@ -38,29 +37,22 @@ class SelectPaymentMethodForOrderStep implements TestStepInterface private $creditCard; /** - * @constructor * @param OrderCreateIndex $orderCreateIndex * @param array $payment - * @param FixtureFactory $fixtureFactory - * @param string $creditCardClass - * @param array|CreditCard|null $creditCard + * @param CreditCard|null $creditCard */ public function __construct( OrderCreateIndex $orderCreateIndex, array $payment, - FixtureFactory $fixtureFactory, - $creditCardClass = 'credit_card', - array $creditCard = null + CreditCard $creditCard = null ) { $this->orderCreateIndex = $orderCreateIndex; $this->payment = $payment; - if (isset($creditCard['dataset'])) { - $this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]); - } + $this->creditCard = $creditCard; } /** - * Fill Payment data + * Fill Payment data. * * @return void */ 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 df10cccbd82136f027f4ee6b236cafe272cdbdc8..157dfc0f77302318bdce435dd3af7f6de5e261fb 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 @@ -91,4 +91,19 @@ <argument name="severity" xsi:type="string">S0</argument> </arguments> </type> + <type name="Magento\Sales\Test\Constraint\AssertOnlineInvoiceCannotBeCreated"> + <arguments> + <argument name="severity" xsi:type="string">S1</argument> + </arguments> + </type> + <type name="Magento\Sales\Test\Constraint\AssertOrderPaymentInformation"> + <arguments> + <argument name="severity" xsi:type="string">S1</argument> + </arguments> + </type> + <type name="Magento\Sales\Test\Constraint\AssertOnlineInvoiceCannotBeCreated"> + <arguments> + <argument name="severity" xsi:type="string">S1</argument> + </arguments> + </type> </config> diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php index e6462e4697aa612c1239b92b3c7b7e847bd252ba..37aa17e95b2ff4803d95d7865f4892190f940e15 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php @@ -6,6 +6,7 @@ namespace Magento\Vault\Test\TestCase; use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\ObjectManager; use Magento\Mtf\TestCase\Injectable; use Magento\Vault\Test\Constraint\AssertCreditCardNotPresentOnCheckout; @@ -95,7 +96,7 @@ class DeleteSavedCreditCardTest extends Injectable if ($key >= 2) { // if this order will be placed via stored credit card $this->useSavedCreditCard($payment['vault']); } else { - $this->selectPaymentMethod($payment, $payment['creditCardClass'], $payment['creditCard']); + $this->selectPaymentMethod($payment, $payment['creditCard']); $this->saveCreditCard($payment, $creditCardSave); } $this->placeOrder(); @@ -105,8 +106,7 @@ class DeleteSavedCreditCardTest extends Injectable for ($i = 2; $i < $paymentsCount; $i++) { $deletedCard = $this->deleteCreditCardFromMyAccount( $customer, - $payments[$i]['creditCard'], - $payments[$i]['creditCardClass'] + $payments[$i]['creditCard'] ); $this->addToCart($products); $this->proceedToCheckout(); @@ -119,9 +119,12 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Setup configuration step. + * * @param $configData + * @return void */ - protected function setupConfiguration($configData) + private function setupConfiguration($configData) { $setupConfigurationStep = ObjectManager::getInstance()->create( \Magento\Config\Test\TestStep\SetupConfigurationStep::class, @@ -132,7 +135,7 @@ class DeleteSavedCreditCardTest extends Injectable } /** - * Create products + * Create products step. * * @param string $productList * @return array @@ -149,6 +152,8 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Add to cart step. + * * @param array $products * @return void */ @@ -162,6 +167,8 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Proceed to checkout step. + * * @return void */ protected function proceedToCheckout() @@ -173,7 +180,10 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Create customer step. + * * @param array $customer + * @return Customer */ protected function createCustomer(array $customer) { @@ -186,8 +196,11 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Select Checkout method step. + * * @param $checkoutMethod * @param $customer + * @return void */ protected function selectCheckoutMethod($checkoutMethod, $customer) { @@ -202,7 +215,10 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Fill shipping address step. + * * @param array $shippingAddress + * @return void */ protected function fillShippingAddress(array $shippingAddress) { @@ -214,9 +230,10 @@ class DeleteSavedCreditCardTest extends Injectable } /** - * Add products to cart + * Add products to cart. * * @param array $shipping + * @return void */ protected function fillShippingMethod(array $shipping) { @@ -228,17 +245,18 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Select payment method step. + * * @param array $payment - * @param $creditCardClass * @param array $creditCard + * @return void */ - protected function selectPaymentMethod(array $payment, $creditCardClass, array $creditCard) + protected function selectPaymentMethod(array $payment, array $creditCard) { $selectPaymentMethodStep = ObjectManager::getInstance()->create( \Magento\Checkout\Test\TestStep\SelectPaymentMethodStep::class, [ 'payment' => $payment, - 'creditCardClass' => $creditCardClass, 'creditCard' => $creditCard, ] ); @@ -250,6 +268,7 @@ class DeleteSavedCreditCardTest extends Injectable * * @param $payment * @param $creditCardSave + * @return void */ protected function saveCreditCard($payment, $creditCardSave) { @@ -264,6 +283,8 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Fill billing information step. + * * @return void */ protected function fillBillingInformation() @@ -275,6 +296,8 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Place order step. + * * @return void */ protected function placeOrder() @@ -286,7 +309,10 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Use saved credit card step. + * * @param $payment + * @return void */ protected function useSavedCreditCard($payment) { @@ -298,18 +324,19 @@ class DeleteSavedCreditCardTest extends Injectable } /** + * Delete credit card from My Account step. + * * @param $customer * @param $creditCard - * @param $creditCardClass + * @return array */ - protected function deleteCreditCardFromMyAccount($customer, $creditCard, $creditCardClass) + protected function deleteCreditCardFromMyAccount($customer, $creditCard) { $deleteCreditCardFromMyAccountStep = ObjectManager::getInstance()->create( \Magento\Vault\Test\TestStep\DeleteCreditCardFromMyAccountStep::class, [ 'customer' => $customer, - 'creditCard' => $creditCard, - 'creditCardClass' => $creditCardClass + 'creditCard' => $creditCard ] ); $deletedCard = $deleteCreditCardFromMyAccountStep->run(); diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.xml b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.xml index 2cafc815fed1dfc1865d1f2627f536d1ba909563..c6daa6ac89d58c68f9edc9c7e9372780107f56a7 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.xml +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.xml @@ -17,23 +17,29 @@ <data name="payments" xsi:type="array"> <item name="0" xsi:type="array"> <item name="method" xsi:type="string">braintree</item> - <item name="creditCardClass" xsi:type="string">credit_card_braintree</item> <item name="creditCard" xsi:type="array"> - <item name="dataset" xsi:type="string">visa_braintree</item> + <item name="dataset" xsi:type="string">visa_default</item> + <item name="data" xsi:type="array"> + <item name="payment_code" xsi:type="string">braintree</item> + </item> </item> </item> <item name="1" xsi:type="array"> <item name="method" xsi:type="string">payflowpro</item> - <item name="creditCardClass" xsi:type="string">credit_card</item> <item name="creditCard" xsi:type="array"> <item name="dataset" xsi:type="string">visa_alt</item> + <item name="data" xsi:type="array"> + <item name="payment_code" xsi:type="string">payment</item> + </item> </item> </item> <item name="2" xsi:type="array"> <item name="method" xsi:type="string">braintree</item> - <item name="creditCardClass" xsi:type="string">credit_card_braintree</item> <item name="creditCard" xsi:type="array"> - <item name="dataset" xsi:type="string">visa_braintree</item> + <item name="dataset" xsi:type="string">visa_default</item> + <item name="data" xsi:type="array"> + <item name="payment_code" xsi:type="string">braintree</item> + </item> </item> <item name="vault" xsi:type="array"> <item name="method" xsi:type="string">braintree_cc_vault</item> @@ -41,9 +47,11 @@ </item> <item name="3" xsi:type="array"> <item name="method" xsi:type="string">payflowpro</item> - <item name="creditCardClass" xsi:type="string">credit_card</item> <item name="creditCard" xsi:type="array"> <item name="dataset" xsi:type="string">visa_alt</item> + <item name="data" xsi:type="array"> + <item name="payment_code" xsi:type="string">payment</item> + </item> </item> <item name="vault" xsi:type="array"> <item name="method" xsi:type="string">payflowpro_cc_vault</item> diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/DeleteCreditCardFromMyAccountStep.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/DeleteCreditCardFromMyAccountStep.php index c3cb46347dd8c50bfa372b84df66231086e054a5..f751108d28b16600c0b61050923174f81a98678c 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/DeleteCreditCardFromMyAccountStep.php +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/DeleteCreditCardFromMyAccountStep.php @@ -7,86 +7,87 @@ namespace Magento\Vault\Test\TestStep; use Magento\Customer\Test\Fixture\Customer; use Magento\Customer\Test\Page\CustomerAccountIndex; -use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Mtf\Fixture\InjectableFixture; use Magento\Mtf\ObjectManager; use Magento\Mtf\TestStep\TestStepInterface; +use Magento\Payment\Test\Fixture\CreditCard; use Magento\Vault\Test\Constraint\AssertStoredPaymentDeletedMessage; use Magento\Vault\Test\Page\StoredPaymentMethods; /** + * Delete credit card from My Account step. + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class DeleteCreditCardFromMyAccountStep implements TestStepInterface { /** + * Customer Fixture. + * * @var Customer */ private $customer; /** + * Object manager. + * * @var ObjectManager */ private $objectManager; /** + * Customer account index page. + * * @var CustomerAccountIndex */ private $customerAccountIndex; /** - * @var FixtureFactory - */ - private $fixtureFactory; - - /** - * @var \Magento\Mtf\Fixture\FixtureInterface + * Credit card fixture. + * + * @var CreditCard */ private $creditCard; /** + * Assert message of success deletion of stored payment method. + * * @var AssertStoredPaymentDeletedMessage */ private $assertStoredPaymentDeletedMessage; /** + * Stored payment methods page. + * * @var StoredPaymentMethods */ private $storedPaymentMethodsPage; /** - * DeleteCreditCardFromMyAccountStep constructor. - * * @param StoredPaymentMethods $storedPaymentMethodsPage * @param Customer $customer * @param ObjectManager $objectManager * @param CustomerAccountIndex $customerAccountIndex - * @param FixtureFactory $fixtureFactory * @param AssertStoredPaymentDeletedMessage $assertStoredPaymentDeletedMessage - * @param array $creditCard - * @param string $creditCardClass + * @param CreditCard $creditCard */ public function __construct( StoredPaymentMethods $storedPaymentMethodsPage, Customer $customer, ObjectManager $objectManager, CustomerAccountIndex $customerAccountIndex, - FixtureFactory $fixtureFactory, AssertStoredPaymentDeletedMessage $assertStoredPaymentDeletedMessage, - array $creditCard, - $creditCardClass = 'credit_card' + CreditCard $creditCard ) { $this->storedPaymentMethodsPage = $storedPaymentMethodsPage; $this->customer = $customer; $this->objectManager = $objectManager; $this->customerAccountIndex = $customerAccountIndex; - $this->fixtureFactory = $fixtureFactory; $this->assertStoredPaymentDeletedMessage = $assertStoredPaymentDeletedMessage; - $this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]); + $this->creditCard = $creditCard; } /** - * @inheritdoc + * Run Delete credit card from My Account step. * * @return array */ diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/SaveCreditCardOnBackendStep.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/SaveCreditCardOnBackendStep.php index 24d1c76c01621fa9b6ce892aa8fd3262e3f7090a..3a378633bd4036737f391185ecd1bebb697609f1 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/SaveCreditCardOnBackendStep.php +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/SaveCreditCardOnBackendStep.php @@ -5,13 +5,12 @@ */ namespace Magento\Vault\Test\TestStep; -use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestStep\TestStepInterface; use Magento\Payment\Test\Fixture\CreditCard; use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; /** - * Class SaveCreditCardOnBackendStep + * Save credit card during order placement from Admin. */ class SaveCreditCardOnBackendStep implements TestStepInterface { @@ -44,22 +43,18 @@ class SaveCreditCardOnBackendStep implements TestStepInterface /** * @param OrderCreateIndex $orderCreateIndex * @param array $payment - * @param FixtureFactory $fixtureFactory - * @param $creditCardClass - * @param array $creditCard + * @param CreditCard $creditCard * @param string $creditCardSave */ public function __construct( OrderCreateIndex $orderCreateIndex, array $payment, - FixtureFactory $fixtureFactory, - $creditCardClass, - array $creditCard, + CreditCard $creditCard, $creditCardSave = 'No' ) { $this->orderCreatePage = $orderCreateIndex; $this->payment = $payment; - $this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]); + $this->creditCard = $creditCard; $this->creditCardSave = $creditCardSave; } diff --git a/dev/tests/functional/utils/generate.php b/dev/tests/functional/utils/generate.php index e374dae4ccfc2fec002e7be5d63782f7b9c357e3..d53ac44451376dd8d8a4dd0c69d5802a2ce6f1fe 100644 --- a/dev/tests/functional/utils/generate.php +++ b/dev/tests/functional/utils/generate.php @@ -3,12 +3,17 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Filesystem; + require_once dirname(__FILE__) . '/' . 'bootstrap.php'; // Generate fixtures $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); $magentoObjectManager = $magentoObjectManagerFactory->create($_SERVER); - +// Remove previously generated static classes +$fs = $magentoObjectManager->create(Filesystem::class); +$fs->getDirectoryWrite(DirectoryList::ROOT)->delete('dev/tests/functional/generated/'); // Generate factories for old end-to-end tests $magentoObjectManager->create(\Magento\Mtf\Util\Generate\Factory::class)->launch();