Skip to content

Commit 19da1c5

Browse files
committed
MTA-3788: Add variations to place order for Braintree
- MTA-3855: Create test case for failed 3d secure verification
2 parents 98ab501 + 81fe336 commit 19da1c5

File tree

7 files changed

+196
-1
lines changed

7 files changed

+196
-1
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Braintree\Test\Constraint;
8+
9+
use Magento\Checkout\Test\Page\CheckoutOnepage;
10+
use Magento\Mtf\Constraint\AbstractConstraint;
11+
12+
/**
13+
* Assert that 3d secure error message is correct.
14+
*/
15+
class Assert3dSecureFailedMessage extends AbstractConstraint
16+
{
17+
/**
18+
* Error message on checkout.
19+
*/
20+
const ERROR_MESSAGE = 'Please try again with another form of payment.';
21+
22+
/**
23+
* Assert that error message is correct.
24+
*
25+
* @param CheckoutOnepage $checkoutOnepage
26+
* @return void
27+
*/
28+
public function processAssert(CheckoutOnepage $checkoutOnepage)
29+
{
30+
\PHPUnit_Framework_Assert::assertEquals(
31+
self::ERROR_MESSAGE,
32+
$checkoutOnepage->getMessagesBlock()->getErrorMessage(),
33+
'Wrong error message is displayed.'
34+
);
35+
}
36+
37+
/**
38+
* Returns string representation of successful assertion.
39+
*
40+
* @return string
41+
*/
42+
public function toString()
43+
{
44+
return 'Error message on Checkout onepage page is correct.';
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Braintree\Test\TestCase;
8+
9+
use Magento\Mtf\TestCase\Scenario;
10+
11+
/**
12+
* Preconditions:
13+
* 1. Configure payment method.
14+
* 2. Create products.
15+
*
16+
* Steps:
17+
* 1. Log in Storefront.
18+
* 2. Add products to the Shopping Cart.
19+
* 5. Click the 'Proceed to Checkout' button.
20+
* 6. Fill shipping information.
21+
* 7. Select shipping method.
22+
* 8. Select payment method.
23+
* 9. Verify order total on review step.
24+
* 10. Click 'Place Order' button.
25+
* 11. Specify password in 3D Secure popup.
26+
* 12. Click 'Submit'.
27+
* 13. Perform assertions.
28+
*
29+
* @group Braintree
30+
* @ZephyrId MAGETWO-46477
31+
*/
32+
class OnePageCheckoutWith3dSecureFailedTest extends Scenario
33+
{
34+
/* tags */
35+
const MVP = 'yes';
36+
const TEST_TYPE = '3rd_party_test';
37+
const SEVERITY = 'S1';
38+
/* end tags */
39+
40+
/**
41+
* Verifies error message on Onepage Checkout if 3d secure validation is failed.
42+
*
43+
* @return void
44+
*/
45+
public function test()
46+
{
47+
$this->executeScenario();
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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\OnePageCheckoutWith3dSecureFailedTest" summary="Onepage checkout with Braintree payment method with 3D Secure enabled.">
10+
<variation name="OnePageCheckoutBraintree3dSecureFailedTestVariation1" summary="Guest Checkout with Braintree Credit Card from Storefront with 3D Secure verification failed" ticketId="MAGETWO-46477">
11+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
12+
<data name="customer/dataset" xsi:type="string">default</data>
13+
<data name="shippingAddress/dataset" xsi:type="string">US_address_1</data>
14+
<data name="checkoutMethod" xsi:type="string">guest</data>
15+
<data name="shipping/shipping_service" xsi:type="string">Flat Rate</data>
16+
<data name="shipping/shipping_method" xsi:type="string">Fixed</data>
17+
<data name="payment/method" xsi:type="string">braintree</data>
18+
<data name="creditCardClass" xsi:type="string">credit_card_braintree</data>
19+
<data name="creditCard/dataset" xsi:type="string">visa_braintree_3dsecure_failed</data>
20+
<data name="secure3d/dataset" xsi:type="string">secure3d_braintree</data>
21+
<data name="configData" xsi:type="string">braintree, braintree_3d_secure</data>
22+
<data name="status" xsi:type="string">Processing</data>
23+
<data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
24+
<constraint name="Magento\Braintree\Test\Constraint\Assert3dSecureFailedMessage" />
25+
</variation>
26+
</testCase>
27+
</config>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Braintree\Test\TestStep;
8+
9+
use Magento\Checkout\Test\Page\CheckoutOnepage;
10+
use Magento\Mtf\TestStep\TestStepInterface;
11+
use Magento\Braintree\Test\Fixture\Secure3dBraintree;
12+
13+
/**
14+
* Click 'Place order' button and submit 3D secure verification step.
15+
*/
16+
class PlaceOrderWith3dSecureFailedStep implements TestStepInterface
17+
{
18+
/**
19+
* Onepage checkout page.
20+
*
21+
* @var CheckoutOnepage
22+
*/
23+
private $checkoutOnepage;
24+
25+
/**
26+
* 3D Secure fixture.
27+
*
28+
* @var Secure3dBraintree
29+
*/
30+
private $secure3d;
31+
32+
/**
33+
* @param CheckoutOnepage $checkoutOnepage
34+
* @param Secure3dBraintree $secure3d
35+
*/
36+
public function __construct(
37+
CheckoutOnepage $checkoutOnepage,
38+
Secure3dBraintree $secure3d
39+
) {
40+
$this->checkoutOnepage = $checkoutOnepage;
41+
$this->secure3d = $secure3d;
42+
}
43+
44+
/**
45+
* Click 'Place order' button and submit 3D secure verification.
46+
*
47+
* @return array
48+
*/
49+
public function run()
50+
{
51+
$this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
52+
53+
$this->checkoutOnepage->getBraintree3dSecureBlock()->fill($this->secure3d);
54+
}
55+
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@
1616
<argument name="severity" xsi:type="string">S1</argument>
1717
</arguments>
1818
</type>
19+
<type name="Magento\Braintree\Test\Constraint\Assert3dSecureFailedMessage">
20+
<arguments>
21+
<argument name="severity" xsi:type="string">S1</argument>
22+
</arguments>
23+
</type>
1924
</config>

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
<step name="fillBillingInformation" module="Magento_Checkout" next="placeOrderWith3dSecure" />
2222
<step name="placeOrderWith3dSecure" module="Magento_Braintree" />
2323
</scenario>
24+
<scenario name="OnePageCheckoutWith3dSecureFailedTest" firstStep="setupConfiguration">
25+
<step name="setupConfiguration" module="Magento_Config" next="createProducts" />
26+
<step name="createProducts" module="Magento_Catalog" next="addProductsToTheCart" />
27+
<step name="addProductsToTheCart" module="Magento_Checkout" next="proceedToCheckout" />
28+
<step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer" />
29+
<step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod" />
30+
<step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress" />
31+
<step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" />
32+
<step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod" />
33+
<step name="selectPaymentMethod" module="Magento_Checkout" next="fillBillingInformation" />
34+
<step name="fillBillingInformation" module="Magento_Checkout" next="placeOrderWith3dSecureFailed" />
35+
<step name="placeOrderWith3dSecureFailed" module="Magento_Braintree" />
36+
</scenario>
2437
<scenario name="UseVaultWith3dSecureOnCheckoutTest" firstStep="setupConfiguration">
2538
<step name="setupConfiguration" module="Magento_Config" next="createProducts" />
2639
<step name="createProducts" module="Magento_Catalog" next="addProductsToTheCart" />

dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
<block name="paymentBlock" class="Magento\Checkout\Test\Block\Onepage\Payment" locator="#checkout-step-payment" strategy="css selector" />
1515
<block name="discountCodesBlock" class="Magento\Checkout\Test\Block\Onepage\Payment\DiscountCodes" locator=".discount-code" strategy="css selector" />
1616
<block name="reviewBlock" class="Magento\Checkout\Test\Block\Onepage\Review" locator=".opc-block-summary" strategy="css selector" />
17-
<block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".page.messages" strategy="css selector" />
17+
<block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="//*[@id='checkout']//div[@data-role='checkout-messages' and .//div]" strategy="xpath" />
1818
</page>
1919
</config>

0 commit comments

Comments
 (0)