/**
  * 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.");
     }
 }
 /**
  * Run CreateAttributeSetEntity test.
  *
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttribute
  * @return void
  */
 public function test(CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute)
 {
     // Precondition
     $productAttribute->persist();
     // Steps:
     $this->productSetIndex->open();
     $this->productSetIndex->getPageActionsBlock()->addNew();
     $this->productSetAdd->getAttributeSetForm()->fill($attributeSet);
     $this->productSetAdd->getPageActions()->save();
     $this->productSetEdit->getAttributeSetEditBlock()->moveAttribute($productAttribute->getData());
     $this->productSetEdit->getPageActions()->save();
 }
 /**
  * Assert that after save a product template "The attribute set has been saved." successful message appears.
  *
  * @param CatalogProductSetIndex $productSetIndex
  * @return void
  */
 public function processAssert(CatalogProductSetIndex $productSetIndex)
 {
     \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $productSetIndex->getMessagesBlock()->getSuccessMessages());
 }
 /**
  * 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.");
 }