Skip to content

Commit

Permalink
Merge pull request #63 from magento-epam/MAGETWO-62891
Browse files Browse the repository at this point in the history
Magetwo 62891
  • Loading branch information
nikshostko authored Aug 17, 2018
2 parents 9b01481 + e60965a commit 7058877
Show file tree
Hide file tree
Showing 5 changed files with 332 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">

<!-- Go To Product Page -->
<actionGroup name="GoToProductPage">
<click selector="{{GoToProductPageSection.catalog}}" stepKey="clickOnCatalog" />
<waitForPageLoad stepKey="waitForPage"/>
<click selector="{{GoToProductPageSection.product}}" stepKey="clickToSelectProductsItem" />
<waitForPageLoad stepKey="waitForPageProducts"/>
</actionGroup>

<!-- Create Simple Product -->
<actionGroup name="CreateSimpleProduct">
<arguments>
<argument name="product" defaultValue="SimpleProduct"/>
</arguments>
<click selector="{{GoToProductPageSection.add}}" stepKey="clickToAddProduct"/>
<waitForPageLoad stepKey="WaitForProductPageIsLoaded"/>
<fillField selector="{{AdminAddSimpleProductSection.productName}}" userInput="{{product.name}}" stepKey="setNameForProduct"/>
<fillField selector="{{AdminAddSimpleProductSection.productSku}}" userInput="{{product.sku}}" stepKey="setSKUForProduct"/>
<fillField selector="{{AdminAddSimpleProductSection.productPrice}}" userInput="{{product.price}}" stepKey="setPriceForProduct"/>
<fillField selector="{{AdminAddSimpleProductSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="setQuantityForProduct"/>
<click selector="{{AdminAddSimpleProductSection.searchOptimization}}" stepKey="clickOnSearchEngineOptimization"/>
<fillField selector="{{AdminAddSimpleProductSection.urlKey}}" userInput="{{product.urlKey}}" stepKey="setSearchUrlForProduct"/>
<click selector="{{AdminAddSimpleProductSection.saveButton}}" stepKey="clickSaveProduct"/>
<waitForPageLoad stepKey="WaitForProductSave"/>
<see userInput="You saved the product." stepKey="seeSaveConfirmation"/>
</actionGroup>

<!--Create Account -->
<actionGroup name="StorefrontCreateAccountActionGroup">
<click selector="{{StorefrontCreateAccountSection.createAccount}}" stepKey="ClickToCreateAccount"/>
<waitForPageLoad stepKey="waitForAccountFormIsOpened"/>
<fillField selector="{{StorefrontCreateAccountSection.firstName}}" userInput="{{CreateUserData.firstName}}" stepKey="TypeFirstName"/>
<fillField selector="{{StorefrontCreateAccountSection.lastName}}" userInput="{{CreateUserData.lastName}}" stepKey="TypeLastName"/>
<fillField selector="{{StorefrontCreateAccountSection.email}}" userInput="{{CreateUserData.firstName}}@magento.com" stepKey="TypeEmail"/>
<fillField selector="{{StorefrontCreateAccountSection.password}}" userInput="{{CreateUserData.password}}" stepKey="TypePassword"/>
<waitForPageLoad stepKey="waitToConfirmPassword"/>
<fillField selector="{{StorefrontCreateAccountSection.confirmPass}}" userInput="{{CreateUserData.password}}" stepKey="confirmPassword"/>
<click selector="{{StorefrontCreateAccountSection.create}}" stepKey="ClickToSaveAccount"/>
<waitForPageLoad stepKey="waitForAccountPageLoaded"/>
</actionGroup>

<!--Find and add product to cart-->
<actionGroup name="FindAndAddProductToCardActionGroup">
<!--Navigate to a category page -->
<amOnPage url="/{{SimpleProduct.name}}.html" stepKey="goToCreatedProductPage"/>
<waitForPageLoad stepKey="waitForProductPageLoaded"/>
<click selector="{{StorefrontAddCreatedProductToCartSection.addToCartBtn}}" stepKey="addToCart"/>
<waitForElementVisible selector="{{StorefrontAddCreatedProductToCartSection.successMessage}}" time="30" stepKey="waitForProductAdded"/>
<click selector="{{StorefrontAddCreatedProductToCartSection.showCard}}" stepKey="clickToOpenCard"/>
<waitForPageLoad stepKey="WaitForFormOpened"/>
<click selector="{{StorefrontAddCreatedProductToCartSection.proceed}}" stepKey="clickToProceedToCheckout"/>
<waitForPageLoad stepKey="waitForTheFormIsOpened"/>
<see userInput="Shipping Address" stepKey="seeShippingAddress"/>
</actionGroup>

<!--Fill shipment form-->
<actionGroup name="FillShipmentFormActionGroup">
<fillField selector="{{ShipmentFormSection.street}}" userInput="{{Account.street}}" stepKey="SetCustomerStreetAddress"/>
<fillField selector="{{ShipmentFormSection.city}}" userInput="{{Account.city}}" stepKey="SetCustomerCity"/>
<fillField selector="{{ShipmentFormSection.postcode}}" userInput="{{Account.postcode}}" stepKey="SetCustomerZipCode"/>
<fillField selector="{{ShipmentFormSection.telephone}}" userInput="{{Account.telephone}}" stepKey="SetCustomerPhoneNumber"/>
<click selector="{{ShipmentFormSection.region}}" stepKey="clickToSetState"/>
<click selector="{{ShipmentFormSection.state}}" stepKey="clickToChooseState"/>
<click selector="{{ShipmentFormSection.stateAlabama}}" stepKey="chooseStateAlabama"/>
<click selector="{{ShipmentFormSection.next}}" stepKey="clickToSaveShippingInfo"/>
<waitForPageLoad stepKey="waitForReviewAndPaymentsPageIsLoaded"/>
</actionGroup>

<!--Mark "My billing and shipping address are the same"-->
<actionGroup name="MarkMyBillingAndShippingAddressAreTheSame">
<conditionalClick selector="{{ShipmentFormSection.billingShippingAddressTheSameCheckbox}}" dependentSelector="{{ShipmentFormSection.placeOrderButton}}" visible="0" stepKey="selectkMyBillingAndShippingAddressAreTheSameCheckbox"/>
<click stepKey="clickPlaceOrderButton" selector="{{ShipmentFormSection.placeOrderButton}}"/>
<waitForPageLoad stepKey="waitForCheckoutPageLoaded"/>
<see stepKey="seeSuccessfulMessage" userInput="Thank you for your purchase!"/>
</actionGroup>

<!--Go To My Account Page-->
<actionGroup name="GoToMyAccountPage">
<click stepKey="clickCustomerNameItem" selector="{{GoToMyAccountSection.customerName}}"/>
<click stepKey="clickMyAccountItem" selector="{{GoToMyAccountSection.myAccountItem}}"/>
<waitForPageLoad stepKey="waitForMyAccountPageLoaded"/>
</actionGroup>

<!--Assert That Shipping And Billing Address are the same-->
<actionGroup name="AssertThatShippingAndBillingAddressTheSame">
<!--Get shipping and billing addresses-->
<grabTextFrom selector="{{ShipmentFormSection.shippingAddress}}" stepKey="shippingAddr"/>
<grabTextFrom selector="{{ShipmentFormSection.billingAddress}}" stepKey="billingAddr"/>
<!--Make sure that shipping and billing addresses are different-->
<see userInput="Shipping Address" stepKey="seeShippingAddress"/>
<see userInput="Billing Address" stepKey="seeBillingAddress"/>
<assertEquals stepKey="assert" actual="$billingAddr" expected="$shippingAddr"/>
</actionGroup>

<!-- Delete Created Product -->
<actionGroup name="DeleteCreatedProduct">
<conditionalClick selector="{{DeleteCreatedProductSection.clearAll}}" dependentSelector="{{DeleteCreatedProductSection.clearAll}}" visible="1" stepKey="clickClearAllIfThereIsAnyValue"/>
<click stepKey="clickFilterButton" selector="{{DeleteCreatedProductSection.filterButton}}"/>
<waitForElementVisible selector="{{DeleteCreatedProductSection.filterSKUField}}" stepKey="waitForFilterDataLoaded"/>
<fillField stepKey="searchProductUsingSKUField" selector="{{DeleteCreatedProductSection.filterSKUField}}" userInput="{{SimpleProduct.sku}}"/>
<click stepKey="clickFiltersApplyButton" selector="{{DeleteCreatedProductSection.filtersApplyButton}}"/>
<waitForElementNotVisible selector="{{DeleteCreatedProductSection.filterSKUField}}" stepKey="waitForFilterBecomeNotVisible"/>
<click selector="{{DeleteCreatedProductSection.createdProductID}}" stepKey="selectCreatedProduct"/>
<wait stepKey="waitSelectCreatedProduct" time="2"/>
<waitForElementVisible selector="{{DeleteCreatedProductSection.actionSelectBox}}" stepKey="waitToSelectActionVisible"/>
<click stepKey="clickToSelectAction" selector="{{DeleteCreatedProductSection.actionSelectBox}}"/>
<waitForElementVisible selector="{{DeleteCreatedProductSection.deleteButton}}" stepKey="waitForDeleteButtonAppeared"/>
<click selector="{{DeleteCreatedProductSection.deleteButton}}" stepKey="clickToDeleteProduct"/>
<waitForElementVisible selector="{{DeleteCreatedProductSection.okButton}}" stepKey="waitForOkButtonAppeared"/>
<click selector="{{DeleteCreatedProductSection.okButton}}" stepKey="clickToConfirm"/>
<wait stepKey="waitForRecordIsDeleted" time="2"/>
<see userInput="A total of 1 record(s) have been deleted." stepKey="productDeletedSuccessfully"/>
<click stepKey="clickClearAllFilterButton" selector="{{DeleteCreatedProductSection.clearAll}}"/>
<wait stepKey="waitToClearAllFilters" time="2"/>
</actionGroup>

<!--Delete created Customer -->
<actionGroup name="DeleteCreatedCustomerActionGroup">
<click stepKey="clickCustomerItem" selector="{{DashboardSection.customer}}"/>
<wait stepKey="WaitForCustomerViewOpened" time="2"/>
<click stepKey="clickCustomerAllCustomerItem" selector="{{DashboardSection.customerAllCustomer}}"/>
<waitForPageLoad stepKey="WaitForCustomerPageIsLoaded"/>
<fillField stepKey="searchToKeyword" selector="{{AdminCustomerAccInformationSection.searchToKeyword}}" userInput="{{CreateUserData.firstName}}"/>
<click stepKey="clickSearchButton" selector="{{AdminCustomerAccInformationSection.searchButton}}"/>
<waitForElementVisible stepKey="waitForFiltering" selector="{{AdminCustomerAccInformationSection.selectCustomer}}"/>
<click selector="{{AdminCustomerAccInformationSection.selectCustomer}}" stepKey="ClickOnCustomer"/>
<click selector="{{AdminCustomerAccInformationSection.actions}}" stepKey="ClickOnActions"/>
<waitForElementVisible selector="{{AdminCustomerAccInformationSection.delete}}" stepKey="waitForDeleteButtonAppeared"/>
<click selector="{{AdminCustomerAccInformationSection.delete}}" stepKey="ClickOnDelete"/>
<waitForElementVisible selector="{{AdminCustomerAccInformationSection.confirm}}" stepKey="waitForConfirmButtonAppeared"/>
<click selector="{{AdminCustomerAccInformationSection.confirm}}" stepKey="ClickToConfirm"/>
<waitForPageLoad stepKey="waitClickToConfirmButton"/>
<click stepKey="clickClearAllFilterButton" selector="{{DeleteCreatedProductSection.clearAll}}"/>
<wait stepKey="waitToClearAllFilters" time="2"/>
</actionGroup>

</actionGroups>
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.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
<entity name="SimpleProduct" type="product">
<data key="name" unique="suffix">testProduct</data>
<data key="sku" unique="suffix">testSku</data>
<data key="price">210</data>
<data key="quantity">10</data>
<data key="urlKey" unique="suffix">testProduct</data>
</entity>

<entity name="Account" type="product">
<data key="street">BirminghamStreet</data>
<data key="city">Birmingham</data>
<data key="postcode">35005</data>
<data key="telephone">222222222</data>
</entity>

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

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="GoToProductPageSection">
<!--Go to Catalog/Products-->
<element name="catalog" type="button" selector="#menu-magento-catalog-catalog"/>
<element name="product" type="button" selector="//span[contains(text(), 'Products')]"/>
<element name="add" type="button" selector="#add_new_product-button"/>
</section>

<section name="AdminAddSimpleProductSection">
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
<element name="productSku" type="input" selector=".admin__field[data-index=sku] input"/>
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
<element name="searchOptimization" type="button" selector="//*[contains(text(),'Search Engine Optimization')]"/>
<element name="urlKey" type="input" selector="//input[contains(@name,'url_key')]"/>
<element name="saveButton" type="button" selector="#save-button"/>
</section>

<section name="StorefrontCreateAccountSection">
<element name="createAccount" type="button" selector="//div[contains(@class, 'panel wrapper')]//a[text()='Create an Account']"/>
<element name="firstName" type="input" selector="#firstname"/>
<element name="lastName" type="input" selector="#lastname"/>
<element name="email" type="input" selector="#email_address"/>
<element name="password" type="input" selector="#password"/>
<element name="confirmPass" type="input" selector="#password-confirmation"/>
<element name="create" type="button" selector="//button[@type='submit' and @title='Create an Account']"/>
</section>

<section name="StorefrontAddCreatedProductToCartSection">
<element name="addToCartBtn" type="button" selector="button.action.tocart.primary"/>
<element name="successMsg" type="button" selector="div.message-success"/>
<element name="showCard" type="button" selector=".action.showcart"/>
<element name="proceed" type="button" selector="#top-cart-btn-checkout"/>
<element name="successMessage" type="button" selector="div.message-success"/>
</section>

<section name="ShipmentFormSection">
<element name="street" type="input" selector="//*[@name='street[0]']"/>
<element name="city" type="input" selector="//*[@name='city']"/>
<element name="postcode" type="input" selector="//*[@name='postcode']"/>
<element name="telephone" type="input" selector="//*[@name='telephone']"/>
<element name="region" type="input" selector="//*[@name='region_id']"/>
<element name="state" type="input" selector="//*[@name='country_id']"/>
<element name="stateAlabama" type="select" selector="//*[@name='region_id']/option[contains(text(),'Alabama')]"/>
<element name="next" type="input" selector="//span[contains(text(), 'Next')]"/>

<element name="billingShippingAddressTheSameCheckbox" type="select" selector="#billing-address-same-as-shipping-checkmo"/>
<element name="placeOrderButton" type="button" selector="//span[contains(text(),'Place Order')]"/>
<element name="shippingAddress" type="textarea" selector="//*[@class='box box-billing-address']//address"/>
<element name="billingAddress" type="textarea" selector="//*[@class='box box-shipping-address']//address"/>
</section>

<section name="GoToMyAccountSection">
<element name="customerName" type="input" selector="//*[@class='page-header']//*[@data-bind='text: customer().fullname']"/>
<element name="myAccountItem" type="input" selector="//*[@class='page-header']//*[contains(text(),'My Account')]"/>
</section>

<section name="DeleteCreatedProductSection">
<element name="searchToKeyword" type="input" selector="//*[@class='admin__data-grid-outer-wrap']/*[@class='admin__data-grid-header']//*[@class='data-grid-search-control-wrap']/input"/>
<element name="searchButton" type="button" selector="//*[@class='admin__data-grid-outer-wrap']/*[@class='admin__data-grid-header']//*[@class='data-grid-search-control-wrap']/button"/>
<element name="createdProductID" type="select" selector="//*[@class='data-grid-checkbox-cell-inner']/input"/>
<element name="actionSelectBox" type="button" selector="//*[@class='col-xs-2']//span[text()='Actions']"/>
<element name="deleteButton" type="button" selector="//div[@class='col-xs-2']//*[text()='Delete']"/>
<element name="okButton" type="button" selector=".action-primary.action-accept"/>
<element name="clearAll" type="button" selector="//*[@class='admin__data-grid-outer-wrap']/*[@class='admin__data-grid-header']//*[contains(text(), 'Clear all')]"/>
<element name="filterButton" type="button" selector="//*[@class='admin__data-grid-outer-wrap']/*[@class='admin__data-grid-header']//*[@class='data-grid-filters-action-wrap']/button"/>
<element name="filterSKUField" type="input" selector="//*[@name='sku']"/>
<element name="filtersApplyButton" type="button" selector="//*[contains(text(),'Apply Filters')]"/>
</section>

<section name="DashboardSection">
<element name="customerAllCustomer" type="button" selector="//*[@data-ui-id='menu-magento-customer-customer-manage']"/>
<element name="customer" type="button" selector="#menu-magento-customer-customer"/>
</section>

<section name="AdminCustomerAccInformationSection">
<element name="searchToKeyword" type="input" selector="//*[@class='admin__data-grid-outer-wrap']/*[@class='admin__data-grid-header']//*[@class='data-grid-search-control-wrap']/input"/>
<element name="searchButton" type="button" selector="//*[@class='admin__data-grid-outer-wrap']/*[@class='admin__data-grid-header']//*[@class='data-grid-search-control-wrap']/button"/>
<element name="selectCustomer" type="checkbox" selector="//*[@class='admin__data-grid-wrap' and @data-role='grid-wrapper']//*[@class='data-grid-multicheck-cell']/div/label"/>
<element name="actions" type="button" selector="//div[@class='admin__data-grid-header']//div[@class='col-xs-2']//span[text()='Actions']"/>
<element name="delete" type="button" selector="//div[@class='col-xs-2']//span[text()='Delete']"/>
<element name="confirm" type="button" selector=".action-primary.action-accept"/>
</section>

</sections>
Loading

0 comments on commit 7058877

Please sign in to comment.