本文整理汇总了PHP中Magento\Mtf\Client\BrowserInterface类的典型用法代码示例。如果您正苦于以下问题:PHP BrowserInterface类的具体用法?PHP BrowserInterface怎么用?PHP BrowserInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BrowserInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that you will be redirected to url from dataset
*
* @param CmsIndex $cmsIndex
* @param BrowserInterface $browser
* @param CatalogSearchQuery $searchTerm
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, BrowserInterface $browser, CatalogSearchQuery $searchTerm)
{
$cmsIndex->open()->getSearchBlock()->search($searchTerm->getSynonymFor());
$windowUrl = $browser->getUrl();
$redirectUrl = $searchTerm->getRedirect();
\PHPUnit_Framework_Assert::assertEquals($windowUrl, $redirectUrl, 'Redirect by synonym was not executed.' . PHP_EOL . "Expected: " . $redirectUrl . PHP_EOL . "Actual: " . $windowUrl);
}
示例2: 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.');
}
示例3: 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.');
}
示例4: processAssert
/**
* Assert that apache redirect works by opening category page and asserting index.php in its url.
*
* @param CatalogCategory $category
* @param CmsIndex $homePage
* @param BrowserInterface $browser
*/
public function processAssert(CatalogCategory $category, CmsIndex $homePage, BrowserInterface $browser)
{
$category->persist();
$homePage->open();
$homePage->getTopmenu()->selectCategory($category->getName());
\PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'index.php') === false, 'Apache redirect for category does not work.');
}
示例5: 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.");
}
示例6: 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);
}
示例7: processAssert
/**
* Assert that Secure Urls Enabled.
*
* @param BrowserInterface $browser
* @param Dashboard $dashboard
* @param CustomerAccountLogin $customerAccountLogin
* @return void
*/
public function processAssert(BrowserInterface $browser, Dashboard $dashboard, CustomerAccountLogin $customerAccountLogin)
{
$dashboard->open();
\PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'https://') !== false, 'Secure Url is not displayed on backend.');
$customerAccountLogin->open();
\PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'https://') !== false, 'Secure Url is not displayed on frontend.');
}
示例8: processAssert
/**
* Check that Shopping Cart is empty, opened page contains text "You have no items in your shopping cart.
* Click here to continue shopping." where 'here' is link that leads to index page
*
* @param CheckoutCart $checkoutCart
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, BrowserInterface $browser)
{
$checkoutCart->open();
$cartEmptyBlock = $checkoutCart->getCartEmptyBlock();
\PHPUnit_Framework_Assert::assertEquals(self::TEXT_EMPTY_CART, $cartEmptyBlock->getText(), 'Wrong text on empty cart page.');
$cartEmptyBlock->clickLinkToMainPage();
\PHPUnit_Framework_Assert::assertEquals($_ENV['app_frontend_url'], $browser->getUrl(), 'Wrong link to main page on empty cart page.');
}
示例9: processAssert
/**
* Assert that outside redirect was success
*
* @param UrlRewrite $urlRewrite
* @param BrowserInterface $browser
* @param UrlRewrite|null $initialRewrite [optional]
* @return void
*/
public function processAssert(UrlRewrite $urlRewrite, BrowserInterface $browser, UrlRewrite $initialRewrite = null)
{
$urlRequestPath = $urlRewrite->hasData('request_path') ? $urlRewrite->getRequestPath() : $initialRewrite->getRequestPath();
$urlTargetPath = $urlRewrite->hasData('target_path') ? $urlRewrite->getTargetPath() : $initialRewrite->getTargetPath();
$browser->open($_ENV['app_frontend_url'] . $urlRequestPath);
$browserUrl = $browser->getUrl();
\PHPUnit_Framework_Assert::assertEquals($browserUrl, $urlTargetPath, 'URL rewrite redirect false.' . "\nExpected: " . $urlTargetPath . "\nActual: " . $browserUrl);
}
示例10: processAssert
/**
* Check whether there is an opportunity to compare products using given attribute.
*
* @param InjectableFixture $product
* @param CatalogProductAttribute $attribute
* @param BrowserInterface $browser
* @param CatalogProductView $catalogProductView
* @param CatalogProductCompare $catalogProductCompare
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductAttribute $attribute, BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductCompare $catalogProductCompare)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->clickAddToCompare();
$catalogProductCompare->open();
$label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
\PHPUnit_Framework_Assert::assertTrue($catalogProductCompare->getCompareProductsBlock()->isAttributeVisible($label), 'Attribute is absent on product compare page.');
}
示例11: processAssert
/**
* Check that product available by new URL on the front
*
* @param UrlRewrite $urlRewrite
* @param CatalogProductView $catalogProductView
* @param BrowserInterface $browser
* @param InjectableFixture $product
* @return void
*/
public function processAssert(UrlRewrite $urlRewrite, CatalogProductView $catalogProductView, BrowserInterface $browser, InjectableFixture $product = null)
{
$browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
if ($product === null) {
$product = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity();
}
\PHPUnit_Framework_Assert::assertEquals($catalogProductView->getTitleBlock()->getTitle(), $product->getName(), 'URL rewrite product redirect false.' . "\nExpected: " . $product->getName() . "\nActual: " . $catalogProductView->getTitleBlock()->getTitle());
}
示例12: processAssert
/**
* Assert that displayed product data on product page(front-end) equals passed from fixture:
* 1. Product Name
* 2. Price
* 3. Special price
* 4. SKU
* 5. Description
* 6. Short Description
*
* @param BrowserInterface $browser
* @param CatalogProductView $catalogProductView
* @param FixtureInterface $product
* @return void
*/
public function processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, FixtureInterface $product)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$this->product = $product;
$this->productView = $catalogProductView->getViewBlock();
$errors = $this->verify();
\PHPUnit_Framework_Assert::assertEmpty($errors, "\nFound the following errors:\n" . implode(" \n", $errors));
}
示例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: processAssert
/**
* Assert that displayed price for bundle items on shopping cart page equals to passed from fixture.
* Price for bundle items has two options:
* 1. Fixed (price of bundle product)
* 2. Dynamic (price of bundle item)
*
* @param CatalogProductView $catalogProductView
* @param BundleProduct $product
* @param CheckoutCart $checkoutCartView
* @param BrowserInterface $browser
* @param BundleProduct $originalProduct [optional]
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, BundleProduct $product, CheckoutCart $checkoutCartView, BrowserInterface $browser, BundleProduct $originalProduct = null)
{
$checkoutCartView->open()->getCartBlock()->clearShoppingCart();
//Open product view page
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
//Process assertions
$this->assertPrice($product, $catalogProductView, $checkoutCartView, $originalProduct);
}
示例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());
}