Skip to content

Commit 199456a

Browse files
author
Stanislav Idolov
committed
MAGETWO-59512: [GitHub] Products in wishlist show $0.00 price #6866
-- functional test
1 parent a7db6d9 commit 199456a

File tree

4 files changed

+68
-2
lines changed

4 files changed

+68
-2
lines changed

dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ public function hoverProductBlock()
164164
$this->_rootElement->find($this->price)->hover();
165165
}
166166

167+
/**
168+
* Returns product price
169+
*
170+
* @return string
171+
*/
172+
public function getPrice()
173+
{
174+
$price = $this->_rootElement->find($this->price)->getText();
175+
return str_replace('$', '', $price);
176+
}
177+
167178
/**
168179
* Get Wish List data for the Product.
169180
*
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Wishlist\Test\Constraint;
8+
9+
class AssertProductPriceIsNotZero extends \Magento\Mtf\Constraint\AbstractConstraint
10+
{
11+
/**
12+
* Assert that product price is not zero in default wishlist.
13+
*
14+
* @param \Magento\Cms\Test\Page\CmsIndex $cmsIndex
15+
* @param \Magento\Customer\Test\Page\CustomerAccountIndex $customerAccountIndex
16+
* @param \Magento\Wishlist\Test\Page\WishlistIndex $wishlistIndex
17+
* @param \Magento\Mtf\Fixture\InjectableFixture $product
18+
*
19+
* @return void
20+
*/
21+
public function processAssert(
22+
\Magento\Cms\Test\Page\CmsIndex $cmsIndex,
23+
\Magento\Customer\Test\Page\CustomerAccountIndex $customerAccountIndex,
24+
\Magento\Wishlist\Test\Page\WishlistIndex $wishlistIndex,
25+
\Magento\Mtf\Fixture\InjectableFixture $product
26+
) {
27+
$cmsIndex->getLinksBlock()->openLink('My Account');
28+
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List');
29+
$wishlistItem = $wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct($product);
30+
31+
\PHPUnit_Framework_Assert::assertNotEquals(
32+
'0.00',
33+
$wishlistItem->getPrice(),
34+
$product->getName() . ' has zero price on Wish List page.'
35+
);
36+
}
37+
38+
/**
39+
* Returns a string representation of the object.
40+
*
41+
* @return string
42+
*/
43+
public function toString()
44+
{
45+
return 'Product price is not zero in default Wish List.';
46+
}
47+
}

dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ public function __prepare(Customer $customer)
4848
*
4949
* @param Customer $customer
5050
* @param string $product
51+
* @param bool $configure
5152
* @return array
5253
*/
53-
public function test(Customer $customer, $product)
54+
public function test(Customer $customer, $product, $configure = true)
5455
{
5556
$product = $this->createProducts($product)[0];
5657

5758
// Steps:
5859
$this->loginCustomer($customer);
59-
$this->addToWishlist([$product], true);
60+
$this->addToWishlist([$product], $configure);
6061

6162
return ['product' => $product];
6263
}

dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,12 @@
4949
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" />
5050
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" />
5151
</variation>
52+
<variation name="AddProductToWishlistEntityTestVariation8">
53+
<data name="product/0" xsi:type="string">configurableProduct::default</data>
54+
<data name="configure" xsi:type="boolean">false</data>
55+
<constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" />
56+
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" />
57+
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductPriceIsNotZero" />
58+
</variation>
5259
</testCase>
5360
</config>

0 commit comments

Comments
 (0)