Skip to content

Commit 5c8ea22

Browse files
committed
Merge branch 'develop' into MAGETWO-62025-develop
2 parents f3a0974 + a005167 commit 5c8ea22

File tree

42 files changed

+2123
-16
lines changed

Some content is hidden

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

42 files changed

+2123
-16
lines changed

dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Indexer.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ class Indexer extends Cli
1818
*/
1919
const PARAM_INDEXER_REINDEX = 'indexer:reindex';
2020

21+
/**
22+
* Parameter for set mode command.
23+
*/
24+
const PARAM_SET_MODE = 'indexer:set-mode';
25+
2126
/**
2227
* Run reindex.
2328
*
@@ -32,4 +37,21 @@ public function reindex(array $indexes = [])
3237
}
3338
parent::execute(Indexer::PARAM_INDEXER_REINDEX . ' ' . $params);
3439
}
40+
41+
/**
42+
* Run set mode. Example of indexers array:
43+
* [
44+
* [0] => ['indexer' => 'category_flat_data', 'mode' => 'schedule'],
45+
* [1] => ['indexer' => 'catalogrule_product', 'mode' => 'realtime']
46+
* ]
47+
*
48+
* @param array $indexers
49+
* @return void
50+
*/
51+
public function setMode(array $indexers)
52+
{
53+
foreach ($indexers as $indexer) {
54+
parent::execute(Indexer::PARAM_SET_MODE . ' ' . $indexer['mode'] . ' ' . $indexer['indexer']);
55+
}
56+
}
3557
}

dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertBackendPageIsAvailable.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace Magento\Backend\Test\Constraint;
88

9-
use Magento\Backend\Test\Fixture\GlobalSearch;
109
use Magento\Backend\Test\Page\Adminhtml\Dashboard;
1110
use Magento\Mtf\Constraint\AbstractConstraint;
1211

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Captcha\Test\Block\Adminhtml;
8+
9+
use Magento\Mtf\Client\Locator;
10+
use Magento\Backend\Test\Block\Admin\Login;
11+
12+
/**
13+
* Login form for backend user.
14+
*/
15+
class LoginWithCaptcha extends Login
16+
{
17+
/**
18+
* Captcha image selector.
19+
*
20+
* @var string
21+
*/
22+
private $captchaImage = '#backend_login';
23+
24+
/**
25+
* Captcha reload button selector.
26+
*
27+
* @var string
28+
*/
29+
private $captchaReload = '#captcha-reload';
30+
31+
/**
32+
* Return captcha element visibility.
33+
*
34+
* @return bool
35+
*/
36+
public function isVisibleCaptcha()
37+
{
38+
return $this->_rootElement->find($this->captchaImage, Locator::SELECTOR_CSS)->isVisible();
39+
}
40+
41+
/**
42+
* Return captcha reload button element visibility.
43+
*
44+
* @return bool
45+
*/
46+
public function isVisibleCaptchaReloadButton()
47+
{
48+
return $this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->isVisible();
49+
}
50+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<mapping strict="1">
9+
<wrapper>login</wrapper>
10+
<fields>
11+
<username>
12+
<selector>#username</selector>
13+
</username>
14+
<password>
15+
<selector>#login</selector>
16+
</password>
17+
<captcha>
18+
<selector>#captcha</selector>
19+
</captcha>
20+
</fields>
21+
</mapping>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Captcha\Test\Block\Form;
8+
9+
use Magento\Mtf\Client\Locator;
10+
use Magento\Customer\Test\Block\Form\Login;
11+
use Magento\Mtf\Client\ElementInterface;
12+
13+
/**
14+
* Form for storefront login with captcha.
15+
*/
16+
class LoginWithCaptcha extends Login
17+
{
18+
/**
19+
* Captcha image selector.
20+
*
21+
* @var string
22+
*/
23+
private $captchaImage = '.captcha-img';
24+
25+
/**
26+
* Captcha reload button selector.
27+
*
28+
* @var string
29+
*/
30+
private $captchaReload = '.captcha-reload';
31+
32+
/**
33+
* Get captcha element visibility.
34+
*
35+
* @return bool
36+
*/
37+
public function isVisibleCaptcha()
38+
{
39+
return $this->_rootElement->find($this->captchaImage, Locator::SELECTOR_CSS)->isVisible();
40+
}
41+
42+
/**
43+
* Get captcha reload button element visibility.
44+
*
45+
* @return bool
46+
*/
47+
public function isVisibleCaptchaReloadButton()
48+
{
49+
return $this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->isVisible();
50+
}
51+
52+
/**
53+
* Click on reload captcha button.
54+
*
55+
* @return void
56+
*/
57+
public function clickReloadCaptchaButton()
58+
{
59+
$this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->click();
60+
}
61+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<mapping strict="1">
9+
<wrapper>login</wrapper>
10+
<fields>
11+
<email>
12+
<selector>[name='login[username]']</selector>
13+
</email>
14+
<password />
15+
<captcha>
16+
<selector>[name='captcha[user_login]']</selector>
17+
</captcha>
18+
</fields>
19+
</mapping>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Captcha\Test\Constraint;
8+
9+
use Magento\Captcha\Test\Page\Captcha\AdminAuthLoginWithCaptcha;
10+
use Magento\Mtf\Constraint\AbstractConstraint;
11+
12+
/**
13+
* Assert captcha on backend login page.
14+
*/
15+
class AssertCaptchaFieldOnBackend extends AbstractConstraint
16+
{
17+
/**
18+
* Assert captcha and reload button are visible on backend login page.
19+
*
20+
* @param AdminAuthLoginWithCaptcha $adminAuthLogin
21+
* @return void
22+
*/
23+
public function processAssert(AdminAuthLoginWithCaptcha $adminAuthLogin)
24+
{
25+
\PHPUnit_Framework_Assert::assertTrue(
26+
$adminAuthLogin->getLoginBlockWithCaptcha()->isVisibleCaptcha(),
27+
'Captcha image is not present on backend login page.'
28+
);
29+
30+
\PHPUnit_Framework_Assert::assertTrue(
31+
$adminAuthLogin->getLoginBlockWithCaptcha()->isVisibleCaptchaReloadButton(),
32+
'Captcha reload button is not present on backend login page.'
33+
);
34+
}
35+
36+
/**
37+
* Returns a string representation of the object.
38+
*
39+
* @return string
40+
*/
41+
public function toString()
42+
{
43+
return 'Captcha and reload button are presents on backend login page.';
44+
}
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Captcha\Test\Constraint;
8+
9+
use Magento\Customer\Test\Page\CustomerAccountLogin;
10+
use Magento\Mtf\Constraint\AbstractConstraint;
11+
12+
/**
13+
* Assert captcha on storefront login page.
14+
*/
15+
class AssertCaptchaFieldOnStorefront extends AbstractConstraint
16+
{
17+
/**
18+
* Assert captcha and reload button are visible on storefront login page.
19+
*
20+
* @param CustomerAccountLogin $loginPage
21+
* @return void
22+
*/
23+
public function processAssert(CustomerAccountLogin $loginPage)
24+
{
25+
\PHPUnit_Framework_Assert::assertTrue(
26+
$loginPage->getLoginBlockWithCaptcha()->isVisibleCaptcha(),
27+
'Captcha image is not present on storefront login page.'
28+
);
29+
30+
\PHPUnit_Framework_Assert::assertTrue(
31+
$loginPage->getLoginBlockWithCaptcha()->isVisibleCaptchaReloadButton(),
32+
'Captcha reload button is not present on storefront login page.'
33+
);
34+
}
35+
36+
/**
37+
* Returns a string representation of the object.
38+
*
39+
* @return string
40+
*/
41+
public function toString()
42+
{
43+
return 'Captcha and reload button are presents on storefront login page.';
44+
}
45+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. 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/fixture.xsd">
9+
<fixture name="customer">
10+
<field name="captcha" is_required="0" />
11+
</fixture>
12+
</config>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. 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/fixture.xsd">
9+
<fixture name="user">
10+
<field name="captcha" is_required="0" />
11+
</fixture>
12+
</config>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. 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="AdminAuthLoginWithCaptcha" area="Captcha" mca="admin/auth/login" module="Magento_Captcha">
10+
<block name="loginBlockWithCaptcha" class="Magento\Captcha\Test\Block\Adminhtml\LoginWithCaptcha" locator="#login-form" strategy="css selector"/>
11+
</page>
12+
</config>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. 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="CustomerAccountLogin">
10+
<block name="loginBlockWithCaptcha" class="Magento\Captcha\Test\Block\Form\LoginWithCaptcha" locator="#login-form" strategy="css selector"/>
11+
</page>
12+
</config>

0 commit comments

Comments
 (0)