Skip to content

Commit d185b01

Browse files
committed
MAGETWO-59343: Automate new update wishlist flow
1 parent 84d382b commit d185b01

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli
3737
* @param Customer $customer
3838
* @param string $products
3939
* @param int $qty
40+
* @param bool $toUpdate
4041
* @return array
4142
*/
42-
public function test(Customer $customer, $products, $qty)
43+
public function test(Customer $customer, $products, $qty, $toUpdate = true)
4344
{
4445
// Preconditions
4546
$customer->persist();
@@ -48,7 +49,7 @@ public function test(Customer $customer, $products, $qty)
4849
$this->addToWishlist($products);
4950

5051
// Steps
51-
$this->addToCart($products, $qty);
52+
$this->addToCart($products, $qty, $toUpdate);
5253

5354
// Prepare data for asserts
5455
$cart = $this->createCart($products);
@@ -61,17 +62,20 @@ public function test(Customer $customer, $products, $qty)
6162
*
6263
* @param array $products
6364
* @param int $qty
65+
* @param bool $toUpdate
6466
* @return void
6567
*/
66-
protected function addToCart(array $products, $qty)
68+
protected function addToCart(array $products, $qty, $toUpdate)
6769
{
6870
$productBlock = $this->wishlistIndex->getWishlistBlock()->getProductItemsBlock();
6971
foreach ($products as $product) {
7072
$this->cmsIndex->getLinksBlock()->openLink("My Wish List");
7173
$this->cmsIndex->getCmsPageBlock()->waitPageInit();
7274
if ($qty != '-') {
7375
$productBlock->getItemProduct($product)->fillProduct(['qty' => $qty]);
74-
$this->wishlistIndex->getWishlistBlock()->clickUpdateWishlist();
76+
if ($toUpdate) {
77+
$this->wishlistIndex->getWishlistBlock()->clickUpdateWishlist();
78+
}
7579
}
7680
$productBlock->getItemProduct($product)->clickAddToCart();
7781
$this->cmsIndex->getCmsPageBlock()->waitPageInit();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<data name="tag" xsi:type="string">stable:no</data>
1212
<data name="products/0" xsi:type="string">catalogProductSimple::product_100_dollar</data>
1313
<data name="qty" xsi:type="string">2</data>
14+
<data name="toUpdate" xsi:type="boolean">false</data>
1415
<constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" />
1516
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" />
1617
</variation>

0 commit comments

Comments
 (0)