From 6446ad53ee9cdd2bd59f9e6db4d3dc78f06dabaa Mon Sep 17 00:00:00 2001 From: saphaljha Date: Fri, 21 Aug 2020 10:53:00 +0530 Subject: [PATCH 1/3] covered mftf for bundle items --- ...aceOrderWithMultipleOptionsSuccessTest.xml | 92 +++++++++++++++++++ .../Mftf/Section/AdminInvoiceItemsSection.xml | 1 + 2 files changed, 93 insertions(+) create mode 100644 app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml new file mode 100644 index 0000000000000..dc768ce708ce0 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml @@ -0,0 +1,92 @@ + + + + + + + + + <description value="Customer should be able to see all the bundle items in invoice view"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-500"/> + <group value="Bundle"/> + </annotations> + + <!-- Actions before test execution --> + <before> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> + </before> + + <!-- Actions after test execution --> + <after> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> + </after> + + <!-- Start creating a bundle product --> + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> + <argument name="product" value="BundleProduct"/> + </actionGroup> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku"> + <argument name="product" value="BundleProduct"/> + </actionGroup> + + <!-- Add Option Three, a "Checkbox" type option --> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts1"> + <argument name="x" value="0"/> + <argument name="n" value="1"/> + <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> + <argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/> + <argument name="optionTitle" value="Option one"/> + <argument name="inputType" value="checkbox"/> + </actionGroup> + + <!-- Save product and go to storefront --> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> + <amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/> + <waitForPageLoad stepKey="waitForStorefront"/> + <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/> + + <!-- Select both checkbox options --> + <checkOption selector="div:nth-child(1) > input[type='checkbox']" stepKey="selectOption1"/> + <checkOption selector="div:nth-child(2) > input[type='checkbox']" stepKey="selectOption2"/> + + <!-- Customize and add the bundle product to our cart --> + <click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart1"/> + <dontSee selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="validForm1"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{BundleProduct.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> + + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> + + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="fillShippingSectionAsGuest"> + <argument name="customerVar" value="CustomerEntityOne"/> + <argument name="customerAddressVar" value="CustomerAddressSimple"/> + </actionGroup> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> + <actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="placeOrder"> + <argument name="orderNumberMessage" value="CONST.successGuestCheckoutOrderNumberMessage"/> + <argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/> + </actionGroup> + <grabTextFrom selector="{{CheckoutSuccessRegisterSection.orderNumber}}" stepKey="grabOrderNumber"/> + + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrdersGridById"> + <argument name="orderId" value="{$grabOrderNumber}"/> + </actionGroup> + + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoice"/> + <waitForPageLoad stepKey="waitForNewInvoicePageToLoad"/> + + <see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $$simpleProduct1.sku$$" stepKey="seeOptionValue1"/> + <see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $$simpleProduct1.sku$$" stepKey="seeOptionValue2"/> + + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceItemsSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceItemsSection.xml index 92c01cf380746..8a52077cc3e80 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceItemsSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceItemsSection.xml @@ -28,5 +28,6 @@ <element name="discountAmountColumn" type="text" selector=".order-invoice-tables .col-discount .price"/> <element name="totalColumn" type="text" selector=".order-invoice-tables .col-total .price"/> <element name="updateQty" type="button" selector=".order-invoice-tables tfoot button[data-ui-id='order-items-update-button']"/> + <element name="bundleItem" type="text" selector="table > tbody > tr:nth-child(n) > td.col-product > div.option-value"/> </section> </sections> From af0d295adedfa2dbacb17fdceb0b4fbe0a987839 Mon Sep 17 00:00:00 2001 From: Saphal Jha <saphal.jha@krishtechnolabs.com> Date: Fri, 21 Aug 2020 11:20:38 +0530 Subject: [PATCH 2/3] Update StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml --- ...StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml index dc768ce708ce0..ce39904f288c3 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml @@ -89,4 +89,4 @@ <see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $$simpleProduct1.sku$$" stepKey="seeOptionValue2"/> </test> -</tests> \ No newline at end of file +</tests> From 55e1ec2c20a9bbe2a383b7e2b9cff03f68379ccd Mon Sep 17 00:00:00 2001 From: saphaljha <saphal.jha@krishtechnolabs.com> Date: Sat, 22 Aug 2020 20:34:33 +0530 Subject: [PATCH 3/3] Updated code --- ...lePlaceOrderWithMultipleOptionsSuccessTest.xml | 15 ++------------- .../Mftf/Section/AdminInvoiceItemsSection.xml | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml index ce39904f288c3..f090b576d715e 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml @@ -16,21 +16,16 @@ <testCaseId value="MC-500"/> <group value="Bundle"/> </annotations> - - <!-- Actions before test execution --> <before> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> </before> - - <!-- Actions after test execution --> <after> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> </after> - <!-- Start creating a bundle product --> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/> <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> @@ -40,7 +35,7 @@ <argument name="product" value="BundleProduct"/> </actionGroup> - <!-- Add Option Three, a "Checkbox" type option --> + <!-- Add a "Checkbox" type option --> <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts1"> <argument name="x" value="0"/> <argument name="n" value="1"/> @@ -52,7 +47,7 @@ <!-- Save product and go to storefront --> <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> - <amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/> + <amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="navigateToBundleProductPage"/> <waitForPageLoad stepKey="waitForStorefront"/> <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/> @@ -64,9 +59,7 @@ <click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart1"/> <dontSee selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="validForm1"/> <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{BundleProduct.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> - <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> - <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="fillShippingSectionAsGuest"> <argument name="customerVar" value="CustomerEntityOne"/> <argument name="customerAddressVar" value="CustomerAddressSimple"/> @@ -77,16 +70,12 @@ <argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/> </actionGroup> <grabTextFrom selector="{{CheckoutSuccessRegisterSection.orderNumber}}" stepKey="grabOrderNumber"/> - <actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrdersGridById"> <argument name="orderId" value="{$grabOrderNumber}"/> </actionGroup> - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoice"/> <waitForPageLoad stepKey="waitForNewInvoicePageToLoad"/> - <see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $$simpleProduct1.sku$$" stepKey="seeOptionValue1"/> <see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $$simpleProduct1.sku$$" stepKey="seeOptionValue2"/> - </test> </tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceItemsSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceItemsSection.xml index 8a52077cc3e80..edefeb188e650 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceItemsSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceItemsSection.xml @@ -28,6 +28,6 @@ <element name="discountAmountColumn" type="text" selector=".order-invoice-tables .col-discount .price"/> <element name="totalColumn" type="text" selector=".order-invoice-tables .col-total .price"/> <element name="updateQty" type="button" selector=".order-invoice-tables tfoot button[data-ui-id='order-items-update-button']"/> - <element name="bundleItem" type="text" selector="table > tbody > tr:nth-child(n) > td.col-product > div.option-value"/> + <element name="bundleItem" type="text" selector="#invoice_item_container > section:nth-child(1) > div.admin__page-section-content.grid > div > table > tbody > tr:nth-child(n) > td.col-product > div.option-value"/> </section> </sections>