Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos-mynij-dev
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
Mynij
slapos-mynij-dev
Commits
b71717b0
Commit
b71717b0
authored
Jan 17, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Selenium : Do not stop if urlError.
parent
a4126731
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
32 deletions
+42
-32
slapos/recipe/seleniumrunner/testrunner.py
slapos/recipe/seleniumrunner/testrunner.py
+42
-32
No files found.
slapos/recipe/seleniumrunner/testrunner.py
View file @
b71717b0
...
@@ -47,38 +47,41 @@ def run(args):
...
@@ -47,38 +47,41 @@ 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'
]))
if
getStatus
(
config
[
'base_url'
])
is
not
''
:
try
:
print
(
"ERROR : Impossible to clean old test result(s)"
)
if
getStatus
(
config
[
'base_url'
])
is
not
''
:
else
:
print
(
"ERROR : Impossible to clean old test result(s)"
)
# Environment is ready, we launch test.
else
:
os
.
environ
[
'DISPLAY'
]
=
config
[
'display'
]
# Environment is ready, we launch test.
xvfb
=
Xvfb
(
config
[
'etc_directory'
],
config
[
'xvfb_binary'
])
os
.
environ
[
'DISPLAY'
]
=
config
[
'display'
]
profile_dir
=
os
.
path
.
join
(
config
[
'etc_directory'
],
'profile'
)
xvfb
=
Xvfb
(
config
[
'etc_directory'
],
config
[
'xvfb_binary'
])
browser
=
Firefox
(
profile_dir
,
config
[
'base_url'
],
config
[
'browser_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."
)
except
urllib2
.
URLError
,
urlError
:
print
"Error: %s"
%
urlError
.
msg
sleep
(
3600
)
sleep
(
3600
)
def
openUrl
(
url
):
def
openUrl
(
url
):
...
@@ -98,7 +101,14 @@ def openUrl(url):
...
@@ -98,7 +101,14 @@ def openUrl(url):
def
getStatus
(
url
):
def
getStatus
(
url
):
try
:
try
:
status
=
openUrl
(
'%s/portal_tests/TestTool_getResults'
%
(
url
))
# Try 5 times.
for
i
in
range
(
5
):
try
:
status
=
openUrl
(
'%s/portal_tests/TestTool_getResults'
%
(
url
))
break
except
urllib2
.
URLError
,
urlError
:
if
i
is
4
:
raise
print
(
"Warning : %s while getting status"
%
urlError
.
msg
)
except
urllib2
.
HTTPError
,
e
:
except
urllib2
.
HTTPError
,
e
:
if
e
.
msg
==
"No Content"
:
if
e
.
msg
==
"No Content"
:
status
=
""
status
=
""
...
...
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