本文整理汇总了PHP中magento\mtf\factory\Factory::getClientBrowser方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getClientBrowser方法的具体用法?PHP Factory::getClientBrowser怎么用?PHP Factory::getClientBrowser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类magento\mtf\factory\Factory
的用法示例。
在下文中一共展示了Factory::getClientBrowser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertOnTheFrontEnd
/**
* Assert configurable product is added to cart together with the proper related product
*
* @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\Related $relatedBlock */
$relatedBlock = $productPage->getRelatedProductBlock();
//Verify related simple2 and configurable on Simple1 product page
$this->assertTrue($relatedBlock->isRelatedProductVisible($simple2->getName()));
$this->assertTrue($relatedBlock->isRelatedProductSelectable($simple2->getName()));
$this->assertTrue($relatedBlock->isRelatedProductVisible($configurable->getName()));
$this->assertFalse($relatedBlock->isRelatedProductSelectable($configurable->getName()));
//Open and verify configurable page
$relatedBlock->openRelatedProduct($configurable->getName());
$this->assertEquals($configurable->getName(), $productPage->getViewBlock()->getProductName());
//Verify related simple2 on Configurable product page and add to cart it
$relatedBlock = $productPage->getRelatedProductBlock();
$this->assertTrue($relatedBlock->isRelatedProductVisible($simple2->getName()));
$this->assertTrue($relatedBlock->isRelatedProductSelectable($simple2->getName()));
$relatedBlock->selectProductForAddToCart($simple2->getName());
$productPage->getViewBlock()->addToCart($configurable);
//Verify that both configurable product and simple product 2 are added to shopping cart
$checkoutCartPage = Factory::getPageFactory()->getCheckoutCartIndex();
$checkoutCartBlock = $checkoutCartPage->getCartBlock();
$checkoutCartPage->getMessagesBlock()->waitSuccessMessage();
$this->assertTrue($checkoutCartBlock->isProductInShoppingCart($configurable), 'Configurable product was not found in the shopping cart.');
$this->assertTrue($checkoutCartBlock->isProductInShoppingCart($simple2), 'Related product was not found in the shopping cart.');
}
示例2: testCreateCrosssell
/**
* Product Cross-selling. Assign cross-selling to products and see them related on the front-end.
*
* @ZephyrId MAGETWO-12390
* @return void
*/
public function testCreateCrosssell()
{
$simple1 = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
$simple1->switchData('simple');
$simple1->persist();
$simple2 = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
$simple2->switchData('simple');
$simple2->persist();
$configurable = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
$configurable->switchData('configurable');
$configurable->persist();
$this->addCrosssellProducts($simple1, [$simple2, $configurable]);
$this->addCrosssellProducts($configurable, [$simple1, $simple2]);
//Ensure shopping cart is empty
$checkoutCartPage = Factory::getPageFactory()->getCheckoutCartIndex();
$checkoutCartPage->open();
$checkoutCartPage->getCartBlock()->clearShoppingCart();
$productPage = Factory::getPageFactory()->getCatalogProductView();
Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $simple1->getUrlKey() . '.html');
$productPage->getViewBlock()->addToCart($simple1);
$checkoutCartPage = Factory::getPageFactory()->getCheckoutCartIndex();
$checkoutCartPage->getMessagesBlock()->waitSuccessMessage();
$cartBlock = $checkoutCartPage->getCartBlock();
$this->assertTrue($cartBlock->isProductInShoppingCart($simple1));
$crosssellBlock = $checkoutCartPage->getCrosssellBlock();
$this->assertTrue($crosssellBlock->isVisible(), "cross-sell view not found");
$this->assertTrue($crosssellBlock->verifyProductcrosssell($configurable), 'Cross-sell product ' . $configurable->getName() . ' was not found in the first product page.');
$this->assertTrue($crosssellBlock->verifyProductcrosssell($simple2), 'Upsell product ' . $simple2->getName() . ' was not found in the first product page.');
$crosssellBlock = $checkoutCartPage->getCrosssellBlock();
$crosssellBlock->clickLink($configurable);
$productPage = Factory::getPageFactory()->getCatalogProductView();
Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $configurable->getUrlKey() . '.html');
$productPage->getViewBlock()->addToCart($configurable);
$checkoutCartPage = Factory::getPageFactory()->getCheckoutCartIndex();
$cartBlock = $checkoutCartPage->getCartBlock();
$this->assertTrue($cartBlock->isProductInShoppingCart($configurable));
$this->assertTrue($cartBlock->isProductInShoppingCart($simple1));
$crosssellBlock = $checkoutCartPage->getCrosssellBlock();
$crosssellBlock->clickLink($simple2);
$productPage = Factory::getPageFactory()->getCatalogProductView();
Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $simple2->getUrlKey() . '.html');
$productPage->getViewBlock()->addToCart($simple2);
$checkoutCartPage = Factory::getPageFactory()->getCheckoutCartIndex();
$cartBlock = $checkoutCartPage->getCartBlock();
$this->assertTrue($cartBlock->isProductInShoppingCart($configurable));
$this->assertTrue($cartBlock->isProductInShoppingCart($simple1));
$this->assertTrue($cartBlock->isProductInShoppingCart($simple2));
$this->assertFalse($checkoutCartPage->getCrosssellBlock()->isVisible());
}
示例3: 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);
}