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
Levin Zimmermann
erp5
Commits
41820141
Commit
41820141
authored
Aug 03, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Type/tests: log details about browser environment
This can help debugging test failures on test nodes
parent
8f4d626f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
+20
-4
No files found.
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
View file @
41820141
...
@@ -35,6 +35,7 @@ import re
...
@@ -35,6 +35,7 @@ import re
import
subprocess
import
subprocess
import
shutil
import
shutil
import
transaction
import
transaction
import
logging
from
ZPublisher.HTTPResponse
import
HTTPResponse
from
ZPublisher.HTTPResponse
import
HTTPResponse
from
zExceptions.ExceptionFormatter
import
format_exception
from
zExceptions.ExceptionFormatter
import
format_exception
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
...
@@ -46,6 +47,8 @@ from selenium.webdriver.common.by import By
...
@@ -46,6 +47,8 @@ from selenium.webdriver.common.by import By
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.support
import
expected_conditions
as
EC
from
selenium.webdriver.support
import
expected_conditions
as
EC
logger
=
logging
.
getLogger
(
__name__
)
# selenium workaround for localhost / 127.0.0.1 resolution
# selenium workaround for localhost / 127.0.0.1 resolution
# ------
# ------
# Selenium connects starts a service on localhost, but when ERP5
# Selenium connects starts a service on localhost, but when ERP5
...
@@ -149,8 +152,8 @@ class Xvfb(Process):
...
@@ -149,8 +152,8 @@ class Xvfb(Process):
else
:
else
:
raise
EnvironmentError
(
"All displays locked : %r"
%
(
self
.
display_list
,))
raise
EnvironmentError
(
"All displays locked : %r"
%
(
self
.
display_list
,))
print
'Xvfb : %d'
%
self
.
process
.
pid
logger
.
debug
(
'Xvfb : %d'
,
self
.
process
.
pid
)
print
'Take screenshots using xwud -in %s/Xvfb_screen0'
%
self
.
fbdir
logger
.
debug
(
'Take screenshots using xwud -in %s/Xvfb_screen0'
,
self
.
fbdir
)
class
FunctionalTestRunner
:
class
FunctionalTestRunner
:
...
@@ -188,8 +191,7 @@ class FunctionalTestRunner:
...
@@ -188,8 +191,7 @@ class FunctionalTestRunner:
xvfb
=
Xvfb
(
self
.
instance_home
)
xvfb
=
Xvfb
(
self
.
instance_home
)
try
:
try
:
if
not
(
debug
and
os
.
getenv
(
'DISPLAY'
)):
if
not
(
debug
and
os
.
getenv
(
'DISPLAY'
)):
print
(
"
\
n
Set 'erp5_debug_mode' environment variable to 1"
logger
.
debug
(
"You can set 'erp5_debug_mode' environment variable to 1 to use your existing display instead of Xvfb."
)
" to use your existing display instead of Xvfb."
)
xvfb
.
run
()
xvfb
.
run
()
capabilities
=
webdriver
.
common
.
desired_capabilities
\
capabilities
=
webdriver
.
common
.
desired_capabilities
\
.
DesiredCapabilities
.
FIREFOX
.
copy
()
.
DesiredCapabilities
.
FIREFOX
.
copy
()
...
@@ -207,6 +209,20 @@ class FunctionalTestRunner:
...
@@ -207,6 +209,20 @@ class FunctionalTestRunner:
kw
.
update
(
firefox_binary
=
firefox_bin
,
executable_path
=
geckodriver
)
kw
.
update
(
firefox_binary
=
firefox_bin
,
executable_path
=
geckodriver
)
browser
=
webdriver
.
Firefox
(
**
kw
)
browser
=
webdriver
.
Firefox
(
**
kw
)
start_time
=
time
.
time
()
start_time
=
time
.
time
()
logger
.
info
(
"Running with browser: %s"
,
browser
)
logger
.
info
(
"Reported user agent: %s"
,
browser
.
execute_script
(
"return navigator.userAgent"
))
logger
.
info
(
"Reported screen information: %s"
,
browser
.
execute_script
(
'''
return JSON.stringify({
'screen.width': window.screen.width,
'screen.height': window.screen.height,
'screen.pixelDepth': window.screen.pixelDepth,
'innerWidth': window.innerWidth,
'innerHeight': window.innerHeight
})'''
))
browser
.
get
(
self
.
_getTestBaseURL
()
+
'/login_form'
)
browser
.
get
(
self
.
_getTestBaseURL
()
+
'/login_form'
)
login_field
=
WebDriverWait
(
browser
,
10
).
until
(
login_field
=
WebDriverWait
(
browser
,
10
).
until
(
EC
.
presence_of_element_located
((
By
.
NAME
,
'__ac_name'
)),
EC
.
presence_of_element_located
((
By
.
NAME
,
'__ac_name'
)),
...
...
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