Skip to content

Commit c168581

Browse files
committed
MC-7293: Admin with access to one website can create product and assign only for this website
1 parent 5a17bf3 commit c168581

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<arguments>
3636
<argument name="product" defaultValue="_defaultProduct"/>
3737
</arguments>
38+
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
3839
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/>
3940
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/>
4041
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/>
@@ -283,4 +284,36 @@
283284
</arguments>
284285
<amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="goToProduct"/>
285286
</actionGroup>
287+
288+
<!-- This action group simply navigates to the product catalog page -->
289+
<actionGroup name="AdminGoToProductCatalogPage">
290+
<comment userInput="actionGroup:GoToProductCatalogPage" stepKey="actionGroupComment"/>
291+
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPage"/>
292+
<waitForPageLoad stepKey="WaitForPageToLoad"/>
293+
</actionGroup>
294+
295+
<!-- You are on product Edit Page -->
296+
<!-- Assert checkbox available for website in Product In Websites -->
297+
<actionGroup name="AdminAssertWebsiteIsAvailableInProductWebsites">
298+
<arguments>
299+
<argument name="website" type="string"/>
300+
</arguments>
301+
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToProductInWebsitesSection"/>
302+
<conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{ProductInWebsitesSection.sectionHeaderOpened}}" visible="false" stepKey="expandProductWebsitesSection"/>
303+
<seeElement selector="{{ProductInWebsitesSection.website(website)}}" stepKey="seeCheckboxForWebsite"/>
304+
</actionGroup>
305+
306+
<!-- You are on product Edit Page -->
307+
<!-- Assert checkbox not available for website in Product In Websites -->
308+
<actionGroup name="AdminAssertWebsiteIsNotAvailableInProductWebsites" extends="AdminAssertWebsiteIsAvailableInProductWebsites">
309+
<remove keyForRemoval="seeCheckboxForWebsite"/>
310+
<dontSeeElement selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="dontSeeCheckboxForWebsite"/>
311+
</actionGroup>
312+
313+
<!-- You are on product Edit Page -->
314+
<!-- Assert checkbox Is checked for website in Product In Websites -->
315+
<actionGroup name="AdminAssertProductIsAssignedToWebsite" extends="AdminAssertWebsiteIsAvailableInProductWebsites">
316+
<remove keyForRemoval="seeCheckboxForWebsite"/>
317+
<seeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsChecked"/>
318+
</actionGroup>
286319
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
</section>
5454
<section name="ProductInWebsitesSection">
5555
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
56+
<element name="sectionHeaderOpened" type="button" selector="[data-index='websites']._show" timeout="30"/>
5657
<element name="website" type="checkbox" selector="//label[contains(text(), '{{var1}}')]/parent::div//input[@type='checkbox']" parameterized="true"/>
5758
<element name="isWebsiteDisabled" type="checkbox" selector="//label[contains(text(), '{{websiteName}}')]/parent::div//input[@type='checkbox' and @disabled]" parameterized="true"/>
5859
</section>

0 commit comments

Comments
 (0)