Skip to content

Commit d51b0a1

Browse files
committed
Merge branch 'revertBranch' into ShareWishlistEntityTest
2 parents 4ae09d4 + 13d0116 commit d51b0a1

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Wishlist\Test\TestCase;
8+
9+
use Magento\Catalog\Test\Fixture\CatalogProductSimple;
10+
use Magento\Cms\Test\Page\CmsIndex;
11+
use Magento\Customer\Test\Fixture\Customer;
12+
use Magento\Wishlist\Test\Page\WishlistIndex;
13+
use Magento\Wishlist\Test\Page\WishlistShare;
14+
use Magento\Mtf\TestCase\Injectable;
15+
16+
/**
17+
* Preconditions:
18+
* 1. Create Customer Account.
19+
* 2. Create product.
20+
*
21+
* Steps:
22+
* 1. Login to frontend as a Customer.
23+
* 2. Add product to Wish List.
24+
* 3. Click "Share Wish List" button.
25+
* 4. Fill in all data according to data set.
26+
* 5. Click "Share Wishlist" button.
27+
* 6. Perform all assertions.
28+
*
29+
* @group Wishlist
30+
* @ZephyrId MAGETWO-23394
31+
*
32+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
33+
*/
34+
class ShareWishlistEntityTest extends Injectable
35+
{
36+
/* tags */
37+
const MVP = 'no';
38+
/* end tags */
39+
40+
/**
41+
* Cms index page.
42+
*
43+
* @var CmsIndex
44+
*/
45+
protected $cmsIndex;
46+
47+
/**
48+
* Wishlist index page.
49+
*
50+
* @var WishlistIndex
51+
*/
52+
protected $wishlistIndex;
53+
54+
/**
55+
* Wishlist share page.
56+
*
57+
* @var WishlistShare
58+
*/
59+
protected $wishlistShare;
60+
61+
/**
62+
* Prepare data.
63+
*
64+
* @param Customer $customer
65+
* @param CatalogProductSimple $product
66+
* @return array
67+
*/
68+
public function __prepare(Customer $customer, CatalogProductSimple $product)
69+
{
70+
$customer->persist();
71+
$product->persist();
72+
73+
return [
74+
'customer' => $customer,
75+
'product' => $product
76+
];
77+
}
78+
79+
/**
80+
* Inject pages.
81+
*
82+
* @param CmsIndex $cmsIndex
83+
* @param WishlistIndex $wishlistIndex
84+
* @param WishlistShare $wishlistShare
85+
* @return void
86+
*/
87+
public function __inject(
88+
CmsIndex $cmsIndex,
89+
WishlistIndex $wishlistIndex,
90+
WishlistShare $wishlistShare
91+
) {
92+
$this->cmsIndex = $cmsIndex;
93+
$this->wishlistIndex = $wishlistIndex;
94+
$this->wishlistShare = $wishlistShare;
95+
}
96+
97+
/**
98+
* Share wish list.
99+
*
100+
* @param Customer $customer
101+
* @param CatalogProductSimple $product
102+
* @param array $sharingInfo
103+
* @return void
104+
*/
105+
public function test(
106+
Customer $customer,
107+
CatalogProductSimple $product,
108+
array $sharingInfo
109+
) {
110+
//Steps
111+
$this->objectManager->create(
112+
\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
113+
['customer' => $customer]
114+
)->run();
115+
$this->objectManager->create(
116+
\Magento\Wishlist\Test\TestStep\AddProductsToWishlistStep::class,
117+
['products' => [$product]]
118+
)->run();
119+
$this->wishlistIndex->getMessagesBlock()->waitSuccessMessage();
120+
$this->wishlistIndex->getWishlistBlock()->clickShareWishList();
121+
$this->cmsIndex->getCmsPageBlock()->waitPageInit();
122+
$this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo);
123+
$this->wishlistShare->getSharingInfoForm()->shareWishlist();
124+
}
125+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Wishlist\Test\TestCase\ShareWishlistEntityTest" summary="Share wishlist" ticketId="MAGETWO-23394">
10+
<variation name="ShareWishlistEntityTestVariation1">
11+
<data name="sharingInfo/emails" xsi:type="string">[email protected],[email protected],[email protected]</data>
12+
<data name="sharingInfo/message" xsi:type="string">Sharing message.</data>
13+
<constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistShareMessage" />
14+
</variation>
15+
</testCase>
16+
</config>

0 commit comments

Comments
 (0)