Commit e46cbf75 authored by Boxiang Sun's avatar Boxiang Sun

test

parent c85bbc21
......@@ -64,8 +64,8 @@ command =
# and at some point the next command (gclient) would break.
# ...
# This command only could work in an empty dir.
fetch --nohooks chromium
gclient sync --revision ${:revision} --with_branch_heads
#fetch --nohooks chromium
#gclient sync --revision ${:revision} --with_branch_heads
stop-on-error = true
[chromium]
......
......@@ -36,6 +36,7 @@ recipe = slapos.recipe.template
url = ${template-runTestSuite:output}
output = $${directory:bin}/runTestSuite
buildout-directory = $${buildout:directory}
configuration = $${instance-parameter:configuration}
mode = 0700
[xvfb-instance]
......
......@@ -13,9 +13,11 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
os.environ['TMPDIR'] = '$${xvfb-instance:tmp-path}'
#os.environ['TMPDIR'] = '$${xvfb-instance:tmp-path}'
os.environ['DISPLAY'] = ':0'
# execute "Xvfb :0 -screen 0 1024x768x24 +extension RANDR &", but where?
BASE_URL = 'http://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/'
def main():
......@@ -49,12 +51,12 @@ def main():
args = parser.parse_args()
import json
parsed_parameters = json.loads('$${instance-parameter:configuration._}')
import ast
configuration = ast.literal_eval('''$${instance-parameter:configuration}'''[4:]) # There has "!py!" prefix in here, remove it.
parsed_parameters = configuration.get('_', {})
if not getattr(args, 'target', None):
args.target = parsed_parameters.get('target', 'firefox')
args.target = parsed_parameters.get('target', 'chrome')
if not getattr(args, 'test_suite', None):
args.test_suite = parsed_parameters.get('test-suite')
if not getattr(args, 'target_version', None):
......@@ -87,8 +89,15 @@ def main():
##########################
is_appium = False
if args.target == 'firefox':
if args.target == 'chrome':
chrome_options = webdriver.chrome.options.Options()
chrome_options.binary_location = '${chromium:location}/chrome'
chrome_args = ['--headless', '--no-sandbox', '--disable-gpu']
for arg in chrome_args:
chrome_options.add_argument(arg)
browser = webdriver.Chrome(executable_path='${chromedriver:location}/chromedriver', chrome_options=chrome_options)
elif args.target == 'firefox':
firefox_capabilities = webdriver.common.desired_capabilities.DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '${firefox:location}/firefox-slapos'
......
......@@ -4,6 +4,7 @@ extends =
../../stack/nodejs.cfg
../../component/git/buildout.cfg
../../component/xorg/buildout.cfg
../../component/headless-chromium/buildout.cfg
../../component/firefox/buildout.cfg
../../component/dash/buildout.cfg
../../component/nginx/buildout.cfg
......@@ -15,6 +16,13 @@ parts =
git
eggs
xserver
depot_tools
chromedriver
chromium-download
chromium
gconf
scrnsaverproto
libXScrnSaver
firefox
xwd
renderjs-install
......@@ -25,7 +33,7 @@ parts =
[instance]
recipe = slapos.recipe.template
md5sum = 7c907db5f803b03a218b49888a3a3799
md5sum = addf9f7f1d6d9537fca03cbd72eafe2d
url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/instance.cfg
mode = 0644
......@@ -107,7 +115,7 @@ mode = 0644
[template-runTestSuite]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/runTestSuite.in
md5sum = fcf15b2a90340e0afe8f8b9921a4ffae
md5sum = 522bf77c9e3941481ace1aee7dc0b20c
output = ${buildout:directory}/runTestSuite.in
mode = 0644
......
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