diff --git a/drydocker/roundcubemail/test_integration.sh b/drydocker/roundcubemail/test_integration.sh index 524e6f4..1fba42b 100755 --- a/drydocker/roundcubemail/test_integration.sh +++ b/drydocker/roundcubemail/test_integration.sh @@ -1,48 +1,51 @@ #!/bin/bash source /srv/stick.git/drydocker/generic_integration.sh # This installs Kolab Groupware retval=$(_shell generic_integration_install) # This sets up Kolab Groupware retval=$(_shell generic_integration_setup) set -x # The installed packages do not ship 'tests/' pushd /usr/share/roundcubemail/ rm -rf tests # Use cp, or tests in Roundcube will use /srv/roundcubemail.git as a # result of what physical file the symbolic links refer to. cp -a /srv/roundcubemail.git/tests tests -sed -i -e 's/firefox/phantomjs/g' tests/Selenium/bootstrap.php +# This is cheating T533 +#sed -i -e 's/firefox/phantomjs/g' tests/Selenium/bootstrap.php popd # We cannot include firefox as a build dependency in the main package, # because OSC so epically fails at downloading the associated blob. -yum -y install firefox +# +# Also, it should not be needed (T533) +#yum -y install firefox chown apache /etc/roundcubemail/* egrep -- "\[testing\]" /etc/kolab/kolab.conf || \ cat >> /etc/kolab/kolab.conf << EOF [testing] roundcube_url = /roundcubemail/ roundcube_dir = /usr/share/roundcubemail develmode = false verbose = true phpunit_bin = /usr/bin/phpunit selenium_server_jar = /usr/local/lib/selenium-standalone-server.jar EOF pushd /srv/stick.git/integration/ retval=$(_shell env NOSE_VERBOSE=2 nosetests -s R/all.py) if [ ${retval} -ne 0 ]; then exit ${retval} fi popd diff --git a/integration/stick/phpunittest.py b/integration/stick/phpunittest.py index 473ea29..82f30c8 100644 --- a/integration/stick/phpunittest.py +++ b/integration/stick/phpunittest.py @@ -1,126 +1,126 @@ import time import subprocess from . import conf from integrationtest import KolabIntegrationTest class KolabPhpunitTest(KolabIntegrationTest): """ Base class for running Roundcube Selenium tests through phpunit This assumes Roundcube being installed with dev dependencies that include the phpunit/phpunit-selenium package. """ server = None env = {} @classmethod def setUpClass(self, *args, **kw): super(KolabPhpunitTest, self).setUpClass(*args, **kw) def tearDown(self, *args, **kw): self._stop_server() super(KolabPhpunitTest, self).tearDown(*args, **kw) def stop(self): self._stop_server() def _start_server(self): # only start once if self.server is None: server_jar = self.get_conf('testing', 'selenium_server_jar', 'selenium-server-standalone-2.45.0.jar') self.log("Starting Selenium server %r" % (server_jar)) self.server = subprocess.Popen(['java', '-jar', server_jar], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ready = False while not ready and not self.server.stdout.closed and self.server.poll() is None: line = self.server.stdout.readline() self.log("* " + line.strip()) if line is None: break elif "Started SocketListener" in line: ready = True elif "Failed" in line or "Error" in line: break if ready: self.log("Selenium server started.") else: raise Exception("Failed to start Selenium server") - self.env['ROUNDCUBE_TEST_BROWSER'] = 'phantomjs' + self.env['ROUNDCUBE_TESTS_BROWSER'] = 'phantomjs' def _stop_server(self): if self.server: self.server.terminate() self.server = None self.log("Selenium server stopped") def set_env(self, var, value): """ Set Roundcube config variable through env variables """ self.env['ROUNDCUBE_' + var.upper()] = value def set_login(self, username, password): """ Set Roundcube login username and password for subsequent phpunit runs """ self.set_env('tests_username', username) self.set_env('tests_password', password) def execute(self, testfile=None, testsuite=None, testfilter=None, selenium=False, groups=None, excludes=None, message=None): """ Execute phpunit on a Roundcube test instance """ cwd = self.get_conf('testing', 'roundcube_dir', '/usr/share/roundcubemail') pbin = self.get_conf('testing', 'phpunit_bin', 'phpunit') cxml = 'tests/Selenium/phpunit.xml' if selenium else 'tests/phpunit.xml' args = [ pbin, '--configuration', cxml ] if self.verbose: args.append('--verbose') if testfile: args.append(testfile) else: if testsuite: args.append('--testsuite') args.append(testsuite) if testfilter: args.append('--filter') args.append(testfilter) if groups: if not isinstance(groups, list): groups = [groups] for group in groups: args.append('--group') args.append(group) if excludes: if not isinstance(excludes, list): excludes = [excludes] for group in excludes: args.append('--exclude-group') args.append(group) if not conf.cli_keywords.todo: args.append('--disallow-todo-tests') if selenium: self._start_server() self.log("Executing %r with %r" % (args, self.env)) p = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.env) for line in iter(p.stdout.readline, ''): self.log(line.strip()) retval = p.wait() self.assertEqual(retval, 0, message)