10
10
use Magento \Catalog \Test \Page \Adminhtml \CatalogCategoryEdit ;
11
11
use Magento \Catalog \Test \Page \Adminhtml \CatalogCategoryIndex ;
12
12
use Magento \Mtf \Constraint \AbstractAssertForm ;
13
- use Magento \Mtf \Client \Locator ;
14
- use Magento \Mtf \Client \BrowserInterface ;
15
- use Magento \Mtf \Block \BlockFactory ;
16
13
17
14
/**
18
15
* Assert that displayed category data on edit page equals passed from fixture.
@@ -34,77 +31,31 @@ class AssertCategoryForm extends AbstractAssertForm
34
31
'store_id '
35
32
];
36
33
37
- /**
38
- * Default sore switcher block locator.
39
- *
40
- * @var string
41
- */
42
- private $ storeSwitcherBlock = '.store-switcher ' ;
43
-
44
- /**
45
- * Dropdown block locator.
46
- *
47
- * @var string
48
- */
49
- private $ dropdownBlock = '.dropdown ' ;
50
-
51
- /**
52
- * Selector for confirm.
53
- *
54
- * @var string
55
- */
56
- private $ confirmModal = '.confirm._show[data-role=modal] ' ;
57
-
58
34
/**
59
35
* Assert that displayed category data on edit page equals passed from fixture.
60
36
*
61
37
* @param CatalogCategoryIndex $catalogCategoryIndex
62
38
* @param CatalogCategoryEdit $catalogCategoryEdit
63
39
* @param Category $category
64
- * @param BrowserInterface $browser
65
- * @param BlockFactory $blockFactory
66
40
* @return void
67
41
*/
68
42
public function processAssert (
69
43
CatalogCategoryIndex $ catalogCategoryIndex ,
70
44
CatalogCategoryEdit $ catalogCategoryEdit ,
71
- Category $ category ,
72
- BrowserInterface $ browser ,
73
- BlockFactory $ blockFactory
45
+ Category $ category
74
46
) {
75
47
$ catalogCategoryIndex ->open ();
76
48
$ catalogCategoryIndex ->getTreeCategories ()->selectCategory ($ category , true );
77
- $ this ->switchScope ($ category , $ browser , $ blockFactory );
49
+ if ($ category ->hasData ('store_id ' )) {
50
+ $ storeName = $ category ->getStoreId ()['source ' ]->getName ();
51
+ $ catalogCategoryEdit ->getFormPageActions ()->selectStoreView ($ storeName );
52
+ }
78
53
$ fixtureData = $ this ->prepareFixtureData ($ category ->getData ());
79
54
$ formData = $ catalogCategoryEdit ->getEditForm ()->getData ($ category );
80
55
$ error = $ this ->verifyData ($ this ->sortData ($ fixtureData ), $ this ->sortData ($ formData ));
81
56
\PHPUnit_Framework_Assert::assertEmpty ($ error , $ error );
82
57
}
83
58
84
- /**
85
- * Switches scope to selected store on the edit form
86
- *
87
- * @param Category $category
88
- * @param BrowserInterface $browser
89
- * @param BlockFactory $blockFactory
90
- * @return void
91
- */
92
- private function switchScope (Category $ category , BrowserInterface $ browser , BlockFactory $ blockFactory )
93
- {
94
- if ($ category ->hasData ('store_id ' )) {
95
- $ store = $ category ->getStoreId ()['source ' ]->getName ();
96
- $ storeSwitcherBlock = $ browser ->find ($ this ->storeSwitcherBlock );
97
- $ storeSwitcherBlock ->find ($ this ->dropdownBlock , Locator::SELECTOR_CSS , 'liselectstore ' )->setValue ($ store );
98
- $ modalElement = $ browser ->find ($ this ->confirmModal );
99
- /** @var \Magento\Ui\Test\Block\Adminhtml\Modal $modal */
100
- $ modal = $ blockFactory ->create (
101
- \Magento \Ui \Test \Block \Adminhtml \Modal::class,
102
- ['element ' => $ modalElement ]
103
- );
104
- $ modal ->acceptAlert ();
105
- }
106
- }
107
-
108
59
/**
109
60
* Prepares fixture data for comparison.
110
61
*
0 commit comments