Exemplo n.º 1
0
 /**
  * Adding temporary redirect for product
  *
  * @return void
  * @ZephyrId MAGETWO-12409
  */
 public function testUrlRewriteCreation()
 {
     /** @var UrlRewriteProduct $urlRewriteProduct */
     $urlRewriteProduct = Factory::getFixtureFactory()->getMagentoUrlRewriteUrlRewriteProduct();
     $urlRewriteProduct->switchData('product_with_temporary_redirect');
     //Pages & Blocks
     $urlRewriteGridPage = Factory::getPageFactory()->getAdminUrlrewriteIndex();
     $pageActionsBlock = $urlRewriteGridPage->getPageActionsBlock();
     $urlRewriteEditPage = Factory::getPageFactory()->getAdminUrlrewriteEdit();
     $categoryTreeBlock = $urlRewriteEditPage->getTreeBlock();
     $productGridBlock = $urlRewriteEditPage->getProductGridBlock();
     $typeSelectorBlock = $urlRewriteEditPage->getUrlRewriteTypeSelectorBlock();
     $urlRewriteInfoForm = $urlRewriteEditPage->getFormBlock();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $urlRewriteGridPage->open();
     $pageActionsBlock->addNew();
     $typeSelectorBlock->selectType($urlRewriteProduct->getUrlRewriteType());
     $productGridBlock->searchAndSelect(['sku' => $urlRewriteProduct->getProductSku()]);
     $categoryTreeBlock->selectCategory($urlRewriteProduct->getCategoryName());
     $urlRewriteInfoForm->fill($urlRewriteProduct);
     $urlRewriteEditPage->getPageMainActions()->save();
     $this->assertContains('The URL Rewrite has been saved.', $urlRewriteGridPage->getMessagesBlock()->getSuccessMessages());
     $this->assertUrlRedirect($_ENV['app_frontend_url'] . $urlRewriteProduct->getRewrittenRequestPath(), $_ENV['app_frontend_url'] . $urlRewriteProduct->getOriginalRequestPath());
 }
Exemplo n.º 2
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()->getMagentoCatalogConfigurableProduct();
     $configurable->switchData('configurable');
     $configurable->persist();
     $productSku = $configurable->getProductSku();
     //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->getFormAction()->save();
     //Verifying
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($editProduct);
     $this->assertOnFrontend($editProduct);
 }
Exemplo n.º 3
0
 /**
  * Creating Category from Category page with required fields only
  *
  * @ZephyrId MAGETWO-12513
  */
 public function testWithRequiredFields()
 {
     //Data
     /** @var Category $category */
     $category = Factory::getFixtureFactory()->getMagentoCatalogCategory();
     //Pages & Blocks
     $catalogCategoryPage = Factory::getPageFactory()->getCatalogCategory();
     $treeBlock = $catalogCategoryPage->getTreeBlock();
     $catalogCategoryEditPage = Factory::getPageFactory()->getCatalogCategoryEditId();
     $treeBlockEdit = $catalogCategoryEditPage->getTreeBlock();
     $formBlock = $catalogCategoryEditPage->getFormBlock();
     $actionsBlock = $catalogCategoryEditPage->getPageActionsBlock();
     $messagesBlock = $catalogCategoryEditPage->getMessagesBlock();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $catalogCategoryPage->open();
     $treeBlock->selectCategory($category);
     $treeBlockEdit->addSubcategory();
     $formBlock->fill($category);
     $actionsBlock->save();
     //Verifying
     $messagesBlock->assertSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertCategoryOnFrontend($category);
 }
Exemplo n.º 4
0
 /**
  * Create product
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     Factory::getApp()->magentoBackendLoginUser();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $createProductPage->open(['type' => $fixture->getDataConfig()['create_url_params']['type'], 'set' => $fixture->getDataConfig()['create_url_params']['set']]);
     $createProductPage->getProductForm()->fill($fixture);
     $createProductPage->getFormPageActions()->save();
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
 }
Exemplo n.º 5
0
 /**
  * Create product
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     Factory::getApp()->magentoBackendLoginUser();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $createProductPage->init($fixture);
     $createProductPage->open();
     $productForm = $createProductPage->getProductForm();
     $productForm->fill($fixture);
     $createProductPage->getFormAction()->save();
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
 }
Exemplo n.º 6
0
 /**
  * Adding product review from not logged customer prospective
  *
  * @ZephyrId MAGETWO-12403
  */
 public function testAddReviewByGuest()
 {
     //Preconditions
     $productFixture = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $productFixture->switchData('simple_required');
     $productFixture->persist();
     $reviewFixture = Factory::getFixtureFactory()->getMagentoReviewReview();
     //Pages & Blocks
     $homePage = Factory::getPageFactory()->getCmsIndexIndex();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     $backendReviewIndex = Factory::getPageFactory()->getReviewProductIndex();
     $backendReviewEdit = Factory::getPageFactory()->getReviewProductEdit();
     $reviewsSummaryBlock = $productPage->getReviewSummaryBlock();
     $reviewsBlock = $productPage->getCustomerReviewBlock();
     $reviewForm = $productPage->getReviewFormBlock();
     $reviewGrid = $backendReviewIndex->getReviewGrid();
     $reviewBackendForm = $backendReviewEdit->getReviewForm();
     //Steps & verifying
     $homePage->open();
     $productPage->init($productFixture);
     $productPage->open();
     $this->verifyNoReviewOnPage($reviewsSummaryBlock);
     $reviewsSummaryBlock->getAddReviewLink()->click();
     $this->assertFalse($reviewsBlock->getFirstReview()->isVisible(), 'No reviews below the form required');
     $reviewForm->fill($reviewFixture);
     $reviewForm->submit();
     $submitReviewMessage = 'Your review has been accepted for moderation.';
     $this->assertContains($submitReviewMessage, $productPage->getMessagesBlock()->getSuccessMessages(), sprintf('Message "%s" is not appear', $submitReviewMessage));
     $this->verifyNoReviewOnPage($productPage->getReviewSummaryBlock());
     Factory::getApp()->magentoBackendLoginUser();
     $backendReviewIndex->open();
     $reviewGrid->searchAndOpen(array('title' => $reviewFixture->getTitle()));
     $this->assertEquals('Guest', $reviewBackendForm->getPostedBy(), 'Review is not posted by Guest');
     $this->assertEquals('Pending', $reviewBackendForm->getStatus(), 'Review is not in Pending status');
     $this->assertTrue($this->verifyReviewBackendForm($reviewFixture, $reviewBackendForm), 'Review data is not corresponds to submitted one');
     $reviewBackendForm->setApproveReview();
     $backendReviewEdit->getPageActions()->save();
     $this->assertContains('You saved the review.', $backendReviewIndex->getMessagesBlock()->getSuccessMessages(), 'Review is not saved');
     $this->flushCacheStorageWithAssert();
     $productPage->open();
     $reviewsSummaryBlock = $productPage->getReviewSummaryBlock();
     $this->assertTrue($reviewsSummaryBlock->getAddReviewLink()->isVisible(), 'Add review link is not visible');
     $this->assertTrue($reviewsSummaryBlock->getViewReviewLink()->isVisible(), 'View review link is not visible');
     $this->assertContains('1', $reviewsSummaryBlock->getViewReviewLink()->getText(), 'There is more than 1 approved review');
     $reviewForm = $productPage->getReviewFormBlock();
     $reviewsBlock = $productPage->getCustomerReviewBlock();
     $reviewsSummaryBlock->getViewReviewLink()->click();
     $this->assertContains(sprintf('You\'re reviewing:%s', $productFixture->getName()), $reviewForm->getLegend()->getText());
     $this->verifyReview($reviewsBlock, $reviewFixture);
 }
 /**
  * Creating a subcategory and assign products to the category
  *
  * @ZephyrId MAGETWO-16351
  */
 public function testAssignProducts()
 {
     //Data
     $simple = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $simple->switchData('simple_required');
     $simple->persist();
     $configurable = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
     $configurable->switchData('configurable_required');
     $configurable->persist();
     $bundle = Factory::getFixtureFactory()->getMagentoBundleBundleFixed();
     $bundle->switchData('bundle_fixed_required');
     $bundle->persist();
     $category = Factory::getFixtureFactory()->getMagentoCatalogCatalogCategory();
     $category->persist();
     //Pages & Blocks
     $catalogCategoryPage = Factory::getPageFactory()->getCatalogCategory();
     $catalogCategoryEditPage = Factory::getPageFactory()->getCatalogCategoryEditId();
     $treeBlock = $catalogCategoryPage->getTreeBlock();
     $formBlock = $catalogCategoryPage->getFormBlock();
     $messagesBlock = $catalogCategoryPage->getMessagesBlock();
     $actionsBlock = $catalogCategoryEditPage->getPageActionsBlock();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $catalogCategoryPage->open();
     $treeBlock->selectCategory($category);
     $formBlock->openTab('category_products');
     $categoryProductsGrid = $formBlock->getCategoryProductsGrid();
     $products = [$simple, $configurable, $bundle];
     /** @var Product $product */
     foreach ($products as $product) {
         $categoryProductsGrid->searchAndSelect(['sku' => $product->getProductSku()]);
     }
     $actionsBlock->save();
     $messagesBlock->assertSuccessMessage();
     //Clean Cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Indexing
     $indexPage = Factory::getPageFactory()->getAdminProcessList();
     $indexPage->open();
     $indexPage->getActionsBlock()->reindexAll();
     $indexPage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertProductsOnCategory($category, $products);
 }
Exemplo n.º 8
0
 /**
  * Create Tax Rule with new and existing Tax Rate, Customer Tax Class, Product Tax Class
  *
  * @ZephyrId MAGETWO-12438
  */
 public function testCreateTaxRule()
 {
     //Data
     $objectManager = Factory::getObjectManager();
     $fixture = $objectManager->create('\\Magento\\Tax\\Test\\Fixture\\TaxRule', ['dataSet' => 'us_ca_ny_rule']);
     //Pages
     $taxGridPage = Factory::getPageFactory()->getTaxRuleIndex();
     $newTaxRulePage = Factory::getPageFactory()->getTaxRuleNew();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $taxGridPage->open();
     $taxGridPage->getGridPageActions()->addNew();
     $newTaxRulePage->getTaxRuleForm()->fill($fixture);
     $newTaxRulePage->getFormPageActions()->saveAndContinue();
     //Verifying
     $newTaxRulePage->getMessagesBlock()->assertSuccessMessage();
     $this->_assertOnGrid($fixture);
 }
Exemplo n.º 9
0
 /**
  * Adding permanent redirect for category
  *
  * @param UrlRewriteCategory $urlRewriteCategory
  * @return void
  * @ZephyrId MAGETWO-12407
  */
 public function test(\Magento\UrlRewrite\Test\Fixture\UrlRewriteCategory $urlRewriteCategory)
 {
     $urlRewriteCategory->switchData('category_with_permanent_redirect');
     //Pages & Blocks
     $urlRewriteIndexPage = Factory::getPageFactory()->getAdminUrlrewriteIndex();
     $pageActionsBlock = $urlRewriteIndexPage->getPageActionsBlock();
     $urlRewriteEditPage = Factory::getPageFactory()->getAdminUrlrewriteEdit();
     $categoryTreeBlock = $urlRewriteEditPage->getTreeBlock();
     $urlRewriteInfoForm = $urlRewriteEditPage->getFormBlock();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $urlRewriteIndexPage->open();
     $pageActionsBlock->addNew();
     $categoryTreeBlock->selectCategory($urlRewriteCategory->getCategoryName());
     $urlRewriteInfoForm->fill($urlRewriteCategory);
     $urlRewriteEditPage->getPageMainActions()->save();
     $this->assertContains('The URL Rewrite has been saved.', $urlRewriteIndexPage->getMessagesBlock()->getSuccessMessages());
     $this->assertUrlRedirect($_ENV['app_frontend_url'] . $urlRewriteCategory->getRewrittenRequestPath(), $_ENV['app_frontend_url'] . $urlRewriteCategory->getOriginalRequestPath());
 }
Exemplo n.º 10
0
 /**
  * Login into backend area before test
  */
 protected function setUp()
 {
     Factory::getApp()->magentoBackendLoginUser();
 }
Exemplo n.º 11
0
 /**
  * Create category
  *
  * @return Category
  */
 public function persist()
 {
     $id = Factory::getApp()->magentoCatalogCreateCategory($this);
     $this->_data['fields']['category_id']['value'] = $id;
     return $this;
 }
Exemplo n.º 12
0
 /**
  * Create user
  */
 public function persist()
 {
     Factory::getApp()->magentoUserCreateUser($this);
 }
Exemplo n.º 13
0
 /**
  * Create Store
  *
  * @return Store
  */
 public function persist()
 {
     return Factory::getApp()->magentoStoreCreateStoreGroup($this);
 }
Exemplo n.º 14
0
 /**
  * Create product
  *
  * @return $this|ConfigurableProduct
  */
 public function persist()
 {
     $id = Factory::getApp()->magentoConfigurableProductCreateConfigurable($this);
     $this->_data['id']['value'] = $id;
     return $this;
 }
Exemplo n.º 15
0
 /**
  * Create customer via backend
  */
 public function persist()
 {
     Factory::getApp()->magentoCustomerCreateCustomerBackend($this);
 }
Exemplo n.º 16
0
 /**
  * Create product
  *
  * @return void
  */
 public function persist()
 {
     $id = Factory::getApp()->magentoCatalogCreateProduct($this);
     $this->_data['fields']['id']['value'] = $id;
 }
Exemplo n.º 17
0
 /**
  * Create customer via frontend
  *
  * @return string
  */
 public function persist()
 {
     return Factory::getApp()->magentoCustomerCreateCustomer($this);
 }
Exemplo n.º 18
0
 /**
  * Create bundle product
  *
  * @return $this|void
  */
 public function persist()
 {
     Factory::getApp()->magentoBundleCreateBundle($this);
     return $this;
 }
Exemplo n.º 19
0
 /**
  * Create customer group
  */
 public function persist()
 {
     $this->_data['fields']['id']['value'] = Factory::getApp()->magentoCustomerCreateCustomerGroup($this);
 }
Exemplo n.º 20
0
 /**
  * Create product
  */
 public function persist()
 {
     $id = Factory::getApp()->magentoDownloadableCreateDownloadable($this);
     $this->_data['fields']['id']['value'] = $id;
 }
Exemplo n.º 21
0
 /**
  * {@inheritdoc}
  */
 public function persist()
 {
     return Factory::getApp()->magentoUserCreateRole($this);
 }
 /**
  * Save Attribute into Magento
  */
 public function persist()
 {
     $attributeIds = Factory::getApp()->magentoCatalogCreateProductAttribute($this);
     $this->_data['fields']['attribute_id']['value'] = $attributeIds['attributeId'];
     $this->_data['fields']['option_ids'] = $attributeIds['optionIds'];
     return $this;
 }
Exemplo n.º 23
0
 /**
  * Open backend page and log in if needed
  *
  * @param array $params
  * @return $this
  */
 public function open(array $params = [])
 {
     Factory::getApp()->magentoBackendLoginUser();
     return parent::open($params);
 }
 protected function setUp()
 {
     $this->product = Factory::getFixtureFactory()->getMagentoDownloadableDownloadableProductLinksPurchasedSeparately();
     $this->product->switchData('downloadable');
     Factory::getApp()->magentoBackendLoginUser();
 }
Exemplo n.º 25
0
 /**
  * Persists prepared data into application
  */
 public function persist()
 {
     Factory::getApp()->magentoCustomerCreateAddress($this);
 }