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
Xiaowu Zhang
erp5
Commits
1e81d39e
Commit
1e81d39e
authored
Jun 20, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to wait for activities in Browser before continuing performance script.
parent
579b6a50
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
erp5/util/testbrowser/browser.py
erp5/util/testbrowser/browser.py
+27
-0
No files found.
erp5/util/testbrowser/browser.py
View file @
1e81d39e
...
@@ -566,6 +566,33 @@ class Browser(ExtendedTestBrowser):
...
@@ -566,6 +566,33 @@ class Browser(ExtendedTestBrowser):
return
activity_counter
return
activity_counter
def
waitForActivity
(
self
,
interval
=
20
,
maximum_attempt_number
=
30
):
"""
Wait for activities every C{interval} seconds at most
C{maximum_attempt_number} of times and return the waiting time (excluding
loading time to get the number of remaining time).
This is mainly relevant when a setup script triggering activities has to
be executed before running the actual script.
@param interval: Interval between checking for remaining activities
@type interval: int
@param maximum_attempt_number: Number of attempts before failing
@type maximum_attempt_number: int
@return: Number of seconds spent waiting
@rtype: int
"""
current_attempt_counter
=
0
while
current_attempt_counter
<
maximum_attempt_number
:
if
self
.
getRemainingActivityCounter
()
==
0
:
return
current_attempt_counter
*
interval
time
.
sleep
(
interval
)
current_attempt_counter
+=
1
raise
AssertionError
(
"Maximum number of attempts reached while waiting "
"for activities to be processed"
)
from
zope.testbrowser.browser
import
Form
,
ListControl
from
zope.testbrowser.browser
import
Form
,
ListControl
class
LoginError
(
Exception
):
class
LoginError
(
Exception
):
...
...
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