Skip to content

Commit 31f4b7a

Browse files
author
Dmytro Aponasenko
committed
MTA-1499: Analyse functional test failures
1 parent 53717c8 commit 31f4b7a

File tree

8 files changed

+45
-17
lines changed

8 files changed

+45
-17
lines changed

dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/FrontendDecorator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\Mtf\Util\Protocol\CurlTransport;
88

9-
use Magento\Customer\Test\Fixture\CustomerInjectable;
9+
use Magento\Customer\Test\Fixture\Customer;
1010
use Magento\Mtf\Util\Protocol\CurlInterface;
1111
use Magento\Mtf\Util\Protocol\CurlTransport;
1212

@@ -48,9 +48,9 @@ class FrontendDecorator implements CurlInterface
4848
* Constructor
4949
*
5050
* @param CurlTransport $transport
51-
* @param CustomerInjectable $customer
51+
* @param Customer $customer
5252
*/
53-
public function __construct(CurlTransport $transport, CustomerInjectable $customer)
53+
public function __construct(CurlTransport $transport, Customer $customer)
5454
{
5555
$this->transport = $transport;
5656
$this->authorize($customer);
@@ -59,11 +59,11 @@ public function __construct(CurlTransport $transport, CustomerInjectable $custom
5959
/**
6060
* Authorize customer on frontend
6161
*
62-
* @param CustomerInjectable $customer
62+
* @param Customer $customer
6363
* @throws \Exception
6464
* @return void
6565
*/
66-
protected function authorize(CustomerInjectable $customer)
66+
protected function authorize(Customer $customer)
6767
{
6868
$url = $_ENV['app_frontend_url'] . 'customer/account/login/';
6969
$this->transport->write(CurlInterface::POST, $url);

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/GridPageAction.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class GridPageAction extends ParentGridPageActions
2929
*/
3030
protected $productItem = '[data-ui-id=products-list-add-new-product-button-item-%productType%]';
3131

32+
/**
33+
* Product type list
34+
*
35+
* @var string
36+
*/
37+
protected $typeList = '[data-ui-id=products-list-add-new-product-button-dropdown-menu]';
38+
3239
/**
3340
* Add product using split button
3441
*
@@ -43,4 +50,18 @@ public function addProduct($productType = 'simple')
4350
Locator::SELECTOR_CSS
4451
)->click();
4552
}
53+
54+
/**
55+
* Get product list
56+
*
57+
* @return array
58+
*/
59+
public function getTypeList()
60+
{
61+
$this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS)->click();
62+
return $this->_rootElement->find(
63+
$this->typeList,
64+
Locator::SELECTOR_CSS
65+
)->getText();
66+
}
4667
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function getOptions(FixtureInterface $product)
138138

139139
/** @var SimpleElement $optionElement */
140140
$optionElement = $listCustomOptions[$title];
141-
$typeMethod = preg_replace('/[^a-zA-Z]/', '', $this->getOptionType($option['type']));
141+
$typeMethod = preg_replace('/[^a-zA-Z]/i', '', $this->getOptionType($option['type']));
142142
$getTypeData = 'get' . ucfirst(strtolower($typeMethod)) . 'Data';
143143

144144
$optionData = $this->$getTypeData($optionElement);
@@ -495,7 +495,7 @@ protected function fillOptions(array $options)
495495
*/
496496
protected function getOptionType($option)
497497
{
498-
$option = substr($option, strpos($option, "/") + 1);
498+
$option = strpos($option, "/") !== false ? substr($option, strpos($option, "/") + 1) : $option;
499499
return strtolower(preg_replace('/[^a-z]/i', '', $option));
500500
}
501501
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@ class AssertAddToCartButtonAbsent extends AbstractConstraint
2626
* Assert that "Add to cart" button is not display on page.
2727
*
2828
* @param InjectableFixture $product
29-
* @param Category $category
3029
* @param CmsIndex $cmsIndex
3130
* @param CatalogCategoryView $catalogCategoryView
3231
* @param CatalogProductView $catalogProductView
32+
* @param Category $category [optional]
3333
*
3434
* @return void
3535
*/
3636
public function processAssert(
3737
InjectableFixture $product,
38-
Category $category,
3938
CmsIndex $cmsIndex,
4039
CatalogCategoryView $catalogCategoryView,
41-
CatalogProductView $catalogProductView
40+
CatalogProductView $catalogProductView,
41+
Category $category = null
4242
) {
4343
$cmsIndex->open();
44-
$cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
44+
$categoryName = $category === null ? $product->getCategoryIds()[0] : $category->getName();
45+
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
4546

4647
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
4748
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@ class AssertAddToCartButtonPresent extends AbstractConstraint
2626
* Assert that "Add to cart" button is present on page.
2727
*
2828
* @param InjectableFixture $product
29-
* @param Category $category
3029
* @param CmsIndex $cmsIndex
3130
* @param CatalogCategoryView $catalogCategoryView
3231
* @param CatalogProductView $catalogProductView
32+
* @param Category $category [optional]
3333
*
3434
* @return void
3535
*/
3636
public function processAssert(
3737
InjectableFixture $product,
38-
Category $category,
3938
CmsIndex $cmsIndex,
4039
CatalogCategoryView $catalogCategoryView,
41-
CatalogProductView $catalogProductView
40+
CatalogProductView $catalogProductView,
41+
Category $category = null
4242
) {
4343
$cmsIndex->open();
44-
$cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
44+
$categoryName = $category === null ? $product->getCategoryIds()[0] : $category->getName();
45+
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
4546

4647
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
4748
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {

dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/SimpleProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected function getSimpleCustomOption()
140140
[
141141
'title' => 'custom option drop down',
142142
'is_require' => true,
143-
'type' => 'Drop-down',
143+
'type' => 'Select/Drop-down',
144144
'options' => [
145145
[
146146
'title' => 'Title Drop - down 1',

dev/tests/functional/tests/app/Magento/Reports/Test/Repository/ConfigData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<repository xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
99
<storage class="Magento\Core\Test\Repository\ConfigData">
1010
<dataset name="compare_products">
11-
<field path="catalog/recently_products/scope" scope="catalog" scope_id="1" label="Website" xsi:type="string">website</field>
11+
<field path="catalog/recently_products/scope" scope="catalog" scope_id="1" label="Website" xsi:type="string">Website</field>
1212
<field path="catalog/recently_products/viewed_count" scope="catalog" scope_id="1" label="" xsi:type="string">5</field>
1313
<field path="catalog/recently_products/compared_count" scope="catalog" scope_id="1" label="" xsi:type="string">12</field>
1414
</dataset>

dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@
1212
<namespace value="Magento" />
1313
</allow>
1414
</rule>
15+
<rule scope="testcase">
16+
<deny>
17+
<tag group="test_type" value="3rd_party_test" />
18+
</deny>
19+
</rule>
1520
</config>

0 commit comments

Comments
 (0)