From 8c893b79d230cc844226bdf3b1de95cd5a99ecb2 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 30 Jan 2014 09:12:57 +0100 Subject: Branching off for release 1.0 --- tests/Selenium/Addressbook/Addressbook.php | 21 ---- tests/Selenium/Addressbook/Import.php | 29 ----- tests/Selenium/Login.php | 21 ---- tests/Selenium/Logout.php | 20 ---- tests/Selenium/Mail/CheckRecent.php | 14 --- tests/Selenium/Mail/Compose.php | 25 ---- tests/Selenium/Mail/Getunread.php | 13 -- tests/Selenium/Mail/List.php | 25 ---- tests/Selenium/Mail/Mail.php | 23 ---- tests/Selenium/Settings/About.php | 14 --- tests/Selenium/Settings/Folders.php | 20 ---- tests/Selenium/Settings/Identities.php | 19 --- tests/Selenium/Settings/Settings.php | 17 --- tests/Selenium/bootstrap.php | 185 ----------------------------- tests/Selenium/index.html | 8 -- tests/Selenium/phpunit.xml | 21 ---- 16 files changed, 475 deletions(-) delete mode 100644 tests/Selenium/Addressbook/Addressbook.php delete mode 100644 tests/Selenium/Addressbook/Import.php delete mode 100644 tests/Selenium/Login.php delete mode 100644 tests/Selenium/Logout.php delete mode 100644 tests/Selenium/Mail/CheckRecent.php delete mode 100644 tests/Selenium/Mail/Compose.php delete mode 100644 tests/Selenium/Mail/Getunread.php delete mode 100644 tests/Selenium/Mail/List.php delete mode 100644 tests/Selenium/Mail/Mail.php delete mode 100644 tests/Selenium/Settings/About.php delete mode 100644 tests/Selenium/Settings/Folders.php delete mode 100644 tests/Selenium/Settings/Identities.php delete mode 100644 tests/Selenium/Settings/Settings.php delete mode 100644 tests/Selenium/bootstrap.php delete mode 100644 tests/Selenium/index.html delete mode 100644 tests/Selenium/phpunit.xml (limited to 'tests/Selenium') diff --git a/tests/Selenium/Addressbook/Addressbook.php b/tests/Selenium/Addressbook/Addressbook.php deleted file mode 100644 index 9a22b6e13..000000000 --- a/tests/Selenium/Addressbook/Addressbook.php +++ /dev/null @@ -1,21 +0,0 @@ -go('addressbook'); - - // check task - $env = $this->get_env(); - $this->assertEquals('addressbook', $env['task']); - - $objects = $this->get_objects(); - - // these objects should be there always - $this->assertContains('qsearchbox', $objects); - $this->assertContains('folderlist', $objects); - $this->assertContains('contactslist', $objects); - $this->assertContains('countdisplay', $objects); - } -} diff --git a/tests/Selenium/Addressbook/Import.php b/tests/Selenium/Addressbook/Import.php deleted file mode 100644 index 13d81740f..000000000 --- a/tests/Selenium/Addressbook/Import.php +++ /dev/null @@ -1,29 +0,0 @@ -go('addressbook', 'import'); - - // check task and action - $env = $this->get_env(); - $this->assertEquals('addressbook', $env['task']); - $this->assertEquals('import', $env['action']); - - $objects = $this->get_objects(); - - // these objects should be there always - $this->assertContains('importform', $objects); - } - - public function testImport2() - { - $this->go('addressbook', 'import'); - - $objects = $this->get_objects(); - - // these objects should be there always - $this->assertContains('importform', $objects); - } -} diff --git a/tests/Selenium/Login.php b/tests/Selenium/Login.php deleted file mode 100644 index a3f0ab6b4..000000000 --- a/tests/Selenium/Login.php +++ /dev/null @@ -1,21 +0,0 @@ -url(TESTS_URL); - - // task should be set to 'login' - $env = $this->get_env(); - $this->assertEquals('login', $env['task']); - - // test valid login - $this->login(); - - // task should be set to 'mail' now - $env = $this->get_env(); - $this->assertEquals('mail', $env['task']); - } -} diff --git a/tests/Selenium/Logout.php b/tests/Selenium/Logout.php deleted file mode 100644 index 95eeda57c..000000000 --- a/tests/Selenium/Logout.php +++ /dev/null @@ -1,20 +0,0 @@ -go('mail'); - - $this->click_button('logout'); - - sleep(TESTS_SLEEP); - - // task should be set to 'login' - $env = $this->get_env(); - $this->assertEquals('login', $env['task']); - - // form should exist - $user_input = $this->byCssSelector('form input[name="_user"]'); - } -} diff --git a/tests/Selenium/Mail/CheckRecent.php b/tests/Selenium/Mail/CheckRecent.php deleted file mode 100644 index 865421c2d..000000000 --- a/tests/Selenium/Mail/CheckRecent.php +++ /dev/null @@ -1,14 +0,0 @@ -go('mail'); - - $res = $this->ajaxResponse('check-recent', "rcmail.command('checkmail')"); - - $this->assertEquals('check-recent', $res['action']); - $this->assertRegExp('/this\.set_unread_count/', $res['exec']); - } -} diff --git a/tests/Selenium/Mail/Compose.php b/tests/Selenium/Mail/Compose.php deleted file mode 100644 index e707ef17d..000000000 --- a/tests/Selenium/Mail/Compose.php +++ /dev/null @@ -1,25 +0,0 @@ -go('mail', 'compose'); - - // check task and action - $env = $this->get_env(); - $this->assertEquals('mail', $env['task']); - $this->assertEquals('compose', $env['action']); - - $objects = $this->get_objects(); - - // these objects should be there always - $this->assertContains('qsearchbox', $objects); - $this->assertContains('addressbookslist', $objects); - $this->assertContains('contactslist', $objects); - $this->assertContains('messageform', $objects); - $this->assertContains('attachmentlist', $objects); - $this->assertContains('filedrop', $objects); - $this->assertContains('uploadform', $objects); - } -} diff --git a/tests/Selenium/Mail/Getunread.php b/tests/Selenium/Mail/Getunread.php deleted file mode 100644 index d6362f2f4..000000000 --- a/tests/Selenium/Mail/Getunread.php +++ /dev/null @@ -1,13 +0,0 @@ -go('mail'); - - $res = $this->ajaxResponse('getunread', "rcmail.http_request('getunread')"); - - $this->assertEquals('getunread', $res['action']); - } -} diff --git a/tests/Selenium/Mail/List.php b/tests/Selenium/Mail/List.php deleted file mode 100644 index 7574c1801..000000000 --- a/tests/Selenium/Mail/List.php +++ /dev/null @@ -1,25 +0,0 @@ -go('mail'); - - $res = $this->ajaxResponse('list', "rcmail.command('list')"); - - $this->assertEquals('list', $res['action']); - $this->assertRegExp('/this\.set_pagetitle/', $res['exec']); - $this->assertRegExp('/this\.set_unread_count/', $res['exec']); - $this->assertRegExp('/this\.set_rowcount/', $res['exec']); - $this->assertRegExp('/this\.set_message_coltypes/', $res['exec']); -// $this->assertRegExp('/this\.add_message_row/', $res['exec']); - - $this->assertContains('current_page', $res['env']); - $this->assertContains('exists', $res['env']); - $this->assertContains('pagecount', $res['env']); - $this->assertContains('pagesize', $res['env']); - $this->assertContains('messagecount', $res['env']); - $this->assertContains('mailbox', $res['env']); - } -} diff --git a/tests/Selenium/Mail/Mail.php b/tests/Selenium/Mail/Mail.php deleted file mode 100644 index 98413787b..000000000 --- a/tests/Selenium/Mail/Mail.php +++ /dev/null @@ -1,23 +0,0 @@ -go('mail'); - - // check task - $env = $this->get_env(); - $this->assertEquals('mail', $env['task']); - - $objects = $this->get_objects(); - - // these objects should be there always - $this->assertContains('qsearchbox', $objects); - $this->assertContains('mailboxlist', $objects); - $this->assertContains('messagelist', $objects); - $this->assertContains('quotadisplay', $objects); - $this->assertContains('search_filter', $objects); - $this->assertContains('countdisplay', $objects); - } -} diff --git a/tests/Selenium/Settings/About.php b/tests/Selenium/Settings/About.php deleted file mode 100644 index 9a6c31d4b..000000000 --- a/tests/Selenium/Settings/About.php +++ /dev/null @@ -1,14 +0,0 @@ -url(TESTS_URL . '/?_task=settings&_action=about'); - - // check task and action - $env = $this->get_env(); - $this->assertEquals('settings', $env['task']); - $this->assertEquals('about', $env['action']); - } -} diff --git a/tests/Selenium/Settings/Folders.php b/tests/Selenium/Settings/Folders.php deleted file mode 100644 index fa64e45d6..000000000 --- a/tests/Selenium/Settings/Folders.php +++ /dev/null @@ -1,20 +0,0 @@ -go('settings', 'folders'); - - // task should be set to 'settings' and action to 'folders' - $env = $this->get_env(); - $this->assertEquals('settings', $env['task']); - $this->assertEquals('folders', $env['action']); - - $objects = $this->get_objects(); - - // these objects should be there always - $this->assertContains('quotadisplay', $objects); - $this->assertContains('subscriptionlist', $objects); - } -} diff --git a/tests/Selenium/Settings/Identities.php b/tests/Selenium/Settings/Identities.php deleted file mode 100644 index 869018b09..000000000 --- a/tests/Selenium/Settings/Identities.php +++ /dev/null @@ -1,19 +0,0 @@ -go('settings', 'identities'); - - // check task and action - $env = $this->get_env(); - $this->assertEquals('settings', $env['task']); - $this->assertEquals('identities', $env['action']); - - $objects = $this->get_objects(); - - // these objects should be there always - $this->assertContains('identitieslist', $objects); - } -} diff --git a/tests/Selenium/Settings/Settings.php b/tests/Selenium/Settings/Settings.php deleted file mode 100644 index 08d8339f1..000000000 --- a/tests/Selenium/Settings/Settings.php +++ /dev/null @@ -1,17 +0,0 @@ -go('settings'); - - // task should be set to 'settings' - $env = $this->get_env(); - $this->assertEquals('settings', $env['task']); - - $objects = $this->get_objects(); - - $this->assertContains('sectionslist', $objects); - } -} diff --git a/tests/Selenium/bootstrap.php b/tests/Selenium/bootstrap.php deleted file mode 100644 index e8b186a1e..000000000 --- a/tests/Selenium/bootstrap.php +++ /dev/null @@ -1,185 +0,0 @@ - | - | Author: Aleksander Machniak | - +-----------------------------------------------------------------------+ -*/ - -if (php_sapi_name() != 'cli') - die("Not in shell mode (php-cli)"); - -if (!defined('INSTALL_PATH')) define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../../') . '/' ); - -define('TESTS_DIR', dirname(__FILE__) . '/'); - -if (@is_dir(TESTS_DIR . 'config')) { - define('RCUBE_CONFIG_DIR', TESTS_DIR . 'config'); -} - -require_once(INSTALL_PATH . 'program/include/iniset.php'); - -// Extend include path so some plugin test won't fail -$include_path = ini_get('include_path') . PATH_SEPARATOR . TESTS_DIR . '..'; -if (set_include_path($include_path) === false) { - die("Fatal error: ini_set/set_include_path does not work."); -} - -$rcmail = rcube::get_instance('test'); - -define('TESTS_URL', $rcmail->config->get('tests_url')); -define('TESTS_BROWSER', $rcmail->config->get('tests_browser', 'firefox')); -define('TESTS_USER', $rcmail->config->get('tests_username')); -define('TESTS_PASS', $rcmail->config->get('tests_password')); -define('TESTS_SLEEP', $rcmail->config->get('tests_sleep', 5)); - -PHPUnit_Extensions_Selenium2TestCase::shareSession(true); - -// @TODO: remove user record from DB before running tests -// @TODO: make sure mailbox has some content (always the same) or is empty -// @TODO: plugins: enable all? - -/** - * Base class for all tests in this directory - */ -class Selenium_Test extends PHPUnit_Extensions_Selenium2TestCase -{ - protected function setUp() - { -// $this->rc = rcube::get_instance(); - $this->setBrowser(TESTS_BROWSER); - - // Set root to our index.html, for better performance - // See https://github.com/sebastianbergmann/phpunit-selenium/issues/217 - $this->setBrowserUrl(TESTS_URL . '/tests/Selenium'); - } - - protected function login() - { - $this->go('mail'); - - $user_input = $this->byCssSelector('form input[name="_user"]'); - $pass_input = $this->byCssSelector('form input[name="_pass"]'); - $submit = $this->byCssSelector('form input[type="submit"]'); - - $user_input->value(TESTS_USER); - $pass_input->value(TESTS_PASS); - - // submit login form - $submit->click(); - - // wait after successful login - sleep(TESTS_SLEEP); - } - - protected function go($task = 'mail', $action = null) - { - $this->url(TESTS_URL . '/?_task=' . $task); - - // wait for interface load (initial ajax requests, etc.) - sleep(TESTS_SLEEP); - - if ($action) { - $this->click_button($action); - - sleep(TESTS_SLEEP); - } - } - - protected function get_env() - { - return $this->execute(array( - 'script' => 'return rcmail.env;', - 'args' => array(), - )); - } - - protected function get_buttons($action) - { - $buttons = $this->execute(array( - 'script' => "return rcmail.buttons['$action'];", - 'args' => array(), - )); - - if (is_array($buttons)) { - foreach ($buttons as $idx => $button) { - $buttons[$idx] = $button['id']; - } - } - - return (array) $buttons; - } - - protected function get_objects() - { - return $this->execute(array( - 'script' => "var i,r = []; for (i in rcmail.gui_objects) r.push(i); return r;", - 'args' => array(), - )); - } - - protected function click_button($action) - { - $buttons = $this->get_buttons($action); - $id = array_shift($buttons); - - // this doesn't work for me - $this->byId($id)->click(); - } - - protected function ajaxResponse($action, $script = '', $button = false) - { - if (!$script && !$button) { - $script = "rcmail.command('$action')"; - } - - $script = - "if (!window.test_ajax_response) { - window.test_ajax_response_object = {}; - function test_ajax_response(response) - { - if (response.response && response.response.action) { - window.test_ajax_response_object[response.response.action] = response.response; - } - } - rcmail.addEventListener('responsebefore', test_ajax_response); - } - window.test_ajax_response_object['$action'] = null; - $script; - "; - - // run request - $this->execute(array( - 'script' => $script, - 'args' => array(), - )); - - if ($button) { - $this->click_button($action); - } - - // wait - sleep(TESTS_SLEEP); - - // get response - $response = $this->execute(array( - 'script' => "return window.test_ajax_response_object['$action'];", - 'args' => array(), - )); - - return $response; - } -} diff --git a/tests/Selenium/index.html b/tests/Selenium/index.html deleted file mode 100644 index 7aa65f829..000000000 --- a/tests/Selenium/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - Roundcube Webmail Tests - - -Testing... - - diff --git a/tests/Selenium/phpunit.xml b/tests/Selenium/phpunit.xml deleted file mode 100644 index b5835cf74..000000000 --- a/tests/Selenium/phpunit.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - Login.php - Addressbook/Addressbook.php - Addressbook/Import.php - Mail/Mail.php - Mail/CheckRecent.php - Mail/Compose.php - Mail/Getunread.php - Mail/List.php - Settings/About.php - Settings/Folders.php - Settings/Identities.php - Settings/Settings.php - Logout.php - - - -- cgit v1.2.3