/** * Performs LogIn admin user on back-end * * @return Mage_Selenium_TestCase */ public function loginAdminUser() { try { $this->admin('log_in_to_admin', false); $currentPage = $this->_findCurrentPageFromUrl($this->getLocation()); if ($currentPage != $this->_firstPageAfterAdminLogin) { if ($currentPage == 'log_in_to_admin') { $this->validatePage('log_in_to_admin'); $loginData = array('user_name' => $this->_applicationHelper->getDefaultAdminUsername(), 'password' => $this->_applicationHelper->getDefaultAdminPassword()); $this->fillForm($loginData); $this->clickButton('login', false); $this->waitForElement(array(self::$xpathAdminLogo, self::$xpathErrorMessage, self::$xpathValidationMessage)); if (!$this->checkCurrentPage($this->_firstPageAfterAdminLogin)) { throw new PHPUnit_Framework_Exception('Admin was not logged in'); } if ($this->isElementPresent(self::$xpathGoToNotifications)) { if ($this->waitForElement(self::$xpathIncomingMessageClose, 10)) { $this->click(self::$xpathIncomingMessageClose); } } $this->validatePage($this->_firstPageAfterAdminLogin); } else { throw new PHPUnit_Framework_Exception('Wrong page was opened'); } } } catch (PHPUnit_Framework_Exception $e) { $this->fail($e->getMessage()); } return $this; }
/** * Convert page MCA to page ID * * @param string Page's mca * @param Mage_Selenium_Helper_Params $paramsDecorator Params decorator instance * * @return string Page identifier */ public function getPageByMca($mca, $paramsDecorator = null) { if (!$this->_applicationHelper) { throw new Mage_Selenium_Exception("ApplicationHelper hasn't inited yet"); } return $this->_config->getUimapHelper()->getUimapPageByMca($this->_applicationHelper->getArea(), $mca, $paramsDecorator); }