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
19ee4509
Commit
19ee4509
authored
Sep 02, 2011
by
Vivien Alger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored recipe so that everything is in one wrapper
parent
166975d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
32 deletions
+20
-32
slapos/recipe/selenium/__init__.py
slapos/recipe/selenium/__init__.py
+20
-32
No files found.
slapos/recipe/selenium/__init__.py
View file @
19ee4509
...
...
@@ -46,47 +46,31 @@ class Recipe(BaseSlapRecipe):
self
.
path_list
=
[]
self
.
requirements
,
self
.
ws
=
self
.
egg
.
working_set
()
xvfb_conf
=
self
.
instaciateXvfb
()
self
.
instanciateTestRunner
(
xvfb_conf
[
'display'
]
)
self
.
instanciateTestRunner
(
self
.
getDisplay
()
)
self
.
linkBinary
()
self
.
computer_partition_setConnectionDict
()
return
self
.
path_list
def
instanciateXvfb
(
self
):
def
getDisplay
(
self
):
"""
C
reate Xvfb configuration dictionnary and instanciate a wrapper for it
C
hoose a display for the instance
Parameters : None
Returns :
Dictionnary xvfb_conf
Returns :
display
"""
xvfb_conf
=
{}
xvfb_conf
[
'xvfb_binary'
]
=
self
.
options
[
'xvfb_binary'
]
display_list
=
[
":%s"
%
i
for
i
in
range
(
123
,
144
)]
for
display_try
in
display_list
:
lock_filepath
=
'/tmp/.X%s-lock'
%
display_try
.
replace
(
":"
,
""
)
if
not
os
.
path
.
exists
(
lock_filepath
):
xvfb_conf
[
'display'
]
=
display_try
display
=
display_try
break
xvfb_template_location
=
pkg_resources
.
resource_filename
(
__name__
,
os
.
path
.
join
(
'template'
,
'xvfb_run.in'
))
xvfb_runner_path
=
self
.
createRunningWrapper
(
"Xvfb"
,
self
.
substituteTemplate
(
xvfb_template_location
,
xvfb_conf
))
self
.
path_list
.
append
(
xvfb_runner_path
)
return
xvfb_conf
return
display
def
instanciateTestRunner
(
self
,
display
):
"""
...
...
@@ -97,17 +81,21 @@ class Recipe(BaseSlapRecipe):
Returns : None
"""
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([(
'selenium'
,
__name__
+
'.testrunner'
,
'run'
)],
self
.
ws
,
if
self
.
parameter_dict
[
'browser'
]
==
'chrome'
or
self
.
parameter_dict
[
'browser'
]
==
'chromium'
:
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([(
'testrunner'
,
__name__
+
'.testrunner'
,
'run'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
dict
(
browser_binary
=
self
.
options
[
'chromium_binary'
],
display
=
display
,
option
=
"--ignore-certificate-errors --disable-translate --disable-web-security"
,
suite_name
=
self
.
parameter_dict
[
'suite_name'
],
base_url
=
self
.
parameter_dict
[
'url'
],
user
=
self
.
parameter_dict
[
'user'
],
password
=
self
.
paramer_dict
[
'password'
]
browser_binary
=
self
.
options
[
'chromium_binary'
],
xvfb_binary
=
self
.
options
[
'xvfb_binary'
],
display
=
display
,
option_ssl
=
'--ignore-certificate-errors'
,
option_translate
=
'--disable-translate'
,
option_security
=
'--disable-web-security'
,
suite_name
=
self
.
parameter_dict
[
'suite_name'
],
base_url
=
self
.
parameter_dict
[
'url'
],
user
=
self
.
parameter_dict
[
'user'
],
password
=
self
.
parameter_dict
[
'password'
]
)]))
def
linkBinary
(
self
):
...
...
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