Skip to content

Tests for: magento/magento2#24907, magento/magento2#25051, magento/magento2#25149, magento/magento2#24973, magento/magento2#25666. #25915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,11 @@
<requiredEntity type="product_option">ProductOptionDateTime</requiredEntity>
<requiredEntity type="product_option">ProductOptionTime</requiredEntity>
</entity>
<entity name="productWithDateTimeOption" type="product">
<var key="sku" entityType="product" entityKey="sku" />
<data key="file">magento.jpg</data>
<requiredEntity type="product_option">ProductOptionDateTime</requiredEntity>
</entity>
<entity name="productWithOptionRadiobutton" type="product">
<var key="sku" entityType="product" entityKey="sku" />
<requiredEntity type="product_option">ProductOptionRadiobuttonWithTwoFixedOptions</requiredEntity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminProductCustomizableOptionsSection">
<element name="requiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('#product_composite_configure_form_fields .admin__field.required .admin__field-label'), ':after').getPropertyValue('content');"/>
<element name="checkIfCustomizableOptionsTabOpen" type="text" selector="//span[text()='Customizable Options']/parent::strong/parent::*[@data-state-collapsible='closed']" timeout="30"/>
<element name="customizableOptions" type="text" selector="//strong[contains(@class, 'admin__collapsible-title')]/span[text()='Customizable Options']"/>
<element name="useDefaultOptionTitle" type="text" selector="[data-index='options'] tr.data-row [data-index='title'] [name^='options_use_default']"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<element name="specialPriceValue" type="text" selector="//span[@class='special-price']//span[@class='price']"/>
<element name="mapPrice" type="text" selector="//div[@class='price-box price-final_price']//span[contains(@class, 'price-msrp_price')]"/>
<element name="clickForPriceLink" type="text" selector="//div[@class='price-box price-final_price']//a[contains(text(), 'Click for price')]"/>
<element name="addReviewLink" type="text" selector="//div[@class='reviews-actions']//a[@class='action add']"/>

<!-- The parameter is the nth custom option that you want to get -->
<element name="nthCustomOption" type="block" selector="//*[@id='product-options-wrapper']/*[@class='fieldset']/*[contains(@class, 'field')][{{customOptionNum}}]" parameterized="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
<element name="imageFile" type="text" selector="//*[@class='product media']//img[contains(@src, '{{filename}}')]" parameterized="true"/>
<element name="productImageActive" type="text" selector=".product.media div[data-active=true] > img[src*='{{filename}}']" parameterized="true"/>
<element name="productImageInFotorama" type="file" selector=".fotorama__nav__shaft img[src*='{{imageName}}']" parameterized="true"/>
<element name="fotoramaPrevButton" type="button" selector="//*[@data-gallery-role='gallery']//*[@data-gallery-role='nav-wrap']//*[@data-gallery-role='arrow' and contains(@class, 'fotorama__thumb__arr--left')]"/>
<element name="fotoramaNextButton" type="button" selector="//*[@data-gallery-role='gallery']//*[@data-gallery-role='nav-wrap']//*[@data-gallery-role='arrow' and contains(@class, 'fotorama__thumb__arr--right')]"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminAddDefaultImageSimpleProductTest">
<annotations>
<features value="Catalog"/>
<title value="Storefront Fotorama arrows test"/>
<description value="Check arrows next to the thumbs are not visible than there is room for all pictures."/>
<severity value="MINOR"/>
<group value="Catalog"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="_defaultProduct" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logout"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
</after>

<!-- Open Product for edit -->
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="findCreatedProductInGrid">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="goToEditProductPage">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>

<!-- Add images to product -->
<actionGroup ref="addProductImage" stepKey="addFirstImageToProduct">
<argument name="image" value="MagentoLogo"/>
</actionGroup>
<actionGroup ref="addProductImage" stepKey="addSecondImageToProduct">
<argument name="image" value="ProductImage"/>
</actionGroup>
<actionGroup ref="addProductImage" stepKey="addThirdImageToProduct">
<argument name="image" value="TestImageNew"/>
</actionGroup>
<actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/>

<!-- Assert product in storefront product page -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openCreatedProductPage">
<argument name="productUrl" value="$$createProduct.name$$"/>
</actionGroup>

<!-- Assert Fotorama arrows aren't visible -->
<dontSeeElement selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="dontSeePrevButton"/>
<dontSeeElement selector="{{StorefrontProductMediaSection.fotoramaNextButton}}" stepKey="dontSeeNextButton"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontCategoryAccessibleWhenSuffixIsNullTest">
<annotations>
<title value="Storefront category is accessible when url suffix is set to null test"/>
<description value="Check no crash occurs on Category page when catalog/seo/category_url_suffix is set to null"/>
<features value="CatalogUrlRewrite"/>
<severity value="MAJOR"/>
<group value="CatalogUrlRewrite"/>
</annotations>
<before>
<magentoCLI command="config:set catalog/seo/category_url_suffix ''" stepKey="setCategoryUrlSuffix"/>
<magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 0"
stepKey="setCategoryProductRewrites"/>
<magentoCLI command="cache:flush" stepKey="flushCacheBefore"/>
<createData entity="_defaultCategory" stepKey="createCategory"/>
</before>
<after>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<magentoCLI command="config:set catalog/seo/category_url_suffix '.html'"
stepKey="restoreCategoryUrlSuffix"/>
<magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1"
stepKey="restoreCategoryProductRewrites"/>
<magentoCLI command="cache:flush" stepKey="flushCacheAfter"/>
</after>

<amOnPage url="/$$createCategory.name$$" stepKey="onCategoryPage"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<seeInTitle userInput="$$createCategory.name$$" stepKey="assertCategoryNameInTitle"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontNoJavascriptErrorOnAddYourReviewClickTest">
<annotations>
<features value="Review"/>
<title value="Storefront no javascript error on 'Add Your Review' click test"/>
<description value="Verify no javascript error occurs when customer clicks 'Add Your Review' link"/>
<severity value="MAJOR"/>
<group value="review"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<createData entity="textProductAttribute" stepKey="createProductAttribute"/>
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/"
stepKey="onAttributeSetEdit"/>
<actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup">
<argument name="group" value="Product Details"/>
<argument name="attribute" value="$$createProductAttribute.attribute_code$$"/>
</actionGroup>
<actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="SimpleProductWithCustomAttributeSet" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
<requiredEntity createDataKey="createAttributeSet"/>
</createData>
</before>
<after>
<deleteData createDataKey="createProduct" stepKey="deleteProductCustom"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/>
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="goToProductPage"/>
<dontSeeElement selector="{{StorefrontProductInfoDetailsSection.productNameForReview}}" stepKey="dontSeeReviewTab"/>
<click selector="{{StorefrontProductInfoMainSection.addReviewLink}}" stepKey="clickAddReview"/>
<dontSeeJsError stepKey="dontSeeJsError"/>
<seeElement selector="{{StorefrontProductInfoDetailsSection.productNameForReview}}" stepKey="seeReviewTab"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCreateOrderWithDateTimeOptionUITest">
<annotations>
<title value="Admin create order with date time option UI test"/>
<description value="Check asterisk rendered correctly for Product with custom option (datetime) at backend"/>
<features value="Sales"/>
<severity value="MINOR"/>
<group value="Sales"/>
</annotations>

<before>
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="_defaultProduct" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<updateData createDataKey="createProduct" entity="productWithDateTimeOption" stepKey="updateProductWithOption"/>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logout"/>
<deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/>
<deleteData createDataKey="createCustomer" stepKey="deleteSimpleCustomer"/>
</after>

<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer">
<argument name="customer" value="$$createCustomer$$"/>
</actionGroup>

<click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/>
<fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="$$createProduct.sku$$" stepKey="fillSkuFilter"/>
<click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/>
<scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/>
<checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/>
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
<executeJS function="{{AdminProductCustomizableOptionsSection.requiredFieldIndicator}}" stepKey="dateTimeRequiredFieldIndicator"/>
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="dateTimeRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator"/>
</test>
</tests>

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Magento\TestFramework\Helper\Bootstrap;

/**
* Collection test
* Test for Magento\Catalog\Model\ResourceModel\Product\Collection
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
Expand Down Expand Up @@ -287,8 +287,8 @@ public function testAddAttributeToFilterAffectsGetSize(): void
*/
public function testAddAttributeTierPriceToFilter($condition): void
{
$this->collection->addAttributeToFilter('tier_price', $condition);
$this->assertEquals(1, $this->collection->getSize());
$size = $this->collection->addAttributeToFilter('tier_price', $condition)->getSize();
$this->assertEquals(1, $size);
}

/**
Expand All @@ -314,8 +314,8 @@ public function addAttributeTierPriceToFilterDataProvider(): array
*/
public function testAddAttributeIsSaleableToFilter($condition): void
{
$this->collection->addAttributeToFilter('is_saleable', $condition);
$this->assertEquals(1, $this->collection->getSize());
$size = $this->collection->addAttributeToFilter('is_saleable', $condition)->getSize();
$this->assertEquals(1, $size);
}

/**
Expand Down