diff --git a/software/jstestnode/runTestSuite.in b/software/jstestnode/runTestSuite.in index 0da2266091610a8d8c60ace5238595c244b62b31..87a6c173b9993dd6135001f25c7364e477ff662f 100644 --- a/software/jstestnode/runTestSuite.in +++ b/software/jstestnode/runTestSuite.in @@ -118,6 +118,7 @@ def main(): appium_url = "http://%s@ondemand.saucelabs.com/wd/hub" % (args.appium_server_auth) browser = webdriver.Remote(appium_url, capabilities) + is_browser_running = True full_path = '$${runTestSuite-instance:buildout-directory}/software_release/parts/%s' % parsed_parameters['test-url'] full_path = full_path.split('srv')[-1] url = "%s%s" % (args.frontend_url, full_path) @@ -158,6 +159,13 @@ def main(): 'html_test_result': etree.tostring(elt.xpath('.//ol')[0]) } + # do quit browser asap as we have results. this is required in case of timeout of + # remote appium service which will close test session of no command received within + # usually 90s and thus fail this script. And it costs processing time as well + # to keep test session needlessly opened. + browser.quit() + is_browser_running = False + tool = taskdistribution.TaskDistributionTool(portal_url=args.master_url) test_result = tool.createTestResult(revision = revision, test_name_list = test_line_dict.keys(), @@ -189,7 +197,8 @@ def main(): raise EnvironmentError(result) finally: - browser.quit() + if is_browser_running: + browser.quit() if __name__ == "__main__": main() diff --git a/software/jstestnode/software.cfg b/software/jstestnode/software.cfg index f4c159dac9721527338daba0cbe34d0341c07298..b7930b6970e808c60fd4fdcb03c30f211ff90f41 100644 --- a/software/jstestnode/software.cfg +++ b/software/jstestnode/software.cfg @@ -107,7 +107,7 @@ mode = 0644 [template-runTestSuite] recipe = slapos.recipe.template url = ${:_profile_base_location_}/runTestSuite.in -md5sum = 777751601384344984c2759155d9bf99 +md5sum = 020f67ccfdf51a529579ab629cd9afe4 output = ${buildout:directory}/runTestSuite.in mode = 0644