Skip to content

Commit de4cbbc

Browse files
author
Bohdan Korablov
committed
MAGETWO-51754: Fail automated test CreateProductAttributeEntityTest
1 parent 8cf5dc6 commit de4cbbc

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsRequired.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,25 @@ class AssertProductAttributeIsRequired extends AbstractConstraint
2929
* @param CatalogProductEdit $catalogProductEdit
3030
* @param CatalogProductAttribute $attribute
3131
* @param InjectableFixture $product
32+
* @param string $sectionName
3233
* @return void
3334
*/
3435
public function processAssert(
3536
CatalogProductIndex $catalogProductIndex,
3637
CatalogProductEdit $catalogProductEdit,
3738
CatalogProductAttribute $attribute,
38-
InjectableFixture $product
39+
InjectableFixture $product,
40+
$sectionName
3941
) {
4042
$catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
4143
$productForm = $catalogProductEdit->getProductForm();
4244
if (!$productForm->checkAttributeLabel($attribute)) {
43-
$productForm->openSection('attributes');
45+
$productForm->openSection($sectionName);
4446
}
4547
$productForm->getAttributeElement($attribute)->setValue('');
4648
$catalogProductEdit->getFormPageActions()->save();
47-
$failedFields = $productForm->getRequireNoticeFields($product);
48-
$actualMessage = $failedFields['attributes'][$attribute->getFrontendLabel()];
49+
$validationErrors = $productForm->getSection($sectionName)->getValidationErrors();
50+
$actualMessage = $validationErrors[$attribute->getFrontendLabel()];
4951

5052
\PHPUnit_Framework_Assert::assertEquals(
5153
self::REQUIRE_MESSAGE,

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<data name="attribute/data/is_required" xsi:type="string">Yes</data>
5656
<data name="attribute/data/attribute_code" xsi:type="string">attr_text_%isolation%</data>
5757
<data name="attribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data>
58+
<data name="sectionName" xsi:type="string">attributes</data>
5859
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired" />
5960
</variation>
6061
<variation name="CreateProductAttributeEntityFromProductPageTestVariation4">

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data>
3333
<data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data>
3434
<data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data>
35+
<data name="sectionName" xsi:type="string">product-details</data>
3536
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" />
3637
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" />
3738
<constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" />
@@ -130,6 +131,7 @@
130131
<data name="assertProduct/data/name" xsi:type="string">Product name</data>
131132
<data name="assertProduct/data/sku" xsi:type="string">product-sku</data>
132133
<data name="assertProduct/data/price" xsi:type="string">35</data>
134+
<data name="sectionName" xsi:type="string">product-details</data>
133135
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" />
134136
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" />
135137
<constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" />

dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ public function searchAndOpen(array $filter)
236236
} else {
237237
throw new \Exception('Searched item was not found.');
238238
}
239+
$this->waitForElementNotVisible($this->searchButton);
240+
$this->waitLoader();
239241
}
240242

241243
/**

0 commit comments

Comments
 (0)