Skip to content

Commit a9e285d

Browse files
author
Roman Liukshyn
committed
MTA-560: Re-factor Tests for Online Onepage Checkout
- CR Changes
1 parent ead4747 commit a9e285d

File tree

8 files changed

+31
-17
lines changed

8 files changed

+31
-17
lines changed

dev/tests/functional/credentials.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<field path="section/carriers_usps_userid/value" value="" />
2626
<field path="section/carriers_usps_password/value" value="" />
2727

28+
<field path="section/payment_authorizenet_login/value" value="" />
29+
<field path="section/payment_authorizenet_trans_key/value" value="" />
30+
2831
<field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_business_account/value" value="" />
2932
<field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_api_username/value" value="" />
3033
<field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_api_password/value" value="" />

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Methods.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class Methods extends Form
6262
* Select payment method
6363
*
6464
* @param array $payment
65-
* @param CreditCard $creditCard
65+
* @param CreditCard|null $creditCard
6666
* @throws \Exception
6767
* @return void
6868
*/
69-
public function selectPaymentMethod(array $payment, CreditCard $creditCard)
69+
public function selectPaymentMethod(array $payment, CreditCard $creditCard = null)
7070
{
7171
$paymentSelector = $this->_rootElement->find(sprintf($this->paymentMethodInput, $payment['method']));
7272
if ($paymentSelector->isVisible()) {
@@ -81,7 +81,7 @@ public function selectPaymentMethod(array $payment, CreditCard $creditCard)
8181
if ($payment['method'] == "purchaseorder") {
8282
$this->_rootElement->find($this->purchaseOrderNumber)->setValue($payment['po_number']);
8383
}
84-
if ($creditCard->hasData()) {
84+
if ($creditCard !== null) {
8585
/** @var \Magento\Payment\Test\Block\Form\Cc $formBlock */
8686
$formBlock = $this->blockFactory->create(
8787
'\\Magento\\Payment\\Test\\Block\\Form\\Cc',

dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class FillShippingMethodStep implements TestStepInterface
3434
* @param CheckoutOnepage $checkoutOnepage
3535
* @param array $shipping
3636
*/
37-
public function __construct(CheckoutOnepage $checkoutOnepage, $shipping = [])
37+
public function __construct(CheckoutOnepage $checkoutOnepage, array $shipping = [])
3838
{
3939
$this->checkoutOnepage = $checkoutOnepage;
4040
$this->shipping = $shipping;

dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ class SelectPaymentMethodStep implements TestStepInterface
4040
/**
4141
* @constructor
4242
* @param CheckoutOnepage $checkoutOnepage
43-
* @param CreditCard $creditCard
4443
* @param array $payment
44+
* @param CreditCard|null $creditCard
4545
*/
4646
public function __construct(
4747
CheckoutOnepage $checkoutOnepage,
48-
CreditCard $creditCard,
49-
array $payment
48+
array $payment,
49+
CreditCard $creditCard = null
5050
) {
5151
$this->checkoutOnepage = $checkoutOnepage;
5252
$this->payment = $payment;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
<scenario name="OnePageCheckoutTest" firstStep="setupConfiguration">
1010
<step name="setupConfiguration" module="Magento_Core" next="createProducts"/>
1111
<step name="createProducts" module="Magento_Catalog" next="createTaxRule"/>
12-
<step name="createTaxRule" module="Magento_Tax" next="createRewardExchangeRates"/>
12+
<step name="createTaxRule" module="Magento_Tax" next="addProductsToTheCart"/>
1313
<step name="addProductsToTheCart" module="Magento_Checkout" next="estimateShippingAndTax"/>
14-
<step name="estimateShippingAndTax" module="Magento_Checkout" next="applyGiftCard"/>
14+
<step name="estimateShippingAndTax" module="Magento_Checkout" next="proceedToCheckout"/>
1515
<step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer"/>
16-
<step name="createCustomer" module="Magento_Customer" next="applyCustomerBalanceToCustomer"/>
16+
<step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod"/>
1717
<step name="selectCheckoutMethod" module="Magento_Checkout" next="fillBillingInformation"/>
1818
<step name="fillBillingInformation" module="Magento_Checkout" next="fillShippingMethod"/>
19-
<step name="fillShippingMethod" module="Magento_Checkout" next="selectStoreCredit"/>
19+
<step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod"/>
2020
<step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrder"/>
2121
<step name="placeOrder" module="Magento_Checkout"/>
2222
</scenario>

dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/Curl.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function prepareData(FixtureInterface $fixture)
5959
$fields = $fixture->getData();
6060
if (isset($fields['section'])) {
6161
foreach ($fields['section'] as $itemSection) {
62-
parse_str($this->modify($itemSection), $configPath);
62+
parse_str($this->modifyConfigPath($itemSection), $configPath);
6363
$result = array_merge_recursive($result, $configPath);
6464
}
6565
}
@@ -69,10 +69,12 @@ protected function prepareData(FixtureInterface $fixture)
6969
/**
7070
* Modify config path.
7171
*
72-
* @param $input
72+
* From payment/cashondelivery/active to ['payment']['groups']['cashondelivery']['fields']['active']
73+
*
74+
* @param array $input
7375
* @return string
7476
*/
75-
protected function modify($input)
77+
protected function modifyConfigPath(array $input)
7678
{
7779
$resultArray = '';
7880
$path = explode('/', $input['path']);

dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
use Magento\Mtf\Constraint\AbstractConstraint;
1212

1313
/**
14-
* Assert that comment about authorized amount exist in Comments History section on order page in backend
14+
* Assert that comment about authorized amount exist in Comments History section on order page in backend.
1515
*/
1616
class AssertOrderCommentsHistory extends AbstractConstraint
1717
{
18+
/**
19+
* Message about authorized amount in order.
20+
*/
21+
const AUTHORIZED_AMOUNT = 'Authorized amount of $';
22+
1823
/**
1924
* Assert that comment about authorized amount exist in Comments History section on order page in backend.
2025
*
@@ -34,10 +39,9 @@ public function processAssert(
3439
$salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
3540

3641
$actualAuthorizedAmount = $salesOrderView->getOrderHistoryBlock()->getCommentsHistory();
37-
$expectedAuthorizedAmount = 'Authorized amount of $' . $grandTotal;
3842

3943
\PHPUnit_Framework_Assert::assertContains(
40-
$expectedAuthorizedAmount,
44+
self::AUTHORIZED_AMOUNT . $grandTotal,
4145
$actualAuthorizedAmount,
4246
'Incorrect authorized amount value for the order #' . $orderId
4347
);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@
2626
<argument name="severity" xsi:type="string">high</argument>
2727
</arguments>
2828
</type>
29+
<type name="Magento\Sales\Test\Constraint\AssertOrderCommentsHistory">
30+
<arguments>
31+
<argument name="severity" xsi:type="string">high</argument>
32+
</arguments>
33+
</type>
2934
</config>

0 commit comments

Comments
 (0)