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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
5c4c85e3
Commit
5c4c85e3
authored
Sep 20, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5-util-benchmark: cleanup useless spaces
parent
35c854b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
39 deletions
+39
-39
erp5/util/benchmark/examples/createSaleOrder.py
erp5/util/benchmark/examples/createSaleOrder.py
+18
-18
erp5/util/benchmark/examples/createWebPage.py
erp5/util/benchmark/examples/createWebPage.py
+9
-9
erp5/util/benchmark/examples/utils.py
erp5/util/benchmark/examples/utils.py
+12
-12
No files found.
erp5/util/benchmark/examples/createSaleOrder.py
View file @
5c4c85e3
...
...
@@ -17,7 +17,7 @@ MAX_PRODUCT = 5
def
addOrderLine
(
browser
,
my_title
,
result
)
:
"""
Add an order line to the sale order
@param browser: Browser
@type browser: Browser
@param my_title: The sale order title
...
...
@@ -26,12 +26,12 @@ def addOrderLine(browser, my_title, result) :
# Create a new Sale Order Line
browser
.
mainForm
.
submitSelectAction
(
label
=
"Add Sale Order Line"
)
assert
browser
.
getTransitionMessage
()
==
'Object created.'
# Fill the quantity randomly
browser
.
mainForm
.
getControl
(
name
=
'field_my_quantity'
).
value
=
str
(
random
.
randint
(
1
,
20
))
result
(
'SetRelationProduct'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
## Choose the product randomly
fillRelatedObjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
1
,
...
...
@@ -54,20 +54,20 @@ def createSaleOrder(result, browser):
"""
# Open ERP5 homepage and log in
result
(
'Open'
,
browser
.
open
())
# Log in unless already logged in by a previous test suite
result
(
'Login'
,
browser
.
mainForm
.
submitLogin
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Go to sale Order module
result
(
'GotoModule'
,
result
(
'GotoModule'
,
browser
.
mainForm
.
submitSelectModule
(
value
=
'/sale_order_module'
,
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Create a new sale order and record the time elapsed in seconds
result
(
'Create'
,
result
(
'Create'
,
browser
.
mainForm
.
submitNew
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether it has been successfully created
assert
browser
.
getTransitionMessage
()
==
'Object created.'
my_order_sale_url
=
browser
.
url
.
split
(
"?"
)[
0
]
...
...
@@ -75,15 +75,15 @@ def createSaleOrder(result, browser):
# Fill the title
my_title
=
PREFIX_TITLE
+
generateString
(
6
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_title'
).
value
=
my_title
# Set some random informations
my_str
=
generateString
(
random
.
randint
(
1
,
100
))
browser
.
mainForm
.
getControl
(
name
=
'field_my_comment'
).
value
=
my_str
browser
.
mainForm
.
getControl
(
name
=
'field_my_description'
).
value
=
my_str
# Select some options randomly
selectRandomOption
(
browser
,
"field_my_order"
)
# Set dates
date
=
datetime
.
datetime
.
now
()
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_start_date_day'
).
value
=
str
(
date
.
day
)
...
...
@@ -92,7 +92,7 @@ def createSaleOrder(result, browser):
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
...
...
@@ -104,24 +104,24 @@ def createSaleOrder(result, browser):
# Click on the specified menu
result
(
'GoToSaleTradeConditionRelations'
,
browser
.
mainForm
.
getControl
(
name
=
"portal_selections/viewSearchRelatedDocumentDialog2:method"
).
click
())
assert
browser
.
getTransitionMessage
()
==
'Please select one object.'
assert
browser
.
getTransitionMessage
()
==
'Please select one object.'
line_number
=
browser
.
getListboxPosition
(
SALE_TRADE_CONDITION_NAME
,
column_number
=
2
)
# Check the box corresponding to line_number
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
click
()
result
(
'SubmitSaleTradeConditionRelation'
,
result
(
'SubmitSaleTradeConditionRelation'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
,
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Add Sale order lines
max_ite
=
random
.
randint
(
1
,
MAX_PRODUCT
)
for
i
in
range
(
0
,
max_ite
):
browser
.
open
(
sale_order_url
+
"/view"
)
addOrderLine
(
browser
,
my_title
,
result
)
browser
.
open
(
my_order_sale_url
)
# Validate the Sale Order
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'plan_action'
)
result
(
'Validate'
,
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'plan_action'
)
result
(
'Validate'
,
browser
.
mainForm
.
submitDialogConfirm
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
erp5/util/benchmark/examples/createWebPage.py
View file @
5c4c85e3
...
...
@@ -26,7 +26,7 @@ def createWebPage(result, browser):
"""
# Open ERP5 homepage
browser
.
open
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
# Log in unless already logged in by a previous test suite
browser
.
mainForm
.
submitLogin
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
...
...
@@ -58,25 +58,25 @@ def createWebPage(result, browser):
selectRandomOption
(
browser
,
"subfield_field_my_site_list_default:list"
)
selectRandomOption
(
browser
,
"subfield_field_my_function_list_default:list"
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_subject_list'
).
value
=
generateString
(
30
)
## Fill the Follow-up input
fillRelatedObjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
NUMMAX_FOLLOW_UP
,
"FollowUp"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
"FollowUp"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
web_page_url
=
browser
.
url
## Edit the relations with other existing documents
# Go to the Related Documents view
browser
.
open
(
web_page_url
+
"/Document_viewRelated"
)
# Fill the Referenced Documents input
fillRelatedObjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
3
,
...
...
@@ -102,6 +102,6 @@ def createWebPage(result, browser):
result
(
'Waiting for publish_action'
,
waiting_for_publish_action
)
result
(
'Show publish'
,
show_publish_time
)
result
(
'Published'
,
browser
.
mainForm
.
submitDialogConfirm
())
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
erp5/util/benchmark/examples/utils.py
View file @
5c4c85e3
...
...
@@ -4,7 +4,7 @@ import string
def
selectRandomOption
(
browser
,
select_name
):
"""
Function to select randomly an option
@param browser: Browser
@type browser: Browser
@param select_name: Name of the input
...
...
@@ -20,7 +20,7 @@ def selectRandomOption(browser, select_name):
def
generateString
(
size
)
:
"""
Function to generate a string randomly (a-z)
@param size: Size of the string
@type size: int
"""
...
...
@@ -32,7 +32,7 @@ def generateString(size) :
def
fillRelatedObjects
(
browser
,
result
,
name
,
maximum
=
1
,
actionName
=
""
,
TMIN_SLEEP
=
0
,
TMAX_SLEEP
=
0
,
col_num
=
0
,
text
=
""
)
:
"""
Function to fill randomly related objetcs
@param browser: browser
@type browser: Browser
@param result: result
...
...
@@ -52,7 +52,7 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
@param text: Text used to filter
@type text: string
"""
# Go to the section linked by the input
result
(
'GoTo '
+
actionName
+
' Relations'
,
browser
.
mainForm
.
getControl
(
name
=
name
).
click
())
...
...
@@ -64,12 +64,12 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
# Check if it is possible to choose many objects
if
(
browser
.
getTransitionMessage
()
==
'Please select one object.'
):
assert
(
maximum
<=
1
)
# Filter applied the 'col_num' column with text 'text'
if
col_num
!=
0
:
browser
.
mainForm
.
getListboxControl
(
line_number
=
2
,
column_number
=
col_num
).
value
=
text
browser
.
mainForm
.
submitDialogUpdate
()
# Get the number of lines
page_stop_number
=
browser
.
etree
.
xpath
(
'//span[@class="listbox-current-page-stop-number"]'
)
if
len
(
page_stop_number
)
>
0
:
...
...
@@ -84,10 +84,10 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
# Check the box corresponding to line_number if not already checked
if
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
selected
==
False
:
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
click
()
result
(
'Submit '
+
actionName
+
' Relations'
,
result
(
'Submit '
+
actionName
+
' Relations'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
,
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
...
...
@@ -96,16 +96,16 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
def
fillOneRelatedObjectSimplified
(
browser
,
name
):
"""
Function to fill randomly related objetcs
@param browser: browser
@type browser: Browser
@param name: Name of the input name attribute
@type name: string
"""
# Go to the section linked by the input
browser
.
mainForm
.
getControl
(
name
=
name
).
click
()
# Check the status
assert
(
browser
.
getTransitionMessage
()
==
'Please select one object.'
)
...
...
@@ -115,7 +115,7 @@ def fillOneRelatedObjectSimplified(browser, name):
num_line
=
int
(
page_stop_number
[
0
].
text
)
else
:
num_line
=
0
# Choose randomly one or more objects
if
num_line
>
0
:
line_number
=
random
.
randint
(
1
,
num_line
)
+
2
...
...
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