本文整理匯總了PHP中Magento\Mtf\Client\Browser::open方法的典型用法代碼示例。如果您正苦於以下問題:PHP Browser::open方法的具體用法?PHP Browser::open怎麽用?PHP Browser::open使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Mtf\Client\Browser
的用法示例。
在下文中一共展示了Browser::open方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
/**
* Add products to the wish list.
*
* @return void
*/
public function run()
{
foreach ($this->products as $product) {
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$viewBlock = $this->catalogProductView->getViewBlock();
$this->configure ? $viewBlock->addToWishlist($product) : $viewBlock->clickAddToWishlist();
}
}
示例2: run
/**
* Add products to the cart.
*
* @return void
*/
public function run()
{
// Ensure that shopping cart is empty
$this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
foreach ($this->products as $product) {
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$this->catalogProductView->getViewBlock()->addToCart($product);
}
}
示例3: processAssert
/**
* Assert that displayed price view for bundle product on product page equals passed from fixture.
*
* @param CatalogProductView $catalogProductView
* @param Browser $browser
* @param BundleProduct $product
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, Browser $browser, BundleProduct $product)
{
//Open product view page
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
//Process assertions
$this->assertPrice($product, $catalogProductView);
}
示例4: processAssert
/**
* Assertion that tier prices are displayed correctly.
*
* @param Browser $browser
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @return void
*/
public function processAssert(Browser $browser, CatalogProductView $catalogProductView, InjectableFixture $product)
{
//Open product view page
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
//Process assertions
$this->assertPrice($product, $catalogProductView->getViewBlock());
}
示例5: isNotDisplayingOnFrontendAssert
/**
* Verify product displaying on frontend.
*
* @param InjectableFixture $product
* @return array
*/
protected function isNotDisplayingOnFrontendAssert(InjectableFixture $product)
{
$errors = [];
//Check that product is not available by url
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
if ($this->catalogProductView->getViewBlock()->isVisible()) {
$errors[] = '- product view block is visible in product page.';
}
//Check that product can't be found
$this->cmsIndex->open()->getSearchBlock()->search($product->getSku());
if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product)) {
$errors[] = '- successful product search.';
}
//Check that product is not available in category page
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
$this->cmsIndex->open()->getTopmenu()->selectCategory($categoryName);
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product);
$bottomToolBar = $this->catalogCategoryView->getBottomToolbar();
while (!$isProductVisible && $bottomToolBar->nextPage()) {
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product);
}
if ($isProductVisible) {
$errors[] = "- product with name '{$product->getName()}' is found in this category.";
}
return $errors;
}
示例6: processAssert
/**
* Assert that created CMS page displays with error message on unassigned store views on frontend.
*
* @param CmsPage $cms
* @param FrontendCmsPage $frontendCmsPage
* @param Browser $browser
* @param CmsIndex $cmsIndex
* @param string|null $notFoundMessage
* @return void
*/
public function processAssert(CmsPage $cms, FrontendCmsPage $frontendCmsPage, Browser $browser, CmsIndex $cmsIndex, $notFoundMessage = null)
{
$browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier());
$notFoundMessage = $notFoundMessage !== null ? $notFoundMessage : self::ERROR_MESSAGE;
$cmsIndex->getHeaderBlock()->selectStore('Default Store View');
\PHPUnit_Framework_Assert::assertContains($notFoundMessage, $frontendCmsPage->getCmsPageContentBlock()->getPageContent(), 'Wrong page content is displayed.');
}
示例7: processAssert
/**
* Assert that products are displayed in up-sell section.
*
* @param Browser $browser
* @param FixtureInterface $product
* @param array $upSellProducts
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(Browser $browser, FixtureInterface $product, array $upSellProducts, CatalogProductView $catalogProductView)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
foreach ($upSellProducts as $upSellProduct) {
\PHPUnit_Framework_Assert::assertTrue($catalogProductView->getUpsellBlock()->getItemBlock($upSellProduct)->isVisible(), "Product {$upSellProduct->getName()} is absent in up-sells products.");
}
}
示例8: processAssert
/**
* Assert that redirect from newCategory/oldProduct is correct to new product.
*
* @param InjectableFixture $product
* @param InjectableFixture $initialProduct
* @param Browser $browser
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(InjectableFixture $product, InjectableFixture $initialProduct, Browser $browser, CatalogProductView $catalogProductView)
{
$category = $product->getDataFieldConfig('category_ids')['source']->getProductCategory();
$productUrl = $_ENV['app_frontend_url'] . $category->getUrlKey() . '/' . $initialProduct->getUrlKey() . '.html';
$browser->open($productUrl);
\PHPUnit_Framework_Assert::assertEquals($catalogProductView->getViewBlock()->getProductName(), strtoupper($product->getName()));
}
示例9: processAssert
/**
* Assert that product is displayed in related products section.
*
* @param Browser $browser
* @param CatalogProductSimple $product
* @param InjectableFixture[] $relatedProducts
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(Browser $browser, CatalogProductSimple $product, array $relatedProducts, CatalogProductView $catalogProductView)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
foreach ($relatedProducts as $relatedProduct) {
\PHPUnit_Framework_Assert::assertTrue($catalogProductView->getRelatedProductBlock()->getItemBlock($relatedProduct)->isVisible(), "Product {$relatedProduct->getName()} is absent in related products.");
}
}
示例10: processAssert
/**
* Assertion that the product is correctly displayed in cart.
*
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @param Browser $browser
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
{
// Add product to cart
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
// Check price
$this->assertOnShoppingCart($product, $checkoutCart);
}
示例11: processAssert
/**
* Assertion that the product is correctly displayed in cart.
*
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @param Browser $browser
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$checkoutData = $product->getCheckoutData();
$price = $checkoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
\PHPUnit_Framework_Assert::assertEquals($checkoutData['cartItem']['price'], $price, 'Product price in shopping cart is not correct.');
}
示例12: processAssert
/**
* Assert that price stored in fixture equals to product price on product page.
*
* @param CatalogProductSimple $productSimple
* @param Browser $browser
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductSimple $productSimple, Browser $browser, CatalogProductView $catalogProductView)
{
$productSimple->persist();
$browser->open($_ENV['app_frontend_url'] . $productSimple->getUrlKey() . '.html');
$productPriceFromFixture = $productSimple->getPrice();
$productPrice = number_format($catalogProductView->getViewBlock()->getPriceBlock()->getPrice(), 2);
\PHPUnit_Framework_Assert::assertEquals($productPrice, $productPriceFromFixture);
}
示例13: processAssert
/**
* Assert that gift card usable in frontend.
*
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param CatalogProductSimple $product
* @param Browser $browser
* @param string $code
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, CatalogProductSimple $product, Browser $browser, $code)
{
$this->checkoutCart = $checkoutCart;
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->clickAddToCart();
$checkoutCart->getGiftCardAccountBlock()->addGiftCard($code);
$this->assert();
}
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:18,代碼來源:AbstractAssertGiftCardAccountUsableInCartOnFrontend.php
示例14: processAssert
/**
* Assert that displayed assigned products on category page equals passed from fixture.
*
* @param CatalogCategory $category
* @param CatalogCategoryView $categoryView
* @param Browser $browser
* @return void
*/
public function processAssert(CatalogCategory $category, CatalogCategoryView $categoryView, Browser $browser)
{
$browser->open($_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html');
$products = $category->getDataFieldConfig('category_products')['source']->getProducts();
foreach ($products as $productFixture) {
\PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($productFixture), "Products '{$productFixture->getName()}' is not find.");
}
}
示例15: processAssert
/**
* Assertion that commodity options are displayed correctly.
*
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @param Browser $browser
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$fixtureCustomOptions = $this->prepareOptions($product);
$formCustomOptions = $catalogProductView->getViewBlock()->getOptions($product)['custom_options'];
$error = $this->verifyData($fixtureCustomOptions, $formCustomOptions);
\PHPUnit_Framework_Assert::assertEmpty($error, $error);
}