/** * Fill bundle options * * @param array $bundleOptions * @return void */ public function fillBundleOptions($bundleOptions) { $index = 1; foreach ($bundleOptions as $option) { /** @var $optionBlock \Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option\Radio| * \Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option\Select */ $getClass = 'getMagentoBundleCatalogProductViewTypeOption' . ucfirst($option['type']); $optionBlock = Factory::getBlockFactory()->{$getClass}($this->_rootElement->find('.field.option.required:nth-of-type(' . $index++ . ')')); $optionBlock->fillOption($option); } }
/** * Select cross-sells products * * @param array $products * @param Element|null $context * @return $this */ public function fillFormTab(array $products, Element $context = null) { if (!isset($products['crosssell_products'])) { return $this; } $element = $context ?: $this->_rootElement; $crossSellBlock = Factory::getBlockFactory()->getMagentoCatalogAdminhtmlProductEditTabCrosssellGrid($element->find('#cross_sell_product_grid')); foreach ($products['crosssell_products']['value'] as $product) { $crossSellBlock->searchAndSelect($product); } return $this; }
/** * Get backend abstract block * * @return \Magento\Backend\Test\Block\Template */ protected function getTemplateBlock() { return Factory::getBlockFactory()->getMagentoBackendTemplate($this->_rootElement->find($this->templateBlock, Locator::SELECTOR_XPATH)); }
/** * Get variations block * * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Super\Config */ protected function getVariationsBlock() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlProductEditTabSuperConfig($this->_rootElement->find($this->variationsWrapper)); }
/** * Retrieve actions block * * @return \Magento\Backend\Test\Block\System\Store\Actions */ public function getPageActionsBlock() { return Factory::getBlockFactory()->getMagentoBackendSystemStoreActions($this->_browser->find($this->actionsBlock)); }
/** * Get abstract block * * @return \Magento\Backend\Test\Block\Template */ public function getTemplateBlock() { return Factory::getBlockFactory()->getMagentoBackendTemplate($this->_browser->find($this->templateBlock, Locator::SELECTOR_CSS)); }
/** * Get product variations matrix block * * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Super\Config\Matrix */ protected function getMatrixBlock() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlProductEditTabSuperConfigMatrix($this->_rootElement->find($this->matrixBlock, Locator::SELECTOR_CSS)); }
/** * Get messages block * * @return \Magento\Core\Test\Block\Messages */ public function getMessagesBlock() { return Factory::getBlockFactory()->getMagentoCoreMessages($this->_browser->find($this->messagesBlock, Locator::SELECTOR_CSS)); }
/** * Get bundle options block * * @param int $blockNumber * @return \Magento\Bundle\Test\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option */ protected function getBundleOptionBlock($blockNumber) { return Factory::getBlockFactory()->getMagentoBundleAdminhtmlCatalogProductEditTabBundleOption($this->_rootElement->find($this->bundleOptionBlock . $blockNumber)); }
/** * Get bundle options block * * @return \Magento\Bundle\Test\Block\Catalog\Product\View\Type\Bundle */ public function getBundleBlock() { return Factory::getBlockFactory()->getMagentoBundleCatalogProductViewTypeBundle($this->_rootElement->find($this->bundleBlock)); }
/** * Retrieve store configuration form group * * @param string $name * @return Form\Group */ public function getGroup($name) { $blockFactory = Factory::getBlockFactory(); $element = $this->_rootElement->find(sprintf($this->groupBlock, $name), Locator::SELECTOR_XPATH); return $blockFactory->getMagentoBackendSystemConfigFormGroup($element); }
/** * Get block price * * @return \Magento\Catalog\Test\Block\Product\Price */ protected function getPriceBlock() { return Factory::getBlockFactory()->getMagentoCatalogProductPrice($this->_rootElement->find('.product-info-main .price-box')); }
/** * Get global messages block * * @return \Magento\Core\Test\Block\Messages */ public function getMessagesBlock() { return Factory::getBlockFactory()->getMagentoCoreMessages($this->_browser->find($this->messagesBlock)); }
/** * This method returns the price box block for the named product. * * @param string $productName String containing the name of the product to find. * @return Price */ public function getProductPriceBlock($productName) { return Factory::getBlockFactory()->getMagentoCatalogProductPrice($this->getProductDetailsElement($productName)->find($this->priceBlockClass, Locator::SELECTOR_CLASS_NAME)); }
/** * Get product row assigned to bundle option * * @param int $rowNumber * @param Element $context * @return \Magento\Bundle\Test\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Selection */ protected function getSelectionBlock($rowNumber, Element $context = null) { $element = $context !== null ? $context : $this->_rootElement; return Factory::getBlockFactory()->getMagentoBundleAdminhtmlCatalogProductEditTabBundleOptionSelection($element->find($this->selectionBlock . '_' . $rowNumber)); }
/** * Get default addresses block * * @return \Magento\Customer\Test\Block\Account\AddressesDefault */ public function getDefaultAddresses() { return Factory::getBlockFactory()->getMagentoCustomerAccountAddressesDefault($this->_browser->find($this->defaultAddressesSelector, Locator::SELECTOR_CSS)); }
/** * Get customer login form * * @return \Magento\Customer\Test\Block\Form\Login */ public function getLoginBlock() { return Factory::getBlockFactory()->getMagentoCustomerFormLogin($this->_browser->find($this->loginBlock, Locator::SELECTOR_CSS)); }
/** * Get Category edit form * * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Tab\ProductGrid */ public function getCategoryProductsGrid() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlCategoryTabProductGrid($this->_rootElement->find($this->productsGridBlock)); }
/** * Get messages block * * @return \Magento\Core\Test\Block\Messages */ protected function getMessagesBlock() { return Factory::getBlockFactory()->getMagentoCoreMessages($this->_rootElement->find($this->messagesSelector, Locator::SELECTOR_XPATH)); }
/** * Get variations block * * @return \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\Edit\Tab\Super\Config */ protected function getVariationsBlock() { return Factory::getBlockFactory()->getMagentoConfigurableProductAdminhtmlProductEditTabSuperConfig($this->browser->find($this->variationsWrapper)); }
/** * Get Customer Forgot Password form * * @return \Magento\Customer\Test\Block\Form\ForgotPassword */ public function getForgotPasswordForm() { return Factory::getBlockFactory()->getMagentoCustomerFormForgotPassword($this->_browser->find($this->forgotPasswordForm, Locator::SELECTOR_CSS)); }
/** * Get associated products list block * * @param Element $context * @return \Magento\Catalog\Test\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts */ protected function getListAssociatedProductsBlock(Element $context = null) { $element = $context ?: $this->_rootElement; return Factory::getBlockFactory()->getMagentoCatalogProductGroupedAssociatedProductsListAssociatedProducts($element->find($this->associatedProductsBlock)); }
/** * Retrieve attributes form block * * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Action\Attribute */ public function getAttributesBlockForm() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlProductEditActionAttribute($this->_browser->find($this->attributesFormBlock, Locator::SELECTOR_CSS)); }
/** * Getting block products * * @param string $productId * @param Element $context * @return ListAssociatedProducts\Product */ private function getProductBlock($productId, Element $context = null) { $element = $context ?: $this->_rootElement; return Factory::getBlockFactory()->getMagentoCatalogProductGroupedAssociatedProductsListAssociatedProductsProduct($element->find(sprintf("//tr[td/input[@data-role='id' and @value='%s']]", $productId), Locator::SELECTOR_XPATH)); }
/** * Get proceed to checkout block * * @return Link */ public function getOnepageLinkBlock() { return Factory::getBlockFactory()->getMagentoCheckoutOnepageLink($this->_rootElement->find($this->onepageLinkBlock, Locator::SELECTOR_CSS)); }
/** * Get Customer Address Edit form * * @return \Magento\Customer\Test\Block\Address\Edit */ public function getEditForm() { return Factory::getBlockFactory()->getMagentoCustomerAddressEdit($this->_browser->find($this->editForm, Locator::SELECTOR_CSS)); }