Skip to content

Commit

Permalink
Add some timeout helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrichau committed Feb 28, 2024
1 parent b5e4ed5 commit aa6a233
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
@@ -0,0 +1,4 @@
misc.
waitUntil: aCondition ifTimeout: timeoutBlock

^ self waitUntil: aCondition ifTimeout: timeoutBlock times100MsToWait: 50
@@ -0,0 +1,9 @@
misc.
waitUntil: aCondition ifTimeout: timeoutBlock times100MsToWait: times

| delay100ms |
delay100ms := Delay forMilliseconds: 100.
times timesRepeat: [
aCondition value ifTrue: [ ^ true ]
ifFalse: [ delay100ms wait ] ].
^ timeoutBlock value
@@ -0,0 +1,10 @@
misc.
waitUntilNoBPNoSuchElementExceptionIn: aBlock

| delay100ms |
delay100ms := Delay forMilliseconds: 100.
30 timesRepeat: [
[ ^ aBlock value ]
on: BPNoSuchElementException
do: [ :exc | delay100ms wait ] ].
^ self error: 'Timeout waiting for element to be available'
@@ -1 +1 @@
SystemOrganization addCategory: #'Parasol-Core'!
self packageOrganizer ensurePackage: #'Parasol-Core' withTags: #()!

0 comments on commit aa6a233

Please sign in to comment.