Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductsOnStorefront.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Product\CatalogProductView;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Mtf\Client\BrowserInterface;
12 
16 class AssertProductsOnStorefront extends AbstractConstraint
17 {
26  public function processAssert(
27  CatalogProductView $catalogProductView,
28  BrowserInterface $browser,
29  array $entities
30  ) {
31  foreach ($entities as $entity) {
32  $browser->open($_ENV['app_frontend_url'] . $entity->getUrlKey() . '.html');
33  \PHPUnit\Framework\Assert::assertEquals(
34  $catalogProductView->getViewBlock()->getProductName(),
35  $entity->getName(),
36  "Can't find product in store front"
37  );
38  }
39  }
40 
46  public function toString()
47  {
48  return 'Products are present on storefront.';
49  }
50 }
processAssert(CatalogProductView $catalogProductView, BrowserInterface $browser, array $entities)
$entity
Definition: element.phtml:22