Skip to content

Commit

Permalink
Merge pull request #3705 from magento-obsessive-owls/cms-team-1-deliv…
Browse files Browse the repository at this point in the history
…ery-core

[Owls] Product associated to website & MFTF migration to core
  • Loading branch information
joanhe committed Feb 8, 2019
2 parents ca42e42 + 2209e7a commit 88d0413
Show file tree
Hide file tree
Showing 20 changed files with 220 additions and 6 deletions.
Expand Up @@ -71,7 +71,9 @@
<!--Save product and see success message-->
<actionGroup name="saveProductForm">
<scrollToTopOfPage stepKey="scrollTopPageProduct"/>
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveProductButton" />
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
<waitForPageLoad stepKey="waitForProductToSave"/>
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
</actionGroup>

Expand Down Expand Up @@ -258,7 +260,7 @@
<argument name="website" type="string"/>
</arguments>
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/>
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenProductInWebsite"/>
<conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{AdminProductContentSection.sectionHeaderShow}}" visible="false" stepKey="expandSection"/>
<waitForPageLoad stepKey="waitForPageOpened"/>
<checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/>
</actionGroup>
Expand Down Expand Up @@ -328,4 +330,47 @@
</assertEquals>
</actionGroup>

<actionGroup name="expandAdminProductSection">
<arguments>
<argument name="sectionSelector" defaultValue="{{AdminProductContentSection.sectionHeader}}" type="string"/>
<argument name="sectionDependentSelector" defaultValue="{{AdminProductContentSection.sectionHeaderShow}}" type="string"/>
</arguments>
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
<waitForElementVisible time="30" selector="{{sectionSelector}}" stepKey="waitForSection"/>
<conditionalClick selector="{{sectionSelector}}" dependentSelector="{{sectionDependentSelector}}" visible="false" stepKey="expandSection"/>
<waitForPageLoad time="30" stepKey="waitForSectionToExpand"/>
</actionGroup>
<actionGroup name="navigateToCreatedProductEditPage">
<arguments>
<argument name="product" defaultValue="_defaultProduct"/>
</arguments>
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage"/>
<waitForPageLoad stepKey="waitForProductIndexPageToLoad"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
<waitForPageLoad stepKey="waitForClearFilters"/>
<dontSeeElement selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="dontSeeClearFilters"/>
<click selector="{{AdminProductGridFilterSection.viewDropdown}}" stepKey="openViewBookmarksTab"/>
<click selector="{{AdminProductGridFilterSection.viewBookmark('Default View')}}" stepKey="resetToDefaultGridView"/>
<waitForPageLoad stepKey="waitForResetToDefaultView"/>
<see selector="{{AdminProductGridFilterSection.viewDropdown}}" userInput="Default View" stepKey="seeDefaultViewSelected"/>
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
<waitForPageLoad stepKey="waitForFilterOnGrid"/>
<click selector="{{AdminProductGridSection.selectRowBasedOnName(product.name)}}" stepKey="clickProduct"/>
<waitForPageLoad stepKey="waitForProductEditPageLoad"/>
<waitForElementVisible selector="{{AdminProductFormBundleSection.productSku}}" stepKey="waitForProductSKUField"/>
<seeInField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSKU"/>
</actionGroup>
<actionGroup name="addUpSellProductBySku" extends="addRelatedProductBySku">
<click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddUpSellProductsButton}}" stepKey="clickAddRelatedProductButton"/>
<conditionalClick selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
<click selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
<fillField selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
<click selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
<click selector="{{AdminAddUpSellProductsModalSection.Modal}}{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/>
<click selector="{{AdminAddUpSellProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/>
<waitForPageLoad stepKey="waitForPageToLoad1"/>
</actionGroup>
</actionGroups>
Expand Up @@ -96,4 +96,21 @@
<waitForPageLoad stepKey="waitForUserInput"/>
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/>
</actionGroup>
<actionGroup name="saveProductAttribute">
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/>
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/>
<waitForPageLoad stepKey="waitForAttributeToSave"/>
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/>
</actionGroup>
<actionGroup name="confirmChangeInputTypeModal">
<waitForElementVisible selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostConfirmButton}}" stepKey="waitForChangeInputTypeButton"/>
<click selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostConfirmButton}}" stepKey="clickChangeInputTypeButton"/>
<waitForElementNotVisible selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostModal}}" stepKey="waitForChangeInputTypeModalGone"/>
</actionGroup>
<actionGroup name="saveProductAttributeInUse">
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/>
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/>
<waitForPageLoad stepKey="waitForAttributeToSave"/>
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Expand Up @@ -261,4 +261,15 @@
<waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
</actionGroup>

<actionGroup name="NavigateToAndResetProductGridToDefaultView" extends="resetProductGridToDefaultView">
<amOnPage url="{{AdminProductIndexPage.url}}" before="clickClearFilters" stepKey="goToAdminProductIndexPage"/>
<waitForPageLoad after="goToAdminProductIndexPage" stepKey="waitForProductIndexPageToLoad"/>
</actionGroup>
<actionGroup name="NavigateToAndResetProductAttributeGridToDefaultView">
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
<waitForPageLoad stepKey="waitForGridLoad"/>
</actionGroup>
</actionGroups>
23 changes: 23 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml
Expand Up @@ -115,4 +115,27 @@
<data key="used_for_sort_by">true</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
<entity name="productAttributeText" type="ProductAttribute">
<data key="attribute_code" unique="suffix">attribute</data>
<data key="frontend_input">text</data>
<data key="scope">global</data>
<data key="is_required">false</data>
<data key="is_unique">false</data>
<data key="is_searchable">false</data>
<data key="is_visible">true</data>
<data key="backend_type">text</data>
<data key="is_wysiwyg_enabled">false</data>
<data key="is_visible_in_advanced_search">false</data>
<data key="is_visible_on_front">true</data>
<data key="is_filterable">false</data>
<data key="is_filterable_in_search">false</data>
<data key="used_in_product_listing">false</data>
<data key="is_used_for_promo_rules">false</data>
<data key="is_comparable">true</data>
<data key="is_used_in_grid">false</data>
<data key="is_visible_in_grid">false</data>
<data key="is_filterable_in_grid">false</data>
<data key="used_for_sort_by">false</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
</entities>
Expand Up @@ -14,4 +14,10 @@
<data key="attributeGroupId">7</data>
<data key="sortOrder">0</data>
</entity>
<entity name="AddToDefaultSetSortOrder1" type="ProductAttributeSet">
<var key="attributeCode" entityKey="attribute_code" entityType="ProductAttribute"/>
<data key="attributeSetId">4</data>
<data key="attributeGroupId">7</data>
<data key="sortOrder">1</data>
</entity>
</entities>
9 changes: 9 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Expand Up @@ -708,4 +708,13 @@
<data key="status">1</data>
<requiredEntity type="product_extension_attribute">EavStock100</requiredEntity>
</entity>
<entity name="ProductShortDescription" type="ProductAttribute">
<data key="attribute_code">short_description</data>
</entity>
<entity name="AddToDefaultSetTopOfContentSection" type="ProductAttributeSet">
<var key="attributeCode" entityKey="attribute_code" entityType="ProductAttribute"/>
<data key="attributeSetId">4</data>
<data key="attributeGroupId">13</data>
<data key="sortOrder">0</data>
</entity>
</entities>
Expand Up @@ -18,6 +18,8 @@
<element name="AttributeDescription" type="text" selector="#description"/>
<element name="ChangeAttributeDescriptionToggle" type="checkbox" selector="#toggle_description"/>
<element name="Save" type="button" selector="button[title=Save]" timeout="30"/>
<element name="ProductDataMayBeLostModal" type="button" selector="//aside[contains(@class,'_show')]//header[contains(.,'Product data may be lost')]"/>
<element name="ProductDataMayBeLostConfirmButton" type="button" selector="//aside[contains(@class,'_show')]//button[.='Change Input Type']"/>
<element name="defaultLabel" type="text" selector="//td[contains(text(), '{{attributeName}}')]/following-sibling::td[contains(@class, 'col-frontend_label')]" parameterized="true"/>
</section>
</sections>
Expand Up @@ -10,6 +10,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminProductContentSection">
<element name="sectionHeader" type="button" selector="div[data-index='content']" timeout="30"/>
<element name="sectionHeaderShow" type="button" selector="div[data-index='content']._show" timeout="30"/>
<element name="descriptionTextArea" type="textarea" selector="#product_form_description"/>
<element name="shortDescriptionTextArea" type="textarea" selector="#product_form_short_description"/>
<element name="sectionHeaderIfNotShowing" type="button" selector="//div[@data-index='content']//div[contains(@class, '_hide')]"/>
Expand Down
Expand Up @@ -10,6 +10,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminProductFormRelatedUpSellCrossSellSection">
<element name="AddRelatedProductsButton" type="button" selector="button[data-index='button_related']" timeout="30"/>
<element name="AddUpSellProductsButton" type="button" selector="button[data-index='button_upsell']" timeout="30"/>
<element name="relatedProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='related']"/>
<element name="upSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='upsell']"/>
<element name="crossSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='crosssell']"/>
Expand All @@ -18,4 +19,8 @@
<element name="selectedRelatedProduct" type="block" selector="//span[@data-index='name']"/>
<element name="removeRelatedProduct" type="button" selector="//span[text()='Related Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
</section>
<section name="AdminAddUpSellProductsModalSection">
<element name="Modal" type="button" selector=".product_form_product_form_related_upsell_modal"/>
<element name="AddSelectedProductsButton" type="button" selector="//aside[contains(@class, 'product_form_product_form_related_upsell_modal')]//button/span[contains(text(), 'Add Selected Products')]" timeout="30"/>
</section>
</sections>
5 changes: 5 additions & 0 deletions app/code/Magento/CatalogWidget/Block/Product/ProductsList.php
Expand Up @@ -300,6 +300,11 @@ public function createCollection()
{
/** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
$collection = $this->productCollectionFactory->create();

if ($this->getData('store_id') !== null) {
$collection->setStoreId($this->getData('store_id'));
}

$collection->setVisibility($this->catalogProductVisibility->getVisibleInCatalogIds());

$collection = $this->_addProductAttributesAndPrices($collection)
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Cms/Block/Widget/Block.php
Expand Up @@ -83,7 +83,7 @@ protected function _beforeToHtml()

if ($block && $block->isActive()) {
try {
$storeId = $this->_storeManager->getStore()->getId();
$storeId = $this->getData('store_id') ?? $this->_storeManager->getStore()->getId();
$this->setText(
$this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent())
);
Expand Down
47 changes: 46 additions & 1 deletion app/code/Magento/Cms/Test/Mftf/ActionGroup/CMSActionGroup.xml
Expand Up @@ -54,7 +54,6 @@
<waitForPageLoad stepKey="waitForPageLoad4"/>
<see userInput="You deleted the block." stepKey="VerifyBlockIsDeleted"/>
</actionGroup>

<actionGroup name="AddStoreViewToCmsPage" extends="navigateToCreatedCMSPage">
<arguments>
<argument name="storeViewName" type="string"/>
Expand All @@ -70,4 +69,50 @@
<waitForPageLoad stepKey="waitForPageLoad"/>
<see userInput="You saved the page." stepKey="seeMessage"/>
</actionGroup>
<actionGroup name="saveAndCloseCMSBlockWithSplitButton">
<waitForElementVisible selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="waitForExpandSplitButtonToBeVisible" />
<click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitButton"/>
<click selector="{{BlockNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveBlock"/>
<waitForPageLoad stepKey="waitForPageLoadAfterClickingSave" />
<see userInput="You saved the block." stepKey="assertSaveBlockSuccessMessage"/>
</actionGroup>
<actionGroup name="navigateToStorefrontForCreatedPage">
<arguments>
<argument name="page" type="string"/>
</arguments>
<amOnPage url="{{page}}" stepKey="goToStorefront"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>
<actionGroup name="saveCMSBlock">
<waitForElementVisible selector="{{CmsNewBlockBlockActionsSection.savePage}}" stepKey="waitForSaveButton"/>
<click selector="{{CmsNewBlockBlockActionsSection.savePage}}" stepKey="clickSaveButton"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<see userInput="You saved the block." stepKey="seeSuccessfulSaveMessage"/>
</actionGroup>
<actionGroup name="saveAndContinueEditCmsPage">
<waitForElementVisible time="10" selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="waitForSaveAndContinueVisibility"/>
<click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSaveAndContinueEditCmsPage"/>
<waitForPageLoad stepKey="waitForCmsPageLoad"/>
<waitForElementVisible time="1" selector="{{CmsNewPagePageActionsSection.cmsPageTitle}}" stepKey="waitForCmsPageSaveButton"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
</actionGroup>
<actionGroup name="saveCmsPage">
<waitForElementVisible selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="waitForSplitButton"/>
<click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitButton"/>
<waitForElementVisible selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="waitForSaveCmsPage"/>
<click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSaveCmsPage"/>
<waitForElementVisible time="1" selector="{{CmsPagesPageActionsSection.addNewPageButton}}" stepKey="waitForCmsPageSaveButton"/>
<see userInput="You saved the page." selector="{{CmsPagesPageActionsSection.savePageSuccessMessage}}" stepKey="assertSavePageSuccessMessage"/>
</actionGroup>
<actionGroup name="setLayout">
<arguments>
<argument name="designSection"/>
<argument name="layoutOption"/>
</arguments>
<waitForElementVisible selector="{{designSection.DesignTab}}" stepKey="waitForDesignTabVisible"/>
<conditionalClick selector="{{designSection.DesignTab}}" dependentSelector="{{designSection.LayoutDropdown}}" visible="false" stepKey="clickOnDesignTab"/>
<waitForPageLoad stepKey="waitForPageLoadDesignTab"/>
<waitForElementVisible selector="{{designSection.LayoutDropdown}}" stepKey="waitForLayoutDropDown" />
<selectOption selector="{{designSection.LayoutDropdown}}" userInput="{{layoutOption}}" stepKey="selectLayout"/>
</actionGroup>
</actionGroups>
9 changes: 9 additions & 0 deletions app/code/Magento/Cms/Test/Mftf/Data/CmsPageData.xml
Expand Up @@ -86,4 +86,13 @@
<data key="content">1&lt;br/&gt;2&lt;br/&gt;3&lt;br/&gt;4&lt;br/&gt;5&lt;br/&gt;6&lt;br/&gt;7&lt;br/&gt;8&lt;br/&gt;9&lt;br/&gt;10&lt;br/&gt;11&lt;br/&gt;12&lt;br/&gt;13&lt;br/&gt;14&lt;br/&gt;15&lt;br/&gt;16&lt;br/&gt;17&lt;br/&gt;18&lt;br/&gt;19&lt;br/&gt;20&lt;br/&gt;line21&lt;br/&gt;22&lt;br/&gt;23&lt;br/&gt;24&lt;br/&gt;25&lt;br/&gt;26&lt;br/&gt;line27&lt;br/&gt;2&lt;br/&gt;3&lt;br/&gt;4&lt;br/&gt;5</data>
<data key="identifier" unique="suffix">test-page-</data>
</entity>
<entity name="_emptyCmsPage" type="cms_page">
<data key="title" unique="suffix">Test CMS Page</data>
<data key="identifier" unique="suffix">test-page-</data>
</entity>
<entity name="_emptyCmsBlock" type="block">
<data key="title" unique="suffix">Test CMS Block</data>
<data key="identifier" unique="suffix" >block</data>
<data key="active">true</data>
</entity>
</entities>

0 comments on commit 88d0413

Please sign in to comment.