/** * Check whether attribute is displayed in the advanced search form on the frontend. * * @param CatalogProductAttribute $attribute * @param CatalogsearchAdvanced $advancedSearch * @return void */ public function processAssert(CatalogProductAttribute $attribute, CatalogsearchAdvanced $advancedSearch) { $advancedSearch->open(); $formLabels = $advancedSearch->getForm()->getFormlabels(); $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel(); \PHPUnit_Framework_Assert::assertTrue(in_array($label, $formLabels), 'Attribute is absent on advanced search form.'); }
/** * Check whether there is an opportunity to compare products using given attribute. * * @param InjectableFixture $product * @param CatalogProductAttribute $attribute * @param BrowserInterface $browser * @param CatalogProductView $catalogProductView * @param CatalogProductCompare $catalogProductCompare * @return void */ public function processAssert(InjectableFixture $product, CatalogProductAttribute $attribute, BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductCompare $catalogProductCompare) { $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $catalogProductView->getViewBlock()->clickAddToCompare(); $catalogProductCompare->open(); $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel(); \PHPUnit_Framework_Assert::assertTrue($catalogProductCompare->getCompareProductsBlock()->isAttributeVisible($label), 'Attribute is absent on product compare page.'); }
/** * Assert that after save a product template on edit product set page displays: * 1. Correct product template name in Attribute set name field passed from fixture * 2. Created Product Attribute (if was added) * * @param CatalogProductSetIndex $productSet * @param CatalogProductSetEdit $productSetEdit * @param CatalogAttributeSet $attributeSet * @param CatalogProductAttribute $productAttribute [optional] * @return void */ public function processAssert(CatalogProductSetIndex $productSet, CatalogProductSetEdit $productSetEdit, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute = null) { $filterAttribute = ['set_name' => $attributeSet->getAttributeSetName()]; $productSet->open(); $productSet->getGrid()->searchAndOpen($filterAttribute); \PHPUnit_Framework_Assert::assertEquals($filterAttribute['set_name'], $productSetEdit->getAttributeSetEditBlock()->getAttributeSetName()); if ($productAttribute !== null) { $attributeLabel = $productAttribute->getFrontendLabel(); \PHPUnit_Framework_Assert::assertTrue($productSetEdit->getAttributeSetEditBlock()->checkProductAttribute($attributeLabel), "Product Attribute '{$attributeLabel}' is absent on Product Template Groups."); } }
/** * Assert that attribute present in sort dropdown on search results page on frontend. * * @param CmsIndex $cmsIndex * @param CatalogsearchResult $catalogsearchResult * @param CatalogProductAttribute $attribute * @param InjectableFixture $product * @return void */ public function processAssert(CmsIndex $cmsIndex, CatalogsearchResult $catalogsearchResult, CatalogProductAttribute $attribute, InjectableFixture $product) { $cmsIndex->open()->getSearchBlock()->search($product->getName()); $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel(); \PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogsearchResult->getListProductBlock()->getSortByValues()), 'Attribute is absent in sort dropdown on search results page on frontend.'); }
/** * Check out if the attribute in the navigation bar on the search results page in Layered navigation. * * @param CmsIndex $cmsIndex * @param CatalogsearchResult $catalogsearchResult * @param InjectableFixture $product * @param CatalogProductAttribute $attribute * @return void */ public function processAssert(CmsIndex $cmsIndex, CatalogsearchResult $catalogsearchResult, InjectableFixture $product, CatalogProductAttribute $attribute) { $cmsIndex->open()->getSearchBlock()->search($product->getName()); $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel(); \PHPUnit_Framework_Assert::assertTrue(in_array(strtoupper($label), $catalogsearchResult->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on search page.'); }
/** * Check whether the attribute filter is displayed on the frontend in Layered navigation. * * @param CatalogCategoryView $catalogCategoryView * @param InjectableFixture $product * @param CatalogProductAttribute $attribute * @param CmsIndex $cmsIndex * @return void */ public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex) { $cmsIndex->open()->getTopmenu()->selectCategory($product->getCategoryIds()[0]); $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel(); \PHPUnit_Framework_Assert::assertTrue(in_array(strtoupper($label), $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.'); }
/** * Get attribute element. * * @param CatalogProductAttribute $attribute * @return CustomAttribute */ public function getAttributeElement(CatalogProductAttribute $attribute) { return $this->_rootElement->find(sprintf($this->attributeBlock, $attribute->getFrontendLabel()), Locator::SELECTOR_XPATH, 'Mage\\Adminhtml\\Test\\Block\\Catalog\\Product\\Attribute\\CustomAttribute'); }