/**
  * Checking the product on the category page
  *
  * @param Bundle $product
  * @return void
  */
 protected function assertOnCategory($product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()));
     $productListBlock->openProductViewPage($product->getName());
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $this->assertSame($product->getName(), $productViewBlock->getProductName());
     $this->assertEquals($product->getProductPrice(), $productViewBlock->getProductPrice());
     // @TODO: add click on "Customize and Add To Cart" button and assert options count
     $productOptionsBlock = $productPage->getCustomOptionsBlock();
     $actualOptions = $productOptionsBlock->getOptions();
     $expectedOptions = $product->getBundleOptions();
     foreach ($actualOptions as $optionType => $actualOption) {
         $this->assertContains($expectedOptions[$optionType], $actualOption);
     }
 }
 /**
  * Checking the product on the category page
  *
  * @param Bundle $product
  * @return void
  */
 protected function assertOnCategory($product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()), 'Product "' . $product->getName() . '" is absent on category page');
     $productListBlock->openProductViewPage($product->getName());
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $this->assertSame($product->getName(), $productViewBlock->getProductName());
     $this->assertEquals($product->getProductPrice(), ['price_from' => $productViewBlock->getPriceBlock()->getPriceFrom(), 'price_to' => $productViewBlock->getPriceBlock()->getPriceTo()]);
     $actualOptions = $productPage->getViewBlock()->getOptions($product)['bundle_options'];
     $expectedOptions = $product->getBundleOptions();
     foreach ($actualOptions as $key => $actualOption) {
         $this->assertContains($expectedOptions[$key]['title'], $actualOption);
     }
 }