Skip to content

Commit 62a5577

Browse files
author
Dmytro Aponasenko
committed
Merge branch 'MTA-2496' of https://github.corp.ebay.com/magento-qmt/magento2ce into develop
2 parents 4668de3 + ba69f31 commit 62a5577

File tree

7 files changed

+95
-32
lines changed

7 files changed

+95
-32
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Customer\Test\Constraint;
8+
9+
use Magento\Cms\Test\Page\CmsIndex;
10+
use Magento\Customer\Test\Page\CustomerAccountIndex;
11+
use Magento\Mtf\Constraint\AbstractConstraint;
12+
13+
/**
14+
* Assert that customer success log out.
15+
*/
16+
class AssertCustomerLogout extends AbstractConstraint
17+
{
18+
/**
19+
* Logout page title.
20+
*/
21+
const LOGOUT_PAGE_TITLE = 'You are signed out';
22+
23+
/**
24+
* Home page title.
25+
*/
26+
const HOME_PAGE_TITLE = 'Home Page';
27+
28+
/**
29+
* Assert that customer success log out.
30+
*
31+
* @param CustomerAccountIndex $customerAccountIndex
32+
* @param CmsIndex $cmsIndex
33+
* @return void
34+
*/
35+
public function processAssert(CustomerAccountIndex $customerAccountIndex, CmsIndex $cmsIndex)
36+
{
37+
$customerAccountIndex->open();
38+
$cmsIndex->getCmsPageBlock()->waitPageInit();
39+
40+
$cmsIndex->getLinksBlock()->openLink('Sign Out');
41+
$cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible(self::LOGOUT_PAGE_TITLE);
42+
$cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible(self::HOME_PAGE_TITLE);
43+
$cmsIndex->getCmsPageBlock()->waitPageInit();
44+
\PHPUnit_Framework_Assert::assertTrue(
45+
$cmsIndex->getLinksBlock()->isLinkVisible('Sign In'),
46+
"Customer wasn't logged out."
47+
);
48+
}
49+
50+
/**
51+
* Returns a string representation of the object.
52+
*
53+
* @return string
54+
*/
55+
public function toString()
56+
{
57+
return "Customer is successfully log out.";
58+
}
59+
}

dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessRegisterMessage.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
use Magento\Mtf\Constraint\AbstractConstraint;
1111

1212
/**
13-
* Class AssertCustomerSuccessRegisterMessage
14-
*
13+
* Assert that success message is displayed after customer registered on frontend.
1514
*/
1615
class AssertCustomerSuccessRegisterMessage extends AbstractConstraint
1716
{
1817
const SUCCESS_MESSAGE = 'Thank you for registering with Main Website Store.';
1918

2019
/**
21-
* Assert that success message is displayed after customer registered on frontend
20+
* Assert that success message is displayed after customer registered on frontend.
2221
*
2322
* @param CustomerAccountCreate $registerPage
2423
* @return void
@@ -36,7 +35,7 @@ public function processAssert(CustomerAccountCreate $registerPage)
3635
}
3736

3837
/**
39-
* Text of success register message is displayed
38+
* Text of success register message is displayed.
4039
*
4140
* @return string
4241
*/

dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Customer\Test\Fixture\Customer;
1010
use Magento\Customer\Test\Page\CustomerAccountCreate;
1111
use Magento\Cms\Test\Page\CmsIndex;
12-
use Magento\Customer\Test\Page\CustomerAccountLogout;
12+
use Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep;
1313
use Magento\Mtf\TestCase\Injectable;
1414

1515
/**
@@ -32,40 +32,49 @@ class RegisterCustomerFrontendEntityTest extends Injectable
3232
/* end tags */
3333

3434
/**
35+
* Customer registry page.
36+
*
3537
* @var CustomerAccountCreate
3638
*/
3739
protected $customerAccountCreate;
3840

3941
/**
40-
* @var CustomerAccountLogout
42+
* Cms page.
43+
*
44+
* @var CmsIndex $cmsIndex
4145
*/
42-
protected $customerAccountLogout;
46+
protected $cmsIndex;
4347

4448
/**
45-
* @var CmsIndex $cmsIndex
49+
* Customer log out step.
50+
*
51+
* @var LogoutCustomerOnFrontendStep
4652
*/
47-
protected $cmsIndex;
53+
protected $logoutCustomerOnFrontendStep;
4854

4955
/**
56+
* Inject data.
57+
*
5058
* @param CustomerAccountCreate $customerAccountCreate
51-
* @param CustomerAccountLogout $customerAccountLogout
5259
* @param CmsIndex $cmsIndex
60+
* @param LogoutCustomerOnFrontendStep $logoutCustomerOnFrontendStep
61+
* @return void
5362
*/
5463
public function __inject(
5564
CustomerAccountCreate $customerAccountCreate,
56-
CustomerAccountLogout $customerAccountLogout,
57-
CmsIndex $cmsIndex
65+
CmsIndex $cmsIndex,
66+
LogoutCustomerOnFrontendStep $logoutCustomerOnFrontendStep
5867
) {
59-
$this->customerAccountLogout = $customerAccountLogout;
6068
$this->customerAccountCreate = $customerAccountCreate;
6169
$this->cmsIndex = $cmsIndex;
62-
$this->customerAccountLogout->open();
70+
$this->logoutCustomerOnFrontendStep = $logoutCustomerOnFrontendStep;
6371
}
6472

6573
/**
6674
* Create Customer account on Storefront.
6775
*
6876
* @param Customer $customer
77+
* @return void
6978
*/
7079
public function test(Customer $customer)
7180
{
@@ -76,12 +85,12 @@ public function test(Customer $customer)
7685
}
7786

7887
/**
79-
* Logout customer from frontend account
88+
* Logout customer from frontend account.
8089
*
81-
* return void
90+
* @return void
8291
*/
8392
public function tearDown()
8493
{
85-
$this->customerAccountLogout->open();
94+
$this->logoutCustomerOnFrontendStep->run();
8695
}
8796
}

dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Customer\Test\TestCase\RegisterCustomerFrontendEntityTest" summary="Register New Customer" ticketId="MAGETWO-23546">
10-
<variation name="RegisterCustomerFrontendEntityTestVariation1">
11-
<data name="description" xsi:type="string">Register new customer</data>
10+
<variation name="RegisterCustomerFrontendEntityTestVariation1" summary="Register new customer">
1211
<data name="customer/data/firstname" xsi:type="string">john</data>
1312
<data name="customer/data/lastname" xsi:type="string">doe</data>
1413
<data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data>
@@ -17,9 +16,9 @@
1716
<data name="customer/data/password_confirmation" xsi:type="string">123123q</data>
1817
<constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessRegisterMessage" />
1918
<constraint name="Magento\Customer\Test\Constraint\AssertCustomerInGrid" />
19+
<constraint name="Magento\Customer\Test\Constraint\AssertCustomerLogout" />
2020
</variation>
21-
<variation name="RegisterCustomerFrontendEntityTestVariation2">
22-
<data name="description" xsi:type="string">Register new customer with subscribing</data>
21+
<variation name="RegisterCustomerFrontendEntityTestVariation2" summary="Register new customer with subscribing">
2322
<data name="customer/data/firstname" xsi:type="string">john</data>
2423
<data name="customer/data/lastname" xsi:type="string">doe</data>
2524
<data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data>

dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
*/
1616
class LogoutCustomerOnFrontendStep implements TestStepInterface
1717
{
18-
/**
19-
* Logout page title.
20-
*/
21-
const LOGOUT_PAGE_TITLE = 'You are signed out.';
22-
2318
/**
2419
* Cms index page.
2520
*

dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Subscriber/Grid.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
namespace Magento\Newsletter\Test\Block\Adminhtml\Subscriber;
88

99
/**
10-
* Newsletter subscribers grid
11-
*
10+
* Newsletter subscribers grid.
1211
*/
13-
class Grid extends \Magento\Ui\Test\Block\Adminhtml\DataGrid
12+
class Grid extends \Magento\Backend\Test\Block\Widget\Grid
1413
{
1514
/**
16-
* Filters array mapping
15+
* Filters array mapping.
1716
*
1817
* @var array
1918
*/

dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ public function openLink($linkTitle)
7575
*/
7676
public function isLinkVisible($linkTitle)
7777
{
78-
$this->expandCustomerMenu();
79-
return $this->_rootElement->find(sprintf($this->link, $linkTitle), Locator::SELECTOR_XPATH)->isVisible();
78+
$link = $this->_rootElement->find(sprintf($this->link, $linkTitle), Locator::SELECTOR_XPATH);
79+
if (!$link->isVisible()) {
80+
$this->expandCustomerMenu();
81+
}
82+
return $link->isVisible();
8083
}
8184

8285
/**

0 commit comments

Comments
 (0)