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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
bea28e78
Commit
bea28e78
authored
Jan 17, 2020
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5TypeFunctionalTestCase: Use login_form to get authentication cookie.
Like a real-world user.
parent
cf7b8110
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
+21
-8
No files found.
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
View file @
bea28e78
...
@@ -80,7 +80,7 @@ selenium.webdriver.common.utils.join_host_port = join_host_port
...
@@ -80,7 +80,7 @@ selenium.webdriver.common.utils.join_host_port = join_host_port
# /selenium workaround
# /selenium workaround
ZELENIUM_BASE_URL
=
"%s/portal_tests/%s/core/TestRunner.html?test=../test_suite_html&auto=on&resultsUrl=../postResults
&__ac_name=%s&__ac_password=%s
"
ZELENIUM_BASE_URL
=
"%s/portal_tests/%s/core/TestRunner.html?test=../test_suite_html&auto=on&resultsUrl=../postResults"
tests_framework_home
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
tests_framework_home
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
# handle 'system global' instance
# handle 'system global' instance
...
@@ -171,18 +171,18 @@ class FunctionalTestRunner:
...
@@ -171,18 +171,18 @@ class FunctionalTestRunner:
transaction
.
begin
()
transaction
.
begin
()
return
self
.
portal
.
portal_tests
.
TestTool_getResults
(
self
.
run_only
)
return
self
.
portal
.
portal_tests
.
TestTool_getResults
(
self
.
run_only
)
def
_getTestURL
(
self
):
def
_getTest
Base
URL
(
self
):
# Access the https proxy in front of runUnitTest's zserver
# Access the https proxy in front of runUnitTest's zserver
base_url
=
os
.
getenv
(
'zserver_frontend_url'
)
base_url
=
os
.
getenv
(
'zserver_frontend_url'
)
if
base_url
:
if
base_url
:
base_url
=
'%s%s'
%
(
base_url
,
self
.
portal
.
getId
())
return
'%s%s'
%
(
base_url
,
self
.
portal
.
getId
())
else
:
return
self
.
portal
.
portal_url
()
base_url
=
self
.
portal
.
portal_url
()
def
_getTestURL
(
self
):
return
ZELENIUM_BASE_URL
%
(
return
ZELENIUM_BASE_URL
%
(
base_url
,
self
.
_getTestBaseURL
()
,
self
.
run_only
,
self
.
run_only
,
self
.
user
,
)
self
.
password
)
def
test
(
self
,
debug
=
0
):
def
test
(
self
,
debug
=
0
):
xvfb
=
Xvfb
(
self
.
instance_home
)
xvfb
=
Xvfb
(
self
.
instance_home
)
...
@@ -207,6 +207,19 @@ class FunctionalTestRunner:
...
@@ -207,6 +207,19 @@ 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
()
browser
.
get
(
self
.
_getTestBaseURL
()
+
'/login_form'
)
login_field
=
WebDriverWait
(
browser
,
10
).
until
(
EC
.
presence_of_element_located
((
By
.
NAME
,
'__ac_name'
)),
)
login_field
.
clear
()
login_field
.
send_keys
(
self
.
user
)
password_field
=
browser
.
find_element_by_name
(
'__ac_password'
)
password_field
.
clear
()
password_field
.
send_keys
(
self
.
password
)
login_form_url
=
browser
.
current_url
password_field
.
submit
()
WebDriverWait
(
browser
,
10
).
until
(
EC
.
url_changes
(
login_form_url
))
WebDriverWait
(
browser
,
10
).
until
(
EC
.
presence_of_element_located
((
By
.
TAG_NAME
,
'body'
)))
browser
.
get
(
self
.
_getTestURL
())
browser
.
get
(
self
.
_getTestURL
())
WebDriverWait
(
browser
,
10
).
until
(
EC
.
presence_of_element_located
((
WebDriverWait
(
browser
,
10
).
until
(
EC
.
presence_of_element_located
((
...
...
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