本文整理汇总了PHP中Mtf\Factory\Factory::getClientBrowser方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getClientBrowser方法的具体用法?PHP Factory::getClientBrowser怎么用?PHP Factory::getClientBrowser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mtf\Factory\Factory
的用法示例。
在下文中一共展示了Factory::getClientBrowser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddReviewByGuest
/**
* Adding product review from not logged customer prospective
*
* @ZephyrId MAGETWO-12403
*/
public function testAddReviewByGuest()
{
//Preconditions
$productFixture = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
$productFixture->switchData('simple_required');
$productFixture->persist();
$reviewFixture = Factory::getFixtureFactory()->getMagentoReviewReview();
//Pages & Blocks
$homePage = Factory::getPageFactory()->getCmsIndexIndex();
$productPage = Factory::getPageFactory()->getCatalogProductView();
$backendReviewIndex = Factory::getPageFactory()->getReviewProductIndex();
$backendReviewEdit = Factory::getPageFactory()->getReviewProductEdit();
$reviewsSummaryBlock = $productPage->getReviewSummary();
$reviewsBlock = $productPage->getCustomerReviewBlock();
$reviewForm = $productPage->getReviewFormBlock();
$reviewGrid = $backendReviewIndex->getReviewGrid();
$reviewBackendForm = $backendReviewEdit->getReviewForm();
//Steps & verifying
$homePage->open();
Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $productFixture->getUrlKey() . '.html');
$this->verifyNoReviewOnPage($reviewsSummaryBlock);
$reviewsSummaryBlock->getAddReviewLink()->click();
$this->assertFalse($reviewsBlock->isVisibleReviewItem(), 'No reviews below the form required');
$reviewForm->fill($reviewFixture);
$reviewForm->submit();
$submitReviewMessage = 'Your review has been accepted for moderation.';
$this->assertContains($submitReviewMessage, $productPage->getMessagesBlock()->getSuccessMessages(), sprintf('Message "%s" is not appear', $submitReviewMessage));
$this->verifyNoReviewOnPage($productPage->getReviewSummary());
Factory::getApp()->magentoBackendLoginUser();
$backendReviewIndex->open();
$reviewGrid->searchAndOpen(['title' => $reviewFixture->getTitle()]);
$this->assertEquals('Guest', $reviewBackendForm->getPostedBy(), 'Review is not posted by Guest');
$this->assertEquals('Pending', $reviewBackendForm->getStatus(), 'Review is not in Pending status');
$this->assertTrue($this->verifyReviewBackendForm($reviewFixture, $reviewBackendForm), 'Review data is not corresponds to submitted one');
$reviewBackendForm->setApproveReview();
$backendReviewEdit->getPageActions()->save();
$this->assertContains('You saved the review.', $backendReviewIndex->getMessagesBlock()->getSuccessMessages(), 'Review is not saved');
$this->flushCacheStorageWithAssert();
Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $productFixture->getUrlKey() . '.html');
$reviewsSummaryBlock = $productPage->getReviewSummary();
$this->assertTrue($reviewsSummaryBlock->getAddReviewLink()->isVisible(), 'Add review link is not visible');
$this->assertTrue($reviewsSummaryBlock->getViewReviewLink()->isVisible(), 'View review link is not visible');
$this->assertContains('1', $reviewsSummaryBlock->getViewReviewLink()->getText(), 'There is more than 1 approved review');
$reviewForm = $productPage->getReviewFormBlock();
$reviewsBlock = $productPage->getCustomerReviewBlock();
$reviewsSummaryBlock->getViewReviewLink()->click();
$this->assertContains(sprintf("You're reviewing:\n%s", $productFixture->getName()), $reviewForm->getLegend()->getText());
$this->verifyReview($reviewsBlock, $reviewFixture);
}
示例2: 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->getProductPrice();
$this->assertEquals(number_format($productEdited->getProductPrice(), 2), $price['price_regular_price']);
}
示例3: _reopenBrowser
/**
* Force reopen browser
* @return void
*/
protected function _reopenBrowser()
{
Factory::getClientBrowser()->reopen();
}
示例4: assertUrlRedirect
/**
* Assert that request URL redirects to target URL
*
* @param string $requestUrl
* @param string $targetUrl
* @param string $message
* @return void
*/
protected function assertUrlRedirect($requestUrl, $targetUrl, $message = '')
{
$browser = Factory::getClientBrowser();
$browser->open($requestUrl);
$this->assertStringStartsWith($targetUrl, $browser->getUrl(), $message);
}
示例5: addNewAttribute
/**
* Add new attribute to product
*
* @param ProductAttribute $attribute
* @return void
*/
protected function addNewAttribute(ProductAttribute $attribute)
{
$createProductPage = Factory::getPageFactory()->getCatalogProductNew();
$productForm = $createProductPage->getConfigurableProductForm();
$productForm->openVariationsTab();
$productForm->clickCreateNewVariationSet();
$newAttributeForm = $productForm->getConfigurableAttributeEditBlock();
$this->assertTrue($newAttributeForm->isVisible(), '"New attribute" window is not opened');
$newAttributeForm->openFrontendProperties();
$newAttributeForm->fill($attribute);
$newAttributeForm->saveAttribute();
Factory::getClientBrowser()->switchToFrame();
}