Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into PR-4
Browse files Browse the repository at this point in the history
  • Loading branch information
Natalia Momotenko committed Oct 21, 2015
2 parents acb3f2c + 098d3ff commit ec58e4d
Show file tree
Hide file tree
Showing 122 changed files with 2,136 additions and 575 deletions.
2 changes: 1 addition & 1 deletion dev/tests/functional/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"magento/mtf": "1.0.0-rc35",
"magento/mtf": "1.0.0-rc36",
"php": "~5.5.0|~5.6.0|~7.0.0",
"phpunit/phpunit": "4.1.0",
"phpunit/phpunit-selenium": ">=1.2"
Expand Down
34 changes: 33 additions & 1 deletion dev/tests/functional/etc/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,39 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="events.xsd">
<preset name="base">
<observer class="Magento\Mtf\System\Observer\WebapiResponse">
<tag name="webapi_failed"/>
<tag name="webapi_failed" />
</observer>
</preset>
<preset name="coverage" extends="base">
<observer class="Magento\Mtf\System\Observer\PageUrl">
<tag name="click_after"/>
<tag name="accept_alert_after"/>
<tag name="dismiss_alert_after"/>
<tag name="open_after"/>
<tag name="forward"/>
<tag name="back"/>
</observer>
<observer class="Magento\Mtf\System\Observer\AppState">
<tag name="app_state_applied"/>
</observer>
<observer class="Magento\Mtf\System\Observer\Log">
<tag name="exception"/>
<tag name="failure"/>
<tag name="execution" />
</observer>
<observer class="Magento\Mtf\System\Observer\SourceCode">
<tag name="exception"/>
<tag name="failure"/>
</observer>
<observer class="Magento\Mtf\System\Observer\Screenshot">
<tag name="exception"/>
<tag name="failure"/>
</observer>
<observer class="Magento\Mtf\System\Observer\CurlResponse">
<tag name="curl_failed"/>
</observer>
<observer class="Magento\Mtf\System\Observer\WebapiResponse">
<tag name="webapi_failed" />
</observer>
</preset>
</config>
2 changes: 1 addition & 1 deletion dev/tests/functional/lib/Magento/Mtf/Handler/Webapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Abstract class for webapi handlers.
*/
abstract class Webapi implements HandlerInterface
abstract class Webapi extends Curl implements HandlerInterface
{
/**
* Configuration parameters array.
Expand Down
8 changes: 4 additions & 4 deletions dev/tests/functional/lib/Magento/Mtf/Page/BackendPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Magento\Mtf\Factory\Factory;

/**
* Class BackendPage
* Admin backend page.
*
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
Expand All @@ -19,13 +19,13 @@ class BackendPage extends Page
*
* @return void
*/
protected function _init()
protected function initUrl()
{
$this->_url = $_ENV['app_backend_url'] . static::MCA;
$this->url = $_ENV['app_backend_url'] . static::MCA;
}

/**
* Open backend page and log in if needed
* Open backend page and log in if needed.
*
* @param array $params
* @return $this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest">
<testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="One page check out with Authorize.Net payment method.">
<variation name="OnePageCheckoutAuthorizenetTestVariation1" summary="Check Out as a Guest with Authorize.Net and Offline Shipping method" ticketId="MAGETWO-12832">
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
<data name="customer/dataset" xsi:type="string">default</data>
<data name="billingAddress/dataset" xsi:type="string">US_address_1</data>
<data name="shippingAddress/dataset" xsi:type="string">US_address_1</data>
<data name="checkoutMethod" xsi:type="string">guest</data>
<data name="shipping/shipping_service" xsi:type="string">Flat Rate</data>
<data name="shipping/shipping_method" xsi:type="string">Fixed</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Backend\Test\Block\Cache;

use Magento\Backend\Test\Block\Widget\Grid as ParentGrid;

/**
* Backend Cache Management grid.
*/
class Grid extends ParentGrid
{
/**
* Search for item and select it.
*
* @param array $filter
* @return void
* @throws \Exception
*/
public function searchAndSelect(array $filter)
{
$selectItem = $this->getRow($filter, false)->find($this->selectItem);
if ($selectItem->isVisible()) {
$selectItem->click();
} else {
throw new \Exception('Searched item was not found.');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FormPageActions extends PageActions
*
* @var string
*/
protected $deleteButton = '#delete';
protected $deleteButton = '.delete';

/**
* Magento loader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,34 @@
use Magento\Mtf\Client\Element\SimpleElement;

/**
* Is used to represent any form with tabs on the page
* Is used to represent any form with tabs on the page.
*
* @SuppressWarnings(PHPMD.NumberOfChildren)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class FormTabs extends Form
{
/**
* Tabs list.
*
* @var array
*/
protected $tabs = [];

/**
* Fields which aren't assigned to any tab
* Fields which aren't assigned to any tab.
*
* @var array
*/
protected $unassignedFields = [];

/**
* Page header selector.
*
* @var string
*/
protected $header = 'header';

/**
* @constructor
* @param SimpleElement $element
Expand All @@ -55,15 +64,15 @@ public function __construct(
}

/**
* Initialize block
* Initialize block.
*/
protected function init()
{
$this->tabs = $this->getFormMapping();
}

/**
* Fill form with tabs
* Fill form with tabs.
*
* @param FixtureInterface $fixture
* @param SimpleElement|null $element
Expand All @@ -76,7 +85,7 @@ public function fill(FixtureInterface $fixture, SimpleElement $element = null)
}

/**
* Fill specified form with tabs
* Fill specified form with tabs.
*
* @param array $tabs
* @param SimpleElement|null $element
Expand All @@ -91,14 +100,14 @@ protected function fillTabs(array $tabs, SimpleElement $element = null)
$tab->fillFormTab($tabFields, $context);
}
if (!empty($this->unassignedFields)) {
$this->fillMissedFields($tabs);
$this->fillMissedFields();
}

return $this;
}

/**
* Fill fields which weren't found on filled tabs
* Fill fields which weren't found on filled tabs.
*
* @throws \Exception
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
Expand Down Expand Up @@ -130,7 +139,7 @@ protected function fillMissedFields()
}

/**
* Get data of the tabs
* Get data of the tabs.
*
* @param FixtureInterface|null $fixture
* @param SimpleElement|null $element
Expand Down Expand Up @@ -163,7 +172,7 @@ public function getData(FixtureInterface $fixture = null, SimpleElement $element
}

/**
* Update form with tabs
* Update form with tabs.
*
* @param FixtureInterface $fixture
* @return FormTabs
Expand All @@ -178,7 +187,7 @@ public function update(FixtureInterface $fixture)
}

/**
* Create data array for filling tabs
* Create data array for filling tabs.
*
* @param FixtureInterface $fixture
* @return array
Expand All @@ -194,7 +203,7 @@ protected function getFieldsByTabs(FixtureInterface $fixture)
}

/**
* Create data array for filling tabs (new fixture specification)
* Create data array for filling tabs (new fixture specification).
*
* @param InjectableFixture $fixture
* @return array
Expand All @@ -217,7 +226,7 @@ private function getFixtureFieldsByTabs(InjectableFixture $fixture)
}

/**
* Create data array for filling tabs (deprecated fixture specification)
* Create data array for filling tabs (deprecated fixture specification).
*
* @param FixtureInterface $fixture
* @return array
Expand Down Expand Up @@ -284,6 +293,7 @@ protected function getTabElement($tabName)
*/
public function openTab($tabName)
{
$this->browser->find($this->header)->hover();
$this->getTabElement($tabName)->click();
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
use Magento\Mtf\Client\Locator;

/**
* Class Tab
* Is used to represent any tab on the page
* Is used to represent any tab on the page.
*
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
Expand All @@ -23,24 +22,24 @@ class Tab extends AbstractForm
*
* @var string
*/
protected $mageErrorField = '//*[contains(@class,"field ")][.//*[@class="mage-error"]]';
protected $mageErrorField = '//fieldset/*[contains(@class,"field ")][.//*[contains(@class,"error")]]';

/**
* Fields label with mage error.
*
* @var string
*/
protected $mageErrorLabel = './label';
protected $mageErrorLabel = './/*[contains(@class,"label")]';

/**
* Mage error text.
*
* @var string
*/
protected $mageErrorText = './/*[@class="mage-error"]';
protected $mageErrorText = './/label[contains(@class,"error")]';

/**
* Fill data to fields on tab
* Fill data to fields on tab.
*
* @param array $fields
* @param SimpleElement|null $element
Expand All @@ -55,7 +54,7 @@ public function fillFormTab(array $fields, SimpleElement $element = null)
}

/**
* Get data of tab
* Get data of tab.
*
* @param array|null $fields
* @param SimpleElement|null $element
Expand All @@ -68,10 +67,11 @@ public function getDataFormTab($fields = null, SimpleElement $element = null)
}

/**
* Update data to fields on tab
* Update data to fields on tab.
*
* @param array $fields
* @param SimpleElement|null $element
* @return void
*/
public function updateFormTab(array $fields, SimpleElement $element = null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Backend\Test\Constraint;

use Magento\Mtf\Constraint\AbstractConstraint;
use Magento\Backend\Test\Page\Adminhtml\AdminCache;

/**
* Assert Cache is Invalidated and Refreshable.
*/
class AssertCacheIsRefreshableAndInvalidated extends AbstractConstraint
{
/**
* Success message of refreshed cache.
*/
const SUCCESS_MESSAGE = '%d cache type(s) refreshed.';

/**
* Assert Cache is Invalidated and Refreshable.
*
* @param AdminCache $adminCache
* @param array $cacheTags
* @return void
*/
public function processAssert(AdminCache $adminCache, $cacheTags)
{
$items = [];
foreach ($cacheTags as $cacheTag) {
$items[] = [
'tags' => $cacheTag,
'status' => 'Invalidated'
];
}

$adminCache->open();
$adminCache->getGridBlock()->massaction($items, 'Refresh');

\PHPUnit_Framework_Assert::assertEquals(
sprintf(self::SUCCESS_MESSAGE, count($items)),
$adminCache->getMessagesBlock()->getSuccessMessages(),
'Cache is Invalid and refreshable.'
);
}

/**
* Returns a string representation of the object.
*
* @return string
*/
public function toString()
{
return 'Cache is not Invalid or not refreshable.';
}
}
Loading

0 comments on commit ec58e4d

Please sign in to comment.