|
| 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 | +} |
0 commit comments