7
7
namespace Magento \Catalog \Test \Block \Adminhtml \Product \Edit \Section \ProductDetails ;
8
8
9
9
use Magento \Mtf \Client \Element \MultisuggestElement ;
10
+ use Magento \Mtf \Client \BrowserInterface ;
11
+ use Magento \Mtf \Client \Locator ;
12
+ use Magento \Mtf \Client \DriverInterface ;
13
+ use Magento \Mtf \Client \ElementInterface ;
14
+ use Magento \Mtf \System \Event \EventManagerInterface ;
10
15
11
16
/**
12
17
* Typified element class for category element.
@@ -19,4 +24,60 @@ class CategoryIds extends MultisuggestElement
19
24
* @var string
20
25
*/
21
26
protected $ resultItem = './/label[contains(@class, "admin__action-multiselect-label")]/span[text() = "%s"] ' ;
27
+
28
+ /**
29
+ * Browser instance.
30
+ *
31
+ * @var BrowserInterface
32
+ */
33
+ protected $ browser ;
34
+
35
+ /**
36
+ * Locator for page footer.
37
+ *
38
+ * @var string
39
+ */
40
+ protected $ pageFooter = '.page-footer ' ;
41
+
42
+ /**
43
+ * Locator for advanced inventory button.
44
+ *
45
+ * @var string
46
+ */
47
+ protected $ advancedInventoryButton = '[data-index="advanced_inventory_button"] ' ;
48
+
49
+ /**
50
+ * @constructor
51
+ * @param BrowserInterface $browser
52
+ * @param DriverInterface $driver
53
+ * @param EventManagerInterface $eventManager
54
+ * @param Locator $locator
55
+ * @param ElementInterface $context
56
+ */
57
+ public function __construct (
58
+ BrowserInterface $ browser ,
59
+ DriverInterface $ driver ,
60
+ EventManagerInterface $ eventManager ,
61
+ Locator $ locator ,
62
+ ElementInterface $ context = null
63
+ ) {
64
+ $ this ->browser = $ browser ;
65
+ parent ::__construct ($ driver , $ eventManager , $ locator , $ context );
66
+ }
67
+
68
+ /**
69
+ * Set category value.
70
+ *
71
+ * @param array|string $value
72
+ * @return void
73
+ */
74
+ public function setValue ($ value )
75
+ {
76
+ // Align Category ids select element to the center of the browser for created categories
77
+ if ($ this ->browser ->find ($ this ->pageFooter )->isVisible ()) {
78
+ $ this ->browser ->find ($ this ->pageFooter )->hover ();
79
+ $ this ->browser ->find ($ this ->advancedInventoryButton )->hover ();
80
+ }
81
+ parent ::setValue ($ value );
82
+ }
22
83
}
0 commit comments