Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 4c781dc

Browse files
author
Joan He
committed
MAGETWO-82125: Display advertisement popup at the 1st time per admin login
1 parent 52b06d1 commit 4c781dc

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\ReleaseNotification\Test\Constraint;
7+
8+
use Magento\Backend\Test\Page\Adminhtml\Dashboard;
9+
use Magento\Mtf\Constraint\AbstractConstraint;
10+
use Magento\PageCache\Test\Page\Adminhtml\AdminCache;
11+
use Magento\User\Test\Fixture\User;
12+
13+
/**
14+
* Assert that Release Notification Popup is visible on dashboard when admin user login again after flush cache
15+
*/
16+
class AssertLoginAgainAfterFlushCacheReleaseNotificationPopupExist extends AbstractConstraint
17+
{
18+
/**
19+
* Assert that Release Notification Popup is visibile on dashboard when admin user login again after flush cache
20+
*
21+
* @param Dashboard $dashboard
22+
* @param User $user
23+
* @param AdminCache $adminCache
24+
* @return void
25+
*/
26+
public function processAssert(Dashboard $dashboard, User $user, AdminCache $adminCache)
27+
{
28+
// Flush cache
29+
$adminCache->open();
30+
$adminCache->getActionsBlock()->flushMagentoCache();
31+
$adminCache->getMessagesBlock()->waitSuccessMessage();
32+
33+
// Log out
34+
$dashboard->getAdminPanelHeader()->logOut();
35+
36+
// Log in again
37+
$this->objectManager->create(
38+
\Magento\User\Test\TestStep\LoginUserOnBackendStep::class,
39+
['user' => $user]
40+
)->run();
41+
42+
\PHPUnit_Framework_Assert::assertTrue(
43+
$dashboard->getReleaseNotificationBlock()->isVisible(),
44+
"Release Notification Popup is absent on dashboard."
45+
);
46+
}
47+
48+
/**
49+
* Returns a string representation of the object.
50+
*
51+
* @return string
52+
*/
53+
public function toString()
54+
{
55+
return "Release Notification Popup is visible on dashboard.";
56+
}
57+
}

dev/tests/functional/tests/app/Magento/ReleaseNotification/Test/TestCase/NotificationTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<data name="user/dataset" xsi:type="string">custom_admin_with_default_role</data>
1717
<constraint name="Magento\ReleaseNotification\Test\Constraint\AssertReleaseNotificationPopupExist" />
1818
<constraint name="Magento\ReleaseNotification\Test\Constraint\AssertLoginAgainReleaseNotificationPopupNotExist" />
19+
<constraint name="Magento\ReleaseNotification\Test\Constraint\AssertLoginAgainAfterFlushCacheReleaseNotificationPopupExist" />
1920
</variation>
2021
</testCase>
2122
</config>

0 commit comments

Comments
 (0)