/**
  * Assert product details.
  *
  * @param WishlistIndex $wishlistIndex
  * @param InjectableFixture $product
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 protected function assertProductDetails(WishlistIndex $wishlistIndex, InjectableFixture $product, FixtureFactory $fixtureFactory)
 {
     $actualOptions = $wishlistIndex->getItemsBlock()->getItemProduct($product)->getOptions();
     $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]);
     $expectedOptions = $cartFixture->getItems()[0]->getData()['options'];
     $errors = $this->verifyData($this->sortDataByPath($expectedOptions, '::title'), $this->sortDataByPath($actualOptions, '::title'));
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * Assert that product is not present in Wishlist on Frontend.
  *
  * @param CustomerAccountIndex $customerAccountIndex
  * @param WishlistIndex $wishlistIndex
  * @param InjectableFixture[] $products
  * @param Customer $customer
  * @return void
  */
 public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, $products, Customer $customer)
 {
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $customerAccountIndex->open()->getAccountMenuBlock()->openMenuItem("My Wish List");
     $itemBlock = $wishlistIndex->getWishlistBlock()->getProductItemsBlock();
     foreach ($products as $itemProduct) {
         \PHPUnit_Framework_Assert::assertFalse($itemBlock->getItemProduct($itemProduct)->isVisible(), 'Product \'' . $itemProduct->getName() . '\' is present in Wish List on Frontend.');
     }
 }
 /**
  * Assert that product is not present in Wishlist on Frontend
  *
  * @param CustomerAccountIndex $customerAccountIndex
  * @param WishlistIndex $wishlistIndex
  * @param InjectableFixture $product
  * @param CustomerInjectable $customer
  * @param CmsIndex $cmsIndex
  * @param CustomerAccountLogin $customerAccountLogin
  * @param CustomerAccountLogout $customerAccountLogout
  * @return void
  */
 public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, InjectableFixture $product, CustomerInjectable $customer, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout)
 {
     $productName = $product->getName();
     $customerAccountLogout->open();
     $cmsIndex->getLinksBlock()->openLink('Log In');
     $customerAccountLogin->getLoginBlock()->login($customer);
     $customerAccountIndex->open()->getAccountMenuBlock()->openMenuItem("My Wish List");
     \PHPUnit_Framework_Assert::assertFalse($wishlistIndex->getWishlistBlock()->getProductItemsBlock()->isProductPresent($productName), 'Product \'' . $productName . '\' is present in Wishlist on Frontend.');
 }
 /**
  * Assert that product is not present in Wishlist on Frontend
  *
  * @param CustomerAccountIndex $customerAccountIndex
  * @param WishlistIndex $wishlistIndex
  * @param InjectableFixture[] $products
  * @param Customer $customer
  * @param CmsIndex $cmsIndex
  * @param CustomerAccountLogin $customerAccountLogin
  * @param CustomerAccountLogout $customerAccountLogout
  * @return void
  */
 public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, $products, Customer $customer, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout)
 {
     $customerAccountLogout->open();
     $cmsIndex->getLinksBlock()->openLink('Log In');
     $customerAccountLogin->getLoginBlock()->login($customer);
     $customerAccountIndex->open()->getAccountMenuBlock()->openMenuItem("My Wish List");
     $itemBlock = $wishlistIndex->getWishlistBlock()->getProductItemsBlock();
     foreach ($products as $itemProduct) {
         \PHPUnit_Framework_Assert::assertFalse($itemBlock->getItemProduct($itemProduct)->isVisible(), 'Product \'' . $itemProduct->getName() . '\' is present in Wishlist on Frontend.');
     }
 }
 /**
  * Share wish list.
  *
  * @param Customer $customer
  * @param CatalogProductSimple $product
  * @param array $sharingInfo
  * @return void
  */
 public function test(Customer $customer, CatalogProductSimple $product, array $sharingInfo)
 {
     //Steps
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $this->objectManager->create('Magento\\Wishlist\\Test\\TestStep\\AddProductsToWishlistStep', ['products' => [$product]])->run();
     $this->wishlistIndex->getMessagesBlock()->waitSuccessMessage();
     $this->wishlistIndex->getWishlistBlock()->clickShareWishList();
     $this->cmsIndex->getCmsPageBlock()->waitPageInit();
     $this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo);
     $this->wishlistShare->getSharingInfoForm()->shareWishlist();
 }
 /**
  * Share wish list
  *
  * @param BrowserInterface $browser
  * @param Customer $customer
  * @param CatalogProductSimple $product
  * @param array $sharingInfo
  * @return void
  */
 public function test(BrowserInterface $browser, Customer $customer, CatalogProductSimple $product, array $sharingInfo)
 {
     //Steps
     $this->loginCustomer($customer);
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->catalogProductView->getViewBlock()->clickAddToWishlist();
     $this->wishlistIndex->getMessagesBlock()->waitSuccessMessage();
     $this->wishlistIndex->getWishlistBlock()->clickShareWishList();
     $this->cmsIndex->getCmsPageBlock()->waitPageInit();
     $this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo);
     $this->wishlistShare->getSharingInfoForm()->shareWishlist();
 }
 /**
  * Assert that success message appears on My Wish List page after adding product to wishlist.
  *
  * @param WishlistIndex $wishlistIndex
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(WishlistIndex $wishlistIndex, InjectableFixture $product)
 {
     \PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_MESSAGE, $product->getName()), $wishlistIndex->getMessagesBlock()->getSuccessMessage(), "Expected success message doesn't match actual.");
 }
 /**
  * Assert that product is present in default wishlist
  *
  * @param CmsIndex $cmsIndex
  * @param CustomerAccountIndex $customerAccountIndex
  * @param WishlistIndex $wishlistIndex
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, InjectableFixture $product)
 {
     $cmsIndex->getLinksBlock()->openLink('My Account');
     $customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List');
     \PHPUnit_Framework_Assert::assertTrue($wishlistIndex->getItemsBlock()->getItemProduct($product)->isVisible(), $product->getName() . ' is not visible on wishlist page.');
 }
 /**
  * Assert wish list is empty
  *
  * @param CmsIndex $cmsIndex
  * @param WishlistIndex $wishlistIndex
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex)
 {
     $cmsIndex->getCmsPageBlock()->waitPageInit();
     $cmsIndex->getLinksBlock()->openLink("My Wish List");
     \PHPUnit_Framework_Assert::assertTrue($wishlistIndex->getWishlistBlock()->isEmptyBlockVisible(), 'Wish List is not empty.');
 }
 /**
  * Assert that success message is displayed after wishlist has been shared
  *
  * @param WishlistIndex $wishlistIndex
  * @return void
  */
 public function processAssert(WishlistIndex $wishlistIndex)
 {
     \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $wishlistIndex->getMessagesBlock()->getSuccessMessages(), 'Wrong success message is displayed.');
 }
 /**
  * Share wish list
  *
  * @param Browser $browser
  * @param CustomerInjectable $customer
  * @param CatalogProductSimple $product
  * @param array $sharingInfo
  * @return void
  */
 public function test(Browser $browser, CustomerInjectable $customer, CatalogProductSimple $product, array $sharingInfo)
 {
     //Steps
     $this->loginCustomer($customer);
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->catalogProductView->getViewBlock()->addToWishlist();
     $this->wishlistIndex->getWishlistBlock()->clickShareWishList();
     $this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo);
     $this->wishlistShare->getSharingInfoForm()->shareWishlist();
 }
 /**
  * Share wish list
  *
  * @param CustomerInjectable $customer
  * @param CatalogProductSimple $product
  * @param array $sharingInfo
  * @return void
  */
 public function test(CustomerInjectable $customer, CatalogProductSimple $product, $sharingInfo)
 {
     //Steps
     $this->loginCustomer($customer);
     $this->catalogProductView->init($product);
     $this->catalogProductView->open()->getViewBlock()->addToWishlist();
     $this->wishlistIndex->getWishlistBlock()->clickShareWishList();
     $this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo);
     $this->wishlistShare->getSharingInfoForm()->shareWishlist();
 }