@@ -21,7 +21,7 @@ class CustomerForm extends FormTabs
21
21
*
22
22
* @var string
23
23
*/
24
- protected $ loader = '[data-role="spinner"] ' ;
24
+ protected $ spinner = '[data-role="spinner"] ' ;
25
25
26
26
/**
27
27
* Customer form to load.
@@ -31,32 +31,34 @@ class CustomerForm extends FormTabs
31
31
protected $ activeFormTab = '.entry-edit.form-inline [data-bind="visible: active"]:not([style="display: none;"]) ' ;
32
32
33
33
/**
34
- * Field label on customer form.
34
+ * Field wrapper with label on form.
35
35
*
36
36
* @var string
37
37
*/
38
- protected $ fieldLabel = './/*[contains(@class, "form__field")]/*[contains(@class,"label")] ' ;
38
+ protected $ fieldLabel = './/*[contains(@class, "form__field")]/*[contains(@class,"label")] ' ;
39
39
40
40
/**
41
- * Field with absent label on customer form.
41
+ * Field wrapper with absent label on form.
42
42
*
43
43
* @var string
44
44
*/
45
- protected $ fieldLabelAbsent = './/*[contains(@class, "form__field") and not(./*[contains(@class,"label")]/*)] ' ;
45
+ protected $ fieldLabelAbsent = './/*[contains(@class, "form__field") and not(./*[contains(@class,"label")]/*)] ' ;
46
46
47
47
/**
48
- * Wrapper for field on customer form.
48
+ * Field wrapper with control block on form.
49
49
*
50
50
* @var string
51
51
*/
52
52
protected $ fieldWrapperControl = './/*[contains(@class, "form__field")]/*[contains(@class,"control")] ' ;
53
53
54
+ // @codingStandardsIgnoreStart
54
55
/**
55
- * Wrapper with absent field on customer form.
56
+ * Field wrapper with absent control block on form.
56
57
*
57
58
* @var string
58
59
*/
59
60
protected $ fieldWrapperControlAbsent = './/*[contains(@class, "form__field") and not(./input or ./*[contains(@class,"control")]/*)] ' ;
61
+ // @codingStandardsIgnoreEnd
60
62
61
63
/**
62
64
* Fill Customer forms on tabs by customer, addresses data.
@@ -67,8 +69,10 @@ class CustomerForm extends FormTabs
67
69
*/
68
70
public function fillCustomer (FixtureInterface $ customer , $ address = null )
69
71
{
70
- $ isHasData = ($ customer instanceof InjectableFixture) ? $ customer ->hasData () : true ;
71
72
$ this ->waitForm ();
73
+ $ this ->waitFields ();
74
+
75
+ $ isHasData = ($ customer instanceof InjectableFixture) ? $ customer ->hasData () : true ;
72
76
if ($ isHasData ) {
73
77
parent ::fill ($ customer );
74
78
}
@@ -89,8 +93,9 @@ public function fillCustomer(FixtureInterface $customer, $address = null)
89
93
*/
90
94
public function updateCustomer (FixtureInterface $ customer , $ address = null )
91
95
{
92
- $ isHasData = ($ customer instanceof InjectableFixture) ? $ customer ->hasData () : true ;
93
96
$ this ->waitForm ();
97
+
98
+ $ isHasData = ($ customer instanceof InjectableFixture) ? $ customer ->hasData () : true ;
94
99
if ($ isHasData ) {
95
100
parent ::fill ($ customer );
96
101
}
@@ -130,14 +135,25 @@ public function getDataCustomer(FixtureInterface $customer, $address = null)
130
135
*/
131
136
protected function waitForm ()
132
137
{
133
- $ this ->waitForElementNotVisible ($ this ->loader );
138
+ $ this ->waitForElementNotVisible ($ this ->spinner );
134
139
$ this ->waitForElementVisible ($ this ->activeFormTab );
140
+ }
135
141
142
+ /**
143
+ * Wait for User before fill form which calls JS validation on correspondent fields of form.
144
+ * See details in MAGETWO-31435.
145
+ *
146
+ * @return void
147
+ */
148
+ protected function waitFields ()
149
+ {
150
+ /* Wait for field label is visible in the form */
136
151
$ this ->waitForElementVisible ($ this ->fieldLabel , Locator::SELECTOR_XPATH );
152
+ /* Wait for render all field's labels(assert that absent field without label) in the form */
137
153
$ this ->waitForElementNotVisible ($ this ->fieldLabelAbsent , Locator::SELECTOR_XPATH );
154
+ /* Wait for field's control block is visible in the form */
138
155
$ this ->waitForElementVisible ($ this ->fieldWrapperControl , Locator::SELECTOR_XPATH );
156
+ /* Wait for render all field's control blocks(assert that absent field without control block) in the form */
139
157
$ this ->waitForElementNotVisible ($ this ->fieldWrapperControlAbsent , Locator::SELECTOR_XPATH );
140
-
141
- usleep (500000 );
142
158
}
143
159
}
0 commit comments