6
6
7
7
namespace Magento \CatalogRule \Test \Block \Adminhtml \Promo \Catalog \Edit ;
8
8
9
- use \ Magento \Ui \Test \Block \Adminhtml \ FormSections ;
10
- use Magento \Mtf \Client \Element \ SimpleElement ;
9
+ use Magento \Backend \Test \Block \Template ;
10
+ use Magento \Mtf \Client \Locator ;
11
11
use Magento \Mtf \Fixture \FixtureInterface ;
12
+ use Magento \Mtf \Client \Element \SimpleElement ;
13
+ use Magento \Ui \Test \Block \Adminhtml \FormSections ;
12
14
13
15
/**
14
16
* Form for creation of a Catalog Price Rule.
15
17
*/
16
18
class PromoForm extends FormSections
17
19
{
20
+ /**
21
+ * Selector for template block.
22
+ *
23
+ * @var string
24
+ */
25
+ private $ templateBlockSelector = './ancestor::body ' ;
26
+
18
27
/**
19
28
* Fill form with tabs.
20
29
*
@@ -25,6 +34,7 @@ class PromoForm extends FormSections
25
34
*/
26
35
public function fill (FixtureInterface $ fixture , SimpleElement $ element = null , array $ replace = null )
27
36
{
37
+ $ this ->waitPageToLoad ();
28
38
$ sections = $ this ->getFixtureFieldsByContainers ($ fixture );
29
39
if ($ replace ) {
30
40
$ sections = $ this ->prepareData ($ sections , $ replace );
@@ -55,4 +65,28 @@ protected function prepareData(array $tabs, array $replace)
55
65
56
66
return $ tabs ;
57
67
}
68
+
69
+ /**
70
+ * Wait page to load.
71
+ *
72
+ * @return void
73
+ */
74
+ protected function waitPageToLoad ()
75
+ {
76
+ $ this ->waitForElementVisible ($ this ->header );
77
+ $ this ->getTemplateBlock ()->waitLoader ();
78
+ }
79
+
80
+ /**
81
+ * Get template block.
82
+ *
83
+ * @return Template
84
+ */
85
+ private function getTemplateBlock ()
86
+ {
87
+ return $ this ->blockFactory ->create (
88
+ Template::class,
89
+ ['element ' => $ this ->_rootElement ->find ($ this ->templateBlockSelector , Locator::SELECTOR_XPATH )]
90
+ );
91
+ }
58
92
}
0 commit comments