/**
  * Assert that Wishlist can't be find by another Customer (or guest) via "Wishlist Search".
  *
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param SearchResult $searchResult
  * @param CatalogCategory $category
  * @param Customer $customer
  * @param Wishlist $wishlist
  * @return void
  */
 public function processAssert(CustomerAccountLogout $customerAccountLogout, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, SearchResult $searchResult, CatalogCategory $category, Customer $customer, Wishlist $wishlist)
 {
     $customerAccountLogout->open();
     $cmsIndex->open()->getTopmenu()->selectCategory($category->getName());
     $catalogCategoryView->getWishlistSearchBlock()->searchByCustomer($customer);
     \PHPUnit_Framework_Assert::assertFalse($searchResult->getWishlistSearchResultBlock()->isWishlistVisibleInGrid($wishlist), "Multiple wishlist is visible on wishlist search result page.");
 }
 /**
  * Disable enabled config after test.
  *
  * @return void
  */
 public function tearDown()
 {
     $this->customerAccountLogout->open();
     if (isset($this->currentVariation['arguments']['configData'])) {
         $this->objectManager->create('Mage\\Core\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->currentVariation['arguments']['configData'], 'rollback' => true])->run();
     }
 }
 /**
  * Run step.
  *
  * @return void
  */
 public function run()
 {
     $this->customerAccountLogout->open();
     $this->cmsIndex->getFooterBlock()->clickLink('Orders and Returns');
     $this->salesGuestForm->getSearchForm()->fill($this->order);
     $this->salesGuestForm->getSearchForm()->submit();
 }
 /**
  * Assert that message from dataSet is displayed on order view page on frontend.
  *
  * @param GiftMessage $giftMessage
  * @param Customer $customer
  * @param OrderHistory $orderHistory
  * @param OrderView $orderView
  * @param CustomerAccountLogout $customerAccountLogout
  * @param string $orderId
  * @return void
  */
 public function processAssert(GiftMessage $giftMessage, Customer $customer, OrderHistory $orderHistory, OrderView $orderView, CustomerAccountLogout $customerAccountLogout, $orderId)
 {
     $this->loginOnFrontend($customer);
     $this->openOrderPage($orderHistory, $orderId);
     $expectedData = $this->prepareExpectedData($giftMessage);
     \PHPUnit_Framework_Assert::assertEquals($expectedData, $orderView->getGiftMessageForOrderBlock()->getGiftMessage());
     $customerAccountLogout->open();
 }
 /**
  * Assert that message from dataSet is displayed for each items on order view page on frontend.
  *
  * @param GiftMessage $giftMessage
  * @param Customer $customer
  * @param OrderHistory $orderHistory
  * @param OrderView $orderView
  * @param CustomerAccountLogout $customerAccountLogout
  * @param string $orderId
  * @param array $products
  * @return void
  */
 public function processAssert(GiftMessage $giftMessage, Customer $customer, OrderHistory $orderHistory, OrderView $orderView, CustomerAccountLogout $customerAccountLogout, $orderId, array $products = [])
 {
     $this->loginOnFrontend($customer);
     $this->openOrderPage($orderHistory, $orderId);
     $expectedData = $this->prepareExpectedData($giftMessage);
     $actualData = $this->prepareActualData($orderView, $products);
     \PHPUnit_Framework_Assert::assertEquals($expectedData, $actualData);
     $customerAccountLogout->open();
 }
 /**
  * Assert that Gift Wrapping can be found during one page checkout on frontend.
  *
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param BrowserInterface $browser
  * @param CheckoutOnepage $checkoutOnepage
  * @param GiftWrapping $giftWrapping
  * @param Address $billingAddress
  * @param CatalogProductSimple $product
  * @param Customer $customer
  * @param CustomerAccountLogout $customerAccountLogout
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, BrowserInterface $browser, CheckoutOnepage $checkoutOnepage, GiftWrapping $giftWrapping, Address $billingAddress, CatalogProductSimple $product, Customer $customer, CustomerAccountLogout $customerAccountLogout)
 {
     // Preconditions
     $customer->persist();
     $product->persist();
     // Steps
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $checkoutCart->open()->getCartBlock()->getProceedToCheckoutBlock()->proceedToCheckout();
     $checkoutOnepage->getLoginBlock()->loginCustomer($customer);
     $checkoutOnepage->getBillingBlock()->fillBilling($billingAddress);
     $checkoutOnepage->getBillingBlock()->clickContinue();
     \PHPUnit_Framework_Assert::assertContains($giftWrapping->getDesign(), $checkoutOnepage->getGiftOptionsBlock()->getGiftWrappingsAvailable(), "Gift Wrapping '{$giftWrapping->getDesign()}' is not present in one page checkout on frontend.");
     $customerAccountLogout->open();
 }
 /**
  * 1. Navigate to frontend
  * 2. If "Log Out" link is visible and "isLoggedIn" empty
  *    - makes logout
  * 3. If "isLoggedIn" not empty
  *    - login as customer
  * 4. Clear shopping cart
  * 5. Add test product(s) to shopping cart with specify quantity
  * 6. If "salesRule/data/coupon_code" not empty:
  *    - fill "Enter your code" input in Dіscount Codes
  *    - click "Apply Coupon" button
  * 7. If "address/data/country_id" not empty:
  *    On Estimate Shipping and Tax:
  *    - fill Country, State/Province, Zip/Postal Code
  *    - click 'Get a Quote' button
  *    - select 'Flat Rate' shipping
  *    - click 'Update Total' button
  * 8. Implementation assert
  *
  * @param CheckoutCart $checkoutCart
  * @param CmsIndex $cmsIndex
  * @param CustomerAccountLogin $customerAccountLogin
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param Customer $customer
  * @param SalesRule $salesRule
  * @param Address $address
  * @param Browser $browser
  * @param array $productQuantity
  * @param CatalogProductSimple $productForSalesRule1
  * @param CatalogProductSimple $productForSalesRule2
  * @param array $shipping [optional]
  * @param int|null $isLoggedIn
  * @return void
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(CheckoutCart $checkoutCart, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, Customer $customer, SalesRule $salesRule, Address $address, Browser $browser, array $productQuantity, CatalogProductSimple $productForSalesRule1, CatalogProductSimple $productForSalesRule2, array $shipping = [], $isLoggedIn = null)
 {
     $this->checkoutCart = $checkoutCart;
     $this->cmsIndex = $cmsIndex;
     $this->customerAccountLogin = $customerAccountLogin;
     $this->customerAccountLogout = $customerAccountLogout;
     $this->catalogCategoryView = $catalogCategoryView;
     $this->catalogProductView = $catalogProductView;
     $this->customer = $customer;
     $this->browser = $browser;
     $this->productForSalesRule1 = $productForSalesRule1;
     $this->productForSalesRule2 = $productForSalesRule2;
     $isLoggedIn ? $this->login() : $this->customerAccountLogout->open();
     $this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
     $this->addProductsToCart($productQuantity);
     if ($address->hasData('country_id')) {
         $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address);
         if (!empty($shipping)) {
             $this->checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
         }
     }
     if ($salesRule->getCouponCode()) {
         $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($salesRule->getCouponCode());
     }
     $this->assert();
 }
 /**
  * Assert that product is displayed in cross-sell section for customer segment.
  *
  * @param Browser $browser
  * @param Customer $customer
  * @param CheckoutCart $checkoutCart
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param CustomerAccountLogout $customerAccountLogout
  * @param InjectableFixture[] $promotedProducts
  * @return void
  */
 public function processAssert(Browser $browser, Customer $customer, CheckoutCart $checkoutCart, CatalogProductSimple $product, CatalogProductView $catalogProductView, CustomerAccountLogout $customerAccountLogout, array $promotedProducts)
 {
     // Create customer, logout and login to frontend
     $customer->persist();
     $customerAccountLogout->open();
     $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     // Clear cart
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->clearShoppingCart();
     // Check display cross sell products
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     $errors = [];
     foreach ($promotedProducts as $promotedProduct) {
         if (!$checkoutCart->getCrosssellBlock()->getItemBlock($promotedProduct)->isVisible()) {
             $errors[] = "Product '{$promotedProduct->getName()}' is absent in cross-sell section.";
         }
     }
     \PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
 }
 /**
  * Login to frontend. Create product. Adding product to shopping cart.
  *
  * @param CheckoutCart $checkoutCart
  * @param CatalogProductSimple $product
  * @param CmsIndex $cmsIndex
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CatalogProductView $catalogProductView
  * @param Customer $customer
  * @param CustomerSegment $customerSegment
  * @param CustomerSegmentIndex $customerSegmentIndex
  * @param BrowserInterface $browser
  * @param CustomerSegmentNew $customerSegmentNew
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, CatalogProductSimple $product, CmsIndex $cmsIndex, CustomerAccountLogout $customerAccountLogout, CatalogProductView $catalogProductView, Customer $customer, CustomerSegment $customerSegment, CustomerSegmentIndex $customerSegmentIndex, BrowserInterface $browser, CustomerSegmentNew $customerSegmentNew)
 {
     $this->checkoutCart = $checkoutCart;
     $this->cmsIndex = $cmsIndex;
     $this->customerAccountLogout = $customerAccountLogout;
     $this->catalogProductView = $catalogProductView;
     $this->customer = $customer;
     $this->customerSegment = $customerSegment;
     $this->customerSegmentIndex = $customerSegmentIndex;
     $this->customerSegmentNew = $customerSegmentNew;
     $this->cmsIndex->open();
     $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $this->customer])->run();
     $product->persist();
     $this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->catalogProductView->getViewBlock()->clickAddToCart();
     $this->checkoutCart->getMessagesBlock()->getSuccessMessages();
     $this->assert();
     $this->customerAccountLogout->open();
 }
 /**
  * Logout after variation.
  *
  * @return void
  */
 public function tearDown()
 {
     $this->customerAccountLogout->open();
 }
예제 #11
0
 /**
  * Logout customer.
  *
  * @return void
  */
 public function run()
 {
     $this->customerAccountLogout->open();
 }