Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
73e93d60
Commit
73e93d60
authored
Oct 08, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stack/erp5: simplify setting when run selenium test on remote server
parent
0f5b52f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
75 deletions
+16
-75
stack/erp5/buildout.hash.cfg
stack/erp5/buildout.hash.cfg
+3
-3
stack/erp5/instance-erp5.cfg.in
stack/erp5/instance-erp5.cfg.in
+1
-1
stack/erp5/instance-zope.cfg.in
stack/erp5/instance-zope.cfg.in
+3
-3
stack/erp5/run-zelenium-test.py.in
stack/erp5/run-zelenium-test.py.in
+9
-68
No files found.
stack/erp5/buildout.hash.cfg
View file @
73e93d60
...
@@ -66,7 +66,7 @@ md5sum = 0969fbb25b05c02ef3c2d437b2f4e1a0
...
@@ -66,7 +66,7 @@ md5sum = 0969fbb25b05c02ef3c2d437b2f4e1a0
[template-run-zelenium]
[template-run-zelenium]
filename = run-zelenium-test.py.in
filename = run-zelenium-test.py.in
md5sum =
c64f35f825200fe35328641b2b8e0fdd
md5sum =
99004d9571b2574bb05058140d170013
[template]
[template]
filename = instance.cfg.in
filename = instance.cfg.in
...
@@ -78,7 +78,7 @@ md5sum = d41d8cd98f00b204e9800998ecf8427e
...
@@ -78,7 +78,7 @@ md5sum = d41d8cd98f00b204e9800998ecf8427e
[template-erp5]
[template-erp5]
filename = instance-erp5.cfg.in
filename = instance-erp5.cfg.in
md5sum =
ff5e0d8d1ca167399fb438e890baf370
md5sum =
4fe42a1fe78ce9531d8e9c9837f4a784
[template-zeo]
[template-zeo]
filename = instance-zeo.cfg.in
filename = instance-zeo.cfg.in
...
@@ -86,7 +86,7 @@ md5sum = 10a01b85c966ad9fe13bc981f1ddabe8
...
@@ -86,7 +86,7 @@ md5sum = 10a01b85c966ad9fe13bc981f1ddabe8
[template-zope]
[template-zope]
filename = instance-zope.cfg.in
filename = instance-zope.cfg.in
md5sum = 5
93a421b5de155756d5c483a2f7b9982
md5sum = 5
eba2aa53af7ee74959745e6225ea0a7
[template-balancer]
[template-balancer]
filename = instance-balancer.cfg.in
filename = instance-balancer.cfg.in
...
...
stack/erp5/instance-erp5.cfg.in
View file @
73e93d60
...
@@ -187,7 +187,7 @@ config-cloudooo-url = {{ dumps(slapparameter_dict.get('cloudooo-url', default_cl
...
@@ -187,7 +187,7 @@ config-cloudooo-url = {{ dumps(slapparameter_dict.get('cloudooo-url', default_cl
config-caucase-url = {{ dumps(caucase_url) }}
config-caucase-url = {{ dumps(caucase_url) }}
config-deadlock-debugger-password = ${publish-early:deadlock-debugger-password}
config-deadlock-debugger-password = ${publish-early:deadlock-debugger-password}
config-developer-list = {{ dumps(slapparameter_dict.get('developer-list', [inituser_login])) }}
config-developer-list = {{ dumps(slapparameter_dict.get('developer-list', [inituser_login])) }}
config-s
aucelabs-dict = {{ dumps(slapparameter_dict.get('saucelabs
-dict', {})) }}
config-s
elenium-server-configuration-dict = {{ dumps(slapparameter_dict.get('selenium-server-configuration
-dict', {})) }}
config-hosts-dict = {{ dumps(slapparameter_dict.get('hosts-dict', {})) }}
config-hosts-dict = {{ dumps(slapparameter_dict.get('hosts-dict', {})) }}
config-hostalias-dict = {{ dumps(slapparameter_dict.get('hostalias-dict', {})) }}
config-hostalias-dict = {{ dumps(slapparameter_dict.get('hostalias-dict', {})) }}
config-id-store-interval = {{ dumps(slapparameter_dict.get('id-store-interval')) }}
config-id-store-interval = {{ dumps(slapparameter_dict.get('id-store-interval')) }}
...
...
stack/erp5/instance-zope.cfg.in
View file @
73e93d60
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
{% set zodb_dict = slapparameter_dict['zodb-dict'] -%}
{% set zodb_dict = slapparameter_dict['zodb-dict'] -%}
{% set instance_index_list = range(slapparameter_dict['instance-count']) -%}
{% set instance_index_list = range(slapparameter_dict['instance-count']) -%}
{% set node_id_base = slapparameter_dict['name'] -%}
{% set node_id_base = slapparameter_dict['name'] -%}
{% set s
aucelabs_dict = slapparameter_dict.get('saucelabs
-dict', None) -%}
{% set s
elenium_server_configuration_dict = slapparameter_dict.get('selenium-server-configuration
-dict', None) -%}
{% set node_id_index_format = '-%%0%ii' % (len(str(instance_index_list[-1])), ) -%}
{% set node_id_index_format = '-%%0%ii' % (len(str(instance_index_list[-1])), ) -%}
{% set part_list = [] -%}
{% set part_list = [] -%}
{% set publish_list = [] -%}
{% set publish_list = [] -%}
...
@@ -405,9 +405,9 @@ wrapper-path = ${buildout:bin-directory}/${:_buildout_section_name_}
...
@@ -405,9 +405,9 @@ wrapper-path = ${buildout:bin-directory}/${:_buildout_section_name_}
{% do test_runner_address_list.append((ipv4, next_port())) %}
{% do test_runner_address_list.append((ipv4, next_port())) %}
{% endfor %}
{% endfor %}
{% if s
aucelabs
_dict -%}
{% if s
elenium_server_configuration
_dict -%}
[test-zelenium-runner-parameter]
[test-zelenium-runner-parameter]
configuration = {{ dumps(s
aucelabs
_dict) }}
configuration = {{ dumps(s
elenium_server_configuration
_dict) }}
user = {{ dumps(slapparameter_dict['inituser-login']) }}
user = {{ dumps(slapparameter_dict['inituser-login']) }}
password = {{ dumps(slapparameter_dict['inituser-password']) }}
password = {{ dumps(slapparameter_dict['inituser-password']) }}
bin-path = {{ bin_directory }}/{{ parameter_dict['egg-interpreter'] }}
bin-path = {{ bin_directory }}/{{ parameter_dict['egg-interpreter'] }}
...
...
stack/erp5/run-zelenium-test.py.in
View file @
73e93d60
...
@@ -26,94 +26,35 @@ def main():
...
@@ -26,94 +26,35 @@ def main():
parser.add_argument('--node_quantity', help='ignored', type=int)
parser.add_argument('--node_quantity', help='ignored', type=int)
parser.add_argument('--master_url',
parser.add_argument('--master_url',
help='The Url of Master controling many suites')
help='The Url of Master controling many suites')
parser.add_argument('--remote_access_url',
help='The access url',
default = parser_configuration.get('remote-access-url')
)
parser.add_argument('--target',
help='Target OS to run tests on',
default = parser_configuration.get('target')
)
parser.add_argument('--target_version',
help='Target OS version to use',
default = parser_configuration.get('target-version')
)
parser.add_argument('--target_browser',
help='The desired browser of the target OS to be used. Example: Firefox if target is Android.',
default = parser_configuration.get('target-browser')
)
parser.add_argument('--target_device',
help='The desired device running the target OS. Example: iPad Simulator, if target is iOS.',
default = parser_configuration.get('target-device')
)
parser.add_argument('--appium_server_auth',
help='Combination of user and token to access SauceLabs service. (i.e. user:token)',
default = parser_configuration.get('appium-server-auth')
)
parser.add_argument('--run_only',
help='zuite to run',
default = parser_configuration.get('run-only')
)
parser.add_argument('--max_duration',
type=int,
help='max duration for running test en second',
default = parser_configuration.get('max-duration', 1800)
)
args = parser.parse_args()
args = parser.parse_args()
test_line_dict = {}
test_line_dict = {}
test_suite_title = args.test_suite_title or args.test_suite
test_suite_title = args.test_suite_title or args.test_suite
test_suite = args.test_suite
test_suite = args.test_suite
revision = args.revision
revision = args.revision
# curl https://saucelabs.com/rest/v1/info/platforms/all
# https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
if not parser_configuration['server-url'] or not parser_configuration['remote-access-url']:
if args.target in ['iOS', 'Android']:
# parameters for mobile emulators have different names then parameters for
# desktop OSes
capabilities = {
'platformName': args.target,
'platformVersion': args.target_version,
'deviceName': args.target_device,
'browserName': args.target_browser,
'maxDuration': args.max_duration,
'name': test_suite_title
}
elif 'Windows' in args.target or 'OS X' in args.target:
capabilities = {
'browserName': args.target_browser,
'platform': args.target,
'version': args.target_version,
'maxDuration': args.max_duration,
'name': test_suite_title
}
if not args.appium_server_auth or not args.remote_access_url:
sys.exit(-1)
sys.exit(-1)
#Authentication over HTTPS is not supported in saucelab
if parser_configuration['run-only']:
#https://wiki.saucelabs.com/display/DOCS/Instant+Selenium+Python+Tests
appium_url = "http://%s@ondemand.saucelabs.com/wd/hub" % (args.appium_server_auth)
# adjust make path to access url
# Do not store any test result in the ZMI
if args.run_only:
url = "%s/erp5/portal_tests/%s/core/TestRunner.html" \
url = "%s/erp5/portal_tests/%s/core/TestRunner.html" \
"?test=../test_suite_html" \
"?test=../test_suite_html" \
"&auto=on" \
"&auto=on" \
"&resultsUrl=../getId" \
"&resultsUrl=../getId" \
"&__ac_name=%s" \
"&__ac_name=%s" \
"&__ac_password=%s" % (
args.remote_access_url, args.run_only
, {{ repr(user) }}, {{ repr(password) }})
"&__ac_password=%s" % (
parser_configuration['remote-access-url'], parser_configuration['run-only']
, {{ repr(user) }}, {{ repr(password) }})
else:
else:
url = "%s/erp5/portal_tests/core/TestRunner.html" \
url = "%s/erp5/portal_tests/core/TestRunner.html" \
"?test=../test_suite_html" \
"?test=../test_suite_html" \
"&auto=on" \
"&auto=on" \
"&resultsUrl=../getId" \
"&resultsUrl=../getId" \
"&__ac_name=%s" \
"&__ac_name=%s" \
"&__ac_password=%s" % (
args.remote_access_url
, {{ repr(user) }}, {{ repr(password) }})
"&__ac_password=%s" % (
parser_configuration['remote-access-url']
, {{ repr(user) }}, {{ repr(password) }})
# Wait until all activities are finished...
# Wait until all activities are finished...
wait_url = "%s/erp5/ActivityTool_getSqlStatisticList" \
wait_url = "%s/erp5/ActivityTool_getSqlStatisticList" \
"?__ac_name=%s" \
"?__ac_name=%s" \
"&__ac_password=%s" % (
args.remote_access_url
, {{ repr(user) }}, {{ repr(password) }})
"&__ac_password=%s" % (
parser_configuration['remote-access-url']
, {{ repr(user) }}, {{ repr(password) }})
while 1:
while 1:
try:
try:
response = urlopen(wait_url)
response = urlopen(wait_url)
...
@@ -136,7 +77,7 @@ def main():
...
@@ -136,7 +77,7 @@ def main():
time.sleep(600)
time.sleep(600)
tool = taskdistribution.TaskDistributor(portal_url=args.master_url)
tool = taskdistribution.TaskDistributor(portal_url=args.master_url)
browser = webdriver.Remote(
appium_url, capabilities
)
browser = webdriver.Remote(
parser_configuration['server-url'] , parser_configuration['desired-capabilities']
)
try:
try:
agent = browser.execute_script("return navigator.userAgent")
agent = browser.execute_script("return navigator.userAgent")
...
@@ -158,7 +99,7 @@ def main():
...
@@ -158,7 +99,7 @@ def main():
# Wait for test to be executed
# Wait for test to be executed
while 1:
while 1:
try:
try:
WebDriverWait(browser,
args.max_duration
).until(EC.presence_of_element_located((
WebDriverWait(browser,
parser_configuration['max-duration']
).until(EC.presence_of_element_located((
By.XPATH, '//td[@id="testRuns" and contains(text(), "%i")]' % test_count
By.XPATH, '//td[@id="testRuns" and contains(text(), "%i")]' % test_count
)))
)))
break
break
...
@@ -276,4 +217,4 @@ def main():
...
@@ -276,4 +217,4 @@ def main():
raise EnvironmentError(result)
raise EnvironmentError(result)
if __name__ == "__main__":
if __name__ == "__main__":
main()
main()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment