/**
  * Run test duplicate product entity.
  *
  * @param string $productType
  * @return array
  */
 public function test($productType)
 {
     // Precondition
     $product = $this->createProduct($productType);
     // Steps
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $this->editProductPage->getFormPageActions()->duplicate();
     return ['product' => $product];
 }
 /**
  * Check whether the attribute is mandatory.
  *
  * @param CatalogProduct $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogProduct $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, InjectableFixture $product)
 {
     $catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $productForm = $catalogProductEdit->getProductForm();
     $productForm->getAttributeElement($attribute)->setValue('');
     $catalogProductEdit->getFormPageActions()->save();
     $failedAttributes = $productForm->getRequireNoticeAttributes($product);
     $actualMessage = $failedAttributes['general'][$attribute->getFrontendLabel()];
     \PHPUnit_Framework_Assert::assertEquals(self::REQUIRE_MESSAGE, $actualMessage, 'JS error notice on product edit page is not equal to expected.');
 }
 /**
  * Run update product simple entity test.
  *
  * @param CatalogProductSimple $initialProduct
  * @param CatalogProductSimple $product
  * @return array
  */
 public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product)
 {
     // Preconditions
     $initialProduct->persist();
     // Steps
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->searchAndOpen(['sku' => $initialProduct->getSku()]);
     $this->editProductPage->getProductForm()->fill($product);
     $this->editProductPage->getFormPageActions()->save();
     return ['category' => $this->getCategory($initialProduct, $product)];
 }
 /**
  * Add appurtenant products and save product.
  *
  * @param InjectableFixture $product
  * @param array $appurtenantData
  * @return void
  */
 protected function addAppurtenantProducts(InjectableFixture $product, array $appurtenantData)
 {
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $form = $this->editProductPage->getProductForm();
     $form->openTab($this->tabName);
     $appurtenantTab = $form->getTabElement($this->tabName);
     $appurtenantData[$this->appurtenantType['formIndex']]['value'] = $this->prepareData($appurtenantData[$this->appurtenantType['formIndex']]['value']);
     $appurtenantTab->fillFormTab($appurtenantData);
     $this->editProductPage->getFormPageActions()->save();
 }
 /**
  * Save product.
  *
  * @return void
  */
 public function run()
 {
     $this->catalogProductEdit->getFormPageActions()->save();
 }