Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertUpdatedProductStatusInGrid.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
12 class AssertUpdatedProductStatusInGrid extends AbstractConstraint
13 {
14  /* tags */
15  const SEVERITY = 'low';
16  /* end tags */
17 
25  public function processAssert(
26  CatalogProductSimple $product,
27  CatalogProductIndex $catalogProductIndex
28  ) {
29  $catalogProductIndex->open();
30  $productStatus = ($product->getStatus() === null || $product->getStatus() === 'Yes')
31  ? 'Enabled'
32  : 'Disabled';
33  $filter = ['status' => $productStatus];
34  \PHPUnit\Framework\Assert::assertTrue(
35  $catalogProductIndex->getProductGrid()->isRowVisible($filter),
36  'Product \'' . $product->getName() . '\' is absent in Products grid.'
37  );
38  }
39 
45  public function toString()
46  {
47  return 'Products are in grid.';
48  }
49 }
processAssert(CatalogProductSimple $product, CatalogProductIndex $catalogProductIndex)