Skip to content

Commit

Permalink
Sorting by Websites not working in product grid in backoffice #20511
Browse files Browse the repository at this point in the history
  • Loading branch information
XxXgeoXxX committed Feb 22, 2019
1 parent 93da772 commit 5362c5a
Showing 1 changed file with 51 additions and 60 deletions.
111 changes: 51 additions & 60 deletions app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,80 +15,71 @@
<description value="Sorting products by websites in Admin"/>
</annotations>
<before>
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>

<!--Create Website -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<!--Create new website -->
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
<argument name="newWebsiteName" value="Second Website"/>
<argument name="websiteCode" value="second_website"/>
</actionGroup>

<!--Create Store -->
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
<argument name="website" value="Second Website"/>
<argument name="storeGroupName" value="Second Store"/>
<argument name="storeGroupCode" value="second_store"/>
</actionGroup>

<!--Create Store view -->
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
<waitForPageLoad stepKey="waitForSystemStorePage"/>
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
<waitForElementVisible selector="//legend[contains(., 'Store View Information')]" stepKey="waitForNewStorePageToOpen"/>
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
<fillField userInput="Second Store View" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/>
<fillField userInput="second_store_view" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/>
<selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="1" stepKey="enableStoreViewStatus"/>
<click selector="{{AdminNewStoreViewActionsSection.saveButton}}" stepKey="clickSaveStoreView" />
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForModal" />
<see selector="{{AdminConfirmationModalSection.title}}" userInput="Warning message" stepKey="seeWarning" />
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="dismissModal" />
<waitForPageLoad stepKey="waitForPageLoad2" time="180" />
<waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" time="150" stepKey="waitForPageReolad"/>
<see userInput="You saved the store view." stepKey="seeSavedMessage" />

<!--Create a Simple Product 1 -->
<actionGroup ref="createSimpleProductAndAddToWebsite" stepKey="createSimpleProduct1">
<argument name="product" value="simpleProductForMassUpdate"/>
<argument name="website" value="Second Website"/>
</actionGroup>

<!--Create a Simple Product 2 -->
<actionGroup ref="createSimpleProductAndAddToWebsite" stepKey="createSimpleProduct2">
<argument name="product" value="simpleProductForMassUpdate2"/>
<argument name="website" value="Second Website"/>
</actionGroup>
</before>
<after>
<!--Delete website -->
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite">
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite">
<argument name="websiteName" value="Second Website"/>
</actionGroup>
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>

<!--Delete Products -->
<actionGroup ref="DeleteProductActionGroup" stepKey="deleteProduct1">
<argument name="productName" value="simpleProductForMassUpdate.name"/>
</actionGroup>
<actionGroup ref="DeleteProductActionGroup" stepKey="deleteProduct2">
<argument name="productName" value="simpleProductForMassUpdate2.name"/>
</actionGroup>
<actionGroup ref="logout" stepKey="amOnLogoutPage"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/>
<!--Create a Simple Product -->
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/>
<waitForPageLoad stepKey="waitForCatalogProductGrid"/>
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
<fillField userInput="{{_defaultProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
<fillField userInput="{{_defaultProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>

<!--Save the product -->
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/>
<waitForLoadingMaskToDisappear stepKey="waitProductPageSave"/>
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeProductSavedMessage"/>

<!-- Add this product to second website -->
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProductInWebsitesSection1"/>
<click selector="{{ProductInWebsitesSection.website('Second Website')}}" stepKey="selectSecondWebsite"/>
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/>
<waitForLoadingMaskToDisappear stepKey="waitForProductPagetoSaveAgain"/>
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessageAgain"/>

<!--Sort Ascending-->
<!--Create a Simple Product 2 -->
<amOnPage url="{{ProductCatalogPage.url}}" stepKey="openProductCatalogPage"/>
<waitForPageLoad stepKey="waitForProductCatalogPage"/>
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/>
<waitForPageLoad stepKey="waitForProductToggleToSelectSimpleProduct"/>
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickSimpleProductFromDropDownList"/>

<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.name}}" stepKey="fillSimpleProductName"/>
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.price}}" stepKey="fillSimpleProductPrice"/>
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.weight}}" stepKey="fillSimpleProductWeight"/>
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.quantity}}" stepKey="fillSimpleProductQuantity"/>
<click selector="{{AdminProductFormSection.save}}" stepKey="clickSaveButton2"/>
<waitForPageLoad stepKey="waitForSimpleProductToSave"/>
<!-- Verify customer see success message -->
<see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertSimpleProductSaveSuccessMessage"/>

<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid2"/>
<waitForPageLoad stepKey="waitForCatalogProductGrid2"/>

<!--Sorting works (By Websites) ASC-->
<actionGroup ref="resetProductGridToDefaultView" stepKey="setProductGridToDefaultSortingWebsites"/>
<click selector="{{AdminProductGridSection.columnHeader('Websites')}}" stepKey="clickWebsitesHeaderToSortAsc"/>
<grabTextFrom selector="{{AdminProductGridSection.productGridCell('Main Website', 'Country of Manufacture')}}" stepKey="getFirstWebsitesSortAsc"/>
<grabTextFrom selector="{{AdminProductGridSection.productGridCell('Second Website', 'Country of Manufacture')}}" stepKey="getSecondWebsitesSortAsc"/>
<assertLessThanOrEqual expected="$getSecondPriceSortAsc" actual="$getFirstPriceSortAsc" stepKey="checkPriceAscSortCorrect"/>
<!--Sort Descending-->
<see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="Main Website" stepKey="checkIfProduct1WebsitesAsc"/>
<see selector="{{AdminProductGridSection.productGridContentsOnRow('2')}}" userInput="Second Website" stepKey="checkIfProduct2WebsitesAsc"/>

<!--Sorting works (By Websites) DESC-->
<click selector="{{AdminProductGridSection.columnHeader('Websites')}}" stepKey="clickWebsitesHeaderToSortDesc"/>
<grabTextFrom selector="{{AdminProductGridSection.productGridCell('Main Website', 'Country of Manufacture')}}" stepKey="getFirstWebsitesSortDesc"/>
<grabTextFrom selector="{{AdminProductGridSection.productGridCell('Second Website', 'Country of Manufacture')}}" stepKey="getSecondWebsitesSortDesc"/>
<assertGreaterThanOrEqual expected="$getSecondWebsitesSortDesc" actual="$getFirstWebsitesSortDesc" stepKey="checkWebsitesDescSortCorrect"/>
<see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="Second Website" stepKey="checkIfProduct1WebsitesDesc"/>
<see selector="{{AdminProductGridSection.productGridContentsOnRow('2')}}" userInput="Main Website" stepKey="checkIfProduct2WebsitesDesc"/>
</test>
</tests>

0 comments on commit 5362c5a

Please sign in to comment.