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
'--test_suite_title', test_suite_title,
'--node_quantity', config['node_quantity'],
'--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")
if bt5_path_list not in ('', None,):
invocation_list.extend(["--bt5_path", bt5_path_list])
......
......@@ -74,7 +74,9 @@ class Xvfb:
self.pid = None
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),
stdout=PIPE,
stderr=PIPE,
......@@ -185,7 +187,8 @@ class Firefox(Browser):
def _run(self, url):
# Prepare to run
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))
os.environ['MOZ_NO_REMOTE'] = '0'
......
......@@ -234,6 +234,12 @@ class ERP5TypeTestSuite(TestSuite):
if len(mysql_db_list) > 1:
args = ('--extra_sql_connection_string_list=%s' % \
','.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:
runUnitTest = os.environ.get('RUN_UNIT_TEST',
'runUnitTest')
......
......@@ -60,7 +60,9 @@ def main():
parser.add_argument('--persistent_memcached_server_hostname', default=None)
parser.add_argument('--persistent_memcached_server_port', 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()
if args.bt5_path is not None:
sys.path[0:0] = args.bt5_path.split(",")
......@@ -71,7 +73,9 @@ def main():
node_quantity=args.node_quantity,
revision=revision,
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(),
args.test_node_title, suite.allow_restart, test_suite_title,
args.project_title)
......
......@@ -609,7 +609,9 @@ def main(argument_list=None):
opts, args = getopt.getopt(sys.argv[1:],
"hpvD", ["help", "verbose", "profile", "coverage=", "portal_id=",
"data_fs_path=",
"bt5_path=",
"bt5_path",
"firefox_bin=",
"xvfb_bin=",
"recreate_catalog=", "erp5_sql_connection_string=",
"cmf_activity_sql_connection_string=",
"extra_sql_connection_string_list=",
......@@ -683,6 +685,10 @@ def main(argument_list=None):
elif opt == '--bt5_path':
os.environ["erp5_tests_bt5_path"] = \
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':
os.environ["erp5_tests_recreate_catalog"] = arg
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