1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Spryker Commerce OS. |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
declare(strict_types = 1); |
9
|
|
|
|
10
|
|
|
namespace PyzTest\Zed\ProductRelation\Presentation; |
11
|
|
|
|
12
|
|
|
use PyzTest\Zed\ProductRelation\PageObject\ProductRelationCreatePage; |
13
|
|
|
use PyzTest\Zed\ProductRelation\ProductRelationPresentationTester; |
14
|
|
|
use Spryker\Shared\ProductRelation\ProductRelationTypes; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Auto-generated group annotations |
18
|
|
|
* |
19
|
|
|
* @group PyzTest |
20
|
|
|
* @group Zed |
21
|
|
|
* @group ProductRelation |
22
|
|
|
* @group Presentation |
23
|
|
|
* @group ProductRelationCreateRelationCest |
24
|
|
|
* Add your own group annotations below this line |
25
|
|
|
*/ |
26
|
|
|
class ProductRelationCreateRelationCest |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @param \PyzTest\Zed\ProductRelation\ProductRelationPresentationTester $i |
30
|
|
|
* |
31
|
|
|
* @return void |
32
|
|
|
*/ |
33
|
|
|
public function _before(ProductRelationPresentationTester $i): void |
34
|
|
|
{ |
35
|
|
|
$i->amZed(); |
36
|
|
|
$i->amLoggedInUser(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param \PyzTest\Zed\ProductRelation\ProductRelationPresentationTester $i |
41
|
|
|
* |
42
|
|
|
* @return void |
43
|
|
|
*/ |
44
|
|
|
public function testICanCreateProductRelationAndSeeInYves(ProductRelationPresentationTester $i): void |
45
|
|
|
{ |
46
|
|
|
$i->wantTo('I want to create up selling relation'); |
47
|
|
|
$i->expect('relation is persisted, exported to yves and carousel component is visible'); |
48
|
|
|
|
49
|
|
|
$i->amLoggedInUser(); |
50
|
|
|
|
51
|
|
|
$i->amOnPage(ProductRelationCreatePage::URL); |
52
|
|
|
|
53
|
|
|
$i->waitForElement(ProductRelationPresentationTester::PRODUCT_RELATION_KEY_FIELD_SELECTOR); |
54
|
|
|
$key = uniqid('key-', false); |
55
|
|
|
$i->fillField(ProductRelationPresentationTester::PRODUCT_RELATION_KEY_FIELD_SELECTOR, $key); |
56
|
|
|
|
57
|
|
|
$i->selectRelationType(ProductRelationTypes::TYPE_RELATED_PRODUCTS); |
58
|
|
|
$i->filterProductsByName(ProductRelationCreatePage::PRODUCT_RELATION_PRODUCT_1_NAME); |
59
|
|
|
$i->selectProduct(ProductRelationCreatePage::PRODUCT_RELATION_PRODUCT_1_SKU); |
60
|
|
|
|
61
|
|
|
$i->switchToAssignProductsTab(); |
62
|
|
|
|
63
|
|
|
$i->selectProductRule( |
64
|
|
|
ProductRelationCreatePage::PRODUCT_RULE_NAME, |
65
|
|
|
ProductRelationCreatePage::PRODUCT_RULE_OPERATOR, |
66
|
|
|
ProductRelationCreatePage::PRODUCT_RELATION_PRODUCT_2_SKU, |
67
|
|
|
); |
68
|
|
|
|
69
|
|
|
$i->clickSaveButton(); |
70
|
|
|
|
71
|
|
|
$i->waitForText(sprintf('%s %s', ProductRelationCreatePage::EDIT_PRODUCT_RELATION_TEXT, $key), 20); |
72
|
|
|
$i->seeInPageSource(sprintf('%s %s', ProductRelationCreatePage::EDIT_PRODUCT_RELATION_TEXT, $key)); |
73
|
|
|
|
74
|
|
|
$i->cleanUpProductRelation($key); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|