Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="CheckoutSelectPurchaseOrderPaymentActionGroup">
<annotations>
<description>Selects the 'Purchase Order' Payment Method on the Storefront Checkout page.</description>
</annotations>

<arguments>
<argument name="purchaseOrderNumber" type="string"/>
</arguments>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<remove keyForRemoval="checkCheckMoneyOption"/>
<conditionalClick selector="{{CheckoutPaymentSection.purchaseOrderPayment}}" dependentSelector="{{CheckoutPaymentSection.purchaseOrderPayment}}" visible="true" stepKey="checkPurchaseOrderOption"/>
<fillField selector="{{StorefrontCheckoutPaymentMethodSection.purchaseOrderNumber}}" userInput="{{purchaseOrderNumber}}" stepKey="fillPurchaseOrderNumber"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<element name="cartItemsArea" type="button" selector="div.block.items-in-cart"/>
<element name="cartItemsAreaActive" type="textarea" selector="div.block.items-in-cart.active" timeout="30"/>
<element name="checkMoneyOrderPayment" type="radio" selector="input#checkmo.radio" timeout="30"/>
<element name="purchaseOrderPayment" type="radio" selector="input#purchaseorder.radio" timeout="30"/>
<element name="placeOrder" type="button" selector=".payment-method._active button.action.primary.checkout" timeout="30"/>
<element name="placeOrderWithoutTimeout" type="button" selector=".payment-method._active button.action.primary.checkout"/>
<element name="paymentSectionTitle" type="text" selector="//*[@id='checkout-payment-method-load']//div[@data-role='title']" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">

<test name="StorefrontCheckoutWithPurchaseOrderNumberPressKeyEnterTest">
<annotations>
<features value="Checkout"/>
<stories value="Checkout with Purchase Order Payment. Create Order with Press Key Enter."/>
<title value="Create Checkout with purchase order payment method test. Press key Enter on field Purchase Order Number for create Order."/>
<description value="Create Checkout with purchase order payment method. Press key Enter on field Purchase Order Number for create Order."/>
<severity value="MAJOR"/>
<testCaseId value="MC-37227"/>
<group value="checkout"/>
</annotations>

<before>
<createData entity="SimpleTwo" stepKey="createSimpleProduct"/>

<!-- Enable payment method -->
<magentoCLI command="config:set {{PurchaseOrderEnableConfigData.path}} {{PurchaseOrderEnableConfigData.value}}" stepKey="enablePaymentMethod"/>
</before>

<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>

<!-- Disable payment method -->
<magentoCLI command="config:set {{PurchaseOrderDisabledConfigData.path}} {{PurchaseOrderDisabledConfigData.value}}" stepKey="disablePaymentMethod"/>
</after>

<!--Go to product page-->
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage"/>
<waitForPageLoad stepKey="waitForCatalogPageLoad"/>

<!--Add Product to Shopping Cart-->
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage">
<argument name="productName" value="$$createSimpleProduct.name$$"/>
</actionGroup>

<!--Go to Checkout-->
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>

<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection">
<argument name="customerVar" value="CustomerEntityOne"/>
<argument name="customerAddressVar" value="CustomerAddressSimple"/>
</actionGroup>

<!-- Checkout select Purchase Order payment -->
<actionGroup ref="CheckoutSelectPurchaseOrderPaymentActionGroup" stepKey="selectPurchaseOrderPayment">
<argument name="purchaseOrderNumber" value="12345"/>
</actionGroup>

<!--Press Key ENTER-->
<pressKey selector="{{StorefrontCheckoutPaymentMethodSection.purchaseOrderNumber}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" stepKey="pressKeyEnter"/>
<waitForPageLoad stepKey="waitForPageLoad"/>

<!--See success messages-->
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order # is: " stepKey="seeOrderNumber"/>

</test>

</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontCheckoutWithPurchaseOrderNumberTest">
<annotations>
<features value="Checkout"/>
<stories value="Checkout with Purchase Order Payment"/>
<title value="Create Checkout with purchase order payment method test"/>
<description value="Create Checkout with purchase order payment method"/>
<severity value="MAJOR"/>
<group value="checkout"/>
</annotations>

<before>
<createData entity="SimpleTwo" stepKey="createSimpleProduct"/>

<!-- Enable payment method -->
<magentoCLI command="config:set {{PurchaseOrderEnableConfigData.path}} {{PurchaseOrderEnableConfigData.value}}" stepKey="enablePaymentMethod"/>
</before>

<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>

<!-- Disable payment method -->
<magentoCLI command="config:set {{PurchaseOrderDisabledConfigData.path}} {{PurchaseOrderDisabledConfigData.value}}" stepKey="disablePaymentMethod"/>
</after>

<!--Go to product page-->
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage"/>
<waitForPageLoad stepKey="waitForCatalogPageLoad"/>

<!--Add Product to Shopping Cart-->
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage">
<argument name="productName" value="$$createSimpleProduct.name$$"/>
</actionGroup>

<!--Go to Checkout-->
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>

<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection">
<argument name="customerVar" value="CustomerEntityOne"/>
<argument name="customerAddressVar" value="CustomerAddressSimple"/>
</actionGroup>

<!-- Checkout select Purchase Order payment -->
<actionGroup ref="CheckoutSelectPurchaseOrderPaymentActionGroup" stepKey="selectPurchaseOrderPayment">
<argument name="purchaseOrderNumber" value="12345"/>
</actionGroup>

<!--Click Place Order button-->
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
<waitForPageLoad stepKey="waitForPageLoad"/>

<!--See success messages-->
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order # is: " stepKey="seeOrderNumber"/>

</test>

</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,29 @@
</div>
</div>
</fieldset>
</form>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="actions-toolbar" id="review-buttons-container">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
data-role="review-save">
<span data-bind="i18n: 'Place Order'"></span>
</button>

<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
</div>

<div class="actions-toolbar" id="review-buttons-container">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
data-role="review-save">
<span data-bind="i18n: 'Place Order'"></span>
</button>
</div>
</div>
</form>
</div>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
form {
&.form-purchase-order {
margin-bottom: 15px;

.input-text {
width: 40%;
}
}
}
}
Expand Down Expand Up @@ -119,7 +123,7 @@
margin: 0 0 @indent__base;

.primary {
.action-update {
.action-update {
margin-bottom: 20px;
margin-right: 0;
}
Expand All @@ -133,7 +137,7 @@
.lib-css(line-height, @checkout-billing-address-details__line-height);
.lib-css(padding, @checkout-billing-address-details__padding);
}

input[type="checkbox"] {
vertical-align: top;
}
Expand Down