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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
54ca6494
Commit
54ca6494
authored
Apr 16, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: run test with selenium server
parent
c8036d39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
22 deletions
+70
-22
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
+70
-22
No files found.
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
View file @
54ca6494
...
...
@@ -45,6 +45,7 @@ from selenium import webdriver
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.support
import
expected_conditions
as
EC
from
selenium.webdriver.remote.remote_connection
import
RemoteConnection
# selenium workaround for localhost / 127.0.0.1 resolution
# ------
...
...
@@ -172,6 +173,8 @@ class FunctionalTestRunner:
return
self
.
portal
.
portal_tests
.
TestTool_getResults
(
self
.
run_only
)
def
_getTestBaseURL
(
self
):
return
'https://[2001:67c:1254:26::5e5f]:8445/erp5/'
# Access the https proxy in front of runUnitTest's zserver
base_url
=
os
.
getenv
(
'zserver_frontend_url'
)
if
base_url
:
...
...
@@ -185,27 +188,70 @@ class FunctionalTestRunner:
)
def
test
(
self
,
debug
=
0
):
xvfb
=
Xvfb
(
self
.
instance_home
)
try
:
if
not
(
debug
and
os
.
getenv
(
'DISPLAY'
)):
print
(
"
\
n
Set 'erp5_debug_mode' environment variable to 1"
" to use your existing display instead of Xvfb."
)
xvfb
.
run
()
capabilities
=
webdriver
.
common
.
desired_capabilities
\
.
DesiredCapabilities
.
FIREFOX
.
copy
()
capabilities
[
'marionette'
]
=
True
# Zope is accessed through apache with a certificate not trusted by firefox
capabilities
[
'acceptInsecureCerts'
]
=
True
# Service workers are disabled on Firefox 52 ESR:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1338144
options
=
webdriver
.
FirefoxOptions
()
options
.
set_preference
(
'dom.serviceWorkers.enabled'
,
True
)
kw
=
dict
(
capabilities
=
capabilities
,
options
=
options
)
firefox_bin
=
os
.
environ
.
get
(
'firefox_bin'
)
if
firefox_bin
:
geckodriver
=
os
.
path
.
join
(
os
.
path
.
dirname
(
firefox_bin
),
'geckodriver'
)
kw
.
update
(
firefox_binary
=
firefox_bin
,
executable_path
=
geckodriver
)
browser
=
webdriver
.
Firefox
(
**
kw
)
xvfb
=
browser
=
None
if
0
:
if
not
(
debug
and
os
.
getenv
(
'DISPLAY'
)):
xvfb
=
Xvfb
(
self
.
instance_home
)
print
(
"
\
n
Set 'erp5_debug_mode' environment variable to 1"
" to use your existing display instead of Xvfb."
)
xvfb
.
run
()
capabilities
=
webdriver
.
common
.
desired_capabilities
\
.
DesiredCapabilities
.
FIREFOX
.
copy
()
capabilities
[
'marionette'
]
=
True
# Zope is accessed through apache with a certificate not trusted by firefox
capabilities
[
'acceptInsecureCerts'
]
=
True
# Service workers are disabled on Firefox 52 ESR:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1338144
options
=
webdriver
.
FirefoxOptions
()
options
.
set_preference
(
'dom.serviceWorkers.enabled'
,
True
)
kw
=
dict
(
capabilities
=
capabilities
,
options
=
options
)
firefox_bin
=
os
.
environ
.
get
(
'firefox_bin'
)
if
firefox_bin
:
geckodriver
=
os
.
path
.
join
(
os
.
path
.
dirname
(
firefox_bin
),
'geckodriver'
)
kw
.
update
(
firefox_binary
=
firefox_bin
,
executable_path
=
geckodriver
)
browser
=
webdriver
.
Firefox
(
**
kw
)
else
:
# workaround for https://github.com/SeleniumHQ/selenium/issues/6534
# TODO: version up selenium
if
0
:
executor
=
RemoteConnection
(
'https://selenium:jefmnwhzsral@[2001:67c:1254:26::40e6]:9443/wd/hub'
,
keep_alive
=
True
)
import
urllib3
executor
.
_conn
=
urllib3
.
PoolManager
(
cert_reqs
=
'CERT_NONE'
,
ca_certs
=
None
)
else
:
executor
=
'http://10.0.128.126:4444/wd/hub'
browser
=
webdriver
.
Remote
(
command_executor
=
executor
,
desired_capabilities
=
{
'browserName'
:
'firefox'
,
# or chrome
#'version': '52.9.0esr',
#'version': '68.0.2esr',
'acceptInsecureCerts'
:
True
,
})
# browser.set_window_size()
"""
Editor Delete Cell
Maximize Gadget Editor
Sort in the Editor
Sum Column Updated
Editing Sum Column Updates all Cells ( precision 2 )
"""
"""
Editor Copy and Paste
Adding a New Line
Editor Copy and Paste Using , as Decimal Separator
Editor Delete Cell
Editor Refuses Duplicate Cell Coordinates
Editor Refuses Unknown Dimensions
Maximize Gadget Editor
Sort in the Editor
Sum Column Updated
"""
start_time
=
time
.
time
()
browser
.
get
(
self
.
_getTestBaseURL
()
+
'/login_form'
)
login_field
=
WebDriverWait
(
browser
,
10
).
until
(
...
...
@@ -244,9 +290,11 @@ class FunctionalTestRunner:
).
encode
(
'UTF-8'
),
html_parser
)
browser
.
quit
()
finally
:
xvfb
.
quit
()
if
browser
:
browser
.
quit
()
if
xvfb
:
xvfb
.
quit
()
return
iframe
def
processResult
(
self
,
iframe
):
...
...
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