Skip to content

Commit 467312f

Browse files
author
Oleksandr Manchenko
committed
MTA-1397: Update setValue() method for basic typified elements
- Fixed logical and code style errors
1 parent d61ecb5 commit 467312f

File tree

1 file changed

+28
-12
lines changed
  • dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit

1 file changed

+28
-12
lines changed

dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/CustomerForm.php

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CustomerForm extends FormTabs
2121
*
2222
* @var string
2323
*/
24-
protected $loader = '[data-role="spinner"]';
24+
protected $spinner = '[data-role="spinner"]';
2525

2626
/**
2727
* Customer form to load.
@@ -31,32 +31,34 @@ class CustomerForm extends FormTabs
3131
protected $activeFormTab = '.entry-edit.form-inline [data-bind="visible: active"]:not([style="display: none;"])';
3232

3333
/**
34-
* Field label on customer form.
34+
* Field wrapper with label on form.
3535
*
3636
* @var string
3737
*/
38-
protected $fieldLabel = './/*[contains(@class, "form__field")]/*[contains(@class,"label")]';
38+
protected $fieldLabel = './/*[contains(@class, "form__field")]/*[contains(@class,"label")]';
3939

4040
/**
41-
* Field with absent label on customer form.
41+
* Field wrapper with absent label on form.
4242
*
4343
* @var string
4444
*/
45-
protected $fieldLabelAbsent = './/*[contains(@class, "form__field") and not(./*[contains(@class,"label")]/*)]';
45+
protected $fieldLabelAbsent = './/*[contains(@class, "form__field") and not(./*[contains(@class,"label")]/*)]';
4646

4747
/**
48-
* Wrapper for field on customer form.
48+
* Field wrapper with control block on form.
4949
*
5050
* @var string
5151
*/
5252
protected $fieldWrapperControl = './/*[contains(@class, "form__field")]/*[contains(@class,"control")]';
5353

54+
// @codingStandardsIgnoreStart
5455
/**
55-
* Wrapper with absent field on customer form.
56+
* Field wrapper with absent control block on form.
5657
*
5758
* @var string
5859
*/
5960
protected $fieldWrapperControlAbsent = './/*[contains(@class, "form__field") and not(./input or ./*[contains(@class,"control")]/*)]';
61+
// @codingStandardsIgnoreEnd
6062

6163
/**
6264
* Fill Customer forms on tabs by customer, addresses data.
@@ -67,8 +69,10 @@ class CustomerForm extends FormTabs
6769
*/
6870
public function fillCustomer(FixtureInterface $customer, $address = null)
6971
{
70-
$isHasData = ($customer instanceof InjectableFixture) ? $customer->hasData() : true;
7172
$this->waitForm();
73+
$this->waitFields();
74+
75+
$isHasData = ($customer instanceof InjectableFixture) ? $customer->hasData() : true;
7276
if ($isHasData) {
7377
parent::fill($customer);
7478
}
@@ -89,8 +93,9 @@ public function fillCustomer(FixtureInterface $customer, $address = null)
8993
*/
9094
public function updateCustomer(FixtureInterface $customer, $address = null)
9195
{
92-
$isHasData = ($customer instanceof InjectableFixture) ? $customer->hasData() : true;
9396
$this->waitForm();
97+
98+
$isHasData = ($customer instanceof InjectableFixture) ? $customer->hasData() : true;
9499
if ($isHasData) {
95100
parent::fill($customer);
96101
}
@@ -130,14 +135,25 @@ public function getDataCustomer(FixtureInterface $customer, $address = null)
130135
*/
131136
protected function waitForm()
132137
{
133-
$this->waitForElementNotVisible($this->loader);
138+
$this->waitForElementNotVisible($this->spinner);
134139
$this->waitForElementVisible($this->activeFormTab);
140+
}
135141

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 */
136151
$this->waitForElementVisible($this->fieldLabel, Locator::SELECTOR_XPATH);
152+
/* Wait for render all field's labels(assert that absent field without label) in the form */
137153
$this->waitForElementNotVisible($this->fieldLabelAbsent, Locator::SELECTOR_XPATH);
154+
/* Wait for field's control block is visible in the form */
138155
$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 */
139157
$this->waitForElementNotVisible($this->fieldWrapperControlAbsent, Locator::SELECTOR_XPATH);
140-
141-
usleep(500000);
142158
}
143159
}

0 commit comments

Comments
 (0)