selenium : Assert that test result is empty at start

parent 8682f8d1
...@@ -47,36 +47,38 @@ def run(args): ...@@ -47,36 +47,38 @@ def run(args):
# Clean old test results if any # Clean old test results if any
openUrl('%s/TestTool_cleanUpTestResults?__ac_name=%s&__ac_password=%s' % ( openUrl('%s/TestTool_cleanUpTestResults?__ac_name=%s&__ac_password=%s' % (
config['base_url'], config['user'], config['password'])) config['base_url'], config['user'], config['password']))
# TODO assert getresult is None if getStatus(config['base_url']) is not '':
print("ERROR : Impossible to clean old test result(s)")
os.environ['DISPLAY'] = config['display'] else:
xvfb = Xvfb(config['etc_directory'], config['xvfb_binary']) # Environment is ready, we launch test.
profile_dir = os.path.join(config['etc_directory'], 'profile') os.environ['DISPLAY'] = config['display']
browser = Firefox(profile_dir, config['base_url'], config['browser_binary']) xvfb = Xvfb(config['etc_directory'], config['xvfb_binary'])
try:
start = time.time()
xvfb.run()
profile_dir = os.path.join(config['etc_directory'], 'profile') profile_dir = os.path.join(config['etc_directory'], 'profile')
browser.run(test_url , xvfb.display) browser = Firefox(profile_dir, config['base_url'], config['browser_binary'])
erp5_report.reportStart() try:
while getStatus(config['base_url']) is '': start = time.time()
time.sleep(10) xvfb.run()
if (time.time() - start) > float(timeout): profile_dir = os.path.join(config['etc_directory'], 'profile')
raise TimeoutError("Test took more them %s seconds" % timeout) browser.run(test_url , xvfb.display)
except TimeoutError: erp5_report.reportStart()
continue while getStatus(config['base_url']) is '':
finally: time.sleep(10)
browser.quit() if (time.time() - start) > float(timeout):
xvfb.quit() raise TimeoutError("Test took more them %s seconds" % timeout)
except TimeoutError:
erp5_report.reportFinished(getStatus(config['base_url']).encode("utf-8", continue
"replace")) finally:
browser.quit()
# Clean test results for next test xvfb.quit()
openUrl('%s/TestTool_cleanUpTestResults?__ac_name=%s&__ac_password=%s' % (
config['base_url'], config['user'], config['password'])) erp5_report.reportFinished(getStatus(config['base_url']).encode("utf-8",
"replace"))
print("Test finished and report sent, sleeping.")
# Clean test results for next test
openUrl('%s/TestTool_cleanUpTestResults?__ac_name=%s&__ac_password=%s' % (
config['base_url'], config['user'], config['password']))
print("Test finished and report sent, sleeping.")
sleep(3600) sleep(3600)
def openUrl(url): def openUrl(url):
......
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