Skip to content

Commit bc90a57

Browse files
committed
MTA-1594: Re-factor Functional tests which are not end-to-end
- CR Changes
1 parent 28dc588 commit bc90a57

File tree

4 files changed

+36
-26
lines changed

4 files changed

+36
-26
lines changed
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\Attribute;
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+
}

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

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

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

9-
use Magento\Mtf\Client\Locator;
109
use Magento\Mtf\Fixture\FixtureInterface;
1110
use Magento\Backend\Test\Block\Widget\Form;
1211
use Magento\Mtf\Client\Element\SimpleElement;
@@ -24,28 +23,7 @@ class Attribute extends Form
2423
protected $saveButton = '[data-ui-id="page-actions-toolbar-save-button"]';
2524

2625
/**
27-
* XPath selector for checkbox that enables price editing.
28-
*
29-
* @var string
30-
*/
31-
protected $priceFieldEnablerSelector = '//*[@id="attribute-price-container"]/div[1]/div/label//*[@type="checkbox"]';
32-
33-
/**
34-
* Enable price field editing.
35-
*
36-
* @return void
37-
*/
38-
public function enablePriceEdit()
39-
{
40-
$this->_rootElement->find(
41-
$this->priceFieldEnablerSelector,
42-
Locator::SELECTOR_XPATH,
43-
'checkbox'
44-
)->setValue('Yes');
45-
}
46-
47-
/**
48-
* Fill the root form
26+
* Fill the root form.
4927
*
5028
* @param FixtureInterface $fixture
5129
* @param SimpleElement|null $element
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="Product" 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\Attribute\FormPageActions" locator=".page-main-actions" strategy="css selector" />
12+
</page>
13+
</config>

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,8 @@ public function test(CatalogProductSimple $initialProduct, CatalogProductSimple
9797
// Steps
9898
$this->productGrid->open();
9999
$this->productGrid->getProductGrid()->updateAttributes([['sku' => $initialProduct->getSku()]]);
100-
$formBlock = $this->attributeMassActionPage->getAttributesBlockForm();
101-
$formBlock->fill($product);
102-
$formBlock->save();
100+
$this->attributeMassActionPage->getAttributesBlockForm()->fill($product);
101+
$this->attributeMassActionPage->getFormPageActions()->save();
103102
$this->productGrid->getMessagesBlock()->waitSuccessMessage();
104103
$data = array_merge($initialProduct->getData(), $product->getData());
105104
$product = $this->objectManager->create(

0 commit comments

Comments
 (0)