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
Frederic Thoma
erp5
Commits
1dff572b
Commit
1dff572b
authored
Jul 23, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
benchmark: createWebPage: Improve and debug script
parent
ac7728b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
36 deletions
+23
-36
erp5/util/benchmark/examples/createWebPage.py
erp5/util/benchmark/examples/createWebPage.py
+23
-36
No files found.
erp5/util/benchmark/examples/createWebPage.py
View file @
1dff572b
...
@@ -4,31 +4,18 @@ import datetime
...
@@ -4,31 +4,18 @@ import datetime
import
random
import
random
import
time
import
time
import
string
import
string
import
genericToolToFillForm
from
utils
import
*
from
utils
import
*
PREFIX_TITLE
=
""
PREFIX_TITLE
=
""
if
False
:
TMIN_SLEEP_SHORT
=
2
TMIN_SLEEP_SHORT
=
0
# 2
TMAX_SLEEP_SHORT
=
6
TMAX_SLEEP_SHORT
=
0
# 6
TMIN_SLEEP
=
5
TMIN_SLEEP
=
0
# 5
TMAX_SLEEP
=
15
TMAX_SLEEP
=
0
# 15
TMIN_SLEEP_LONG
=
10
TMIN_SLEEP_LONG
=
0
# 10
TMAX_SLEEP_LONG
=
30
TMAX_SLEEP_LONG
=
0
# 30
NUMMAX_FOLLOW_UP
=
1
NUMMAX_FOLLOW_UP
=
0
NUMMAX_CONTRIBUTORS
=
2
NUMMAX_CONTRIBUTORS
=
0
else
:
TMIN_SLEEP_SHORT
=
2
TMAX_SLEEP_SHORT
=
6
TMIN_SLEEP
=
5
TMAX_SLEEP
=
15
TMIN_SLEEP_LONG
=
10
TMAX_SLEEP_LONG
=
30
NUMMAX_FOLLOW_UP
=
1
NUMMAX_CONTRIBUTORS
=
2
def
createWebPage
(
result
,
browser
):
def
createWebPage
(
result
,
browser
):
"""
"""
...
@@ -65,22 +52,22 @@ def createWebPage(result, browser):
...
@@ -65,22 +52,22 @@ def createWebPage(result, browser):
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_effective_date_day'
).
value
=
str
(
date
.
day
)
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_effective_date_day'
).
value
=
str
(
date
.
day
)
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_effective_date_month'
).
value
=
str
(
date
.
month
)
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_effective_date_month'
).
value
=
str
(
date
.
month
)
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_effective_date_year'
).
value
=
str
(
date
.
year
)
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_effective_date_year'
).
value
=
str
(
date
.
year
)
select
_random_o
ption
(
browser
,
"subfield_field_my_publication_section_list_default:list"
)
select
RandomO
ption
(
browser
,
"subfield_field_my_publication_section_list_default:list"
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_description'
).
value
=
'Benchmark test'
browser
.
mainForm
.
getControl
(
name
=
'field_my_description'
).
value
=
'Benchmark test'
select
_random_o
ption
(
browser
,
"field_my_classification"
)
select
RandomO
ption
(
browser
,
"field_my_classification"
)
select
_random_o
ption
(
browser
,
"subfield_field_my_group_list_default:list"
)
select
RandomO
ption
(
browser
,
"subfield_field_my_group_list_default:list"
)
select
_random_o
ption
(
browser
,
"subfield_field_my_site_list_default:list"
)
select
RandomO
ption
(
browser
,
"subfield_field_my_site_list_default:list"
)
select
_random_o
ption
(
browser
,
"subfield_field_my_function_list_default:list"
)
select
RandomO
ption
(
browser
,
"subfield_field_my_function_list_default:list"
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_subject_list'
).
value
=
gen
_s
tring
(
30
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_subject_list'
).
value
=
gen
erateS
tring
(
30
)
## Fill the Follow-up input
## Fill the Follow-up input
fill
_related_o
bjects
(
browser
,
result
,
fill
RelatedO
bjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
NUMMAX_FOLLOW_UP
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
NUMMAX_FOLLOW_UP
,
"FollowUp"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
"FollowUp"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
## Fill the Contributors input
## Fill the Contributors input
fill
_related_o
bjects
(
browser
,
result
,
fill
RelatedO
bjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog1:method"
,
NUMMAX_CONTRIBUTORS
,
"portal_selections/viewSearchRelatedDocumentDialog1:method"
,
NUMMAX_CONTRIBUTORS
,
"Contributors"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
"Contributors"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
...
@@ -89,30 +76,30 @@ def createWebPage(result, browser):
...
@@ -89,30 +76,30 @@ def createWebPage(result, browser):
# Check whether the changes have been successfully updated
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
WebP
age_url
=
browser
.
url
web_p
age_url
=
browser
.
url
## Edit the relations with other existing documents
## Edit the relations with other existing documents
# Go to the Related Documents view
# Go to the Related Documents view
browser
.
open
(
WebP
age_url
+
"/Document_viewRelated"
)
browser
.
open
(
web_p
age_url
+
"/Document_viewRelated"
)
# Fill the Referenced Documents input
# Fill the Referenced Documents input
fill
_related_o
bjects
(
browser
,
result
,
fill
RelatedO
bjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
3
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
3
,
"ReferencedDocument"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
"ReferencedDocument"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
# Fill the Similar Documents input
# Fill the Similar Documents input
fill
_related_o
bjects
(
browser
,
result
,
fill
RelatedO
bjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog1:method"
,
3
,
"portal_selections/viewSearchRelatedDocumentDialog1:method"
,
3
,
" SimilarDocuments"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
" SimilarDocuments"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
# Fill the Related Documents input
# Fill the Related Documents input
#fill
_related_o
bjects(browser, result,
#fill
RelatedO
bjects(browser, result,
# "portal_selections/viewSearchRelatedDocumentDialog2:method", 3,
# "portal_selections/viewSearchRelatedDocumentDialog2:method", 3,
# "RelatedDocuments", TMIN_SLEEP_SHORT, TMAX_SLEEP_SHORT)
# "RelatedDocuments", TMIN_SLEEP_SHORT, TMAX_SLEEP_SHORT)
## Edit content
## Edit content
WebPage_url
=
'/'
.
join
(
WebP
age_url
.
split
(
'/'
)[:
-
1
])
web_page_url
=
'/'
.
join
(
web_p
age_url
.
split
(
'/'
)[:
-
1
])
browser
.
open
(
WebP
age_url
+
"/WebPage_viewEditor"
)
browser
.
open
(
web_p
age_url
+
"/WebPage_viewEditor"
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_text_content'
).
value
=
'<html><body><h1>Test</h1><p>Content of test</p></body></html>'
browser
.
mainForm
.
getControl
(
name
=
'field_my_text_content'
).
value
=
'<html><body><h1>Test</h1><p>Content of test</p></body></html>'
# Submit the changes, record the time elapsed in seconds
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP_LONG
,
TMAX_SLEEP_LONG
)))
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP_LONG
,
TMAX_SLEEP_LONG
)))
...
...
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