/**
  * Verify incorrect credentials message while login to admin
  *
  * @param AdminAuthLogin $adminAuth
  * @param User $customAdmin
  * @return void
  */
 public function processAssert(AdminAuthLogin $adminAuth, User $customAdmin)
 {
     $adminAuth->open();
     $adminAuth->getLoginBlock()->fill($customAdmin);
     $adminAuth->getLoginBlock()->submit();
     \PHPUnit_Framework_Assert::assertEquals(self::INVALID_CREDENTIALS_MESSAGE, $adminAuth->getMessagesBlock()->getErrorMessages(), 'Message "' . self::INVALID_CREDENTIALS_MESSAGE . '" is not visible.');
 }
 /**
  * Run step flow.
  *
  * @return void
  */
 public function run()
 {
     $this->logoutUserOnBackendStep->run();
     $this->adminAuth->open();
     $this->adminAuth->getLoginBlock()->fill($this->user);
     $this->adminAuth->getLoginBlock()->submit();
     $this->adminAuth->getLoginBlock()->waitFormNotVisible();
 }
Esempio n. 3
0
 /**
  * Verify whether customer has logged in to the Backend
  *
  * @param User $user
  * @param AdminAuthLogin $adminAuth
  * @param Dashboard $dashboard
  * @param User $customAdmin
  * @internal param null|string $userToLoginInAssert
  * @return void
  */
 public function processAssert(User $user, AdminAuthLogin $adminAuth, Dashboard $dashboard, User $customAdmin = null)
 {
     $adminUser = $customAdmin === null ? $user : $customAdmin;
     if ($dashboard->getAdminPanelHeader()->isVisible()) {
         $dashboard->getAdminPanelHeader()->logOut();
     }
     $adminAuth->getLoginBlock()->fill($adminUser);
     $adminAuth->getLoginBlock()->submit();
     \PHPUnit_Framework_Assert::assertTrue($dashboard->getAdminPanelHeader()->isLoggedIn(), 'Admin user was not logged in.');
 }
 /**
  * Run step flow.
  *
  * @return void
  */
 public function run()
 {
     $this->adminAuth->open();
     if (!$this->adminAuth->getLoginBlock()->isVisible()) {
         $this->logoutUserOnBackendStep->run();
     }
     $this->adminAuth->getLoginBlock()->fill($this->user);
     $this->adminAuth->getLoginBlock()->submit();
     $this->adminAuth->getLoginBlock()->waitFormNotVisible();
     $this->dashboard->getSystemMessageDialog()->closePopup();
 }
 /**
  * Runs Delete User Role Entity test.
  *
  * @param AdminUserRole $role
  * @param User $adminUser
  * @param string $isDefaultUser
  * @return void
  */
 public function testDeleteAdminUserRole(AdminUserRole $role, User $adminUser, $isDefaultUser)
 {
     $filter = ['rolename' => $role->getRoleName()];
     //Steps
     if ($isDefaultUser == 0) {
         $this->adminAuthLogin->open();
         $this->adminAuthLogin->getLoginBlock()->fill($adminUser);
         $this->adminAuthLogin->getLoginBlock()->submit();
     }
     $this->userRoleIndex->open();
     $this->userRoleIndex->getRoleGrid()->searchAndOpen($filter);
     $this->userRoleEditRole->getPageActions()->delete();
 }
 /**
  * Runs Delete User Entity test
  *
  * @param User $user
  * @param string $isDefaultUser
  * @return void
  */
 public function testDeleteAdminUserEntity(User $user, $isDefaultUser)
 {
     $filter = ['username' => $user->getUsername()];
     //Steps
     if ($isDefaultUser == 0) {
         $this->adminAuthLogin->open();
         $this->adminAuthLogin->getLoginBlock()->fill($user);
         $this->adminAuthLogin->getLoginBlock()->submit();
     }
     $this->userIndex->open();
     $this->userIndex->getUserGrid()->searchAndOpen($filter);
     $this->userEdit->getPageActions()->delete();
 }
 /**
  * Runs Update Admin User test.
  *
  * @param User $initialUser
  * @param User $user
  * @param string $loginAsDefaultAdmin
  * @return array
  * @throws \Exception
  */
 public function testUpdateAdminUser(User $initialUser, User $user, $loginAsDefaultAdmin)
 {
     // Precondition
     $initialUser->persist();
     // Steps
     $filter = ['username' => $initialUser->getUsername()];
     if ($loginAsDefaultAdmin == '0') {
         $this->adminAuth->open();
         $this->adminAuth->getLoginBlock()->fill($initialUser);
         $this->adminAuth->getLoginBlock()->submit();
     }
     $this->userIndex->open();
     $this->userIndex->getUserGrid()->searchAndOpen($filter);
     $this->userEdit->getUserForm()->fill($user);
     $this->userEdit->getPageActions()->save();
     return ['user' => $this->mergeUsers($initialUser, $user)];
 }
 /**
  * Runs Update Admin User Roles Entity test
  *
  * @param Role $roleInit
  * @param Role $role
  * @param User $user
  * @return array
  */
 public function testUpdateAdminUserRolesEntity(Role $roleInit, Role $role, User $user)
 {
     // Preconditions
     $roleInit->persist();
     if (!$user->hasData('user_id')) {
         $user->persist();
     }
     // Steps
     $filter = ['rolename' => $roleInit->getRoleName()];
     $this->adminAuthLogin->open();
     $this->adminAuthLogin->getLoginBlock()->fill($user);
     $this->adminAuthLogin->getLoginBlock()->submit();
     $this->rolePage->open();
     $this->rolePage->getRoleGrid()->searchAndOpen($filter);
     $this->userRoleEditRole->getRoleFormTabs()->fill($role);
     $this->userRoleEditRole->getPageActions()->save();
     return ['user' => $role->hasData('in_role_users') ? $role->getDataFieldConfig('in_role_users')['source']->getAdminUsers()[0] : $user];
 }
 /**
  * Run Lock user when creating new integration test.
  *
  * @param Integration $integration
  * @param int $attempts
  * @param User $customAdmin
  * @param string $configData
  * @return void
  */
 public function test(Integration $integration, $attempts, User $customAdmin, $configData = null)
 {
     $this->configData = $configData;
     // Preconditions
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->configData])->run();
     $customAdmin->persist();
     $this->adminAuthLogin->open();
     $this->adminAuthLogin->getLoginBlock()->fill($customAdmin);
     $this->adminAuthLogin->getLoginBlock()->submit();
     // Steps
     $this->integrationIndexPage->open();
     $this->integrationIndexPage->getGridPageActions()->addNew();
     for ($i = 0; $i < $attempts; $i++) {
         $this->integrationNewPage->getIntegrationForm()->fill($integration);
         $this->integrationNewPage->getFormPageActions()->saveNew();
     }
     // Reload page
     $this->adminAuthLogin->open();
     $this->adminAuthLogin->getLoginBlock()->fill($customAdmin);
     $this->adminAuthLogin->getLoginBlock()->submit();
 }
 /**
  * Asserts that 'You have logged out.' message is present on page
  *
  * @param AdminAuthLogin $adminAuth
  * @param Dashboard $dashboard
  * @return void
  */
 public function processAssert(AdminAuthLogin $adminAuth, Dashboard $dashboard)
 {
     $dashboard->getAdminPanelHeader()->logOut();
     $isLoginBlockVisible = $adminAuth->getLoginBlock()->isVisible();
     \PHPUnit_Framework_Assert::assertTrue($isLoginBlockVisible, 'Admin user was not logged out.');
 }
 /**
  * Assert that AdminAuthLogin page is present as the result of an expired admin session.
  *
  * @param AdminAuthLogin $adminAuthLogin
  * @return void
  */
 public function processAssert(AdminAuthLogin $adminAuthLogin)
 {
     \PHPUnit_Framework_Assert::assertTrue($adminAuthLogin->getLoginBlock()->isVisible(), 'Admin session does not expire properly.');
 }