Skip to content

Commit

Permalink
MAGETWO-59512: [GitHub] Products in wishlist show $0.00 price #6866
Browse files Browse the repository at this point in the history
-- functional test
  • Loading branch information
Stanislav Idolov committed Oct 24, 2016
1 parent a7db6d9 commit 199456a
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ public function hoverProductBlock()
$this->_rootElement->find($this->price)->hover();
}

/**
* Returns product price
*
* @return string
*/
public function getPrice()
{
$price = $this->_rootElement->find($this->price)->getText();
return str_replace('$', '', $price);
}

/**
* Get Wish List data for the Product.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Wishlist\Test\Constraint;

class AssertProductPriceIsNotZero extends \Magento\Mtf\Constraint\AbstractConstraint
{
/**
* Assert that product price is not zero in default wishlist.
*
* @param \Magento\Cms\Test\Page\CmsIndex $cmsIndex
* @param \Magento\Customer\Test\Page\CustomerAccountIndex $customerAccountIndex
* @param \Magento\Wishlist\Test\Page\WishlistIndex $wishlistIndex
* @param \Magento\Mtf\Fixture\InjectableFixture $product
*
* @return void
*/
public function processAssert(
\Magento\Cms\Test\Page\CmsIndex $cmsIndex,
\Magento\Customer\Test\Page\CustomerAccountIndex $customerAccountIndex,
\Magento\Wishlist\Test\Page\WishlistIndex $wishlistIndex,
\Magento\Mtf\Fixture\InjectableFixture $product
) {
$cmsIndex->getLinksBlock()->openLink('My Account');
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List');
$wishlistItem = $wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct($product);

\PHPUnit_Framework_Assert::assertNotEquals(
'0.00',
$wishlistItem->getPrice(),
$product->getName() . ' has zero price on Wish List page.'
);
}

/**
* Returns a string representation of the object.
*
* @return string
*/
public function toString()
{
return 'Product price is not zero in default Wish List.';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ public function __prepare(Customer $customer)
*
* @param Customer $customer
* @param string $product
* @param bool $configure
* @return array
*/
public function test(Customer $customer, $product)
public function test(Customer $customer, $product, $configure = true)
{
$product = $this->createProducts($product)[0];

// Steps:
$this->loginCustomer($customer);
$this->addToWishlist([$product], true);
$this->addToWishlist([$product], $configure);

return ['product' => $product];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,12 @@
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" />
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" />
</variation>
<variation name="AddProductToWishlistEntityTestVariation8">
<data name="product/0" xsi:type="string">configurableProduct::default</data>
<data name="configure" xsi:type="boolean">false</data>
<constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" />
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" />
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductPriceIsNotZero" />
</variation>
</testCase>
</config>

0 comments on commit 199456a

Please sign in to comment.