當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Factory::getClientBrowser方法代碼示例

本文整理匯總了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.');
 }
開發者ID:,項目名稱:,代碼行數:39,代碼來源:

示例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());
 }
開發者ID:,項目名稱:,代碼行數:55,代碼來源:

示例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);
 }
開發者ID:,項目名稱:,代碼行數:16,代碼來源:


注:本文中的magento\mtf\factory\Factory::getClientBrowser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。