예제 #1
0
 /**
  * Verification of group products
  *
  * @param GroupedProduct $product
  * @return bool
  */
 public function verifyGroupedProducts(GroupedProduct $product)
 {
     foreach ($product->getAssociatedProductNames() as $name) {
         $option = $this->_rootElement->find("//*[@id='super-product-table']//tr[td/strong='{$name}']", Locator::SELECTOR_XPATH);
         if (!$option->isVisible()) {
             return false;
         }
     }
     return true;
 }
 /**
  * Assert Grouped product on Frontend
  *
  * @param GroupedProduct $product
  * @return void
  */
 protected function assertOnFrontend(GroupedProduct $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 is absent on category page.');
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $productListBlock->openProductViewPage($product->getName());
     $this->assertEquals($product->getName(), $productViewBlock->getProductName(), 'Product name does not correspond to specified.');
     $this->assertTrue($productViewBlock->verifyGroupedProducts($product), 'Added Grouped options are absent');
 }