Skip to content

Commit 4e5e087

Browse files
author
Oleksii Korshenko
committed
Merge remote-tracking branch 'qm/MTA-2726' into bugs
2 parents c881a53 + 0c72d89 commit 4e5e087

File tree

34 files changed

+311
-169
lines changed

34 files changed

+311
-169
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Client\Element;
8+
9+
use Magento\Mtf\Client\Locator;
10+
11+
/**
12+
* Typified element class for select with checkboxes.
13+
*/
14+
class DropdownmultiselectElement extends MultiselectElement
15+
{
16+
/**
17+
* Selector for expanding dropdown.
18+
*
19+
* @var string
20+
*/
21+
protected $toggle = 'div';
22+
23+
/**
24+
* Selected option selector.
25+
*
26+
* @var string
27+
*/
28+
protected $selectedValue = 'li._selected';
29+
30+
/**
31+
* Option locator by value.
32+
*
33+
* @var string
34+
*/
35+
protected $optionByValue = './/li[label[contains(normalize-space(.), %s)]]';
36+
37+
/**
38+
* Set values.
39+
*
40+
* @param array|string $values
41+
* @return void
42+
*/
43+
public function setValue($values)
44+
{
45+
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
46+
$this->find($this->toggle)->click();
47+
$this->deselectAll();
48+
$values = is_array($values) ? $values : [$values];
49+
foreach ($values as $value) {
50+
$this->find(
51+
sprintf($this->optionByValue, $this->escapeQuotes($value)),
52+
Locator::SELECTOR_XPATH
53+
)->click();
54+
}
55+
$this->find($this->toggle)->click();
56+
}
57+
58+
/**
59+
* Get values.
60+
*
61+
* @return array
62+
*/
63+
public function getValue()
64+
{
65+
$this->eventManager->dispatchEvent(['get_value'], [__METHOD__, $this->getAbsoluteSelector()]);
66+
$values = [];
67+
$this->find($this->toggle)->click();
68+
$options = $this->getElements($this->selectedValue);
69+
foreach ($options as $option) {
70+
$values[] = $option->getText();
71+
}
72+
$this->find($this->toggle)->click();
73+
74+
return $values;
75+
}
76+
77+
/**
78+
* Deselect all options in the element.
79+
*
80+
* @return void
81+
*/
82+
public function deselectAll()
83+
{
84+
$options = $this->getElements($this->selectedValue);
85+
/** @var SimpleElement $option */
86+
foreach ($options as $option) {
87+
$option->click();
88+
}
89+
}
90+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SimplifiedselectElement extends SelectElement
1818
*
1919
* @var string
2020
*/
21-
protected $optionGroupValue = ".//*[@data-title='%s']";
21+
protected $optionGroupValue = ".//*[@data-title='%s' or contains(normalize-space(.), %s)]";
2222

2323
/**
2424
* Select value in ropdown which has option groups.
@@ -29,7 +29,7 @@ class SimplifiedselectElement extends SelectElement
2929
public function setValue($value)
3030
{
3131
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
32-
$xpath = sprintf($this->optionGroupValue, $value);
32+
$xpath = sprintf($this->optionGroupValue, $value, $this->escapeQuotes($value));
3333
$option = $this->find($xpath, Locator::SELECTOR_XPATH);
3434
$option->click();
3535
}

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ public function navigate($menuItem)
9292
$this->waitForElementVisible($subMenuSelector, Locator::SELECTOR_XPATH);
9393
$subMenuItem = $subMenuSelector . sprintf($this->subMenuItem, $subMenu);
9494
$this->waitForElementVisible($subMenuItem, Locator::SELECTOR_XPATH);
95+
// Resolve an issue on with "Offset within element cannot be scrolled into view" on low screen resolution
96+
try {
97+
$this->_rootElement->find($subMenuItem, Locator::SELECTOR_XPATH)->hover();
98+
} catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
99+
}
95100
$this->_rootElement->find($subMenuItem, Locator::SELECTOR_XPATH)->click();
96101
$this->waitForElementNotVisible($subMenuSelector, Locator::SELECTOR_XPATH);
97102
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Search extends SuggestElement
2020
*
2121
* @var string
2222
*/
23-
protected $topPage = './ancestor::body//header[contains(@class, "page-header")]/div[1]';
23+
protected $topPage = './ancestor::body//header';
2424

2525
/**
2626
* Attributes locator.
@@ -80,7 +80,7 @@ public function getValue()
8080
*/
8181
public function isExistAttributeInSearchResult($productAttribute)
8282
{
83-
$this->find($this->topPage, Locator::SELECTOR_XPATH)->click();
83+
$this->find($this->topPage, Locator::SELECTOR_XPATH)->hover();
8484
$this->find($this->actionToggle)->click();
8585

8686
return $this->isExistValueInSearchResult($productAttribute->getFrontendLabel());

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<input>select</input>
2929
</tax_class_id>
3030
<product_has_weight>
31-
<selector>[name="product[product_has_weight]"]</selector>
32-
<input>checkbox</input>
31+
<selector>[data-role="weight-switcher"]</selector>
32+
<input>radiobutton</input>
3333
</product_has_weight>
3434
<category_ids>
3535
<selector>#attribute-category_ids-container</selector>

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareBlockOnCmsPage" />
2929
</variation>
3030
<variation name="AddCompareProductsTestVariation4">
31-
<data name="products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::default,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product</data>
31+
<data name="products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::configurable_with_qty_1,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product</data>
3232
<data name="isCustomerLoggedIn" xsi:type="string">Yes</data>
3333
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareItemsLink" />
3434
<constraint name="Magento\Catalog\Test\Constraint\AssertProductComparePage" />

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ public function __inject(
8181
public function test($createProduct, $product)
8282
{
8383
// Steps
84-
$this->catalogProductIndex->open();
85-
$this->catalogProductIndex->getGridPageActionBlock()->addProduct($createProduct);
8684
list($fixture, $dataset) = explode('::', $product);
8785
$product = $this->fixtureFactory->createByCode($fixture, ['dataset' => $dataset]);
86+
$this->catalogProductIndex->open();
87+
$this->catalogProductIndex->getGridPageActionBlock()->addProduct($createProduct);
8888
$this->catalogProductNew->getProductForm()->fill($product);
8989
$this->catalogProductNew->getFormPageActions()->save($product);
9090

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
<data name="attribute/data/is_filterable_in_search" xsi:type="string">Yes</data>
4444
<data name="assertProduct/data/name" xsi:type="string">Product name</data>
4545
<data name="assertProduct/data/sku" xsi:type="string">product-sku</data>
46-
<data name="assertProduct/data/price" xsi:type="string">25</data>
4746
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable" />
4847
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch" />
4948
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertProductAttributeIsConfigurable" />

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
<data name="productAttribute/data/used_for_sort_by" xsi:type="string">Yes</data>
129129
<data name="assertProduct/data/name" xsi:type="string">Product name</data>
130130
<data name="assertProduct/data/sku" xsi:type="string">product-sku</data>
131-
<data name="assertProduct/data/price" xsi:type="string">25</data>
132131
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" />
133132
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" />
134133
<constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" />

dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/CmsGrid.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ class CmsGrid extends DataGrid
4444
'input' => 'simplifiedselect'
4545
],
4646
'is_active' => [
47-
'selector' => '[name="is_active"]',
48-
'input' => 'select',
47+
'selector' => '//label[span[text()="Status"]]/following-sibling::div',
48+
'strategy' => 'xpath',
49+
'input' => 'dropdownmultiselect',
4950
],
5051
'creation_time_from' => [
5152
'selector' => '[name="creation_time[from]"]',

0 commit comments

Comments
 (0)