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


PHP Factory::getClientBrowser方法代碼示例

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

示例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']);
 }
開發者ID:buskamuza,項目名稱:magento2-skeleton,代碼行數:16,代碼來源:EditSimpleProductTest.php

示例3: _reopenBrowser

 /**
  * Force reopen browser
  * @return void
  */
 protected function _reopenBrowser()
 {
     Factory::getClientBrowser()->reopen();
 }
開發者ID:Mohitsahu123,項目名稱:mtf,代碼行數:8,代碼來源:Listener.php

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

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


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