/**
  * Assert that after save a product template on edit product set page displays:
  * 1. Correct product template name in Attribute set name field passed from fixture
  * 2. Created Product Attribute (if was added)
  *
  * @param CatalogProductSetIndex $productSet
  * @param CatalogProductSetEdit $productSetEdit
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttribute [optional]
  * @return void
  */
 public function processAssert(CatalogProductSetIndex $productSet, CatalogProductSetEdit $productSetEdit, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute = null)
 {
     $filterAttribute = ['set_name' => $attributeSet->getAttributeSetName()];
     $productSet->open();
     $productSet->getGrid()->searchAndOpen($filterAttribute);
     \PHPUnit_Framework_Assert::assertEquals($filterAttribute['set_name'], $productSetEdit->getAttributeSetEditBlock()->getAttributeSetName());
     if ($productAttribute !== null) {
         $attributeLabel = $productAttribute->getFrontendLabel();
         \PHPUnit_Framework_Assert::assertTrue($productSetEdit->getAttributeSetEditBlock()->checkProductAttribute($attributeLabel), "Product Attribute '{$attributeLabel}' is absent on Product Template Groups.");
     }
 }
 /**
  * Assert that created product template:
  * 1. Displays in product template suggest container dropdown
  * 2. Can be used for new created product.
  *
  * @param FixtureFactory $fixtureFactory
  * @param CatalogProductEdit $productEdit
  * @param CatalogProduct $productGrid
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogAttributeSet $attributeSetOriginal
  * @param CatalogProductNew $newProductPage
  * @param CatalogProductAttribute $productAttribute
  * @return void
  */
 public function processAssert(FixtureFactory $fixtureFactory, CatalogProductEdit $productEdit, CatalogProduct $productGrid, CatalogAttributeSet $attributeSet, CatalogProductNew $newProductPage, CatalogProductAttribute $productAttribute, CatalogAttributeSet $attributeSetOriginal = null)
 {
     $productGrid->open();
     $productGrid->getGridPageActionBlock()->addNew();
     /**@var CatalogProductSimple $productSimple */
     $productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['attribute_set_id' => ['attribute_set' => $attributeSet]]]);
     $newProductPage->getProductForm()->fill($productSimple);
     $newProductPage->getFormPageActions()->saveAndContinue();
     $attributeSetName = $attributeSet->getAttributeSetName();
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeSet($attributeSetName), "Product isn't in '{$attributeSetName}' Attribute Set.");
     if ($attributeSetOriginal === null) {
         $productEdit->getProductForm()->openTab('general');
         \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($productAttribute), "Product Attribute is absent on Product form.");
     }
 }
 /**
  * Assert that new product template displays in Product Templates grid.
  *
  * @param CatalogProductSetIndex $productSetPage
  * @param CatalogAttributeSet $attributeSet
  * @return void
  */
 public function processAssert(CatalogProductSetIndex $productSetPage, CatalogAttributeSet $attributeSet)
 {
     $filterAttributeSet = ['set_name' => $attributeSet->getAttributeSetName()];
     $productSetPage->open();
     \PHPUnit_Framework_Assert::assertTrue($productSetPage->getGrid()->isRowVisible($filterAttributeSet), "Attribute Set '{$filterAttributeSet['set_name']}' is absent in Product Template grid.");
 }