Skip to content

Commit 098d3ff

Browse files
committed
Merge pull request #20 from magento-qmt/develop
[Mavericks] Test maintenance and extend
2 parents 222b77c + cc2c0c7 commit 098d3ff

File tree

122 files changed

+2136
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+2136
-575
lines changed

dev/tests/functional/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"magento/mtf": "1.0.0-rc35",
3+
"magento/mtf": "1.0.0-rc36",
44
"php": "~5.5.0|~5.6.0|~7.0.0",
55
"phpunit/phpunit": "4.1.0",
66
"phpunit/phpunit-selenium": ">=1.2"

dev/tests/functional/etc/events.xml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,39 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="events.xsd">
99
<preset name="base">
1010
<observer class="Magento\Mtf\System\Observer\WebapiResponse">
11-
<tag name="webapi_failed"/>
11+
<tag name="webapi_failed" />
12+
</observer>
13+
</preset>
14+
<preset name="coverage" extends="base">
15+
<observer class="Magento\Mtf\System\Observer\PageUrl">
16+
<tag name="click_after"/>
17+
<tag name="accept_alert_after"/>
18+
<tag name="dismiss_alert_after"/>
19+
<tag name="open_after"/>
20+
<tag name="forward"/>
21+
<tag name="back"/>
22+
</observer>
23+
<observer class="Magento\Mtf\System\Observer\AppState">
24+
<tag name="app_state_applied"/>
25+
</observer>
26+
<observer class="Magento\Mtf\System\Observer\Log">
27+
<tag name="exception"/>
28+
<tag name="failure"/>
29+
<tag name="execution" />
30+
</observer>
31+
<observer class="Magento\Mtf\System\Observer\SourceCode">
32+
<tag name="exception"/>
33+
<tag name="failure"/>
34+
</observer>
35+
<observer class="Magento\Mtf\System\Observer\Screenshot">
36+
<tag name="exception"/>
37+
<tag name="failure"/>
38+
</observer>
39+
<observer class="Magento\Mtf\System\Observer\CurlResponse">
40+
<tag name="curl_failed"/>
41+
</observer>
42+
<observer class="Magento\Mtf\System\Observer\WebapiResponse">
43+
<tag name="webapi_failed" />
1244
</observer>
1345
</preset>
1446
</config>

dev/tests/functional/lib/Magento/Mtf/Handler/Webapi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Abstract class for webapi handlers.
1515
*/
16-
abstract class Webapi implements HandlerInterface
16+
abstract class Webapi extends Curl implements HandlerInterface
1717
{
1818
/**
1919
* Configuration parameters array.

dev/tests/functional/lib/Magento/Mtf/Page/BackendPage.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Magento\Mtf\Factory\Factory;
99

1010
/**
11-
* Class BackendPage
11+
* Admin backend page.
1212
*
1313
* @SuppressWarnings(PHPMD.NumberOfChildren)
1414
*/
@@ -19,13 +19,13 @@ class BackendPage extends Page
1919
*
2020
* @return void
2121
*/
22-
protected function _init()
22+
protected function initUrl()
2323
{
24-
$this->_url = $_ENV['app_backend_url'] . static::MCA;
24+
$this->url = $_ENV['app_backend_url'] . static::MCA;
2525
}
2626

2727
/**
28-
* Open backend page and log in if needed
28+
* Open backend page and log in if needed.
2929
*
3030
* @param array $params
3131
* @return $this

dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
9-
<testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest">
9+
<testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="One page check out with Authorize.Net payment method.">
1010
<variation name="OnePageCheckoutAuthorizenetTestVariation1" summary="Check Out as a Guest with Authorize.Net and Offline Shipping method" ticketId="MAGETWO-12832">
1111
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
1212
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
1313
<data name="customer/dataset" xsi:type="string">default</data>
14-
<data name="billingAddress/dataset" xsi:type="string">US_address_1</data>
14+
<data name="shippingAddress/dataset" xsi:type="string">US_address_1</data>
1515
<data name="checkoutMethod" xsi:type="string">guest</data>
1616
<data name="shipping/shipping_service" xsi:type="string">Flat Rate</data>
1717
<data name="shipping/shipping_method" xsi:type="string">Fixed</data>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Test\Block\Cache;
8+
9+
use Magento\Backend\Test\Block\Widget\Grid as ParentGrid;
10+
11+
/**
12+
* Backend Cache Management grid.
13+
*/
14+
class Grid extends ParentGrid
15+
{
16+
/**
17+
* Search for item and select it.
18+
*
19+
* @param array $filter
20+
* @return void
21+
* @throws \Exception
22+
*/
23+
public function searchAndSelect(array $filter)
24+
{
25+
$selectItem = $this->getRow($filter, false)->find($this->selectItem);
26+
if ($selectItem->isVisible()) {
27+
$selectItem->click();
28+
} else {
29+
throw new \Exception('Searched item was not found.');
30+
}
31+
}
32+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class FormPageActions extends PageActions
4949
*
5050
* @var string
5151
*/
52-
protected $deleteButton = '#delete';
52+
protected $deleteButton = '.delete';
5353

5454
/**
5555
* Magento loader

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,34 @@
1717
use Magento\Mtf\Client\Element\SimpleElement;
1818

1919
/**
20-
* Is used to represent any form with tabs on the page
20+
* Is used to represent any form with tabs on the page.
2121
*
2222
* @SuppressWarnings(PHPMD.NumberOfChildren)
2323
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2424
*/
2525
class FormTabs extends Form
2626
{
2727
/**
28+
* Tabs list.
29+
*
2830
* @var array
2931
*/
3032
protected $tabs = [];
3133

3234
/**
33-
* Fields which aren't assigned to any tab
35+
* Fields which aren't assigned to any tab.
3436
*
3537
* @var array
3638
*/
3739
protected $unassignedFields = [];
3840

41+
/**
42+
* Page header selector.
43+
*
44+
* @var string
45+
*/
46+
protected $header = 'header';
47+
3948
/**
4049
* @constructor
4150
* @param SimpleElement $element
@@ -55,15 +64,15 @@ public function __construct(
5564
}
5665

5766
/**
58-
* Initialize block
67+
* Initialize block.
5968
*/
6069
protected function init()
6170
{
6271
$this->tabs = $this->getFormMapping();
6372
}
6473

6574
/**
66-
* Fill form with tabs
75+
* Fill form with tabs.
6776
*
6877
* @param FixtureInterface $fixture
6978
* @param SimpleElement|null $element
@@ -76,7 +85,7 @@ public function fill(FixtureInterface $fixture, SimpleElement $element = null)
7685
}
7786

7887
/**
79-
* Fill specified form with tabs
88+
* Fill specified form with tabs.
8089
*
8190
* @param array $tabs
8291
* @param SimpleElement|null $element
@@ -91,14 +100,14 @@ protected function fillTabs(array $tabs, SimpleElement $element = null)
91100
$tab->fillFormTab($tabFields, $context);
92101
}
93102
if (!empty($this->unassignedFields)) {
94-
$this->fillMissedFields($tabs);
103+
$this->fillMissedFields();
95104
}
96105

97106
return $this;
98107
}
99108

100109
/**
101-
* Fill fields which weren't found on filled tabs
110+
* Fill fields which weren't found on filled tabs.
102111
*
103112
* @throws \Exception
104113
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
@@ -130,7 +139,7 @@ protected function fillMissedFields()
130139
}
131140

132141
/**
133-
* Get data of the tabs
142+
* Get data of the tabs.
134143
*
135144
* @param FixtureInterface|null $fixture
136145
* @param SimpleElement|null $element
@@ -163,7 +172,7 @@ public function getData(FixtureInterface $fixture = null, SimpleElement $element
163172
}
164173

165174
/**
166-
* Update form with tabs
175+
* Update form with tabs.
167176
*
168177
* @param FixtureInterface $fixture
169178
* @return FormTabs
@@ -178,7 +187,7 @@ public function update(FixtureInterface $fixture)
178187
}
179188

180189
/**
181-
* Create data array for filling tabs
190+
* Create data array for filling tabs.
182191
*
183192
* @param FixtureInterface $fixture
184193
* @return array
@@ -194,7 +203,7 @@ protected function getFieldsByTabs(FixtureInterface $fixture)
194203
}
195204

196205
/**
197-
* Create data array for filling tabs (new fixture specification)
206+
* Create data array for filling tabs (new fixture specification).
198207
*
199208
* @param InjectableFixture $fixture
200209
* @return array
@@ -217,7 +226,7 @@ private function getFixtureFieldsByTabs(InjectableFixture $fixture)
217226
}
218227

219228
/**
220-
* Create data array for filling tabs (deprecated fixture specification)
229+
* Create data array for filling tabs (deprecated fixture specification).
221230
*
222231
* @param FixtureInterface $fixture
223232
* @return array
@@ -284,6 +293,7 @@ protected function getTabElement($tabName)
284293
*/
285294
public function openTab($tabName)
286295
{
296+
$this->browser->find($this->header)->hover();
287297
$this->getTabElement($tabName)->click();
288298
return $this;
289299
}

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Tab.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
use Magento\Mtf\Client\Locator;
1212

1313
/**
14-
* Class Tab
15-
* Is used to represent any tab on the page
14+
* Is used to represent any tab on the page.
1615
*
1716
* @SuppressWarnings(PHPMD.NumberOfChildren)
1817
*/
@@ -23,24 +22,24 @@ class Tab extends AbstractForm
2322
*
2423
* @var string
2524
*/
26-
protected $mageErrorField = '//*[contains(@class,"field ")][.//*[@class="mage-error"]]';
25+
protected $mageErrorField = '//fieldset/*[contains(@class,"field ")][.//*[contains(@class,"error")]]';
2726

2827
/**
2928
* Fields label with mage error.
3029
*
3130
* @var string
3231
*/
33-
protected $mageErrorLabel = './label';
32+
protected $mageErrorLabel = './/*[contains(@class,"label")]';
3433

3534
/**
3635
* Mage error text.
3736
*
3837
* @var string
3938
*/
40-
protected $mageErrorText = './/*[@class="mage-error"]';
39+
protected $mageErrorText = './/label[contains(@class,"error")]';
4140

4241
/**
43-
* Fill data to fields on tab
42+
* Fill data to fields on tab.
4443
*
4544
* @param array $fields
4645
* @param SimpleElement|null $element
@@ -55,7 +54,7 @@ public function fillFormTab(array $fields, SimpleElement $element = null)
5554
}
5655

5756
/**
58-
* Get data of tab
57+
* Get data of tab.
5958
*
6059
* @param array|null $fields
6160
* @param SimpleElement|null $element
@@ -68,10 +67,11 @@ public function getDataFormTab($fields = null, SimpleElement $element = null)
6867
}
6968

7069
/**
71-
* Update data to fields on tab
70+
* Update data to fields on tab.
7271
*
7372
* @param array $fields
7473
* @param SimpleElement|null $element
74+
* @return void
7575
*/
7676
public function updateFormTab(array $fields, SimpleElement $element = null)
7777
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Test\Constraint;
8+
9+
use Magento\Mtf\Constraint\AbstractConstraint;
10+
use Magento\Backend\Test\Page\Adminhtml\AdminCache;
11+
12+
/**
13+
* Assert Cache is Invalidated and Refreshable.
14+
*/
15+
class AssertCacheIsRefreshableAndInvalidated extends AbstractConstraint
16+
{
17+
/**
18+
* Success message of refreshed cache.
19+
*/
20+
const SUCCESS_MESSAGE = '%d cache type(s) refreshed.';
21+
22+
/**
23+
* Assert Cache is Invalidated and Refreshable.
24+
*
25+
* @param AdminCache $adminCache
26+
* @param array $cacheTags
27+
* @return void
28+
*/
29+
public function processAssert(AdminCache $adminCache, $cacheTags)
30+
{
31+
$items = [];
32+
foreach ($cacheTags as $cacheTag) {
33+
$items[] = [
34+
'tags' => $cacheTag,
35+
'status' => 'Invalidated'
36+
];
37+
}
38+
39+
$adminCache->open();
40+
$adminCache->getGridBlock()->massaction($items, 'Refresh');
41+
42+
\PHPUnit_Framework_Assert::assertEquals(
43+
sprintf(self::SUCCESS_MESSAGE, count($items)),
44+
$adminCache->getMessagesBlock()->getSuccessMessages(),
45+
'Cache is Invalid and refreshable.'
46+
);
47+
}
48+
49+
/**
50+
* Returns a string representation of the object.
51+
*
52+
* @return string
53+
*/
54+
public function toString()
55+
{
56+
return 'Cache is not Invalid or not refreshable.';
57+
}
58+
}

0 commit comments

Comments
 (0)