Skip to content

Commit d323e1e

Browse files
committed
MAGETWO-59199: Create Functional test for PayPal Braintree Vault
- Covered a place order case from Admin by PayPal Braintree Vault token
1 parent e5f266d commit d323e1e

File tree

4 files changed

+151
-0
lines changed

4 files changed

+151
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Test\TestCase;
7+
8+
use Magento\Mtf\TestCase\Scenario;
9+
10+
/**
11+
* Preconditions:
12+
* 1. Configure shipping method.
13+
* 2. Configure payment method.
14+
* 3. Create products.
15+
* 4. Create and setup customer.
16+
*
17+
* * Steps:
18+
* 1. Log in Storefront.
19+
* 2. Add products to the Shopping Cart.
20+
* 3. In 'Estimate Shipping and Tax' section specify destination using values from Test Data.
21+
* 4. Click the 'Proceed to Checkout' button.
22+
* 5. Fill shipping information.
23+
* 6. Select shipping method.
24+
* 8. Select payment method
25+
* 9. Verify order total on review step.
26+
* 10. Click 'Continue to PayPal' button.
27+
* 11. Click 'Proceed purchase' in popup.
28+
* 12. Log in Admin panel.
29+
* 13. Open placed order.
30+
* 14. Click 'Reorder' button.
31+
* 15. Select stored Braintree PayPal token.
32+
* 16. Click 'Submit Order'.
33+
* 17. Perform assertions.
34+
*
35+
* @group Braintree
36+
* @ZephyrId MAGETWO-59259
37+
*/
38+
class CreateOrderWithPayPalBraintreeVaultBackendTest extends Scenario
39+
{
40+
/* tags */
41+
const MVP = 'yes';
42+
43+
const TEST_TYPE = '3rd_party_test';
44+
45+
const SEVERITY = 'S0';
46+
/* end tags */
47+
48+
/**
49+
* Runs test scenario
50+
* @return void
51+
*/
52+
public function test()
53+
{
54+
$this->executeScenario();
55+
}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Braintree\Test\TestCase\CreateOrderWithPayPalBraintreeVaultBackendTest" summary="Checkout with PayPal Braintree Vault token from Admin">
10+
<variation name="CreateOrderWithPayPalBraintreeVaultBackendTestVariation1" summary="Checkout with PayPal Braintree Vault token from Admin" ticketId="MAGETWO-59259">
11+
<data name="tag" xsi:type="string">est_type:3rd_party_test,severity:S0</data>
12+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
13+
<data name="customer/dataset" xsi:type="string">default</data>
14+
<data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data>
15+
<data name="checkoutMethod" xsi:type="string">login</data>
16+
<data name="shipping/shipping_service" xsi:type="string">Flat Rate</data>
17+
<data name="shipping/shipping_method" xsi:type="string">Fixed</data>
18+
<data name="payment/method" xsi:type="string">braintree_paypal</data>
19+
<data name="status" xsi:type="string">Processing</data>
20+
<data name="configData" xsi:type="string">braintree, braintree_paypal, braintree_paypal_skip_order_review</data>
21+
<data name="prices" xsi:type="array">
22+
<item name="grandTotal" xsi:type="string">15.00</item>
23+
</data>
24+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
25+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
26+
<constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
27+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" />
28+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" />
29+
</variation>
30+
</testCase>
31+
</config>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Test\TestStep;
7+
8+
use Magento\Mtf\TestStep\TestStepInterface;
9+
use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex;
10+
11+
/**
12+
* Selects Braintree PayPal Vault stored payment method
13+
*/
14+
class UsePayPalVaultTokenStep implements TestStepInterface
15+
{
16+
/**
17+
* @var OrderCreateIndex
18+
*/
19+
private $orderCreateIndex;
20+
21+
/**
22+
* @var array
23+
*/
24+
private $payment;
25+
26+
/**
27+
* UsePayPalVaultToken constructor.
28+
* @param OrderCreateIndex $orderCreateIndex
29+
* @param array $payment
30+
*/
31+
public function __construct(OrderCreateIndex $orderCreateIndex, array $payment)
32+
{
33+
$this->orderCreateIndex = $orderCreateIndex;
34+
$this->payment = $payment;
35+
}
36+
37+
/**
38+
* @inheritdoc
39+
*/
40+
public function run()
41+
{
42+
$block = $this->orderCreateIndex->getCreateBlock();
43+
$this->payment['method'] = 'braintree_paypal_vault';
44+
$block->selectPaymentMethod($this->payment);
45+
$block->selectVaultToken('token_switcher_' . $this->payment['method']);
46+
}
47+
}

dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,21 @@
158158
<step name="changeOrderStatusToPaymentReview" module="Magento_Braintree" next="denyPayment" />
159159
<step name="denyPayment" module="Magento_Braintree" />
160160
</scenario>
161+
<scenario name="CreateOrderWithPayPalBraintreeVaultBackendTest" firstStep="setupConfiguration">
162+
<step name="setupConfiguration" module="Magento_Config" next="createProducts" />
163+
<step name="createProducts" module="Magento_Catalog" next="addProductsToTheCart" />
164+
<step name="addProductsToTheCart" module="Magento_Checkout" next="estimateShippingAndTax" />
165+
<step name="estimateShippingAndTax" module="Magento_Checkout" next="clickProceedToCheckout" />
166+
<step name="clickProceedToCheckout" module="Magento_Checkout" next="createCustomer" />
167+
<step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod" />
168+
<step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress" />
169+
<step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" />
170+
<step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod" />
171+
<step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrderWithPaypal" />
172+
<step name="placeOrderWithPaypal" module="Magento_Braintree" next="openOrder"/>
173+
<step name="openOrder" module="Magento_Sales" next="reorder" />
174+
<step name="reorder" module="Magento_Sales" next="usePayPalVaultToken" />
175+
<step name="usePayPalVaultToken" module="Magento_Braintree" next="submitOrder" />
176+
<step name="submitOrder" module="Magento_Sales" />
177+
</scenario>
161178
</config>

0 commit comments

Comments
 (0)