/** * Assert simple product on Frontend * * @param SimpleProduct $product * @return void */ protected function assertProductOnFrontend(SimpleProduct $product) { //Pages $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex(); $categoryPage = Factory::getPageFactory()->getCatalogCategoryView(); $productPage = Factory::getPageFactory()->getCatalogProductView(); $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()); $price = $productViewBlock->getPriceBlock()->getPrice(); $this->assertEquals(number_format($product->getProductPrice(), 2), $price); }
/** * Assert product data on product page * * @param SimpleProduct $productOld * @param SimpleProduct $productEdited * @return void */ protected function assertOnProductPage(SimpleProduct $productOld, SimpleProduct $productEdited) { Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $productOld->getUrlKey() . '.html'); $productPage = Factory::getPageFactory()->getCatalogProductView(); $productViewBlock = $productPage->getViewBlock(); $this->assertEquals($productEdited->getName(), $productViewBlock->getProductName()); $price = $productViewBlock->getProductPrice(); $this->assertEquals(number_format($productEdited->getProductPrice(), 2), $price['price_regular_price']); }
/** * Assert product data on product page * * @param SimpleProduct $productOld * @param SimpleProduct $productEdited * @return void */ protected function assertOnProductPage(SimpleProduct $productOld, SimpleProduct $productEdited) { $productPage = Factory::getPageFactory()->getCatalogProductView(); $productPage->init($productOld); $productPage->open(); $productViewBlock = $productPage->getViewBlock(); $this->assertEquals($productEdited->getName(), $productViewBlock->getProductName()); $price = $productViewBlock->getProductPrice(); $this->assertEquals(number_format($productEdited->getProductPrice(), 2), $price['price_regular_price']); }