Skip to content

Commit 5362c5a

Browse files
committed
Sorting by Websites not working in product grid in backoffice #20511
1 parent 93da772 commit 5362c5a

File tree

1 file changed

+51
-60
lines changed

1 file changed

+51
-60
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml

Lines changed: 51 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -15,80 +15,71 @@
1515
<description value="Sorting products by websites in Admin"/>
1616
</annotations>
1717
<before>
18-
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>
19-
20-
<!--Create Website -->
18+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
19+
<!--Create new website -->
2120
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
2221
<argument name="newWebsiteName" value="Second Website"/>
2322
<argument name="websiteCode" value="second_website"/>
2423
</actionGroup>
25-
26-
<!--Create Store -->
27-
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
28-
<argument name="website" value="Second Website"/>
29-
<argument name="storeGroupName" value="Second Store"/>
30-
<argument name="storeGroupCode" value="second_store"/>
31-
</actionGroup>
32-
33-
<!--Create Store view -->
34-
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
35-
<waitForPageLoad stepKey="waitForSystemStorePage"/>
36-
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
37-
<waitForPageLoad stepKey="waitForProductPageLoad"/>
38-
<waitForElementVisible selector="//legend[contains(., 'Store View Information')]" stepKey="waitForNewStorePageToOpen"/>
39-
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
40-
<fillField userInput="Second Store View" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/>
41-
<fillField userInput="second_store_view" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/>
42-
<selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="1" stepKey="enableStoreViewStatus"/>
43-
<click selector="{{AdminNewStoreViewActionsSection.saveButton}}" stepKey="clickSaveStoreView" />
44-
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForModal" />
45-
<see selector="{{AdminConfirmationModalSection.title}}" userInput="Warning message" stepKey="seeWarning" />
46-
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="dismissModal" />
47-
<waitForPageLoad stepKey="waitForPageLoad2" time="180" />
48-
<waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" time="150" stepKey="waitForPageReolad"/>
49-
<see userInput="You saved the store view." stepKey="seeSavedMessage" />
50-
51-
<!--Create a Simple Product 1 -->
52-
<actionGroup ref="createSimpleProductAndAddToWebsite" stepKey="createSimpleProduct1">
53-
<argument name="product" value="simpleProductForMassUpdate"/>
54-
<argument name="website" value="Second Website"/>
55-
</actionGroup>
56-
57-
<!--Create a Simple Product 2 -->
58-
<actionGroup ref="createSimpleProductAndAddToWebsite" stepKey="createSimpleProduct2">
59-
<argument name="product" value="simpleProductForMassUpdate2"/>
60-
<argument name="website" value="Second Website"/>
61-
</actionGroup>
6224
</before>
6325
<after>
64-
<!--Delete website -->
65-
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite">
26+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite">
6627
<argument name="websiteName" value="Second Website"/>
6728
</actionGroup>
68-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
69-
70-
<!--Delete Products -->
71-
<actionGroup ref="DeleteProductActionGroup" stepKey="deleteProduct1">
72-
<argument name="productName" value="simpleProductForMassUpdate.name"/>
73-
</actionGroup>
74-
<actionGroup ref="DeleteProductActionGroup" stepKey="deleteProduct2">
75-
<argument name="productName" value="simpleProductForMassUpdate2.name"/>
76-
</actionGroup>
77-
<actionGroup ref="logout" stepKey="amOnLogoutPage"/>
29+
<actionGroup ref="logout" stepKey="logout"/>
7830
</after>
7931

32+
<actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/>
33+
<!--Create a Simple Product -->
8034
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/>
8135
<waitForPageLoad stepKey="waitForCatalogProductGrid"/>
36+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
37+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
38+
<fillField userInput="{{_defaultProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
39+
<fillField userInput="{{_defaultProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
40+
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
41+
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
42+
43+
<!--Save the product -->
44+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/>
45+
<waitForLoadingMaskToDisappear stepKey="waitProductPageSave"/>
46+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeProductSavedMessage"/>
47+
48+
<!-- Add this product to second website -->
49+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProductInWebsitesSection1"/>
50+
<click selector="{{ProductInWebsitesSection.website('Second Website')}}" stepKey="selectSecondWebsite"/>
51+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/>
52+
<waitForLoadingMaskToDisappear stepKey="waitForProductPagetoSaveAgain"/>
53+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessageAgain"/>
8254

83-
<!--Sort Ascending-->
55+
<!--Create a Simple Product 2 -->
56+
<amOnPage url="{{ProductCatalogPage.url}}" stepKey="openProductCatalogPage"/>
57+
<waitForPageLoad stepKey="waitForProductCatalogPage"/>
58+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/>
59+
<waitForPageLoad stepKey="waitForProductToggleToSelectSimpleProduct"/>
60+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickSimpleProductFromDropDownList"/>
61+
62+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.name}}" stepKey="fillSimpleProductName"/>
63+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.price}}" stepKey="fillSimpleProductPrice"/>
64+
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.weight}}" stepKey="fillSimpleProductWeight"/>
65+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.quantity}}" stepKey="fillSimpleProductQuantity"/>
66+
<click selector="{{AdminProductFormSection.save}}" stepKey="clickSaveButton2"/>
67+
<waitForPageLoad stepKey="waitForSimpleProductToSave"/>
68+
<!-- Verify customer see success message -->
69+
<see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertSimpleProductSaveSuccessMessage"/>
70+
71+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid2"/>
72+
<waitForPageLoad stepKey="waitForCatalogProductGrid2"/>
73+
74+
<!--Sorting works (By Websites) ASC-->
75+
<actionGroup ref="resetProductGridToDefaultView" stepKey="setProductGridToDefaultSortingWebsites"/>
8476
<click selector="{{AdminProductGridSection.columnHeader('Websites')}}" stepKey="clickWebsitesHeaderToSortAsc"/>
85-
<grabTextFrom selector="{{AdminProductGridSection.productGridCell('Main Website', 'Country of Manufacture')}}" stepKey="getFirstWebsitesSortAsc"/>
86-
<grabTextFrom selector="{{AdminProductGridSection.productGridCell('Second Website', 'Country of Manufacture')}}" stepKey="getSecondWebsitesSortAsc"/>
87-
<assertLessThanOrEqual expected="$getSecondPriceSortAsc" actual="$getFirstPriceSortAsc" stepKey="checkPriceAscSortCorrect"/>
88-
<!--Sort Descending-->
77+
<see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="Main Website" stepKey="checkIfProduct1WebsitesAsc"/>
78+
<see selector="{{AdminProductGridSection.productGridContentsOnRow('2')}}" userInput="Second Website" stepKey="checkIfProduct2WebsitesAsc"/>
79+
80+
<!--Sorting works (By Websites) DESC-->
8981
<click selector="{{AdminProductGridSection.columnHeader('Websites')}}" stepKey="clickWebsitesHeaderToSortDesc"/>
90-
<grabTextFrom selector="{{AdminProductGridSection.productGridCell('Main Website', 'Country of Manufacture')}}" stepKey="getFirstWebsitesSortDesc"/>
91-
<grabTextFrom selector="{{AdminProductGridSection.productGridCell('Second Website', 'Country of Manufacture')}}" stepKey="getSecondWebsitesSortDesc"/>
92-
<assertGreaterThanOrEqual expected="$getSecondWebsitesSortDesc" actual="$getFirstWebsitesSortDesc" stepKey="checkWebsitesDescSortCorrect"/>
82+
<see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="Second Website" stepKey="checkIfProduct1WebsitesDesc"/>
83+
<see selector="{{AdminProductGridSection.productGridContentsOnRow('2')}}" userInput="Main Website" stepKey="checkIfProduct2WebsitesDesc"/>
9384
</test>
9485
</tests>

0 commit comments

Comments
 (0)