forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'mpi/MAGETWO-48211' into pr-mpi-200416
- Loading branch information
Showing
10 changed files
with
459 additions
and
58 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...l/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Braintree\Test\TestCase; | ||
|
||
use Magento\Mtf\TestCase\Scenario; | ||
|
||
/** | ||
* Preconditions: | ||
* 1. PLace order via Briantree PayPal. | ||
* | ||
* Steps: | ||
* 1. Log in to Admin. | ||
* 2. Open created order. | ||
* 3. Create credit memo. | ||
* 4. Perform assertions. | ||
* | ||
* @group Braintree_(CS) | ||
* @ZephyrId MAGETWO-48689, MAGETWO-48698 | ||
*/ | ||
class CreateOnlineCreditMemoBraintreePaypalTest extends Scenario | ||
{ | ||
/* tags */ | ||
const MVP = 'yes'; | ||
const DOMAIN = 'CS'; | ||
const TEST_TYPE = '3rd_party_test'; | ||
/* end tags */ | ||
|
||
/** | ||
* Runs test for online credit memo creation for order placed via Braintree PayPal. | ||
* | ||
* @return void | ||
*/ | ||
public function test() | ||
{ | ||
$this->executeScenario(); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...l/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?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\Braintree\Test\TestCase\CreateOnlineCreditMemoBraintreePaypalTest" summary="Create online credit memo for Braintree credit card" ticketId="MAGETWO-38324"> | ||
<variation name="CreateCreditMemoBraintreePaypalTestVariation1" summary="Full refund of order placed within Braintree PayPal" ticketId="MAGETWO-48689"> | ||
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, bundleProduct::bundle_fixed_100_dollar_product</data> | ||
<data name="customer/dataset" xsi:type="string">default</data> | ||
<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> | ||
</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> | ||
<data name="shipping/shipping_method" xsi:type="string">Fixed</data> | ||
<data name="payment/method" xsi:type="string">braintree_paypal</data> | ||
<data name="configData" xsi:type="string">braintree, braintree_paypal_sale</data> | ||
<data name="paymentAction" xsi:type="string">sale</data> | ||
<data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Credit Memo, Hold, Ship, Reorder</data> | ||
<data name="data/items_data/0/qty" xsi:type="string">-</data> | ||
<data name="tag" xsi:type="string">test_type:3rd_party_test</data> | ||
<constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" /> | ||
<constraint name="Magento\Sales\Test\Constraint\AssertRefundInCreditMemoTab" /> | ||
<constraint name="Magento\Sales\Test\Constraint\AssertRefundInCommentsHistory" /> | ||
</variation> | ||
<variation name="CreateOnlineCreditMemoBraintreePaypalTestVariation2" summary="Partial refund of order placed within Braintree PayPal" ticketId="MAGETWO-48698"> | ||
<data name="products" xsi:type="string">catalogProductSimple::simple_for_sales</data> | ||
<data name="customer/dataset" xsi:type="string">default</data> | ||
<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> | ||
</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> | ||
<data name="shipping/shipping_method" xsi:type="string">Fixed</data> | ||
<data name="payment/method" xsi:type="string">braintree_paypal</data> | ||
<data name="configData" xsi:type="string">braintree, braintree_paypal</data> | ||
<data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Credit Memo, Hold, Ship, Reorder</data> | ||
<data name="data/items_data/0/qty" xsi:type="string">2</data> | ||
<data name="refundData/items_data/0/qty" xsi:type="string">1</data> | ||
<data name="order/dataset" xsi:type="string">default</data> | ||
<data name="isCreditMemoPartial" xsi:type="string">Yes</data> | ||
<data name="tag" xsi:type="string">test_type:3rd_party_test</data> | ||
<constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" /> | ||
<constraint name="Magento\Sales\Test\Constraint\AssertRefundInCreditMemoTab" /> | ||
<constraint name="Magento\Sales\Test\Constraint\AssertRefundInCommentsHistory" /> | ||
</variation> | ||
</testCase> | ||
</config> |
127 changes: 127 additions & 0 deletions
127
...ts/functional/tests/app/Magento/Braintree/Test/TestStep/CreateBraintreeCreditMemoStep.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Braintree\Test\TestStep; | ||
|
||
use Magento\Config\Test\Fixture\ConfigData; | ||
use Magento\Mtf\ObjectManager; | ||
use Magento\Sales\Test\Fixture\OrderInjectable; | ||
use Magento\Sales\Test\Page\Adminhtml\OrderCreditMemoNew; | ||
use Magento\Sales\Test\Page\Adminhtml\OrderIndex; | ||
use Magento\Sales\Test\Page\Adminhtml\OrderInvoiceView; | ||
use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; | ||
use Magento\Mtf\TestStep\TestStepInterface; | ||
use Braintree\Gateway; | ||
|
||
/** | ||
* Create credit memo for order placed via Braintree credit card payment method. | ||
*/ | ||
class CreateBraintreeCreditMemoStep implements TestStepInterface | ||
{ | ||
/** | ||
* Orders Page. | ||
* | ||
* @var OrderIndex | ||
*/ | ||
private $orderIndex; | ||
|
||
/** | ||
* Order View Page. | ||
* | ||
* @var SalesOrderView | ||
*/ | ||
private $salesOrderView; | ||
|
||
/** | ||
* OrderCreditMemoNew Page. | ||
* | ||
* @var OrderCreditMemoNew | ||
*/ | ||
private $orderCreditMemoNew; | ||
|
||
/** | ||
* OrderInjectable fixture. | ||
* | ||
* @var OrderInjectable | ||
*/ | ||
private $order; | ||
|
||
/** | ||
* Credit memo data. | ||
* | ||
* @var array|null | ||
*/ | ||
private $refundData; | ||
|
||
/** | ||
* Order invoice view page. | ||
* | ||
* @var OrderInvoiceView | ||
*/ | ||
private $orderInvoiceView; | ||
|
||
/** | ||
* @construct | ||
* @param OrderIndex $orderIndex | ||
* @param SalesOrderView $salesOrderView | ||
* @param OrderInjectable $order | ||
* @param OrderInvoiceView $orderInvoiceView | ||
* @param OrderCreditMemoNew $orderCreditMemoNew | ||
* @param array|null refundData [optional] | ||
*/ | ||
public function __construct( | ||
OrderIndex $orderIndex, | ||
SalesOrderView $salesOrderView, | ||
OrderInjectable $order, | ||
OrderInvoiceView $orderInvoiceView, | ||
OrderCreditMemoNew $orderCreditMemoNew, | ||
$refundData = null | ||
) { | ||
$this->orderIndex = $orderIndex; | ||
$this->salesOrderView = $salesOrderView; | ||
$this->order = $order; | ||
$this->orderCreditMemoNew = $orderCreditMemoNew; | ||
$this->refundData = $refundData; | ||
$this->orderInvoiceView = $orderInvoiceView; | ||
} | ||
|
||
/** | ||
* Create credit memo. | ||
* | ||
* @return array | ||
*/ | ||
public function run() | ||
{ | ||
$this->orderIndex->open(); | ||
$this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); | ||
/** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Invoices\Grid $invoicesGrid */ | ||
$invoicesGrid = $this->salesOrderView->getOrderForm()->getTab('invoices')->getGridBlock(); | ||
$this->salesOrderView->getOrderForm()->openTab('invoices'); | ||
$invoicesGrid->viewInvoice(); | ||
$this->salesOrderView->getPageActions()->orderInvoiceCreditMemo(); | ||
if (!empty($this->refundData)) { | ||
$this->orderCreditMemoNew->getFormBlock()->fillProductData( | ||
$this->refundData, | ||
$this->order->getEntityId()['products'] | ||
); | ||
$this->orderCreditMemoNew->getFormBlock()->updateQty(); | ||
} | ||
$this->orderCreditMemoNew->getFormBlock()->submit(); | ||
|
||
return ['ids' => ['creditMemoIds' => $this->getCreditMemoIds()]]; | ||
} | ||
|
||
/** | ||
* Get credit memo ids. | ||
* | ||
* @return array | ||
*/ | ||
private function getCreditMemoIds() | ||
{ | ||
$this->salesOrderView->getOrderForm()->openTab('creditmemos'); | ||
return $this->salesOrderView->getOrderForm()->getTab('creditmemos')->getGridBlock()->getIds(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.