Commit 4fb3bd3f authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Rafael Monnerat

extend code to pass firefox and xvfb binaries as parameter to runUnitTest....

extend code to pass firefox and xvfb binaries as parameter to runUnitTest. With this, is possible run functional tests using firefox and xvfb binaries from selenium testrunner
parent a571e126
...@@ -347,6 +347,12 @@ branch = %(branch)s ...@@ -347,6 +347,12 @@ branch = %(branch)s
'--test_suite_title', test_suite_title, '--test_suite_title', test_suite_title,
'--node_quantity', config['node_quantity'], '--node_quantity', config['node_quantity'],
'--master_url', portal_url]) '--master_url', portal_url])
firefox_bin_list = glob.glob("%s/*/parts/firefox/firefox-slapos" % config["software_root"])
if len(firefox_bin_list):
invocation_list.extend(["--firefox_bin", firefox_bin_list[0]])
xvfb_bin_list = glob.glob("%s/*/parts/xserver/bin/Xvfb" % config["software_root"])
if len(xvfb_bin_list):
invocation_list.extend(["--xvfb_bin", xvfb_bin_list[0]])
bt5_path_list = config.get("bt5_path") bt5_path_list = config.get("bt5_path")
if bt5_path_list not in ('', None,): if bt5_path_list not in ('', None,):
invocation_list.extend(["--bt5_path", bt5_path_list]) invocation_list.extend(["--bt5_path", bt5_path_list])
......
...@@ -74,7 +74,9 @@ class Xvfb: ...@@ -74,7 +74,9 @@ class Xvfb:
self.pid = None self.pid = None
def _runCommand(self, display): def _runCommand(self, display):
command = ['Xvfb', '-fbdir' , self.fbdir, display] xvfb_bin = os.environ.get("xvfb_bin", "Xvfb")
command = [xvfb_bin, '-fbdir' , self.fbdir, display]
self.process = Popen(" ".join(command), self.process = Popen(" ".join(command),
stdout=PIPE, stdout=PIPE,
stderr=PIPE, stderr=PIPE,
...@@ -185,7 +187,8 @@ class Firefox(Browser): ...@@ -185,7 +187,8 @@ class Firefox(Browser):
def _run(self, url): def _run(self, url):
# Prepare to run # Prepare to run
self._createFile('prefs.js', self.getPrefJs()) self._createFile('prefs.js', self.getPrefJs())
self._runCommand(("firefox", "firefox", "-no-remote", firefox_bin = os.environ.get("firefox_bin", "firefox")
self._runCommand((firefox_bin, firefox_bin, "-no-remote",
"-profile", self.profile_dir, url)) "-profile", self.profile_dir, url))
os.environ['MOZ_NO_REMOTE'] = '0' os.environ['MOZ_NO_REMOTE'] = '0'
......
...@@ -234,6 +234,12 @@ class ERP5TypeTestSuite(TestSuite): ...@@ -234,6 +234,12 @@ class ERP5TypeTestSuite(TestSuite):
if len(mysql_db_list) > 1: if len(mysql_db_list) > 1:
args = ('--extra_sql_connection_string_list=%s' % \ args = ('--extra_sql_connection_string_list=%s' % \
','.join(mysql_db_list[1:]),) + args ','.join(mysql_db_list[1:]),) + args
firefox_bin = getattr(self, "firefox_bin", None)
xvfb_bin = getattr(self, "xvfb_bin", None)
if firefox_bin:
args = ("--firefox_bin=%s" % firefox_bin,) + args
if xvfb_bin:
args = ("--xvfb_bin=%s" % xvfb_bin,) + args
try: try:
runUnitTest = os.environ.get('RUN_UNIT_TEST', runUnitTest = os.environ.get('RUN_UNIT_TEST',
'runUnitTest') 'runUnitTest')
......
...@@ -60,6 +60,8 @@ def main(): ...@@ -60,6 +60,8 @@ def main():
parser.add_argument('--persistent_memcached_server_hostname', default=None) parser.add_argument('--persistent_memcached_server_hostname', default=None)
parser.add_argument('--persistent_memcached_server_port', default=None) parser.add_argument('--persistent_memcached_server_port', default=None)
parser.add_argument('--bt5_path', default=None) parser.add_argument('--bt5_path', default=None)
parser.add_argument("--xvfb_bin", default=None)
parser.add_argument("--firefox_bin", default=None)
args = parser.parse_args() args = parser.parse_args()
if args.bt5_path is not None: if args.bt5_path is not None:
...@@ -71,7 +73,9 @@ def main(): ...@@ -71,7 +73,9 @@ def main():
node_quantity=args.node_quantity, node_quantity=args.node_quantity,
revision=revision, revision=revision,
db_list=args.db_list, db_list=args.db_list,
bt5_path=args.bt5_path) bt5_path=args.bt5_path,
firefox_bin=args.firefox_bin,
xvfb_bin=args.xvfb_bin)
test_result = master.createTestResult(revision, suite.getTestList(), test_result = master.createTestResult(revision, suite.getTestList(),
args.test_node_title, suite.allow_restart, test_suite_title, args.test_node_title, suite.allow_restart, test_suite_title,
args.project_title) args.project_title)
......
...@@ -609,7 +609,9 @@ def main(argument_list=None): ...@@ -609,7 +609,9 @@ def main(argument_list=None):
opts, args = getopt.getopt(sys.argv[1:], opts, args = getopt.getopt(sys.argv[1:],
"hpvD", ["help", "verbose", "profile", "coverage=", "portal_id=", "hpvD", ["help", "verbose", "profile", "coverage=", "portal_id=",
"data_fs_path=", "data_fs_path=",
"bt5_path=", "bt5_path",
"firefox_bin=",
"xvfb_bin=",
"recreate_catalog=", "erp5_sql_connection_string=", "recreate_catalog=", "erp5_sql_connection_string=",
"cmf_activity_sql_connection_string=", "cmf_activity_sql_connection_string=",
"extra_sql_connection_string_list=", "extra_sql_connection_string_list=",
...@@ -683,6 +685,10 @@ def main(argument_list=None): ...@@ -683,6 +685,10 @@ def main(argument_list=None):
elif opt == '--bt5_path': elif opt == '--bt5_path':
os.environ["erp5_tests_bt5_path"] = \ os.environ["erp5_tests_bt5_path"] = \
os.environ.get("erp5_tests_bt5_path", "") + arg os.environ.get("erp5_tests_bt5_path", "") + arg
elif opt == '--firefox_bin':
os.environ["firefox_bin"] = arg
elif opt == '--xvfb_bin':
os.environ["xvfb_bin"] = arg
elif opt == '--recreate_catalog': elif opt == '--recreate_catalog':
os.environ["erp5_tests_recreate_catalog"] = arg os.environ["erp5_tests_recreate_catalog"] = arg
elif opt == "--erp5_sql_connection_string": elif opt == "--erp5_sql_connection_string":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment