Skip to content

[WIP] [MFTF] Refactoring AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest #33558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/code/Magento/Payment/Test/Mftf/Data/PaymentMethodData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
<entity name="CashOnDeliveryPaymentMethod" type="payment_method">
<data key="method">cashondelivery</data>
</entity>

<entity name="BankTransferPaymentMethod" type="payment_method">
<data key="method">banktransfer</data>
</entity>
</entities>
7 changes: 6 additions & 1 deletion app/code/Magento/Quote/Test/Mftf/Data/CustomerCartData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@
<requiredEntity type="billing_address">BillingAddressTX</requiredEntity>
</entity>

<entity name="BankTransferPaymentMethod" type="CustomerPaymentInformation">
<var key="cart_id" entityKey="return" entityType="CustomerCart"/>
<requiredEntity type="payment_method">BankTransferPaymentMethod</requiredEntity>
<requiredEntity type="billing_address">BillingAddressTX</requiredEntity>
</entity>

<entity name="GetOrderData" type="CustomerCart">
<var key="cart_id" entityKey="return" entityType="CustomerCart"/>
</entity>

</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,26 @@
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

<!-- Enable Bank Transfer payment -->
<magentoCLI command="config:set {{EnablePaymentBankTransferConfigData.path}} {{EnablePaymentBankTransferConfigData.value}}" stepKey="enableBankTransferPayment"/>

<!--Set default flat rate shipping method settings-->
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>

<!--Create simple customer-->
<createData entity="Simple_US_Customer_CA" stepKey="simpleCustomer"/>

<!-- Create Simple Product -->
<createData entity="SimpleProduct2" stepKey="simpleProduct">
<field key="price">10.00</field>
</createData>

<createData entity="CustomerCart" stepKey="createCustomerCart">
<requiredEntity createDataKey="simpleCustomer"/>
</createData>
<createData entity="CustomerCartItem" stepKey="addCartItem">
<requiredEntity createDataKey="createCustomerCart"/>
<requiredEntity createDataKey="simpleProduct"/>
</createData>
<createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress">
<requiredEntity createDataKey="createCustomerCart"/>
</createData>

</before>
<after>
<magentoCLI command="config:set {{DisablePaymentBankTransferConfigData.path}} {{DisablePaymentBankTransferConfigData.value}}" stepKey="disableBankTransferPayment"/>
Expand All @@ -43,43 +50,35 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<!--Create new customer order-->
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer">
<argument name="customer" value="$$simpleCustomer$$"/>
</actionGroup>

<!--Add Simple product to order-->
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder">
<argument name="product" value="$$simpleProduct$$"/>
</actionGroup>

<!--Select FlatRate shipping method-->
<actionGroup ref="AdminSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToNewOrderWithExistingCustomer"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="addSimpleProductToTheOrder"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFlatRateShippingMethod"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPaymentOptions"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="checkBankTransferOption"/>

<!-- Select bank Transfer payment method -->
<waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/>
<conditionalClick selector="{{AdminOrderFormPaymentSection.bankTransferOption}}" dependentSelector="{{AdminOrderFormPaymentSection.bankTransferOption}}" visible="true" stepKey="checkBankTransferOption"/>
<actionGroup ref="AdminOrderClickSubmitOrderActionGroup" stepKey="submitOrder" />
<updateData createDataKey="createCustomerCart" entity="BankTransferPaymentMethod" stepKey="submitOrder">
<requiredEntity createDataKey="createCustomerCart"/>
</updateData>

<!-- Verify order information -->
<actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="verifyCreatedOrderInformation"/>
<comment userInput="BIC workaround" stepKey="orderId"/>
<grabTextFrom selector="|Order # (\d+)|" stepKey="orderNumber"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="orderNumber"/>
<actionGroup ref="AdminOpenOrderViewPageByOrderIdActionGroup" stepKey="openOrder">
<argument name="orderId" value="$createCustomerCart.return$"/>
</actionGroup>

<!-- Cancel the Order -->
<actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOrder"/>

<!--Log in to Storefront as Customer -->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUp">
<argument name="Customer" value="$$simpleCustomer$$"/>
</actionGroup>

<!-- Assert OrderId and status in frontend order grid -->
<click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('My Orders')}}" stepKey="clickOnMyOrders"/>
<waitForPageLoad stepKey="waitForOrderDetailsToLoad"/>
<actionGroup ref="AdminCheckOrderStatusInGridActionGroup" stepKey="seeOrderStatusInGrid">
<argument name="orderId" value="$orderNumber"/>
<argument name="status" value="Canceled"/>
</actionGroup>
<getData entity="GetOrderData" stepKey="getOrderData">
<requiredEntity createDataKey="createCustomerCart"/>
</getData>

<actionGroup ref="StorefrontOpenMyOrdersPageActionGroup" stepKey="clickOnMyOrders"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForOrderDetailsToLoad"/>
<seeElement selector="{{StorefrontCustomerOrderViewSection.orderStatusInGrid('$createCustomerCart.increment_id$', 'Canceled')}}" stepKey="seeOrderStatusInGrid"/>
</test>
</tests>