/** * 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.'); $optionsOnPage = $productViewBlock->getOptions($product); $pageAssociatedProductNames = []; foreach ($optionsOnPage['grouped_options'] as $optionOnPage) { $pageAssociatedProductNames[] = $optionOnPage['name']; } $this->assertEquals($product->getAssociatedProductNames(), $pageAssociatedProductNames); }