/** * Verify item product data. * * @param InjectableFixture $product * @param int|null $expectedQty * @return void */ protected function verifyItemProduct(InjectableFixture $product, $expectedQty) { \PHPUnit_Framework_Assert::assertTrue($this->wishlistIndex->getItemsBlock()->getItemProductBlock($product)->isVisible(), 'Product "' . $product->getName() . '" in custom wishlist doesn\'t visible.'); if ($expectedQty !== null) { \PHPUnit_Framework_Assert::assertEquals($expectedQty, $this->wishlistIndex->getItemsBlock()->getItemProductBlock($product)->getData()['qty'], 'Actual quantity of "' . $product->getName() . '" in custom wishlist doesn\'t match to expected.'); } }
/** * Assert that product is not present in Wishlist on frontend. * * @param WishlistIndex $wishlistIndex * @param CmsIndex $cmsIndex * @param Customer $customer * @param FrontendActionsForCustomer $frontendActionsForCustomer * @param InjectableFixture[] $products * @return void */ public function processAssert(WishlistIndex $wishlistIndex, CmsIndex $cmsIndex, Customer $customer, FrontendActionsForCustomer $frontendActionsForCustomer, array $products) { $frontendActionsForCustomer->loginCustomer($customer); $cmsIndex->getTopLinksBlock()->openAccountLink("My Wishlist"); $itemBlock = $wishlistIndex->getItemsBlock(); foreach ($products as $itemProduct) { \PHPUnit_Framework_Assert::assertFalse($itemBlock->getItemProductBlock($itemProduct)->isVisible(), "Product '{$itemProduct->getName()}' is present in Wishlist on frontend."); } }
/** * Assert that the correct option details are displayed on the "View Details" tool tip. * * @param CmsIndex $cmsIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture $product * @param FixtureFactory $fixtureFactory * @return void */ public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex, InjectableFixture $product, FixtureFactory $fixtureFactory) { $cmsIndex->getTopLinksBlock()->openAccount(); $cmsIndex->getLinksBlock()->openLink("My Wishlist"); $actualOptions = $wishlistIndex->getItemsBlock()->getItemProductBlock($product)->getOptions(); $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]); $expectedOptions = $this->prepareOptions($cartFixture); $errors = $this->verifyData($expectedOptions, $this->sortDataByPath($actualOptions, '::title')); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Run Create multiple wishlist entity test. * * @param Customer $customer * @param Wishlist $wishlist * @return void */ public function test(Customer $customer, Wishlist $wishlist) { // Prepare widget for assertions $this->setupConfiguration(); $this->createWishlistSearchWidget(); // Steps: $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $this->customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('My Wishlists'); $this->wishlistIndex->getManagementBlock()->clickCreateNewWishlist(); $this->wishlistIndex->getBehaviourBlock()->fillWishlist($wishlist); }
/** * 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()->getSuccessMessages()); }
/** * Assert that success message appears on My Wish List page after moving 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()->getSuccessMessages(), "Expected success move to wish list message doesn't match actual."); }
/** * Assert wish list is empty. * * @param CmsIndex $cmsIndex * @param WishlistIndex $wishlistIndex * @return void */ public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex) { $cmsIndex->getTopLinksBlock()->openAccountLink("My Wishlist"); \PHPUnit_Framework_Assert::assertTrue($wishlistIndex->getWishlistBlock()->isEmptyBlockVisible(), 'Wish list is not empty.'); }
/** * Assert that product is present in default wishlist. * * @param CmsIndex $cmsIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture $product * @return void */ public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex, InjectableFixture $product) { $cmsIndex->getTopLinksBlock()->openAccount(); $cmsIndex->getLinksBlock()->openLink("My Wishlist"); \PHPUnit_Framework_Assert::assertTrue($wishlistIndex->getItemsBlock()->getItemProductBlock($product)->isVisible(), $product->getName() . ' is not visible on wishlist page.'); }
/** * Assert that multiple wish list success save message is displayed. * * @param WishlistIndex $wishlistIndex * @param Wishlist $wishlist * @return void */ public function processAssert(WishlistIndex $wishlistIndex, Wishlist $wishlist) { \PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_SAVE_MESSAGE, $wishlist->getName()), $wishlistIndex->getMessagesBlock()->getSuccessMessages()); }
/** * Assert that multiple wishlist is present on 'My Account' page. * * @param CustomerAccountIndex $customerAccountIndex * @param WishlistIndex $wishlistIndex * @param Wishlist $wishlist * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, Wishlist $wishlist) { $customerAccountIndex->open()->getAccountNavigationBlock()->openNavigationItem('My Wishlists'); \PHPUnit_Framework_Assert::assertTrue($wishlistIndex->getManagementBlock()->isWishlistVisible($wishlist), "{$wishlist->getName()} multiple wishlist is not visible on My Account page."); }