Exemplo n.º 1
0
 /**
  * Assert that created Store View can be found in Stores grid by name.
  *
  * @param Dashboard $dashboard
  * @return void
  */
 public function processAssert(Dashboard $dashboard)
 {
     $config = \Magento\Mtf\ObjectManagerFactory::getObjectManager()->get('Magento\\Mtf\\Config\\GlobalConfig');
     $newVersion = $config->get('version/0/value');
     $dashboard->open();
     \PHPUnit_Framework_Assert::assertTrue($dashboard->getFooter()->findVersion($newVersion)->isVisible());
 }
Exemplo n.º 2
0
 /**
  * Login admin user.
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $this->adminAuthLogin->open();
     $loginBlock = $this->adminAuthLogin->getLoginBlock();
     if ($loginBlock->isVisible()) {
         $loginBlock->fill($fixture);
         $loginBlock->submit();
         $this->dashboard->getAdminPanelHeader()->waitVisible();
     }
 }
 /**
  * Verify whether customer has logged in to the Backend.
  *
  * @param User $user
  * @param AdminAuthLogin $adminAuth
  * @param Dashboard $dashboard
  * @param User $customAdmin
  * @return void
  */
 public function processAssert(User $user, AdminAuthLogin $adminAuth, Dashboard $dashboard, User $customAdmin = null)
 {
     $adminUser = $customAdmin === null ? $user : $customAdmin;
     $adminPanelHeader = $dashboard->getAdminPanelHeader();
     if ($adminPanelHeader->isVisible()) {
         $adminPanelHeader->logOut();
     }
     $adminAuth->getLoginBlock()->loginToAdminPanel($adminUser->getData());
     \PHPUnit_Framework_Assert::assertTrue($adminPanelHeader->isVisible(), 'Admin user was not logged in.');
 }
Exemplo n.º 4
0
 /**
  * Open backend page and log in if needed.
  *
  * @param array $params
  * @return $this
  */
 public function open(array $params = [])
 {
     $systemConfig = ObjectManager::getInstance()->create('Magento\\Mtf\\Config\\DataInterface');
     $admin = ['username' => ['value' => $systemConfig->get('application/0/backendLogin/0/value')], 'password' => ['value' => $systemConfig->get('application/0/backendPassword/0/value')]];
     $this->adminAuthLogin = ObjectManager::getInstance()->create('Mage\\Adminhtml\\Test\\Page\\AdminAuthLogin');
     $this->dashboard = ObjectManager::getInstance()->create('Mage\\Adminhtml\\Test\\Page\\Adminhtml\\Dashboard');
     if (!$this->dashboard->getAdminPanelHeader()->isVisible()) {
         $this->loginSuperAdmin($admin);
     }
     return parent::open($params);
 }
 /**
  * Not allowed resources are not available on menu level.
  * In case if type it via URL - "Access Denied" page appeared.
  *
  * @param User $user
  * @param AdminAuthLogin $adminAuthLogin
  * @param Dashboard $dashboard
  * @param Browser $browser
  * @return void
  */
 public function processAssert(User $user, AdminAuthLogin $adminAuthLogin, Dashboard $dashboard, Browser $browser)
 {
     $adminPanelHeader = $dashboard->getAdminPanelHeader();
     if ($adminPanelHeader->isVisible()) {
         $adminPanelHeader->logOut();
     }
     $adminAuthLogin->getLoginBlock()->loginToAdminPanel($user->getData());
     $menuItems = $adminPanelHeader->getMenuFirstLevelItems();
     \PHPUnit_Framework_Assert::assertTrue(count($menuItems) == 1 && in_array('Sales', $menuItems), 'Sales menu item is not visible or count of menu items is greater than 1.');
     $browser->open($_ENV['app_backend_url'] . $this->manageProductsUrl);
     \PHPUnit_Framework_Assert::assertTrue(strpos($dashboard->getMainBlock()->getMainBlockText(), self::ACCESS_DENIED) !== false, self::ACCESS_DENIED . " text is not visible on dashboard page.");
 }
 /**
  * Assert that user have custom role.
  *
  * @param User $user
  * @param AdminAuthLogin $adminAuth
  * @param Dashboard $dashboard
  * @param CatalogCategoryIndex $categoryIndex
  * @param User $customAdmin [optional]
  * @return void
  */
 public function processAssert(User $user, AdminAuthLogin $adminAuth, Dashboard $dashboard, CatalogCategoryIndex $categoryIndex, User $customAdmin = null)
 {
     $adminUser = $customAdmin === null ? $user : $customAdmin;
     $adminPanelHeader = $dashboard->getAdminPanelHeader();
     if ($adminPanelHeader->isVisible()) {
         $adminPanelHeader->logOut();
     }
     $adminAuth->getLoginBlock()->loginToAdminPanel($adminUser->getData());
     $role = $user->getDataFieldConfig('role_id')['source']->getRole();
     $menuItems = $this->getMenuItems($role);
     foreach ($menuItems as $item) {
         \PHPUnit_Framework_Assert::assertTrue($adminPanelHeader->checkMenu(ucfirst($item)), "Menu {$item} is absent on top menu.");
     }
     // Check access denied message on category page.
     $categoryIndex->open();
     \PHPUnit_Framework_Assert::assertTrue($categoryIndex->getContentBlock()->checkAccessDeniedMessage());
 }
Exemplo n.º 7
0
 /**
  * Log in to admin panel.
  *
  * @param array $admin
  * @return void
  */
 public function loginToAdminPanel(array $admin)
 {
     $data = $this->dataMapping($admin);
     $this->_fill($data);
     $this->submit();
     if (!$this->_rootElement->isVisible()) {
         $this->dashboard->getAdminPanelHeader()->waitVisible();
     }
 }
 /**
  * Assert that Secure Urls Enabled.
  *
  * @param BrowserInterface $browser
  * @param Dashboard $dashboard
  * @return void
  */
 public function processAssert(BrowserInterface $browser, Dashboard $dashboard)
 {
     $dashboard->open();
     \PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'https://') !== false, 'Secure Url is not displayed on backend.');
 }
 /**
  * Asserts that login form 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 selected currency symbol displays on dashboard.
  *
  * @param Dashboard $dashboard
  * @param string $currencySymbol
  * @return void
  */
 public function processAssert(Dashboard $dashboard, $currencySymbol)
 {
     $dashboard->open();
     \PHPUnit_Framework_Assert::assertTrue(strpos($dashboard->getMainBlock()->getRevenuePrice(), $currencySymbol) !== false, 'Selected currency symbol not displays on dashboard.');
 }