public function testLogin()
 {
     $loginPanel = new Tinebase_DOMProxy_LoginPanel(NULL, NULL, $this);
     $loginPanel->findField('username')->waitForVisible();
     Zend_Registry::get('log')->info('Try login with wrong password');
     $loginPanel->setField("username", Zend_Registry::get('testConfig')->username);
     $loginPanel->setField("password", rand(10000, 99999999));
     $loginPanel->pressLogin();
     Ext_MessageBox::getInstance($this)->pressOK();
     Zend_Registry::get('log')->info('Confirm login failure');
     Zend_Registry::get('log')->info('Use Correct Password');
     $loginPanel->setField("password", Zend_Registry::get('testConfig')->password);
     $loginPanel->pressLogin();
     $this->waitForElementPresent('tineMenu');
 }
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
error_reporting(E_ALL | E_STRICT);
set_include_path(implode(PATH_SEPARATOR, array(dirname(__FILE__), dirname(__FILE__) . '/../../tine20', dirname(__FILE__) . '/../../tine20/library', get_include_path())));
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
date_default_timezone_set('UTC');
// get config
if (file_exists(dirname(__FILE__) . '/config.inc.php')) {
    $config = new Zend_Config(require dirname(__FILE__) . '/config.inc.php');
} else {
    throw new Exception("Couldn't find config.inc.php! \n");
}
Zend_Registry::set('testConfig', $config);
// setup tine20 session
$connection = new SessionTestCase();
$connection->setBrowser('*firefox');
$connection->setBrowserUrl($config->url);
$connection->start();
$connection->open($config->url);
$connection->getEval("window.moveBy(-1 * window.screenX, 0); window.resizeTo(screen.width,screen.height);");
$loginPanel = new Tinebase_DOMProxy_LoginPanel(NULL, NULL, $connection);
$loginPanel->findField('username')->waitForVisible();
$loginPanel->setField("username", $config->username);
$loginPanel->setField("password", $config->password);
$loginPanel->pressLogin();
$writer = new LogWriter($connection);
$logger = new Zend_Log($writer);
Zend_Registry::set('log', $logger);
$logger->info('logger initialized');