本文整理匯總了PHP中magento\mtf\factory\Factory::getPageFactory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Factory::getPageFactory方法的具體用法?PHP Factory::getPageFactory怎麽用?PHP Factory::getPageFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類magento\mtf\factory\Factory
的用法示例。
在下文中一共展示了Factory::getPageFactory方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCreateNewLocalizedStoreView
/**
* @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()->waitSuccessMessage();
$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()->waitSuccessMessage();
$configPage = Factory::getPageFactory()->getAdminSystemConfig();
$configPage->open();
$configPage->getPageActions()->selectStore($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()->waitSuccessMessage();
$homePage = Factory::getPageFactory()->getCmsIndexIndex();
$homePage->open();
$homePage->getStoreSwitcherBlock()->selectStoreView($storeFixture->getName());
$this->assertTrue($homePage->getSearchBlock()->isPlaceholderContains('Den gesamten Shop durchsuchen'));
}
示例2: assertOnFrontend
/**
* 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();
$priceOnPage = $productViewBlock->getPriceBlock()->getPrice();
$this->assertEquals(number_format($price, 2), number_format($priceOnPage, 2), 'Product price does not correspond to specified.');
$pageOptions = $productViewBlock->getOptions($product);
$configurableOptions = [];
foreach ($pageOptions['configurable_options'] as $attribute) {
$configurableOption = [];
foreach ($attribute['options'] as $option) {
$configurableOption[] = $option['title'];
}
$configurableOptions[$attribute['title']] = $configurableOption;
}
$this->assertEquals($product->getConfigurableOptions(), $configurableOptions);
}
示例3: testCreateConfigurableProduct
/**
* 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);
}
示例4: assertOnCategory
/**
* 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->getPriceBlock()->getPrice();
$this->assertEquals(number_format($product->getProductPrice(), 2), $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']);
}
示例5: persist
/**
* 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()->waitSuccessMessage();
}
示例6: assertAbsenceOnCategory
/**
* 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()));
}
示例7: testForgotPassword
/**
* Reset password on frontend
*/
public function testForgotPassword()
{
// Create Customer
$customer = $this->objectManager->getInstance()->create('Magento\\Customer\\Test\\Fixture\\Customer', ['dataSet' => '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());
}
示例8: persist
/**
* 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);
}
示例9: assertProductOnFrontend
/**
* Assert simple product on Frontend
*
* @param SimpleProduct $product
* @return void
*/
protected function assertProductOnFrontend(SimpleProduct $product)
{
//Pages
$frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
$categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
$productPage = Factory::getPageFactory()->getCatalogProductView();
$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());
$price = $productViewBlock->getPriceBlock()->getPrice();
$this->assertEquals(number_format($product->getProductPrice(), 2), $price);
}
示例10: persist
/**
* 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();
}
}
示例11: testCreateCustomer
/**
* 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');
}
示例12: assertOnTheFrontEnd
/**
* @param Product $product
* @param Product[] $assigned
* @return void
*/
protected function assertOnTheFrontEnd(Product $product, array $assigned)
{
/** @var Product $simple2 */
/** @var Product $configurable */
list($simple2, $configurable) = $assigned;
//Open up simple1 product page
$productPage = Factory::getPageFactory()->getCatalogProductView();
Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$this->assertEquals($product->getName(), $productPage->getViewBlock()->getProductName());
/** @var \Magento\Catalog\Test\Block\Product\ProductList\Upsell $upsellBlock */
$upsellBlock = $productPage->getUpsellBlock();
//Verify upsell simple2 and configurable on Simple1 product page
$this->assertTrue($upsellBlock->isUpsellProductVisible($simple2->getName()));
$this->assertTrue($upsellBlock->isUpsellProductVisible($configurable->getName()));
//Open and verify configurable page
$upsellBlock->openUpsellProduct($configurable->getName());
$this->assertEquals($configurable->getName(), $productPage->getViewBlock()->getProductName());
//Verify upsell simple2 on Configurable product page and open it
$upsellBlock = $productPage->getUpsellBlock();
$this->assertTrue($upsellBlock->isUpsellProductVisible($simple2->getName()));
$upsellBlock->openUpsellProduct($simple2->getName());
$this->assertEquals($simple2->getName(), $productPage->getViewBlock()->getProductName());
$this->assertFalse($productPage->getUpsellBlock()->isVisible());
}
示例13: addCrosssellProducts
/**
* 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();
}
示例14: assertOnProductPage
/**
* 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->getPriceBlock()->getPrice();
$this->assertEquals(number_format($productEdited->getProductPrice(), 2), $price);
}
示例15: persist
/**
* Logout admin user
*
* @param FixtureInterface $fixture [optional]
* @return mixed|string
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function persist(FixtureInterface $fixture = null)
{
$homePage = Factory::getPageFactory()->getAdminDashboard();
$headerBlock = $homePage->getAdminPanelHeader();
$headerBlock->logOut();
}