diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php new file mode 100644 index 0000000000000000000000000000000000000000..7a21e7498962d92aab05913b06be652afbb42d6b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Catalog\Test\Constraint; + +use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; + +class AssertProductHasImageInGrid extends AbstractConstraint +{ + /** + * Assert that product image is present in grid. + * + * @param CatalogProductIndex $productGrid + * @param InjectableFixture $product + * @return void + */ + public function processAssert( + CatalogProductIndex $productGrid, + InjectableFixture $product + ) { + $filter = ['sku' => $product->getSku()]; + $productGrid->open(); + $productGrid->getProductGrid()->search($filter); + $src = $productGrid->getProductGrid()->getBaseImageSource(); + \PHPUnit_Framework_Assert::assertTrue( + strpos($src, '/placeholder/') === false, + 'Product image is not present in product grid when it should be' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Product image is displayed in product grid.'; + } +} \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml index b26c94e627cdce095c0c8ab9de89df65f6736df6..9f4a5e4bb71fea9293612125157757f7e3d965da 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml @@ -520,6 +520,7 @@ <data name="tag" xsi:type="string">severity:S1</data> <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">100</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductHasImageInGrid" /> <constraint name="Magento\Catalog\Test\Constraint\AssertCanSaveProduct" /> </variation> </testCase>