/**
  * Run delete Catalog Event test.
  *
  * @param CatalogProductSimple $product
  * @return void
  */
 public function test(CatalogProductSimple $product)
 {
     //Steps
     $this->catalogEventIndex->open();
     $this->catalogEventIndex->getEventGrid()->searchAndOpen(['category_name' => $product->getCategoryIds()[0]]);
     $this->catalogEventNew->getPageActions()->deleteAndAcceptAlert();
 }
 /**
  * Create Catalog Event Entity from Catalog Event page.
  *
  * @param CatalogEvent $catalogEvent
  * @param FixtureFactory $fixtureFactory
  * @return array
  */
 public function test(CatalogEvent $catalogEvent, FixtureFactory $fixtureFactory)
 {
     //Preconditions:
     /**@var CatalogProductSimple $product */
     $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category']);
     $product->persist();
     //Steps:
     $this->catalogEventIndex->open();
     $this->catalogEventIndex->getPageActions()->addNew();
     /** @var CatalogCategory $category */
     $category = $product->getDatafieldConfig('category_ids')['source']->getProductCategory();
     $this->catalogEventNew->getTreeCategories()->selectCategory($category->getPath() . '/' . $category->getName());
     $this->catalogEventNew->getEventForm()->fill($catalogEvent);
     $this->catalogEventNew->getPageActions()->save();
     return ['product' => $product];
 }