本文整理匯總了PHP中Magento\Mtf\Client\BrowserInterface::open方法的典型用法代碼示例。如果您正苦於以下問題:PHP BrowserInterface::open方法的具體用法?PHP BrowserInterface::open怎麽用?PHP BrowserInterface::open使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Mtf\Client\BrowserInterface
的用法示例。
在下文中一共展示了BrowserInterface::open方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
/**
* Open product on frontend and click Checkout with PayPal button.
*
* @return void
*/
public function run()
{
$product = reset($this->products);
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$parentWindow = $this->catalogProductView->getViewBlock()->braintreePaypalCheckout();
$this->catalogProductView->getBraintreePaypalBlock()->process($parentWindow);
}
示例2: processAssert
/**
* Assert that displayed category data on category page equals to passed from fixture.
*
* @param Category $category
* @param Category $initialCategory
* @param FixtureFactory $fixtureFactory
* @param CatalogCategoryView $categoryView
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(Category $category, Category $initialCategory, FixtureFactory $fixtureFactory, CatalogCategoryView $categoryView, BrowserInterface $browser)
{
$this->browser = $browser;
$this->categoryViewPage = $categoryView;
$categoryData = $this->prepareData($fixtureFactory, $category, $initialCategory);
$this->browser->open($this->getCategoryUrl($category));
$this->assertGeneralInformation($category, $categoryData);
$this->assertDisplaySetting($category, $categoryData);
}
示例3: 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);
$this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
}
}
示例4: 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');
if ($this->configure) {
$this->catalogProductView->getViewBlock()->addToWishlist($product);
} else {
$this->catalogProductView->getViewBlock()->clickAddToWishlist();
}
}
}
示例5: processAssert
/**
* Assert that category name is different on different store view.
*
* @param BrowserInterface $browser
* @param CatalogCategoryView $categoryView
* @param Category $category
* @param Category $initialCategory
* @param CmsIndex $cmsIndex
* @return void
*/
public function processAssert(BrowserInterface $browser, CatalogCategoryView $categoryView, Category $category, Category $initialCategory, CmsIndex $cmsIndex)
{
$cmsIndex->open();
$cmsIndex->getLinksBlock()->waitWelcomeMessage();
$browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertEquals($initialCategory->getName(), $categoryView->getTitleBlock()->getTitle(), 'Wrong category name is displayed for default store.');
$store = $category->getDataFieldConfig('store_id')['source']->store->getName();
$cmsIndex->getStoreSwitcherBlock()->selectStoreView($store);
$cmsIndex->getLinksBlock()->waitWelcomeMessage();
$browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertEquals($category->getName(), $categoryView->getTitleBlock()->getTitle(), 'Wrong category name is displayed for ' . $store);
}
示例6: processAssert
/**
* Assert that displayed category data on category page equals to passed from fixture.
*
* @param Category $category
* @param CatalogCategoryView $categoryView
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(Category $category, CatalogCategoryView $categoryView, BrowserInterface $browser)
{
$this->browser = $browser;
$this->category = $category;
$this->categoryViewPage = $categoryView;
$this->browser->open($this->getCategoryUrl($category));
$categoryData = $this->prepareFixtureData($category->getData());
$diff = $this->verifyGeneralInformation($categoryData);
$diff = array_merge($diff, $this->verifyContent($categoryData));
$diff = array_merge($diff, $this->verifyDisplaySettings($categoryData));
$diff = array_merge($diff, $this->verifySearchEngineOptimization($categoryData));
\PHPUnit_Framework_Assert::assertEmpty($diff, "Category settings on Storefront page are different.\n" . implode(' ', $diff));
}
示例7: openCategory
/**
* Open category.
*
* @param Category $category
* @return void
*/
protected function openCategory(Category $category)
{
$categoryUrlKey = [];
while ($category) {
$categoryUrlKey[] = $category->hasData('url_key') ? strtolower($category->getUrlKey()) : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-');
$category = $category->getDataFieldConfig('parent_id')['source']->getParentCategory();
if ($category !== null && 1 == $category->getParentId()) {
$category = null;
}
}
$categoryUrlKey = $_ENV['app_frontend_url'] . implode('/', array_reverse($categoryUrlKey)) . '.html';
$this->browser->open($categoryUrlKey);
}
示例8: processAssert
/**
* Assert that product rating is not displayed on frontend on product review
*
* @param CatalogProductView $catalogProductView
* @param CatalogProductSimple $product
* @param Rating $productRating
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating, BrowserInterface $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getReviewSummary()->getAddReviewLink()->click();
$reviewForm = $catalogProductView->getReviewFormBlock();
\PHPUnit_Framework_Assert::assertFalse($reviewForm->isVisibleRating($productRating), 'Product rating "' . $productRating->getRatingCode() . '" is displayed.');
}
示例9: processAssert
/**
* Assert that created entity was found on search page
*
* @param UrlRewrite $initialRewrite
* @param UrlRewrite $urlRewrite
* @param BrowserInterface $browser
* @param CatalogCategoryView $categoryView
* @return void
*/
public function processAssert(UrlRewrite $initialRewrite, UrlRewrite $urlRewrite, BrowserInterface $browser, CatalogCategoryView $categoryView)
{
$urlRequestPath = $urlRewrite->hasData('request_path') ? $urlRewrite->getRequestPath() : $initialRewrite->getRequestPath();
$browser->open($_ENV['app_frontend_url'] . $urlRequestPath);
$entity = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity()->getName();
\PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($entity), "Created entity '{$entity}' isn't found.");
}
示例10: isNotDisplayingOnFrontendAssert
/**
* Verify product displaying on frontend
*
* @param FixtureInterface $product
* @return array
*/
protected function isNotDisplayingOnFrontendAssert(FixtureInterface $product)
{
$errors = [];
// Check the product page is not available
// TODO fix initialization url for frontend page
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$titleBlock = $this->catalogProductView->getTitleBlock();
if ($titleBlock->getTitle() !== self::NOT_FOUND_MESSAGE) {
$errors[] = '- the headline on the page does not match, the text should be -> "' . self::NOT_FOUND_MESSAGE . '".';
}
$this->cmsIndex->open();
$this->cmsIndex->getSearchBlock()->search($product->getSku());
if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product->getName())) {
$errors[] = '- successful product search.';
}
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $this->catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
if ($isProductVisible) {
$errors[] = "- product with name '{$product->getName()}' is found in this category.";
}
return $errors;
}
示例11: processAssert
/**
* Assert that displayed price view for bundle product on product page equals passed from fixture.
*
* @param CatalogProductView $catalogProductView
* @param BrowserInterface $browser
* @param BundleProduct $product
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, BrowserInterface $browser, BundleProduct $product)
{
//Open product view page
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
//Process assertions
$this->assertPrice($product, $catalogProductView);
}
示例12: processAssert
/**
* Assert that the category cannot be accessed from the navigation bar in the frontend
*
* @param CmsIndex $cmsIndex
* @param Category $category
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, Category $category, BrowserInterface $browser)
{
$cmsIndex->open();
\PHPUnit_Framework_Assert::assertFalse($cmsIndex->getTopmenu()->isCategoryVisible($category->getName()), 'Category can be accessed from the navigation bar in the frontend.');
$browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $cmsIndex->getTitleBlock()->getTitle(), 'Wrong page is displayed.');
}
示例13: processAssert
/**
* Assert check URL rewrite custom redirect
*
* @param UrlRewrite $urlRewrite
* @param BrowserInterface $browser
* @param CmsIndex $cmsIndex
* @return void
*/
public function processAssert(UrlRewrite $urlRewrite, BrowserInterface $browser, CmsIndex $cmsIndex)
{
$browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
$entity = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity();
$title = $entity->hasData('name') ? $entity->getName() : $entity->getContentHeading();
$pageTitle = $cmsIndex->getTitleBlock()->getTitle();
\PHPUnit_Framework_Assert::assertEquals($pageTitle, $title, 'URL rewrite product redirect false.' . "\nExpected: " . $title . "\nActual: " . $pageTitle);
}
示例14: addProducts
/**
* Add products to compare list
*
* @param array $products
* @return void
*/
protected function addProducts(array $products)
{
foreach ($products as $itemProduct) {
$this->browser->open($_ENV['app_frontend_url'] . $itemProduct->getUrlKey() . '.html');
$this->catalogProductView->getViewBlock()->clickAddToCompare();
$this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
}
}
示例15: processAssert
/**
* Assertion that tier prices are displayed correctly
*
* @param BrowserInterface $browser
* @param CatalogProductView $catalogProductView
* @param FixtureInterface $product
* @return void
*/
public function processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, FixtureInterface $product)
{
// TODO fix initialization url for frontend page
//Open product view page
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
//Process assertions
$this->assertPrice($product, $catalogProductView->getViewBlock());
}