Skip to content

Commit 2baf254

Browse files
PLGMAG2V2-521: Add MFTF checkout and refund end-to-end tests (#527)
* Create direct order tests 1 * Add refund test for iDEAL Direct * Add refund action groups * Add Bancontact test * Disable payment method after finishing the test * Add missing license notices
1 parent 1205e34 commit 2baf254

24 files changed

+917
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is provided with Magento in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
*
12+
* Copyright © 2022 MultiSafepay, Inc. All rights reserved.
13+
* See DISCLAIMER.md for disclaimer details.
14+
*
15+
*/
16+
-->
17+
18+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
20+
<actionGroup name="AdminAssertCreditMemoSuccessfullyCreatedActionGroup">
21+
<annotations>
22+
<description>Asserts the credit memo and refund.</description>
23+
</annotations>
24+
<arguments>
25+
<argument name="subTotal" defaultValue="1.23" type="string"/>
26+
<argument name="adjustmentRefund" defaultValue="0.10" type="string"/>
27+
<argument name="adjustmentFee" defaultValue="0.20" type="string"/>
28+
<argument name="grandTotal" defaultValue="2.34" type="string"/>
29+
</arguments>
30+
31+
<!-- Perform all assertions: assert refund success create message -->
32+
<see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You created the credit memo." stepKey="assertRefundSuccessCreateMessage"/>
33+
34+
<!--Assert refund in Credit Memo Tab -->
35+
<click selector="{{AdminOrderDetailsOrderViewSection.creditMemos}}" stepKey="clickCreditMemoTab"/>
36+
<waitForPageLoad stepKey="waitForTabLoad"/>
37+
<grabTextFrom selector="{{AdminCreditMemosGridSection.memoId}}" stepKey="grabMemoId"/>
38+
<assertNotEmpty stepKey="assertMemoIdIsNotEmpty" after="grabMemoId">
39+
<actualResult type="const">$grabMemoId</actualResult>
40+
</assertNotEmpty>
41+
<click selector="{{AdminCreditMemosGridSection.memoId}}" stepKey="clickView"/>
42+
<waitForPageLoad stepKey="waitForCreditMemo"/>
43+
<scrollTo selector="{{AdminCreditMemoViewTotalSection.subtotal}}" stepKey="scrollToTotal"/>
44+
<see selector="{{AdminCreditMemoViewTotalSection.subtotal}}" userInput="€{{subTotal}}" stepKey="seeSubtotal"/>
45+
<see selector="{{AdminCreditMemoViewTotalSection.adjustmentRefund}}" userInput="€{{adjustmentRefund}}" stepKey="seeAdjustmentRefund"/>
46+
<see selector="{{AdminCreditMemoViewTotalSection.adjustmentFee}}" userInput="€{{adjustmentFee}}" stepKey="seeAdjustmentFee"/>
47+
<see selector="{{AdminCreditMemoViewTotalSection.grandTotal}}" userInput="€{{grandTotal}}" stepKey="assertRefundOnCreditMemoTab"/>
48+
</actionGroup>
49+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is provided with Magento in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
*
12+
* Copyright © 2022 MultiSafepay, Inc. All rights reserved.
13+
* See DISCLAIMER.md for disclaimer details.
14+
*
15+
*/
16+
-->
17+
18+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
20+
<actionGroup name="AdminCreateNewCreditMemoFromInvoiceViewActionGroup">
21+
<annotations>
22+
<description>Creates a credit memo on the invoice view</description>
23+
</annotations>
24+
<arguments>
25+
<argument name="adjustmentRefund" defaultValue="" type="string"/>
26+
<argument name="adjustmentFee" defaultValue="" type="string"/>
27+
</arguments>
28+
<click selector="{{AdminInvoiceMainActionsSection.openNewCreditMemoFromInvoice}}" stepKey="clickCreditMemo"/>
29+
<click selector="{{AdminCreditMemoItemsSection.itemReturnToStock('1')}}" stepKey="returnToStockCheckbox"/>
30+
<fillField userInput="{{adjustmentRefund}}" selector="{{AdminCreditMemoTotalSection.adjustmentRefund}}" stepKey="fillAdjustmentRefund"/>
31+
<fillField userInput="{{adjustmentFee}}" selector="{{AdminCreditMemoTotalSection.adjustmentFee}}" stepKey="fillAdjustmentFee"/>
32+
<click selector="{{AdminCreditMemoTotalSection.refund}}" stepKey="clickRefund" />
33+
</actionGroup>
34+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is provided with Magento in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
*
12+
* Copyright © 2022 MultiSafepay, Inc. All rights reserved.
13+
* See DISCLAIMER.md for disclaimer details.
14+
*
15+
*/
16+
-->
17+
18+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
20+
<actionGroup name="AdminNavigateToTheInvoiceFromOrderViewActionGroup">
21+
<annotations>
22+
<description>Navigates from the order view to the first invoice.</description>
23+
</annotations>
24+
<click selector="{{AdminOrderDetailsMainActionsSection.invoiceTab}}" stepKey="clickInvoicesTabOrdersPage"/>
25+
<conditionalClick selector="{{AdminOrderInvoicesTabSection.clearFilters}}" dependentSelector="{{AdminOrderInvoicesTabSection.clearFilters}}" visible="true" stepKey="clearInvoiceFilters"/>
26+
<click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="clickInvoice"/>
27+
</actionGroup>
28+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is provided with Magento in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
*
12+
* Copyright © 2022 MultiSafepay, Inc. All rights reserved.
13+
* See DISCLAIMER.md for disclaimer details.
14+
*
15+
*/
16+
-->
17+
18+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
20+
<actionGroup name="CheckoutSelectAfterPayPaymentActionGroup">
21+
<annotations>
22+
<description>Selects the 'AfterPay' Payment Method on the Storefront Checkout page and fills in the payment details.</description>
23+
</annotations>
24+
<arguments>
25+
<argument name="paymentDetailsVar" defaultValue="AfterPayPaymentDetails"/>
26+
</arguments>
27+
28+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
29+
<waitForPageLoad stepKey="waitForPageLoad"/>
30+
<selectOption userInput="multisafepay_afterpay" selector="#multisafepay_afterpay" stepKey="selectAfterPayPaymentMethod"/>
31+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/>
32+
<pressKey userInput="10" selector="{{StorefrontCheckoutAfterPaySection.dateOfBirth}}" stepKey="setDateOfBirthValue1"/>
33+
<pressKey userInput="10" selector="{{StorefrontCheckoutAfterPaySection.dateOfBirth}}" stepKey="setDateOfBirthValue2"/>
34+
<pressKey userInput="2000" selector="{{StorefrontCheckoutAfterPaySection.dateOfBirth}}" stepKey="setDateOfBirthValue3"/>
35+
<selectOption userInput="mr" selector="{{StorefrontCheckoutAfterPaySection.gender}}" stepKey="selectGender"/>
36+
<checkOption selector="#afterpay-terms" stepKey="checkTermsCheckbox"/>
37+
</actionGroup>
38+
</actionGroups>

Test/Mftf/ActionGroup/CheckoutSelectCreditCardPaymentActionGroup.xml

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
<arguments>
2525
<argument name="paymentDetailsVar" defaultValue="CreditCardComponentPaymentDetails"/>
2626
</arguments>
27-
2827
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
2928
<waitForPageLoad stepKey="waitForPageLoad"/>
3029
<conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Credit Card')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Credit Card')}}" visible="true" stepKey="selectCreditCardPaymentMethod"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is provided with Magento in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
*
12+
* Copyright © 2022 MultiSafepay, Inc. All rights reserved.
13+
* See DISCLAIMER.md for disclaimer details.
14+
*
15+
*/
16+
-->
17+
18+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
20+
<actionGroup name="CheckoutSelectEInvoicingPaymentActionGroup">
21+
<annotations>
22+
<description>Selects the 'E-Invoicing' Payment Method on the Storefront Checkout page and fills in the payment details.</description>
23+
</annotations>
24+
<arguments>
25+
<argument name="paymentDetailsVar" defaultValue="PayAfterDeliveryPaymentDetails"/>
26+
</arguments>
27+
28+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
29+
<waitForPageLoad stepKey="waitForPageLoad"/>
30+
<selectOption userInput="multisafepay_einvoicing" selector="#multisafepay_einvoicing" stepKey="selectAfterPayPaymentMethod"/>
31+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/>
32+
<pressKey userInput="10" selector="{{StorefrontCheckoutEInvoicingSection.dateOfBirth}}" stepKey="dateOfBirthValue1"/>
33+
<pressKey userInput="10" selector="{{StorefrontCheckoutEInvoicingSection.dateOfBirth}}" stepKey="dateOfBirthValue2"/>
34+
<pressKey userInput="2000" selector="{{StorefrontCheckoutEInvoicingSection.dateOfBirth}}" stepKey="dateOfBirthValue3"/>
35+
<fillField selector="{{StorefrontCheckoutEInvoicingSection.accountNumber}}" userInput="{{paymentDetailsVar.account_number}}" stepKey="enterAccountNumber"/>
36+
</actionGroup>
37+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is provided with Magento in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
*
12+
* Copyright © 2022 MultiSafepay, Inc. All rights reserved.
13+
* See DISCLAIMER.md for disclaimer details.
14+
*
15+
*/
16+
-->
17+
18+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
20+
<actionGroup name="CheckoutSelectIdealPaymentActionGroup">
21+
<annotations>
22+
<description>Selects the 'iDEAL' Payment Method on the Storefront Checkout page and fills in the payment details.</description>
23+
</annotations>
24+
<arguments>
25+
<argument name="paymentDetailsVar" defaultValue="IdealPaymentDetails"/>
26+
</arguments>
27+
28+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
29+
<waitForPageLoad stepKey="waitForPageLoad"/>
30+
<conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('iDEAL')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('iDEAL')}}" visible="true" stepKey="selectIdealPaymentMethod"/>
31+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/>
32+
<selectOption userInput="3151" selector="#ideal-issuers" stepKey="selectOption1"/>
33+
</actionGroup>
34+
</actionGroups>

Test/Mftf/ActionGroup/CheckoutSelectPayAfterDeliveryPaymentActionGroup.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
<waitForPageLoad stepKey="waitForPageLoad"/>
3030
<conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Pay After Delivery')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Pay After Delivery')}}" visible="true" stepKey="selectPayAfterDeliveryPaymentMethod"/>
3131
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/>
32-
<fillField selector="{{StorefrontCheckoutPayAfterDeliverySection.dateOfBirth}}" userInput="{{paymentDetailsVar.date_of_birth}}" stepKey="enterDateOfBirth"/>
32+
<pressKey userInput="10" selector="{{StorefrontCheckoutPayAfterDeliverySection.dateOfBirth}}" stepKey="dateOfBirthValue1"/>
33+
<pressKey userInput="10" selector="{{StorefrontCheckoutPayAfterDeliverySection.dateOfBirth}}" stepKey="dateOfBirthValue2"/>
34+
<pressKey userInput="2000" selector="{{StorefrontCheckoutPayAfterDeliverySection.dateOfBirth}}" stepKey="dateOfBirthValue3"/>
3335
<fillField selector="{{StorefrontCheckoutPayAfterDeliverySection.accountNumber}}" userInput="{{paymentDetailsVar.account_number}}" stepKey="enterAccountNumber"/>
3436
</actionGroup>
3537
</actionGroups>

Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionWithCountryActionGroup.xml

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
<arguments>
2525
<argument name="customerVar" defaultValue="CustomerEntityOne"/>
2626
<argument name="customerAddressVar" defaultValue="MultiSafepayDeliveryAddress"/>
27-
<!--First available shipping method will be selected if value is not passed for shippingMethod-->
28-
<argument name="shippingMethod" defaultValue="" type="string"/>
2927
</arguments>
3028

3129
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
@@ -37,9 +35,9 @@
3735
<fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/>
3836
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/>
3937
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/>
40-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
41-
<waitForElement selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}" stepKey="waitForShippingMethod"/>
42-
<click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}" stepKey="selectShippingMethod"/>
38+
<wait time="5" stepKey="waitForLoadingMaskToDissapear"/>
39+
<waitForElement selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('')}}" stepKey="waitForShippingMethod"/>
40+
<click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('')}}" stepKey="selectShippingMethod"/>
4341
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
4442
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
4543
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>

Test/Mftf/Data/MultiSafepayConfigData.xml

+72
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040
<data key="label">No</data>
4141
<data key="value">0</data>
4242
</entity>
43+
<entity name="IdealEnableConfigData">
44+
<data key="path">payment/multisafepay_ideal/active</data>
45+
<data key="scope_id">0</data>
46+
<data key="label">Yes</data>
47+
<data key="value">1</data>
48+
</entity>
49+
<entity name="IdealDisableConfigData">
50+
<data key="path">payment/multisafepay_ideal/active</data>
51+
<data key="scope_id">0</data>
52+
<data key="label">No</data>
53+
<data key="value">0</data>
54+
</entity>
4355
<entity name="CreditCardEnableConfigData">
4456
<data key="path">payment/multisafepay_creditcard/active</data>
4557
<data key="scope_id">0</data>
@@ -64,4 +76,64 @@
6476
<data key="label">No</data>
6577
<data key="value">redirect</data>
6678
</entity>
79+
<entity name="AfterPayEnableConfigData">
80+
<data key="path">payment/multisafepay_afterpay/active</data>
81+
<data key="scope_id">0</data>
82+
<data key="label">Yes</data>
83+
<data key="value">1</data>
84+
</entity>
85+
<entity name="AfterPayDisableConfigData">
86+
<data key="path">payment/multisafepay_afterpay/active</data>
87+
<data key="scope_id">0</data>
88+
<data key="label">No</data>
89+
<data key="value">0</data>
90+
</entity>
91+
<entity name="EInvoicingEnableConfigData">
92+
<data key="path">payment/multisafepay_einvoicing/active</data>
93+
<data key="scope_id">0</data>
94+
<data key="label">Yes</data>
95+
<data key="value">1</data>
96+
</entity>
97+
<entity name="EInvoicingDisableConfigData">
98+
<data key="path">payment/multisafepay_einvoicing/active</data>
99+
<data key="scope_id">0</data>
100+
<data key="label">No</data>
101+
<data key="value">0</data>
102+
</entity>
103+
<entity name="BankTransferEnableConfigData">
104+
<data key="path">payment/multisafepay_banktransfer/active</data>
105+
<data key="scope_id">0</data>
106+
<data key="label">Yes</data>
107+
<data key="value">1</data>
108+
</entity>
109+
<entity name="BankTransferDisableConfigData">
110+
<data key="path">payment/multisafepay_banktransfer/active</data>
111+
<data key="scope_id">0</data>
112+
<data key="label">No</data>
113+
<data key="value">0</data>
114+
</entity>
115+
<entity name="BankTransferDirectConfigData">
116+
<data key="path">payment/multisafepay_banktransfer/transaction_type</data>
117+
<data key="scope_id">0</data>
118+
<data key="label">Yes</data>
119+
<data key="value">direct</data>
120+
</entity>
121+
<entity name="BankTransferRedirectConfigData">
122+
<data key="path">payment/multisafepay_banktransfer/transaction_type</data>
123+
<data key="scope_id">0</data>
124+
<data key="label">No</data>
125+
<data key="value">redirect</data>
126+
</entity>
127+
<entity name="BancontactEnableConfigData">
128+
<data key="path">payment/multisafepay_bancontact/active</data>
129+
<data key="scope_id">0</data>
130+
<data key="label">Yes</data>
131+
<data key="value">1</data>
132+
</entity>
133+
<entity name="BancontactDisableConfigData">
134+
<data key="path">payment/multisafepay_bancontact/active</data>
135+
<data key="scope_id">0</data>
136+
<data key="label">No</data>
137+
<data key="value">0</data>
138+
</entity>
67139
</entities>

Test/Mftf/Data/MultiSafepayCustomerData.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
<data key="group_id">1</data>
2222
<data key="default_billing">true</data>
2323
<data key="default_shipping">true</data>
24-
<data key="email" unique="prefix">test@example.com</data>
25-
<data key="firstname">MultiSafepayTEST</data>
26-
<data key="lastname">MultiSafepayTEST</data>
27-
<data key="fullname">MultiSafepayTEST MultiSafepayTEST</data>
28-
<data key="password">test123</data>
24+
<data key="email" unique="prefix">John.Doe@example.com</data>
25+
<data key="firstname">John</data>
26+
<data key="lastname">Doe</data>
27+
<data key="fullname">John Doe</data>
28+
<data key="password">Test123!</data>
2929
<data key="store_id">0</data>
3030
<data key="website_id">0</data>
3131
<data key="group">General</data>

0 commit comments

Comments
 (0)