Skip to content

Commit 888500d

Browse files
committed
ACP2E-2266: added test coverage
1 parent 1d49790 commit 888500d

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
use Magento\Catalog\Api\Data\ProductInterface;
1111
use Magento\Catalog\Api\ProductRepositoryInterface;
1212
use Magento\Catalog\Model\Session;
13+
use Magento\Catalog\Test\Fixture\Category;
14+
use Magento\Catalog\Test\Fixture\Product;
1315
use Magento\Framework\Registry;
1416
use Magento\TestFramework\Catalog\Model\ProductLayoutUpdateManager;
17+
use Magento\TestFramework\Fixture\DataFixture;
18+
use Magento\TestFramework\Fixture\DataFixtureStorage;
19+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
1520
use Magento\TestFramework\Helper\Bootstrap;
1621
use Magento\TestFramework\Helper\Xpath;
1722
use Magento\TestFramework\TestCase\AbstractController;
@@ -34,6 +39,11 @@ class ProductTest extends AbstractController
3439
/** @var Session */
3540
private $session;
3641

42+
/**
43+
* @var DataFixtureStorage
44+
*/
45+
private $fixture;
46+
3747
/**
3848
* @inheritdoc
3949
*/
@@ -53,6 +63,7 @@ protected function setUp(): void
5363
$this->registry = $this->_objectManager->get(Registry::class);
5464
$this->productRepository = $this->_objectManager->get(ProductRepositoryInterface::class);
5565
$this->session = $this->_objectManager->get(Session::class);
66+
$this->fixture = DataFixtureStorageManager::getStorage();
5667
}
5768

5869
/**
@@ -255,4 +266,33 @@ public function testViewWithCustomUpdate(): void
255266
->getHandles();
256267
$this->assertContains("catalog_product_view_selectable_{$sku}_{$file}", $handles);
257268
}
269+
270+
#[
271+
DataFixture(Category::class, as: 'category'),
272+
DataFixture(
273+
Product::class,
274+
['category_ids' => ['$category.id$'], 'short_description' => 'Product Short Description'],
275+
as: 'product'
276+
)
277+
]
278+
public function testItempropOnProductPage()
279+
{
280+
$product = $this->fixture->get('product');
281+
$this->dispatch(sprintf('catalog/product/view/id/%s', $product->getEntityId()));
282+
$html = $this->getResponse()->getBody();
283+
$this->assertEquals(
284+
1,
285+
Xpath::getElementsCountForXpath(
286+
'//*[@itemprop="image"]',
287+
$html
288+
)
289+
);
290+
$this->assertEquals(
291+
1,
292+
Xpath::getElementsCountForXpath(
293+
'//*[@itemprop="description"]',
294+
$html
295+
)
296+
);
297+
}
258298
}

dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ define([
101101
expect(gallery.settings.api).toBeDefined();
102102
expect(gallery.settings.activeBreakpoint).toEqual({});
103103
expect(gallery.config.options.height).toEqual(element.height());
104-
expect(gallery.settings.$elementF.find('.fotorama__stage__frame.fotorama__active img')).toBeDefined();
104+
expect(gallery.settings.$elementF.find('img[itemprop]')).toBeDefined();
105105

106106
$.fn.data = originSpy;
107107
});

0 commit comments

Comments
 (0)