Skip to content

Commit 19e6f6a

Browse files
author
Dmytro Aponasenko
committed
Merge branch 'MTA-1594' of https://github.corp.ebay.com/magento-qmt/magento2ce into develop
2 parents a941bb6 + e431712 commit 19e6f6a

23 files changed

+755
-262
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Catalog\Test\TestCase\Product\ValidateOrderOfProductTypeTest">
10+
<variation name="ValidateOrderOfProductTypeTestVariation1">
11+
<data name="menu/4" xsi:type="string">Bundle Product</data>
12+
</variation>
13+
</testCase>
14+
</config>

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Attribute.php

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,32 @@
66

77
namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Action;
88

9+
use Magento\Mtf\Fixture\FixtureInterface;
910
use Magento\Backend\Test\Block\Widget\Form;
10-
use Magento\Mtf\Client\Locator;
11+
use Magento\Mtf\Client\Element\SimpleElement;
1112

1213
/**
1314
* Product attribute massaction edit page.
1415
*/
1516
class Attribute extends Form
1617
{
1718
/**
18-
* CSS selector for 'save' button.
19+
* Fill the root form.
1920
*
20-
* @var string
21+
* @param FixtureInterface $fixture
22+
* @param SimpleElement|null $element
23+
* @return $this
2124
*/
22-
protected $saveButton = '[data-ui-id="page-actions-toolbar-save-button"]';
23-
24-
/**
25-
* XPath selector for checkbox that enables price editing.
26-
*
27-
* @var string
28-
*/
29-
protected $priceFieldEnablerSelector = '//*[@id="attribute-price-container"]/div[1]/div/label//*[@type="checkbox"]';
30-
31-
/**
32-
* Enable price field editing.
33-
*
34-
* @return void
35-
*/
36-
public function enablePriceEdit()
25+
public function fill(FixtureInterface $fixture, SimpleElement $element = null)
3726
{
38-
$this->_rootElement->find(
39-
$this->priceFieldEnablerSelector,
40-
Locator::SELECTOR_XPATH,
41-
'checkbox'
42-
)->setValue('Yes');
27+
$data = $fixture->getData();
28+
foreach ($data as $name => $dataValue) {
29+
$fields['toggle_' . $name] = 'Yes';
30+
$fields[$name] = $dataValue;
31+
}
32+
$mapping = $this->dataMapping($fields);
33+
$this->_fill($mapping, $element);
34+
35+
return $this;
4336
}
4437
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Attribute.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<mapping strict="0">
99
<wrapper>attributes</wrapper>
1010
<fields>
11-
<price/>
11+
<toggle_price>
12+
<selector>[name='toggle_price']</selector>
13+
<input>checkbox</input>
14+
</toggle_price>
15+
<price />
1216
</fields>
1317
</mapping>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Action;
8+
9+
/**
10+
* Form action.
11+
*/
12+
class FormPageActions extends \Magento\Backend\Test\Block\FormPageActions
13+
{
14+
/**
15+
* "Save" button.
16+
*
17+
* @var string
18+
*/
19+
protected $saveButton = '[data-ui-id="page-actions-toolbar-save-button"]';
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Test\Constraint;
8+
9+
use Magento\Mtf\Constraint\AbstractConstraint;
10+
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11+
12+
/**
13+
* Check mass update success message.
14+
*/
15+
class AssertMassProductUpdateSuccessMessage extends AbstractConstraint
16+
{
17+
/**
18+
* Text value to be checked.
19+
*/
20+
const SUCCESS_MESSAGE = 'A total of %s record(s) were updated.';
21+
22+
/**
23+
* Assert that after mass update successful message appears.
24+
*
25+
* @param CatalogProductIndex $productGrid
26+
* @param array $products
27+
* @return void
28+
*/
29+
public function processAssert(CatalogProductIndex $productGrid, $products = [])
30+
{
31+
$countProducts = count($products) ? count($products) : 1;
32+
$expectedMessage = sprintf(self::SUCCESS_MESSAGE, $countProducts);
33+
$actualMessage = $productGrid->getMessagesBlock()->getSuccessMessages();
34+
\PHPUnit_Framework_Assert::assertEquals(
35+
$expectedMessage,
36+
$actualMessage,
37+
'Wrong success message is displayed.'
38+
);
39+
}
40+
41+
/**
42+
* Returns a string representation of the object.
43+
*
44+
* @return string
45+
*/
46+
public function toString()
47+
{
48+
return 'Mass update success message is present.';
49+
}
50+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Test\Constraint;
8+
9+
use Magento\Mtf\Constraint\AbstractConstraint;
10+
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11+
12+
/**
13+
* Assert that order and types of product on product page equals to incoming data.
14+
*/
15+
class AssertProductTypeOrderOnCreate extends AbstractConstraint
16+
{
17+
/**
18+
* Assert that order and types of product on product page equals to incoming data.
19+
*
20+
* @param CatalogProductIndex $catalogProductIndex
21+
* @param array $menu
22+
* @return void
23+
*/
24+
public function processAssert(CatalogProductIndex $catalogProductIndex, array $menu)
25+
{
26+
$catalogProductIndex->open();
27+
ksort($menu);
28+
\PHPUnit_Framework_Assert::assertEquals(
29+
implode("\n", $menu),
30+
$catalogProductIndex->getGridPageActionBlock()->getTypeList(),
31+
'Order and filling of types on product page not equals to incoming data.'
32+
);
33+
}
34+
35+
/**
36+
* Success message is displayed.
37+
*
38+
* @return string
39+
*/
40+
public function toString()
41+
{
42+
return 'Order and types of product on product page equals to incoming data.';
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd">
9+
<page name="CatalogProductActionAttributeEdit" area="Adminhtml" mca="catalog/product_action_attribute/edit" module="Magento_Catalog">
10+
<block name="attributesBlockForm" class="Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Action\Attribute" locator="body" strategy="css selector" />
11+
<block name="formPageActions" class="Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Action\FormPageActions" locator=".page-main-actions" strategy="css selector" />
12+
</page>
13+
</config>

dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductActionAttributeEdit.php

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
9+
<repository class="Magento\Config\Test\Repository\ConfigData">
10+
<dataset name="product_flat">
11+
<field name="catalog/frontend/flat_catalog_product" xsi:type="array">
12+
<item name="scope" xsi:type="string">default</item>
13+
<item name="scope_id" xsi:type="number">0</item>
14+
<item name="label" xsi:type="string">Yes</item>
15+
<item name="value" xsi:type="number">1</item>
16+
</field>
17+
</dataset>
18+
<dataset name="product_flat_rollback">
19+
<field name="catalog/frontend/flat_catalog_product" xsi:type="array">
20+
<item name="scope" xsi:type="string">default</item>
21+
<item name="scope_id" xsi:type="number">0</item>
22+
<item name="label" xsi:type="string">No</item>
23+
<item name="value" xsi:type="number">0</item>
24+
</field>
25+
</dataset>
26+
</repository>
27+
</config>

0 commit comments

Comments
 (0)