Skip to content

Commit 2a47064

Browse files
committed
MC-6454: [2.3] Admin with access to one website can create product and assign only for this website
1 parent 5177344 commit 2a47064

File tree

4 files changed

+55
-25
lines changed

4 files changed

+55
-25
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<arguments>
3434
<argument name="product" defaultValue="_defaultProduct"/>
3535
</arguments>
36+
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
3637
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/>
3738
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/>
3839
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/>
@@ -489,4 +490,29 @@
489490
<conditionalClick selector="{{AdminProductFormSection.enableProductLabel}}" dependentSelector="{{AdminProductFormSection.productStatusValue('1')}}" visible="true" stepKey="disableProduct"/>
490491
<seeElement selector="{{AdminProductFormSection.productStatusValue('2')}}" stepKey="assertThatProductSetToDisabled"/>
491492
</actionGroup>
493+
494+
<!-- You are on product Edit Page -->
495+
<!-- Assert checkbox available for website in Product In Websites -->
496+
<actionGroup name="AssertWebsiteIsAvailableInProductWebsites">
497+
<arguments>
498+
<argument name="website" type="string"/>
499+
</arguments>
500+
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToProductInWebsitesSection"/>
501+
<conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{ProductInWebsitesSection.sectionHeaderOpened}}" visible="false" stepKey="expandProductWebsitesSection"/>
502+
<seeElement selector="{{ProductInWebsitesSection.website(website)}}" stepKey="seeCheckboxForWebsite"/>
503+
</actionGroup>
504+
505+
<!-- You are on product Edit Page -->
506+
<!-- Assert checkbox not available for website in Product In Websites -->
507+
<actionGroup name="AssertWebsiteIsNotAvailableInProductWebsites" extends="AssertWebsiteIsAvailableInProductWebsites">
508+
<remove keyForRemoval="seeCheckboxForWebsite"/>
509+
<dontSeeElement selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="dontSeeCheckboxForWebsite"/>
510+
</actionGroup>
511+
512+
<!-- You are on product Edit Page -->
513+
<!-- Assert checkbox Is checked for website in Product In Websites -->
514+
<actionGroup name="AssertProductIsAssignedToWebsite" extends="AssertWebsiteIsAvailableInProductWebsites">
515+
<remove keyForRemoval="seeCheckboxForWebsite"/>
516+
<seeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsChecked"/>
517+
</actionGroup>
492518
</actionGroups>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
</section>
7777
<section name="ProductInWebsitesSection">
7878
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
79+
<element name="sectionHeaderOpened" type="button" selector="[data-index='websites']._show" timeout="30"/>
7980
<element name="website" type="checkbox" selector="//label[contains(text(), '{{var1}}')]/parent::div//input[@type='checkbox']" parameterized="true"/>
8081
</section>
8182
<section name="ProductDesignSection">
@@ -214,4 +215,4 @@
214215
<element name="attributeGroupByName" type="button" selector="//div[@class='fieldset-wrapper-title']//span[text()='{{group}}']" parameterized="true"/>
215216
<element name="attributeByGroupAndName" type="text" selector="//div[@class='fieldset-wrapper-title']//span[text()='{{group}}']/../../following-sibling::div//span[contains(text(),'attribute')]" parameterized="true"/>
216217
</section>
217-
</sections>
218+
</sections>

app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedRoleActionGroup.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminDeleteUserRoleActionGroup">
11+
<arguments>
12+
<argument name="roleName" type="string"/>
13+
</arguments>
14+
<amOnPage url="{{AdminRolesPage.url}}" stepKey="navigateToUserRolesGrid" />
15+
<fillField selector="{{AdminRoleGridSection.roleNameFilterTextField}}" userInput="{{roleName}}" stepKey="enterRoleName" />
16+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch" />
17+
<see selector="{{AdminDataGridTableSection.row('1')}}" userInput="{{roleName}}" stepKey="seeUserRole" />
18+
<click selector="{{AdminDataGridTableSection.row('1')}}" stepKey="openRoleEditPage"/>
19+
<waitForPageLoad stepKey="waitForRoleEditPageLoad"/>
20+
<fillField selector="{{AdminEditRoleInfoSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterThePassword" />
21+
<click selector="{{AdminEditRoleInfoSection.deleteButton}}" stepKey="deleteUserRole"/>
22+
<waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForConfirmModal"/>
23+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/>
24+
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitSuccessMessage"/>
25+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="You deleted the role." stepKey="seeUserRoleDeleteMessage"/>
26+
</actionGroup>
27+
</actionGroups>

0 commit comments

Comments
 (0)