Exemple #1
0
 /**
  * Product Up-selling.  Assign upselling to products and see them related on the front-end.
  *
  * @ZephirId MAGETWO-12391
  * @return void
  */
 public function testCreateUpsell()
 {
     // Precondition: create simple product 1
     $simple1 = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $simple1->switchData('simple');
     $simple1->persist();
     $assignToSimple1 = Factory::getFixtureFactory()->getMagentoCatalogUpsellProducts();
     $assignToSimple1->switchData('add_up_sell_products');
     $verify = [$assignToSimple1->getProduct('simple'), $assignToSimple1->getProduct('configurable')];
     //Data
     $productGridPage = Factory::getPageFactory()->getCatalogProductIndex();
     $editProductPage = Factory::getPageFactory()->getCatalogProductEdit();
     //Steps
     $productGridPage->open();
     $productGridPage->getProductGrid()->searchAndOpen(['sku' => $simple1->getSku()]);
     $editProductPage->getProductForm()->fill($assignToSimple1);
     $editProductPage->getFormPageActions()->save();
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
     $productGridPage->open();
     $productGridPage->getProductGrid()->searchAndOpen(['sku' => $assignToSimple1->getProduct('configurable')->getSku()]);
     $assignToSimple1->switchData('add_up_sell_product');
     $productForm = $editProductPage->getProductForm();
     $productForm->fill($assignToSimple1);
     $editProductPage->getFormPageActions()->save();
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
     $this->assertOnTheFrontend($simple1, $verify);
 }
Exemple #2
0
 /**
  * Init most popular custom roles
  */
 protected function initCustomRoles()
 {
     $resourceFixture = Factory::getFixtureFactory()->getMagentoUserResource();
     $salesAllScopes = $this->_data['custom_permissions_all_scopes']['data'];
     $salesAllScopes['fields']['resource']['value'] = $resourceFixture->get('Magento_Sales::sales');
     $this->_data['sales_all_scopes']['data'] = $salesAllScopes;
 }
Exemple #3
0
 /**
  * Edit configurable product and add new options to attribute
  *
  * @ZephyrId MAGETWO-12840
  * @return void
  */
 public function testCreateConfigurableProduct()
 {
     //Preconditions
     //Preparing Data for original product
     $configurable = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
     $configurable->switchData('configurable');
     $configurable->persist();
     $productSku = $configurable->getSku();
     //Preparing Data for editing product
     $editProduct = $configurable->getEditData();
     //Steps
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $productForm = $createProductPage->getProductForm();
     //Login
     Factory::getApp()->magentoBackendLoginUser();
     $productGridPage = Factory::getPageFactory()->getCatalogProductIndex();
     $productGridPage->open();
     //Search and open original configurable product
     $productGridPage->getProductGrid()->searchAndOpen(['sku' => $productSku]);
     //Editing product options
     $productForm->fill($editProduct);
     $createProductPage->getFormPageActions()->save();
     //Verifying
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($editProduct);
     $this->assertOnFrontend($editProduct);
 }
Exemple #4
0
 /**
  * Creating bundle (dynamic) product and assigning it to the category
  *
  * @ZephyrId MAGETWO-12702
  * @return void
  */
 public function testCreate()
 {
     //Data
     $bundle = Factory::getFixtureFactory()->getMagentoBundleBundleDynamic();
     $bundle->switchData('bundle');
     //Pages & Blocks
     $manageProductsGrid = Factory::getPageFactory()->getCatalogProductIndex();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $productForm = $createProductPage->getProductForm();
     //Steps
     $manageProductsGrid->open();
     $manageProductsGrid->getGridPageActionBlock()->addProduct('bundle');
     $category = $bundle->getCategories()['category'];
     $productForm->fill($bundle, null, $category);
     $createProductPage->getFormPageActions()->save();
     //Verification
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
     // Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verification
     $this->assertOnGrid($bundle);
     $this->assertOnCategory($bundle);
 }
Exemple #5
0
 /**
  * Edit bundle
  *
  * @dataProvider createDataProvider
  * @ZephyrId MAGETWO-12842
  * @ZephyrId MAGETWO-12841
  *
  * @param $fixture
  * @return void
  */
 public function testEditBundle($fixture)
 {
     //Data
     /** @var $product \Magento\Bundle\Test\Fixture\Bundle */
     /** @var $editProduct \Magento\Bundle\Test\Fixture\Bundle */
     $product = Factory::getFixtureFactory()->{$fixture}();
     $product->switchData('bundle');
     $product->persist();
     $editProduct = Factory::getFixtureFactory()->{$fixture}();
     $editProduct->switchData('bundle_edit_required_fields');
     $productGridPage = Factory::getPageFactory()->getCatalogProductIndex();
     $gridBlock = $productGridPage->getProductGrid();
     $editProductPage = Factory::getPageFactory()->getCatalogProductEdit();
     $productForm = $editProductPage->getProductForm();
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $productGridPage->open();
     $gridBlock->searchAndOpen(['sku' => $product->getSku(), 'type' => 'Bundle Product']);
     $productForm->fill($editProduct);
     $editProductPage->getFormPageActions()->save();
     //Verifying
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
     // Flush cache
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($editProduct);
     $this->assertOnCategory($editProduct, $product->getCategoryName());
 }
Exemple #6
0
 /**
  * Test product create
  *
  * @ZephyrId MAGETWO-13345
  * @return void
  */
 public function testCreateProduct()
 {
     //Data
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple_with_new_category');
     //Page & Blocks
     $productListPage = Factory::getPageFactory()->getCatalogProductIndex();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $addProductBlock = $productListPage->getGridPageActionBlock();
     $productForm = $createProductPage->getProductForm();
     //Steps
     $productListPage->open();
     $addProductBlock->addProduct();
     $productForm->fill($product);
     $productForm->addNewCategory($product);
     $createProductPage->getFormPageActions()->save();
     //Verifying
     $this->assertSuccessMessage("You saved the product.");
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $this->assertProductOnFrontend($product);
 }
Exemple #7
0
 /**
  * Retrieve specify data from role.trieve specify data from role.
  *
  * @param $roleName
  * @return mixed
  */
 protected function roleProvider($roleName)
 {
     $role = Factory::getFixtureFactory()->getMagentoUserRole();
     $role->switchData($roleName);
     $data = $role->persist();
     return $data['id'];
 }
Exemple #8
0
 /**
  * Create new configurable attribute and add it to product
  *
  * @return string
  */
 protected function attributeProvider()
 {
     $attribute = Factory::getFixtureFactory()->getMagentoCatalogProductAttribute();
     $attribute->switchData('configurable_attribute');
     $attribute->persist();
     $this->_dataConfig['attributes']['id'][] = $attribute->getAttributeId();
     $this->_dataConfig['attributes'][$attribute->getAttributeId()]['code'] = $attribute->getAttributeCode();
     $this->_dataConfig['options'][$attribute->getAttributeId()]['id'] = $attribute->getOptionIds();
     $options = $attribute->getOptionLabels();
     $placeholders['attribute_1_name'] = $attribute->getFrontendLabel();
     $placeholders['attribute_1_option_label_1'] = $options[0];
     $placeholders['attribute_1_option_label_2'] = $options[1];
     $this->_applyPlaceholders($this->_data, $placeholders);
     return $attribute->getFrontendLabel();
 }
 /**
  * Login admin user
  *
  * @param FixtureInterface $fixture [optional]
  * @return void|mixed
  */
 public function persist(FixtureInterface $fixture = null)
 {
     if (null === $fixture) {
         $fixture = Factory::getFixtureFactory()->getMagentoBackendAdminSuperAdmin();
     }
     $loginPage = Factory::getPageFactory()->getAdminAuthLogin();
     $loginForm = $loginPage->getLoginBlock();
     $adminHeaderPanel = $loginPage->getHeaderBlock();
     if (!$adminHeaderPanel || !$adminHeaderPanel->isVisible()) {
         $loginPage->open();
         if ($adminHeaderPanel->isVisible()) {
             return;
         }
         $loginForm->fill($fixture);
         $loginForm->submit();
         $loginPage->waitForHeaderBlock();
     }
 }
Exemple #10
0
 /**
  * New customer creation in backend
  *
  * @ZephyrId MAGETWO-12516
  */
 public function testCreateCustomer()
 {
     //Data
     $customerFixture = Factory::getFixtureFactory()->getMagentoCustomerCustomer();
     $customerFixture->switchData('backend_customer');
     $searchData = ['email' => $customerFixture->getEmail()];
     //Pages
     $customerPage = Factory::getPageFactory()->getCustomerIndex();
     $customerCreatePage = Factory::getPageFactory()->getCustomerIndexNew();
     //Steps
     $customerPage->open();
     $customerPage->getPageActionsBlock()->addNew();
     $customerCreatePage->getCustomerForm()->fillCustomer($customerFixture);
     $customerCreatePage->getPageActionsBlock()->saveAndContinue();
     $customerCreatePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $customerPage->open();
     $this->assertTrue($customerPage->getCustomerGridBlock()->isRowVisible($searchData), 'Customer email "' . $searchData['email'] . '" not found in the grid');
 }
Exemple #11
0
 /**
  * Creating configurable product with creating new category and new attribute (required fields only)
  *
  * @ZephyrId MAGETWO-13361
  * @return void
  */
 public function testCreateConfigurableProductWithNewAttribute()
 {
     //Data
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple_with_new_category');
     $attribute = Factory::getFixtureFactory()->getMagentoCatalogProductAttribute();
     $attribute->switchData('new_attribute');
     $variations = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
     $variations->switchData('product_variations');
     $variations->provideNewAttributeData($attribute);
     //Steps
     $this->fillSimpleProductWithNewCategory($product);
     $this->addNewAttribute($attribute);
     $this->fillProductVariationsAndSave($variations);
     //Verifying
     $this->assertProductSaved();
     $this->assertOnGrid($product);
     $this->assertOnFrontend($product, $variations);
 }
Exemple #12
0
 /**
  * Create simple product with settings in advanced inventory tab
  *
  * @ZephyrId MAGETWO-12914
  * @return void
  */
 public function testCreateProductAdvancedInventory()
 {
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple_advanced_inventory');
     //Data
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $productForm = $createProductPage->getProductForm();
     //Steps
     $createProductPage->open(['type' => 'simple', 'set' => 4]);
     $productForm->fill($product);
     $createProductPage->getFormPageActions()->save();
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $this->assertOnGrid($product);
     $this->assertOnCategory($product);
 }
Exemple #13
0
 /**
  * Creating simple product with custom options and assigning it to the category
  *
  * @ZephyrId MAGETWO-12703
  * @return void
  */
 public function testCreateProduct()
 {
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple_custom_options');
     //Data
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $productForm = $createProductPage->getProductForm();
     //Steps
     $createProductPage->open(['type' => $product->getDataConfig()['create_url_params']['type'], 'set' => $product->getDataConfig()['create_url_params']['set']]);
     $category = $product->getCategories()['category'];
     $productForm->fill($product, null, $category);
     $createProductPage->getFormPageActions()->save();
     //Verifying
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
     // Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($product);
     $this->assertOnCategory($product);
 }
Exemple #14
0
 /**
  * Unassigning products from the category on Product Information page
  *
  * @ZephyrId MAGETWO-12417
  * @return void
  */
 public function testUnassignOnProductPage()
 {
     //Data
     $simple = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $simple->switchData('simple');
     $simple->persist();
     //Steps
     $editProductPage = Factory::getPageFactory()->getCatalogProductEdit();
     $editProductPage->open(['id' => $simple->getProductId()]);
     $productForm = $editProductPage->getProductForm();
     $productForm->clearCategorySelect();
     $editProductPage->getFormPageActions()->save();
     //Verifying
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $this->assertAbsenceOnCategory($simple);
 }
Exemple #15
0
 /**
  * Creating configurable product and assigning it to category
  *
  * @ZephyrId MAGETWO-12620
  * @return void
  */
 public function testCreateConfigurableProduct()
 {
     //Data
     $product = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
     $product->switchData('configurable');
     //Page & Blocks
     $manageProductsGrid = Factory::getPageFactory()->getCatalogProductIndex();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     //Steps
     $manageProductsGrid->open();
     $manageProductsGrid->getGridPageActionBlock()->addProduct('configurable');
     $createProductPage->getProductForm()->fill($product);
     $createProductPage->getFormPageActions()->save($product);
     //Verifying
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $this->assertOnGrid($product);
     $this->assertOnFrontend($product);
 }
Exemple #16
0
 protected function setUp()
 {
     $this->product = Factory::getFixtureFactory()->getMagentoDownloadableDownloadableProductLinksPurchasedSeparately();
     $this->product->switchData('downloadable');
     Factory::getApp()->magentoBackendLoginUser();
 }
Exemple #17
0
 /**
  * Create a new product
  *
  * @param string $productType
  * @throws \InvalidArgumentException
  * @return Product
  */
 public function getProduct($productType)
 {
     if (!isset($this->products[$productType])) {
         switch ($productType) {
             case 'simple':
                 $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
                 $product->switchData($productType . '_required');
                 break;
             case 'virtual':
                 $product = Factory::getFixtureFactory()->getMagentoCatalogVirtualProduct();
                 $product->switchData($productType . '_required');
                 break;
             case 'downloadable':
                 $product = Factory::getFixtureFactory()->getMagentoDownloadableDownloadableProductLinksNotPurchasedSeparately();
                 break;
             case 'configurable':
                 $product = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
                 break;
             default:
                 throw new \InvalidArgumentException("Product of type '{$productType}' cannot be added to grouped product.");
         }
         $product->persist();
         $this->products[$productType] = $product;
     }
     return $this->products[$productType];
 }
Exemple #18
0
 /**
  * Assign an array of products as cross-sells to the passed in $product
  *
  * @param Product $product
  * @param array $crosssellProducts
  * @return void
  */
 private function addCrosssellProducts(Product $product, array $crosssellProducts)
 {
     $crosssellFixture = Factory::getFixtureFactory()->getMagentoCatalogCrosssellProducts();
     $crosssellFixture->setProducts($crosssellProducts);
     $crosssellFixture->switchData('add_crosssell_products');
     //Data
     $productGridPage = Factory::getPageFactory()->getCatalogProductIndex();
     $editProductPage = Factory::getPageFactory()->getCatalogProductEdit();
     //Steps
     $productGridPage->open();
     $productGridPage->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $editProductPage->getProductForm()->fill($crosssellFixture);
     $editProductPage->getFormPageActions()->save();
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
 }
Exemple #19
0
 /**
  * @return \Magento\Customer\Test\Fixture\Address
  */
 public function getAddressData()
 {
     $customerAddress = Factory::getFixtureFactory()->getMagentoCustomerAddress();
     $customerAddress->switchData('address_data_US_1');
     $customerAddress->setCustomer($this);
     return $customerAddress;
 }