/**
  * Assert configurable product on frontend
  *
  * @param Product $product
  * @param ConfigurableProduct $variations
  * @return void
  */
 protected function assertOnFrontend(Product $product, ConfigurableProduct $variations)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getNewCategoryName());
     //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.');
     $price = $productViewBlock->getPriceBlock()->getPrice();
     $this->assertEquals(number_format($product->getProductPrice(), 2), $price, 'Product price does not correspond to specified.');
     $pageOptions = $productViewBlock->getOptions($variations);
     $configurableOptions = [];
     foreach ($pageOptions['configurable_options'] as $attribute) {
         $configurableOption = [];
         foreach ($attribute['options'] as $option) {
             $configurableOption[] = $option['title'];
         }
         $configurableOptions[$attribute['title']] = $configurableOption;
     }
     $this->assertEquals($variations->getConfigurableOptions(), $configurableOptions);
 }
 /**
  * Assert configurable product on frontend
  *
  * @param Product $product
  * @param ConfigurableProduct $variations
  * @return void
  */
 protected function assertOnFrontend(Product $product, ConfigurableProduct $variations)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getNewCategoryName());
     //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.');
     $price = $productViewBlock->getProductPrice();
     $this->assertEquals(number_format($product->getProductPrice(), 2), $price['price_regular_price'], 'Product price does not correspond to specified.');
     $this->assertTrue($productViewBlock->verifyProductOptions($variations), 'Added configurable options are absent.');
 }
 /**
  * Save new category
  *
  * @param Product $fixture
  * @return void
  */
 public function addNewCategory(Product $fixture)
 {
     $this->openTab('product-details');
     $this->openNewCategoryDialog();
     $this->_rootElement->find($this->createCategoryDialog . $this->fieldNewCategoryName, Locator::SELECTOR_XPATH)->setValue($fixture->getNewCategoryName());
     $this->clearCategorySelect();
     $this->selectParentCategory();
     $buttonCreateCategory = $this->createCategoryDialog . $this->createCategoryButton;
     $this->_rootElement->find($buttonCreateCategory, Locator::SELECTOR_XPATH)->click();
     $this->waitForElementNotVisible($buttonCreateCategory, Locator::SELECTOR_XPATH);
 }
Example #4
0
 /**
  * Save new category
  *
  * @param Product $fixture
  * @return void
  */
 public function addNewCategory(Product $fixture)
 {
     $this->openNewCategoryDialog();
     $this->_rootElement->find('input#new_category_name', Locator::SELECTOR_CSS)->setValue($fixture->getNewCategoryName());
     $this->clearCategorySelect();
     $this->selectParentCategory();
     $this->_rootElement->find('div.ui-dialog-buttonset button.action-create')->click();
     $this->waitForElementNotVisible('div.ui-dialog-buttonset button.action-create');
 }