Exemplo n.º 1
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'];
 }
Exemplo n.º 2
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);
 }
 /**
  * Creating configurable product and assigning it to category
  *
  * @ZephyrId MAGETWO-12620
  * @return void
  */
 public function testCreateConfigurableProduct()
 {
     //Data
     $product = Factory::getFixtureFactory()->getMagentoCatalogConfigurableProduct();
     $product->switchData('configurable');
     //Page & Blocks
     $manageProductsGrid = Factory::getPageFactory()->getCatalogProductIndex();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     //Steps
     $manageProductsGrid->open();
     $manageProductsGrid->getProductBlock()->addProduct('configurable');
     $productForm = $createProductPage->getProductForm();
     $productForm->fill($product);
     $createProductPage->getFormAction()->saveProduct($createProductPage, $product);
     //Verifying
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertOnGrid($product);
     $this->assertOnFrontend($product);
 }
Exemplo n.º 4
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());
 }
 /**
  * Edit simple product
  *
  * @ZephyrId MAGETWO-12428
  * @return void
  */
 public function testEditProduct()
 {
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple');
     $product->persist();
     $editProduct = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $editProduct->switchData('simple_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->getProductSku(), 'type' => 'Simple Product']);
     $productForm->fill($editProduct);
     $editProductPage->getFormPageActions()->save();
     //Verifying
     $editProductPage->getMessagesBlock()->assertSuccessMessage();
     // Flush cache
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($editProduct);
     $this->assertOnCategoryPage($editProduct, $product->getCategoryName());
     $this->assertOnProductPage($product, $editProduct);
 }
Exemplo n.º 6
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->getForm();
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $productGridPage->open();
     $gridBlock->searchAndOpen(array('sku' => $product->getProductSku(), 'type' => 'Bundle Product'));
     $productForm->fillProduct($editProduct);
     $editProductPage->getFormAction()->save();
     //Verifying
     $editProductPage->getMessagesBlock()->assertSuccessMessage();
     // Flush cache
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($editProduct);
     $this->assertOnCategory($editProduct, $product->getCategoryName());
 }
Exemplo n.º 7
0
 /**
  * Create Customer account on frontend
  *
  * @ZephyrId MAGETWO-12394
  */
 public function testCreateCustomer()
 {
     //Data
     $customer = Factory::getFixtureFactory()->getMagentoCustomerCustomer();
     $customer->switchData('customer_US_1');
     $customerAddress = $customer->getAddressData();
     //Page
     $homePage = Factory::getPageFactory()->getCmsIndexIndex();
     $createPage = Factory::getPageFactory()->getCustomerAccountCreate();
     $accountIndexPage = Factory::getPageFactory()->getCustomerAccountIndex();
     $addressEditPage = Factory::getPageFactory()->getCustomerAddressEdit();
     //Step 1 Create Account
     $homePage->open();
     $topLinks = $homePage->getLinksBlock();
     $topLinks->openLink('Register');
     $createPage->getRegisterForm()->registerCustomer($customer);
     //Verifying
     $this->assertContains('Thank you for registering', $accountIndexPage->getMessages()->getSuccessMessages());
     //Check that customer redirected to Dashboard after registration
     $this->assertContains('My Dashboard', $accountIndexPage->getTitleBlock()->getTitle());
     //Step 2 Set Billing Address
     $accountIndexPage->getDashboardAddress()->editBillingAddress();
     $addressEditPage->getEditForm()->editCustomerAddress($customerAddress);
     //Verifying
     $accountIndexPage = Factory::getPageFactory()->getCustomerAccountIndex();
     $this->assertContains('The address has been saved', $accountIndexPage->getMessages()->getSuccessMessages());
     //Verify customer address against previously entered data
     $accountIndexPage->open();
     $accountIndexPage->getDashboardAddress()->editBillingAddress();
     $addressEditPage = Factory::getPageFactory()->getCustomerAddressEdit();
     $this->verifyCustomerAddress($customerAddress, $addressEditPage->getEditForm());
 }
Exemplo n.º 8
0
 /**
  * @ZephyrId MAGETWO-12405
  */
 public function testCreateNewLocalizedStoreView()
 {
     $storeFixture = Factory::getFixtureFactory()->getMagentoStoreStore();
     $storeListPage = Factory::getPageFactory()->getAdminSystemStore();
     $storeListPage->open();
     $storeListPage->getPageActionsBlock()->addStoreView();
     $newStorePage = Factory::getPageFactory()->getAdminSystemStoreNewStore();
     $newStorePage->getFormBlock()->fill($storeFixture);
     $newStorePage->getPageActionsBlock()->clickSave();
     $storeListPage->getMessagesBlock()->assertSuccessMessage();
     $this->assertContains('The store view has been saved', $storeListPage->getMessagesBlock()->getSuccessMessages());
     $this->assertTrue($storeListPage->getGridBlock()->isStoreExists($storeFixture->getName()));
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushCacheStorage();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     $configPage = Factory::getPageFactory()->getAdminSystemConfig();
     $configPage->open();
     $configPage->getPageActions()->selectStore(['Main Website', $storeFixture->getData('fields/group/value'), $storeFixture->getName()]);
     $configGroup = $configPage->getForm()->getGroup('Locale Options');
     $configGroup->open();
     $configGroup->setValue('select-groups-locale-fields-code-value', 'German (Germany)');
     $configPage->getPageActions()->save();
     $configPage->getMessagesBlock()->assertSuccessMessage();
     $homePage = Factory::getPageFactory()->getCmsIndexIndex();
     $homePage->open();
     $homePage->getStoreSwitcherBlock()->selectStoreView($storeFixture->getName());
     $this->assertTrue($homePage->getSearchBlock()->isPlaceholderContains('Den gesamten Shop durchsuchen'));
 }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
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.º 11
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->addNewCategory($product);
     $productForm->fill($product);
     $createProductPage->getFormAction()->save();
     //Verifying
     $this->assertSuccessMessage("You saved the product.");
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertProductOnFrontend($product);
 }
Exemplo n.º 12
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->getForm();
     //Steps
     $manageProductsGrid->open();
     $manageProductsGrid->getProductBlock()->addProduct('bundle');
     $productForm->fillProduct($bundle);
     $createProductPage->getFormAction()->save();
     //Verification
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
     // Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Verification
     $this->assertOnGrid($bundle);
     $this->assertOnCategory($bundle);
 }
Exemplo n.º 13
0
 /**
  * @param Config $configuration
  * @param array $placeholders
  */
 public function __construct(Config $configuration, array $placeholders = array())
 {
     parent::__construct($configuration, $placeholders);
     $this->_placeholders['rewritten_category_request_path'] = array($this, 'getRewrittenRequestPath');
     $this->_repository = Factory::getRepositoryFactory()->getMagentoUrlRewriteUrlRewriteCategory($this->_dataConfig, $this->_data);
     $this->category = Factory::getFixtureFactory()->getMagentoCatalogCategory();
     $this->category->persist();
 }
Exemplo n.º 14
0
 /**
  * @param Config $configuration
  * @param array $placeholders
  */
 public function __construct(Config $configuration, $placeholders = array())
 {
     parent::__construct($configuration, $placeholders);
     $this->_placeholders['rewritten_product_request_path'] = array($this, 'getRewrittenRequestPath');
     $this->_repository = Factory::getRepositoryFactory()->getMagentoUrlRewriteUrlRewriteProduct($this->_dataConfig, $this->_data);
     $this->product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $this->product->switchData('simple');
     $this->product->persist();
 }
Exemplo n.º 15
0
 /**
  * Create category needed for placeholders in data and call method for placeholder
  *
  * @param string $placeholder
  * @return string
  */
 protected function _categoryProvider($placeholder)
 {
     list($key, $method) = explode('::', $placeholder);
     if (!isset($this->_categories[$key])) {
         $category = Factory::getFixtureFactory()->getMagentoCatalogCategory();
         $category->switchData($key);
         $category->persist();
         $this->_categories[$key] = $category;
     }
     return is_callable(array($this->_categories[$key], $method)) ? $this->_categories[$key]->{$method}() : '';
 }
Exemplo n.º 16
0
 /**
  * Reset password on frontend
  */
 public function testForgotPassword()
 {
     // Create Customer
     $customer = Factory::getFixtureFactory()->getMagentoCustomerCustomer();
     $customer->switchData('customer_US_1');
     $customer->persist();
     $customerAccountLoginPage = Factory::getPageFactory()->getCustomerAccountLogin();
     $forgotPasswordPage = Factory::getPageFactory()->getCustomerAccountForgotpassword();
     $forgotPasswordPage->open();
     $forgotPasswordPage->getForgotPasswordForm()->resetForgotPassword($customer);
     //Verifying
     $message = sprintf('If there is an account associated with %s you will receive an email with a link to reset your password.', $customer->getEmail());
     $this->assertContains($message, $customerAccountLoginPage->getMessages()->getSuccessMessages());
 }
Exemplo n.º 17
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);
 }
Exemplo n.º 18
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();
 }
 /**
  * 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.º 20
0
 /**
  * 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();
     }
 }
Exemplo n.º 21
0
 /**
  * New customer creation in backend
  *
  * @ZephyrId MAGETWO-12516
  */
 public function testCreateCustomer()
 {
     //Data
     $customerFixture = Factory::getFixtureFactory()->getMagentoCustomerCustomer();
     $customerFixture->switchData('backend_customer');
     $searchData = array('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()->assertSuccessMessage();
     //Verifying
     $customerPage->open();
     $this->assertTrue($customerPage->getCustomerGridBlock()->isRowVisible($searchData), 'Customer email "' . $searchData['email'] . '" not found in the grid');
 }
 /**
  * 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);
 }
Exemplo n.º 23
0
 /**
  * Advanced search product on frontend by product name
  *
  * @ZephyrId MAGETWO-12421
  */
 public function testProductSearch()
 {
     //Data
     $productFixture = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $productFixture->switchData('simple');
     $productFixture->persist();
     //Pages
     $homePage = Factory::getPageFactory()->getCmsIndexIndex();
     $advancedSearchPage = Factory::getPageFactory()->getCatalogsearchAdvanced();
     $advancedSearchResultPage = Factory::getPageFactory()->getCatalogsearchResult();
     //Steps
     $homePage->open();
     $homePage->getSearchBlock()->clickAdvancedSearchButton();
     $searchForm = $advancedSearchPage->getForm();
     $this->assertTrue($searchForm->isVisible(), '"Advanced Search" form is not opened');
     $searchForm->fillCustom($productFixture, ['name', 'sku']);
     $searchForm->submit();
     //Verifying
     $productName = $productFixture->getName();
     $this->assertTrue($advancedSearchResultPage->getListProductBlock()->isProductVisible($productName), sprintf('Product "%s" is not displayed on the "Catalog Advanced Search" results page."', $productName));
 }
Exemplo n.º 24
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->getFormAction()->save();
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertOnGrid($product);
     $this->assertOnCategory($product);
 }
 /**
  * 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();
     $createProductPage->init($product);
     $productForm = $createProductPage->getForm();
     //Steps
     $createProductPage->open();
     $productForm->fillProduct($product);
     $createProductPage->getFormAction()->save();
     //Verifying
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
     // Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($product);
     $this->assertOnCategory($product);
 }
Exemplo n.º 26
0
 /**
  * Creating simple product and assigning it to category
  *
  * @ZephyrId MAGETWO-12514
  * @return void
  */
 public function testCreateProduct()
 {
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple');
     //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']]);
     $productForm->fill($product);
     $createProductPage->getFormPageActions()->save();
     //Verifying
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertOnGrid($product);
     $this->assertOnCategory($product);
 }
 /**
  * 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()->assertSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertAbsenceOnCategory($simple);
 }
Exemplo n.º 28
0
 /**
  * Create a new category and retrieve category fixture
  *
  * @param string $key
  * @return mixed
  */
 protected function getCategory($key)
 {
     if (!isset($this->categories[$key])) {
         $category = Factory::getFixtureFactory()->getMagentoCatalogCategory();
         $category->switchData('subcategory');
         $category->persist();
         $this->categories[$key] = $category;
     }
     return $this->categories[$key];
 }
Exemplo n.º 29
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;
 }
 protected function setUp()
 {
     $this->product = Factory::getFixtureFactory()->getMagentoDownloadableDownloadableProductLinksPurchasedSeparately();
     $this->product->switchData('downloadable');
     Factory::getApp()->magentoBackendLoginUser();
 }