Exemplo n.º 1
0
 /**
  * @ZephyrId MAGETWO-12405
  */
 public function testCreateNewLocalizedStoreView()
 {
     $objectManager = Factory::getObjectManager();
     $storeFixture = $objectManager->create('\\Magento\\Store\\Test\\Fixture\\Store', ['dataSet' => 'german']);
     $storeListPage = Factory::getPageFactory()->getAdminSystemStore();
     $storeListPage->open();
     $storeListPage->getGridPageActions()->addStoreView();
     $newStorePage = Factory::getPageFactory()->getAdminSystemStoreNewStore();
     $newStorePage->getStoreForm()->fill($storeFixture);
     $newStorePage->getFormPageActions()->save();
     $storeListPage->getMessagesBlock()->assertSuccessMessage();
     $this->assertContains('The store view has been saved', $storeListPage->getMessagesBlock()->getSuccessMessages());
     $this->assertTrue($storeListPage->getStoreGrid()->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->getGroupId(), $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.º 2
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.º 3
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.º 4
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.º 5
0
 /**
  * Test admin login to backend
  *
  * @param SuperAdmin $fixture
  */
 public function test(SuperAdmin $fixture)
 {
     //Page
     $loginPage = Factory::getPageFactory()->getAdminAuthLogin();
     //Steps
     $loginPage->open();
     $loginPage->getLoginBlock()->fill($fixture);
     $loginPage->getLoginBlock()->submit();
 }
Exemplo n.º 6
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.º 7
0
 /**
  * Verify category on the frontend
  *
  * @param Category $category
  */
 protected function assertCategoryOnFrontend(Category $category)
 {
     //Open created category on frontend
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $frontendHomePage->open();
     $navigationMenu = $frontendHomePage->getTopmenu();
     $navigationMenu->selectCategoryByName($category->getCategoryName());
     $this->assertEquals($category->getCategoryName(), $frontendHomePage->getTitleBlock()->getTitle());
 }
Exemplo n.º 8
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();
 }
 /**
  * Assert absence product on category page (frontend)
  *
  * @param Product $product
  * @return void
  */
 protected function assertAbsenceOnCategory(Product $product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertFalse($productListBlock->isProductVisible($product->getName()));
 }
Exemplo n.º 10
0
 /**
  * Execute handler
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed
  */
 public function persist(FixtureInterface $fixture = null)
 {
     /** @var \Magento\Customer\Test\Fixture\Address $fixture */
     // Pages
     $loginPage = Factory::getPageFactory()->getCustomerAccountLogin();
     $addressPage = Factory::getPageFactory()->getCustomerAddressEdit();
     $loginPage->open();
     if ($loginPage->getLoginBlock()->isVisible()) {
         $loginPage->getLoginBlock()->login($fixture->getCustomer());
     }
     $addressPage->open();
     $addressPage->getEditForm()->editCustomerAddress($fixture);
 }
Exemplo n.º 11
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.º 12
0
 /**
  * Assert existing tax rule on manage tax rule grid
  *
  * @param TaxRule $fixture
  */
 protected function _assertOnGrid(TaxRule $fixture)
 {
     //Data
     $filter = ['code' => $fixture->getCode(), 'tax_rate' => implode(', ', $fixture->getTaxRate())];
     if ($fixture->getTaxCustomerClass() !== null) {
         $filter['tax_customer_class'] = implode(', ', $fixture->getTaxCustomerClass());
     }
     if ($fixture->getTaxProductClass() !== null) {
         $filter['tax_product_class'] = implode(', ', $fixture->getTaxProductClass());
     }
     //Verification
     $taxGridPage = Factory::getPageFactory()->getTaxRuleIndex();
     $taxGridPage->open();
     $this->assertTrue($taxGridPage->getTaxRuleGrid()->isRowVisible($filter), 'New tax rule was not found.');
 }
Exemplo n.º 13
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.º 14
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');
 }
Exemplo n.º 15
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.º 16
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));
 }
 /**
  * Assert Grouped product on Frontend
  *
  * @param GroupedProduct $product
  * @return void
  */
 protected function assertOnFrontend(GroupedProduct $product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()), 'Product is absent on category page.');
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $productListBlock->openProductViewPage($product->getName());
     $this->assertEquals($product->getName(), $productViewBlock->getProductName(), 'Product name does not correspond to specified.');
     $this->assertTrue($productViewBlock->verifyGroupedProducts($product), 'Added Grouped options are absent');
 }
Exemplo n.º 18
0
 /**
  * Assert product data on product page
  *
  * @param SimpleProduct $productOld
  * @param SimpleProduct $productEdited
  * @return void
  */
 protected function assertOnProductPage(SimpleProduct $productOld, SimpleProduct $productEdited)
 {
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     $productPage->init($productOld);
     $productPage->open();
     $productViewBlock = $productPage->getViewBlock();
     $this->assertEquals($productEdited->getName(), $productViewBlock->getProductName());
     $price = $productViewBlock->getProductPrice();
     $this->assertEquals(number_format($productEdited->getProductPrice(), 2), $price['price_regular_price']);
 }
 /**
  * Assert product data on category and product pages
  *
  * @param Product $product
  * @return void
  */
 protected function assertOnCategory($product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()));
     $productListBlock->openProductViewPage($product->getName());
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $this->assertEquals($product->getName(), $productViewBlock->getProductName());
     $price = $productViewBlock->getProductPrice();
     $this->assertEquals(number_format($product->getProductPrice(), 2), $price['price_regular_price']);
     $productOptionsBlock = $productPage->getViewBlock()->getCustomOptionsBlock();
     $fixture = $product->getData('fields/custom_options/value');
     $actualOptions = $productOptionsBlock->getOptions($product);
     $this->assertCount(count($fixture), $actualOptions);
     $this->assertTrue(isset($actualOptions['custom_options'][$fixture[0]['title']]['options'][0]['title']));
     $this->assertEquals($fixture[0]['title'], $actualOptions['custom_options'][$fixture[0]['title']]['title']);
 }
Exemplo n.º 20
0
 /**
  * Assert product data on category and product pages
  *
  * @param SimpleProduct $product
  * @return void
  */
 protected function assertOnCategory(SimpleProduct $product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()));
     $productListBlock->openProductViewPage($product->getName());
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $this->assertEquals($product->getName(), $productViewBlock->getProductName());
     $price = $productViewBlock->getProductPrice();
     $this->assertEquals(number_format($product->getProductPrice(), 2), $price['price_regular_price']);
 }
 /**
  * Assert product data on product page
  *
  * @param SimpleProduct $productOld
  * @param SimpleProduct $productEdited
  * @return void
  */
 protected function assertOnProductPage(SimpleProduct $productOld, SimpleProduct $productEdited)
 {
     Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $productOld->getUrlKey() . '.html');
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     $productViewBlock = $productPage->getViewBlock();
     $this->assertEquals($productEdited->getName(), $productViewBlock->getProductName());
     $price = $productViewBlock->getProductPrice();
     $this->assertEquals(number_format($productEdited->getProductPrice(), 2), $price['price_regular_price']);
 }
 /**
  * Assert configurable product on frontend
  *
  * @param Product $product
  * @param ConfigurableProduct $variations
  * @return void
  */
 protected function assertOnFrontend(Product $product, ConfigurableProduct $variations)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getNewCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()), 'Product is absent on category page.');
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $productListBlock->openProductViewPage($product->getName());
     $this->assertEquals($product->getName(), $productViewBlock->getProductName(), 'Product name does not correspond to specified.');
     $price = $productViewBlock->getPriceBlock()->getPrice();
     $this->assertEquals(number_format($product->getProductPrice(), 2), $price, 'Product price does not correspond to specified.');
     $pageOptions = $productViewBlock->getOptions($variations);
     $configurableOptions = [];
     foreach ($pageOptions['configurable_options'] as $attribute) {
         $configurableOption = [];
         foreach ($attribute['options'] as $option) {
             $configurableOption[] = $option['title'];
         }
         $configurableOptions[$attribute['title']] = $configurableOption;
     }
     $this->assertEquals($variations->getConfigurableOptions(), $configurableOptions);
 }
 /**
  * Assert configurable product on Frontend
  *
  * @param ConfigurableProduct $product
  * @return void
  */
 protected function assertOnFrontend(ConfigurableProduct $product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()), 'Product is absent on category page.');
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $productListBlock->openProductViewPage($product->getName());
     $this->assertEquals($product->getName(), $productViewBlock->getProductName(), 'Product name does not correspond to specified.');
     $price = $product->getProductPrice();
     $blockPrice = $productViewBlock->getProductPrice();
     $this->assertEquals(number_format($price, 2), number_format($blockPrice['price_regular_price'], 2), 'Product price does not correspond to specified.');
     $this->assertTrue($productViewBlock->verifyProductOptions($product), 'Added configurable options are absent');
 }
Exemplo n.º 24
0
 /**
  * Check the product on the category page
  *
  * @param Bundle $product
  * @param string $categoryName
  * @return void
  */
 protected function assertOnCategory($product, $categoryName)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($categoryName);
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()));
     $productListBlock->openProductViewPage($product->getName());
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $this->assertSame($product->getName(), $productViewBlock->getProductName());
     $this->assertEquals($product->getProductPrice(), ['price_from' => $productViewBlock->getPriceBlock()->getPriceFrom(), 'price_to' => $productViewBlock->getPriceBlock()->getPriceTo()]);
 }
Exemplo n.º 25
0
 /**
  * Flush cache storage and assert success message
  */
 protected function flushCacheStorageWithAssert()
 {
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushCacheStorage();
     $this->assertTrue($cachePage->getActionsBlock()->isStorageCacheFlushed(), 'Cache is not flushed');
 }
 /**
  * Assert product data on category and product pages
  *
  * @return void
  */
 protected function assertOnFrontend()
 {
     $product = $this->product;
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()));
     $productListBlock->openProductViewPage($product->getName());
     $productViewBlock = $productPage->getDownloadableViewBlock();
     $this->assertEquals($product->getName(), $productViewBlock->getProductName());
     $this->assertEquals(sprintf('%1.2f', $product->getProductPrice()), $productViewBlock->getProductPrice()['price_regular_price']);
     $this->assertEquals($productPage->getDownloadableViewBlock()->getDownloadableLinksBlock()->getItemTitle(1), $product->getData('fields/downloadable_links/value/downloadable/link/0/title'));
     $this->assertEquals(sprintf('$%1.2f', $product->getData('fields/downloadable_links/value/downloadable/link/0/price')), $productPage->getDownloadableViewBlock()->getDownloadableLinksBlock()->getItemPrice(1));
 }
Exemplo n.º 27
0
 /**
  * Assert Grouped product on Frontend
  *
  * @param GroupedProduct $product
  * @return void
  */
 protected function assertOnFrontend(GroupedProduct $product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()), 'Product is absent on category page.');
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $productListBlock->openProductViewPage($product->getName());
     $this->assertEquals($product->getName(), $productViewBlock->getProductName(), 'Product name does not correspond to specified.');
     $optionsOnPage = $productViewBlock->getOptions($product);
     $pageAssociatedProductNames = [];
     foreach ($optionsOnPage['grouped_options'] as $optionOnPage) {
         $pageAssociatedProductNames[] = $optionOnPage['name'];
     }
     $this->assertEquals($product->getAssociatedProductNames(), $pageAssociatedProductNames);
 }
Exemplo n.º 28
0
 /**
  * Checking the product on the category page
  *
  * @param Bundle $product
  * @return void
  */
 protected function assertOnCategory($product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()));
     $productListBlock->openProductViewPage($product->getName());
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $this->assertSame($product->getName(), $productViewBlock->getProductName());
     $this->assertEquals($product->getProductPrice(), $productViewBlock->getProductPrice());
     // @TODO: add click on "Customize and Add To Cart" button and assert options count
     $productOptionsBlock = $productPage->getCustomOptionsBlock();
     $actualOptions = $productOptionsBlock->getOptions();
     $expectedOptions = $product->getBundleOptions();
     foreach ($actualOptions as $optionType => $actualOption) {
         $this->assertContains($expectedOptions[$optionType], $actualOption);
     }
 }
Exemplo n.º 29
0
 /**
  * Checking the product on the category page
  *
  * @param Bundle $product
  * @return void
  */
 protected function assertOnCategory($product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()), 'Product "' . $product->getName() . '" is absent on category page');
     $productListBlock->openProductViewPage($product->getName());
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $this->assertSame($product->getName(), $productViewBlock->getProductName());
     $this->assertEquals($product->getProductPrice(), ['price_from' => $productViewBlock->getPriceBlock()->getPriceFrom(), 'price_to' => $productViewBlock->getPriceBlock()->getPriceTo()]);
     $actualOptions = $productPage->getViewBlock()->getOptions($product)['bundle_options'];
     $expectedOptions = $product->getBundleOptions();
     foreach ($actualOptions as $key => $actualOption) {
         $this->assertContains($expectedOptions[$key]['title'], $actualOption);
     }
 }
 /**
  * Assert product data on category and product pages
  *
  * @return void
  */
 protected function assertOnFrontend()
 {
     $product = $this->product;
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()));
     $productListBlock->openProductViewPage($product->getName());
     $productViewBlock = $productPage->getViewBlock();
     $this->assertEquals($product->getName(), $productViewBlock->getProductName());
     $this->assertEquals(number_format($product->getProductPrice(), 2), $productViewBlock->getPriceBlock()->getPrice());
     $productDownloadableLinks = $product->getData('fields/downloadable_links/value/downloadable/link');
     $pageOptions = $productViewBlock->getOptions($product);
     $pageDownloadableOptions = $pageOptions['downloadable_options']['downloadable_links'];
     $pageDownloadableLinks = $pageDownloadableOptions['downloadable']['link'];
     foreach ($productDownloadableLinks as $key => $link) {
         $this->assertEquals($pageDownloadableLinks[$key]['title'], $link['title']);
         $this->assertEquals($pageDownloadableLinks[$key]['price'], $link['price']);
     }
 }