Skip to content

Commit

Permalink
Merge pull request #218 from magento-qmt/develop
Browse files Browse the repository at this point in the history
[Mavericks] Create domain plans and test maintenance
  • Loading branch information
Aponasenko, Dmytro(daponasenko) committed Apr 4, 2015
2 parents dfd7e03 + 0637f41 commit 85dfbb0
Show file tree
Hide file tree
Showing 314 changed files with 4,924 additions and 4,518 deletions.
46 changes: 20 additions & 26 deletions dev/tests/functional/lib/Magento/Mtf/App/State/State1.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,55 @@
namespace Magento\Mtf\App\State;

use Magento\Mtf\ObjectManager;
use Magento\Mtf\Fixture\FixtureFactory;
use Magento\Core\Test\Fixture\ConfigData;

/**
* Class State1
* Example Application State class
* Example Application State class.
*/
class State1 extends AbstractState
{
// TODO: Move data set to ConfigData fixture after implement merging fixture xml
/**
* Data set for configuration state
* Object Manager.
*
* @var array
* @var ObjectManager
*/
protected $configDataSet = [
'section' => [
[
'path' => 'cms/wysiwyg/enabled',
'scope' => 'default',
'scope_id' => 1,
'value' => 'disabled',
],
]
];
protected $objectManager;

/**
* Configuration fixture
* Data for configuration state.
*
* @var ConfigData
* @var string
*/
protected $config;
protected $config ='admin_session_lifetime_1_hour, wysiwyg_disabled';

/**
* @construct
* @param FixtureFactory $fixtureFactory
* @param ObjectManager $objectManager
*/
public function __construct(FixtureFactory $fixtureFactory)
public function __construct(ObjectManager $objectManager)
{
$this->config = $fixtureFactory->createByCode('configData', ['data' => $this->configDataSet]);
$this->objectManager = $objectManager;
}

/**
* @inheritdoc
* Apply set up configuration profile.
*
* @return void
*/
public function apply()
{
parent::apply();
if (file_exists(dirname(dirname(dirname(MTF_BP))) . '/app/etc/config.php')) {
$this->config->persist();
$this->objectManager->create(
'\Magento\Config\Test\TestStep\SetupConfigurationStep',
['configData' => $this->config]
)->run();
}
}

/**
* @inheritdoc
* Get name of the Application State Profile.
*
* @return string
*/
public function getName()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DatepickerElement extends SimpleElement
*
* @var string
*/
protected $datePickerButton = './../img[contains(@class,"ui-datepicker-trigger")]';
protected $datePickerButton = './../button[contains(@class,"ui-datepicker-trigger")]';

/**
* DatePicker block.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function clear()
*/
protected function selectWindow()
{
$this->driver->closeWindow();
$this->driver->selectWindow();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Magento\Mtf\Client\Element;

use Magento\Framework\Webapi\Exception;
use Magento\Mtf\Client\Locator;

/**
Expand Down Expand Up @@ -69,8 +70,13 @@ public function setValue($value)
$this->waitResult();
$searchedItem = $this->find(sprintf($this->resultItem, $value), Locator::SELECTOR_XPATH);
if ($searchedItem->isVisible()) {
$searchedItem->click();
break;
try {
$searchedItem->click();
break;
} catch (\Exception $e) {
// In parallel run on windows change the focus is lost on element
// that causes disappearing of category suggest list.
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\AdminNotification\Test\Block\System;

use Magento\Mtf\Block\Block;

/**
* Global messages block.
*/
class Messages extends Block
{
/**
* Locator for close message block.
*
* @var string
*/
protected $closePopup = '.ui-dialog-titlebar-close';

/**
* Close popup block.
*
* @return void
*/
public function closePopup()
{
if ($this->_rootElement->isVisible()) {
$this->_rootElement->find($this->closePopup)->click();
}
}
}
30 changes: 14 additions & 16 deletions dev/tests/functional/tests/app/Magento/Backend/Test/Block/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,35 @@

use Magento\Mtf\Block\Block;
use Magento\Mtf\Client\Locator;
use Magento\Mtf\Factory\Factory;

/**
* Class Actions
* Cache actions block
*
* Cache actions block.
*/
class Cache extends Block
{
/**
* 'Flush Magento Cache' button
* 'Flush Magento Cache' button.
*
* @var string
*/
protected $flushMagentoCacheButton = '[data-ui-id="adminhtml-cache-container-flush-magento-button"]';

/**
* 'Flush Cache Storage' button
* 'Flush Cache Storage' button.
*
* @var string
*/
protected $flushCacheStorageButton = '[data-ui-id="adminhtml-cache-container-flush-system-button"]';

/**
* Selector for messages block
* Selector for messages block.
*
* @var string
*/
protected $messagesSelector = '//ancestor::div//div[@id="messages"]';

/**
* Messages texts
* Messages texts.
*
* @var array
*/
Expand All @@ -49,15 +46,15 @@ class Cache extends Block
];

/**
* Flush magento cache
* Flush magento cache.
*/
public function flushMagentoCache()
{
$this->_rootElement->find($this->flushMagentoCacheButton)->click();
}

/**
* Flush cache storage
* Flush cache storage.
*/
public function flushCacheStorage()
{
Expand All @@ -66,7 +63,7 @@ public function flushCacheStorage()
}

/**
* Is storage cache flushed successfully
* Is storage cache flushed successfully.
*
* @return bool
*/
Expand All @@ -76,7 +73,7 @@ public function isStorageCacheFlushed()
}

/**
* Is magento cache flushed successfully
* Is magento cache flushed successfully.
*
* @return bool
*/
Expand All @@ -86,14 +83,15 @@ public function isMagentoCacheFlushed()
}

/**
* Get messages block
* Get messages block.
*
* @return \Magento\Core\Test\Block\Messages
* @return \Magento\Backend\Test\Block\Messages
*/
protected function getMessagesBlock()
{
return Factory::getBlockFactory()->getMagentoCoreMessages(
$this->_rootElement->find($this->messagesSelector, Locator::SELECTOR_XPATH)
return $this->blockFactory->create(
'Magento\Backend\Test\Block\Messages',
['element' => $this->_rootElement->find($this->messagesSelector, Locator::SELECTOR_XPATH)]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Backend\Test\Block;

use Magento\Mtf\Block\Block;
Expand All @@ -18,21 +19,21 @@ class Menu extends Block
*
* @var string
*/
protected $mainMenu = './/li/a[span="%s"]';
protected $mainMenu = './/li[@role="menu-item"]/a[span="%s"]';

/**
* Submenu selector.
*
* @var string
*/
protected $subMenu = './/li[a[span="%s"]]/div[@class="submenu" and @style="display: block;"]';
protected $subMenu = './/li[@role="menu-item" and a[span="%s"]]/div[@class="submenu"]';

/**
* Submenu item selector.
*
* @var string
*/
protected $subMenuItem = './/a[span="%s"]';
protected $subMenuItem = '//li[@role="menu-item"]//a[span="%s"]';

/**
* Parent menu item.
Expand Down Expand Up @@ -89,12 +90,9 @@ public function navigate($menuItem)
}
$subMenuSelector = sprintf($this->subMenu, $mainMenu);
$this->waitForElementVisible($subMenuSelector, Locator::SELECTOR_XPATH);
$subMenuItem = $this->_rootElement->find($subMenuSelector, Locator::SELECTOR_XPATH)
->find(sprintf($this->subMenuItem, $subMenu), Locator::SELECTOR_XPATH);
if (!$subMenuItem->isVisible()) {
throw new \Exception('Submenu item "' . $subMenu . '" is not visible in "' . $mainMenu . '"');
}
$subMenuItem->click();
$subMenuItem = $subMenuSelector . sprintf($this->subMenuItem, $subMenu);
$this->waitForElementVisible($subMenuItem, Locator::SELECTOR_XPATH);
$this->_rootElement->find($subMenuItem, Locator::SELECTOR_XPATH)->click();
$this->waitForElementNotVisible($subMenuSelector, Locator::SELECTOR_XPATH);
}
}
Loading

0 comments on commit 85dfbb0

Please sign in to comment.