Skip to content

Commit 2535a47

Browse files
author
Dmytro Aponasenko
committed
Merge branch 'MTA-1397' of https://github.corp.ebay.com/magento-qmt/magento2ce into develop
2 parents 8c2c263 + 467312f commit 2535a47

File tree

7 files changed

+110
-51
lines changed

7 files changed

+110
-51
lines changed

dev/tests/functional/lib/Magento/Mtf/Client/Element/ConditionsElement.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,12 @@ public function setValue($value)
192192
protected function addConditionsCombination($condition, ElementInterface $context)
193193
{
194194
$condition = $this->parseCondition($condition);
195+
196+
$this->driver->selectWindow();
195197
$newCondition = $context->find($this->newCondition, Locator::SELECTOR_XPATH);
196198
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
199+
200+
$this->driver->selectWindow();
197201
$typeNewCondition = $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select');
198202
$typeNewCondition->setValue($condition['type']);
199203

@@ -235,16 +239,23 @@ protected function addSingleCondition($condition, ElementInterface $context)
235239
{
236240
$condition = $this->parseCondition($condition);
237241

242+
$this->driver->selectWindow();
238243
$newCondition = $context->find($this->newCondition, Locator::SELECTOR_XPATH);
239244
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
245+
240246
$typeNew = $this->typeNew;
241247
$newCondition->waitUntil(
242248
function () use ($newCondition, $typeNew) {
243249
$element = $newCondition->find($typeNew, Locator::SELECTOR_XPATH, 'select');
244-
return $element->isVisible() ? true : null;
250+
if ($element->isVisible()) {
251+
return true;
252+
}
253+
$this->driver->selectWindow();
254+
return null;
245255
}
246256
);
247257
$newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select')->setValue($condition['type']);
258+
248259
$createdCondition = $context->find($this->created, Locator::SELECTOR_XPATH);
249260
$this->waitForCondition($createdCondition);
250261
$this->fillCondition($condition['rules'], $createdCondition);
@@ -264,6 +275,8 @@ protected function fillCondition(array $rules, ElementInterface $element)
264275
foreach ($rules as $rule) {
265276
/** @var ElementInterface $param */
266277
$param = $this->findNextParam($element);
278+
279+
$this->driver->selectWindow();
267280
$param->find('a')->click();
268281

269282
if (preg_match('`%(.*?)%`', $rule, $chooserGrid)) {
@@ -392,7 +405,11 @@ protected function waitForCondition(ElementInterface $element)
392405
{
393406
$this->waitUntil(
394407
function () use ($element) {
395-
return $element->getAttribute('class') == 'rule-param-wait' ? null : true;
408+
if ($element->getAttribute('class') == 'rule-param-wait') {
409+
$this->driver->selectWindow();
410+
return null;
411+
}
412+
return true;
396413
}
397414
);
398415
}

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ public function sortGridByField($field, $sort = "desc")
455455
*/
456456
protected function openFilterBlock()
457457
{
458+
$this->getTemplateBlock()->waitForElementNotVisible($this->loader);
459+
458460
$button = $this->_rootElement->find($this->filterButton);
459461
if ($button->isVisible() && !$this->_rootElement->find($this->filterButton . $this->active)->isVisible()) {
460462
$button->click();

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

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,72 @@
77
namespace Magento\Customer\Test\Block\Adminhtml\Edit;
88

99
use Magento\Backend\Test\Block\Widget\FormTabs;
10+
use Magento\Mtf\Client\Locator;
1011
use Magento\Mtf\Fixture\FixtureInterface;
1112
use Magento\Mtf\Fixture\InjectableFixture;
1213

1314
/**
14-
* Class CustomerForm
15-
* Form for creation of the customer
15+
* Form for creation of the customer.
1616
*/
1717
class CustomerForm extends FormTabs
1818
{
1919
/**
20-
* Load spinner
20+
* Magento form loader.
2121
*
2222
* @var string
2323
*/
2424
protected $spinner = '[data-role="spinner"]';
2525

2626
/**
27-
* Customer form to load
27+
* Customer form to load.
2828
*
2929
* @var string
3030
*/
3131
protected $activeFormTab = '.entry-edit.form-inline [data-bind="visible: active"]:not([style="display: none;"])';
3232

3333
/**
34-
* Fill Customer forms on tabs by customer, addresses data
34+
* Field wrapper with label on form.
35+
*
36+
* @var string
37+
*/
38+
protected $fieldLabel = './/*[contains(@class, "form__field")]/*[contains(@class,"label")]';
39+
40+
/**
41+
* Field wrapper with absent label on form.
42+
*
43+
* @var string
44+
*/
45+
protected $fieldLabelAbsent = './/*[contains(@class, "form__field") and not(./*[contains(@class,"label")]/*)]';
46+
47+
/**
48+
* Field wrapper with control block on form.
49+
*
50+
* @var string
51+
*/
52+
protected $fieldWrapperControl = './/*[contains(@class, "form__field")]/*[contains(@class,"control")]';
53+
54+
// @codingStandardsIgnoreStart
55+
/**
56+
* Field wrapper with absent control block on form.
57+
*
58+
* @var string
59+
*/
60+
protected $fieldWrapperControlAbsent = './/*[contains(@class, "form__field") and not(./input or ./*[contains(@class,"control")]/*)]';
61+
// @codingStandardsIgnoreEnd
62+
63+
/**
64+
* Fill Customer forms on tabs by customer, addresses data.
3565
*
3666
* @param FixtureInterface $customer
3767
* @param FixtureInterface|FixtureInterface[]|null $address
3868
* @return $this
3969
*/
4070
public function fillCustomer(FixtureInterface $customer, $address = null)
4171
{
42-
$isHasData = ($customer instanceof InjectableFixture) ? $customer->hasData() : true;
4372
$this->waitForm();
73+
$this->waitFields();
74+
75+
$isHasData = ($customer instanceof InjectableFixture) ? $customer->hasData() : true;
4476
if ($isHasData) {
4577
parent::fill($customer);
4678
}
@@ -53,16 +85,17 @@ public function fillCustomer(FixtureInterface $customer, $address = null)
5385
}
5486

5587
/**
56-
* Update Customer forms on tabs by customer, addresses data
88+
* Update Customer forms on tabs by customer, addresses data.
5789
*
5890
* @param FixtureInterface $customer
5991
* @param FixtureInterface|FixtureInterface[]|null $address
6092
* @return $this
6193
*/
6294
public function updateCustomer(FixtureInterface $customer, $address = null)
6395
{
64-
$isHasData = ($customer instanceof InjectableFixture) ? $customer->hasData() : true;
6596
$this->waitForm();
97+
98+
$isHasData = ($customer instanceof InjectableFixture) ? $customer->hasData() : true;
6699
if ($isHasData) {
67100
parent::fill($customer);
68101
}
@@ -84,8 +117,8 @@ public function updateCustomer(FixtureInterface $customer, $address = null)
84117
public function getDataCustomer(FixtureInterface $customer, $address = null)
85118
{
86119
$this->waitForm();
87-
$data = ['customer' => $customer->hasData() ? parent::getData($customer) : parent::getData()];
88120

121+
$data = ['customer' => $customer->hasData() ? parent::getData($customer) : parent::getData()];
89122
if (null !== $address) {
90123
$this->openTab('addresses');
91124
$data['addresses'] = $this->getTabElement('addresses')->getDataAddresses($address);
@@ -105,4 +138,22 @@ protected function waitForm()
105138
$this->waitForElementNotVisible($this->spinner);
106139
$this->waitForElementVisible($this->activeFormTab);
107140
}
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 */
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 */
153+
$this->waitForElementNotVisible($this->fieldLabelAbsent, Locator::SELECTOR_XPATH);
154+
/* Wait for field's control block is visible in the form */
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 */
157+
$this->waitForElementNotVisible($this->fieldWrapperControlAbsent, Locator::SELECTOR_XPATH);
158+
}
108159
}

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

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,46 @@
77
namespace Magento\Customer\Test\Block\Adminhtml\Edit\Tab;
88

99
use Magento\Backend\Test\Block\Widget\Tab;
10-
use Magento\Customer\Test\Fixture\AddressInjectable;
1110
use Magento\Mtf\Client\Element\SimpleElement;
1211
use Magento\Mtf\Client\Element;
1312
use Magento\Mtf\Client\Locator;
1413
use Magento\Mtf\Fixture\FixtureInterface;
1514

1615
/**
17-
* Class Addresses
18-
* Customer addresses edit block
16+
* Customer addresses edit block.
1917
*/
2018
class Addresses extends Tab
2119
{
2220
/**
23-
* "Add New Customer" button
21+
* "Add New Customer" button.
2422
*
2523
* @var string
2624
*/
2725
protected $addNewAddress = '.address-list-actions .add';
2826

2927
/**
30-
* Open customer address
28+
* Open customer address.
3129
*
3230
* @var string
3331
*/
3432
protected $customerAddress = '//*[contains(@class, "address-list-item")][%d]';
3533

3634
/**
37-
* Magento loader
35+
* Active address tab.
36+
*
37+
* @var string
38+
*/
39+
protected $addressTab = '.address-item-edit[data-bind="visible: element.active"]:not([style="display: none;"])';
40+
41+
/**
42+
* Magento loader.
3843
*
3944
* @var string
4045
*/
4146
protected $loader = '//ancestor::body/div[@data-role="loader"]';
4247

4348
/**
44-
* Fill customer addresses
49+
* Fill customer addresses.
4550
*
4651
* @param FixtureInterface|FixtureInterface[] $address
4752
* @return $this
@@ -51,23 +56,14 @@ public function fillAddresses($address)
5156
$addresses = is_array($address) ? $address : [$address];
5257
foreach ($addresses as $address) {
5358
$this->addNewAddress();
54-
55-
/* Fix switch between region_id and region */
56-
/** @var AddressInjectable $address */
57-
$countryId = $address->getCountryId();
58-
if ($countryId && $this->mapping['country_id']) {
59-
$this->_fill($this->dataMapping(['country_id' => $countryId]));
60-
$this->waitForElementNotVisible($this->loader, Locator::SELECTOR_XPATH);
61-
}
62-
6359
$this->fillFormTab($address->getData(), $this->_rootElement);
6460
}
6561

6662
return $this;
6763
}
6864

6965
/**
70-
* Update customer addresses
66+
* Update customer addresses.
7167
*
7268
* @param FixtureInterface|FixtureInterface[] $address
7369
* @return $this
@@ -90,13 +86,6 @@ public function updateAddresses($address)
9086
}
9187
$this->openCustomerAddress($addressNumber);
9288

93-
/* Fix switch between region_id and region */
94-
/** @var AddressInjectable $address */
95-
$countryId = $address->getCountryId();
96-
if ($countryId && $this->mapping['country_id']) {
97-
$this->_fill($this->dataMapping(['country_id' => $countryId]));
98-
$this->waitForElementNotVisible($this->loader, Locator::SELECTOR_XPATH);
99-
}
10089
$defaultAddress = ['default_billing' => 'No', 'default_shipping' => 'No'];
10190
$addressData = $address->getData();
10291
foreach ($defaultAddress as $key => $value) {
@@ -113,7 +102,7 @@ public function updateAddresses($address)
113102
}
114103

115104
/**
116-
* Get data of Customer addresses
105+
* Get data of Customer addresses.
117106
*
118107
* @param FixtureInterface|FixtureInterface[]|null $address
119108
* @return array
@@ -144,7 +133,7 @@ public function getDataAddresses($address = null)
144133
}
145134

146135
/**
147-
* Get data to fields on tab
136+
* Get data to fields on tab.
148137
*
149138
* @param array|null $fields
150139
* @param SimpleElement|null $element
@@ -159,15 +148,16 @@ public function getDataFormTab($fields = null, SimpleElement $element = null)
159148
}
160149

161150
/**
162-
* Click "Add New Address" button
151+
* Click "Add New Address" button.
163152
*/
164153
protected function addNewAddress()
165154
{
166155
$this->_rootElement->find($this->addNewAddress)->click();
156+
$this->waitForElementVisible($this->addressTab);
167157
}
168158

169159
/**
170-
* Open customer address
160+
* Open customer address.
171161
*
172162
* @param int $addressNumber
173163
* @throws \Exception
@@ -186,7 +176,7 @@ protected function openCustomerAddress($addressNumber)
186176
}
187177

188178
/**
189-
* Check is visible customer address
179+
* Check is visible customer address.
190180
*
191181
* @param int $addressNumber
192182
* @return bool

dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/BackendCustomerCreateTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class BackendCustomerCreateTest extends Functional
1313
{
1414
/* tags */
1515
const TEST_TYPE = 'acceptance_test';
16-
const STABLE = 'no';
1716
/* end tags */
1817

1918
/**
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
"customer/data/website_id";"customer/data/group_id/dataSet";"customer/data/prefix";"customer/data/firstname";"customer/data/middlename";"customer/data/lastname";"customer/data/suffix";"customer/data/email";"customer/data/dob";"customer/data/taxvat";"customer/data/gender";"address/data/firstname";"address/data/lastname";"address/data/street";"address/data/city";"address/data/country_id";"address/data/region_id";"address/data/postcode";"address/data/telephone";"constraint"
2-
"Main Website";"General";"-";"John%isolation%";"-";"Doe%isolation%";"-";"JohnDoe%isolation%@example.com";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertCustomerSuccessSaveMessage, assertCustomerInGrid, assertCustomerForm"
3-
"Admin";"Wholesale";"M";"John%isolation%";"Jack";"Doe%isolation%";"S";"JohnDoe%isolation%@example.com";"03/16/2004";"-";"Male";"-";"-";"-";"-";"-";"-";"-";"-";"assertCustomerSuccessSaveMessage, assertCustomerInGrid, assertCustomerForm"
4-
"Main Website";"General";"-";"John%isolation%";"-";"Doe%isolation%";"-";"JohnDoe%isolation%@example.com";"-";"-";"-";"Joe";"Doe";"1 Main Street";"Culver City";"United States";"California";"90230";"3109450345";"assertCustomerSuccessSaveMessage, assertCustomerInGrid, assertCustomerForm"
5-
"Main Website";"Retailer";"-";"John%isolation%";"-";"Doe%isolation%";"-";"JohnDoe%isolation%@example.ccc";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertCustomerInvalidEmail"
6-
"Main Website";"General";"-";"Thomas%isolation%";"-";"Oster%isolation%";"-";"Thomas%isolation%@example.com";"-";"5250008057";"-";"Thomas";"Oster";"Chmielna 113";"Bielsko-Biala";"Poland";"-";"43-310 ";"799885616";"assertCustomerSuccessSaveMessage, assertCustomerInGrid, assertCustomerForm"
1+
"customer/data/website_id";"customer/data/group_id/dataSet";"customer/data/prefix";"customer/data/firstname";"customer/data/middlename";"customer/data/lastname";"customer/data/suffix";"customer/data/email";"customer/data/dob";"customer/data/taxvat";"customer/data/gender";"address/data/firstname";"address/data/lastname";"address/data/street";"address/data/city";"address/data/country_id";"address/data/region_id";"address/data/postcode";"address/data/telephone";"constraint";"issue"
2+
"Main Website";"General";"-";"John%isolation%";"-";"Doe%isolation%";"-";"JohnDoe%isolation%@example.com";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertCustomerSuccessSaveMessage, assertCustomerInGrid, assertCustomerForm";""
3+
"Admin";"Wholesale";"M";"John%isolation%";"Jack";"Doe%isolation%";"S";"JohnDoe%isolation%@example.com";"03/16/2004";"-";"Male";"-";"-";"-";"-";"-";"-";"-";"-";"assertCustomerSuccessSaveMessage, assertCustomerInGrid, assertCustomerForm";"Bug: MAGETWO-31689"
4+
"Main Website";"General";"-";"John%isolation%";"-";"Doe%isolation%";"-";"JohnDoe%isolation%@example.com";"-";"-";"-";"Joe";"Doe";"1 Main Street";"Culver City";"United States";"California";"90230";"3109450345";"assertCustomerSuccessSaveMessage, assertCustomerInGrid, assertCustomerForm";""
5+
"Main Website";"Retailer";"-";"John%isolation%";"-";"Doe%isolation%";"-";"JohnDoe%isolation%@example.ccc";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertCustomerInvalidEmail";""
6+
"Main Website";"General";"-";"Thomas%isolation%";"-";"Oster%isolation%";"-";"Thomas%isolation%@example.com";"-";"5250008057";"-";"Thomas";"Oster";"Chmielna 113";"Bielsko-Biala";"Poland";"-";"43-310 ";"799885616";"assertCustomerSuccessSaveMessage, assertCustomerInGrid, assertCustomerForm";""
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"initialCustomer/dataSet";"customer/data/group_id/dataSet";"customer/data/prefix";"customer/data/firstname";"customer/data/middlename";"customer/data/lastname";"customer/data/suffix";"customer/data/email";"customer/data/dob";"customer/data/taxvat";"customer/data/gender";"address/data/prefix";"address/data/firstname";"address/data/middlename";"address/data/lastname";"address/data/suffix";"address/data/company";"address/data/street";"address/data/city";"address/data/country_id";"address/data/region_id";"address/data/region";"address/data/postcode";"address/data/telephone";"address/data/fax";"address/data/vat_id";"constraint"
2-
"default";"Wholesale";"%isolation%Prefix_";"John_%isolation%";"Middle Name %isolation%";"Doe%isolation%";"_Suffix%isolation%";"JohnDoe%isolation%@example.com";01/08/1986;123456789001;"Male";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertCustomerSuccessSaveMessage, assertCustomerForm, assertCustomerInGrid"
3-
"default";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"Prefix%isolation%_";"Doe%isolation%";"Middle Name %isolation%";"Doe%isolation%";"_Suffix%isolation%";"Company%isolation%";"3962 Horner Street";"Dothan";"United States";"Alabama";"-";36303;"334-200-4060";"555-666-777-8910";"U1234567890";"assertCustomerSuccessSaveMessage, assertCustomerForm, assertCustomerInGrid"
4-
"default";"Retailer";"%isolation%Prefix_";"Jane_%isolation%";"Jane Middle Name %isolation%";"Doe%isolation%";"_JaneSuffix%isolation%";"Jane%isolation%@example.com";01/12/2000;987654321;"Female";"Prefix%isolation%_";"Doe%isolation%";"Middle Name %isolation%";"Doe%isolation%";"_Suffix%isolation%";"Company%isolation%";"39 Northgate Street";"BICKTON";"United Kingdom";"-";"PINMINNOCH";"KA26 1PF ";"999-777-111-2345";"-";987654321;"assertCustomerSuccessSaveMessage, assertCustomerForm, assertCustomerInGrid"
1+
"initialCustomer/dataSet";"customer/data/group_id/dataSet";"customer/data/prefix";"customer/data/firstname";"customer/data/middlename";"customer/data/lastname";"customer/data/suffix";"customer/data/email";"customer/data/dob";"customer/data/taxvat";"customer/data/gender";"address/data/prefix";"address/data/firstname";"address/data/middlename";"address/data/lastname";"address/data/suffix";"address/data/company";"address/data/street";"address/data/city";"address/data/country_id";"address/data/region_id";"address/data/region";"address/data/postcode";"address/data/telephone";"address/data/fax";"address/data/vat_id";"constraint";"issue"
2+
"default";"Wholesale";"%isolation%Prefix_";"John_%isolation%";"Middle Name %isolation%";"Doe%isolation%";"_Suffix%isolation%";"JohnDoe%isolation%@example.com";01/08/1986;123456789001;"Male";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertCustomerSuccessSaveMessage, assertCustomerForm, assertCustomerInGrid";"Bug: MAGETWO-31689"
3+
"default";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"Prefix%isolation%_";"Doe%isolation%";"Middle Name %isolation%";"Doe%isolation%";"_Suffix%isolation%";"Company%isolation%";"3962 Horner Street";"Dothan";"United States";"Alabama";"-";36303;"334-200-4060";"555-666-777-8910";"U1234567890";"assertCustomerSuccessSaveMessage, assertCustomerForm, assertCustomerInGrid";""
4+
"default";"Retailer";"%isolation%Prefix_";"Jane_%isolation%";"Jane Middle Name %isolation%";"Doe%isolation%";"_JaneSuffix%isolation%";"Jane%isolation%@example.com";01/12/2000;987654321;"Female";"Prefix%isolation%_";"Doe%isolation%";"Middle Name %isolation%";"Doe%isolation%";"_Suffix%isolation%";"Company%isolation%";"39 Northgate Street";"BICKTON";"United Kingdom";"-";"PINMINNOCH";"KA26 1PF ";"999-777-111-2345";"-";987654321;"assertCustomerSuccessSaveMessage, assertCustomerForm, assertCustomerInGrid";"Bug: MAGETWO-31689"

0 commit comments

Comments
 (0)