chore: Fix iOS app management functional tests#575
chore: Fix iOS app management functional tests#575ki4070ma merged 16 commits intoappium:masterfrom ki4070ma:fix-app-mgmt-tc
Conversation
|
Will handle failed android tests with SDK 30 by #576 since it will take more time . |
| self.driver.start_activity(APIDEMO_PKG_NAME, ".ApiDemos") | ||
| self._assert_activity_contains('Demos') | ||
|
|
||
| self.driver.start_activity("com.android.calculator2", ".Calculator") |
test/functional/test_helper.py
Outdated
| """ | ||
| for i in range(timeout + 1): | ||
| if method(): | ||
| return True |
There was a problem hiding this comment.
I would rather return the result of the method itself. this should not necessarily be a boolean value
There was a problem hiding this comment.
Humm, in my understanding, I'm not sure how it can wait for target Callable if it isn't boolean.
Would you give more details?
test/functional/test_helper.py
Outdated
| return os.getenv('CI', 'false') == 'true' | ||
|
|
||
|
|
||
| def wait_for(method: Callable, timeout: int) -> bool: |
There was a problem hiding this comment.
I usually prefer to explicitly mention the time unit for variables (e.g. timeout -> timeout_sec). Also, it makes sense to have a default value (e.g. 5) for it and make it float, so we could provide timeouts lesser than one seconds. It also makes sense to make the interval configurable
There was a problem hiding this comment.
sure:
result = callable()
if result:
return result
There was a problem hiding this comment.
we could even use
if result := callable():
return result
if we drop the support of py37 :-P
There was a problem hiding this comment.
@mykola-mokhnach
Thanks for details.
Ah, yes, actually it popped into my head,
but as my thoughts, it could extend this method usage, but extended usage is limited for "user".
But it's ok since "user" is developer. I'll change it to suggestion. 👍
test/functional/test_helper.py
Outdated
| """ | ||
| result = method() | ||
| for i in range(int(timeout_sec / interval)): | ||
| if i != 0: |
test/functional/test_helper.py
Outdated
|
|
||
| """ | ||
| result = method() | ||
| for i in range(int(timeout_sec / interval)): |
There was a problem hiding this comment.
I would rather use while loop and compare with the time.time() value:
started = time.time()
while time.time() - started <= timeout_sec:
....
test/functional/test_helper.py
Outdated
| for i in range(int(timeout_sec / interval)): | ||
| if i != 0: | ||
| result = method() | ||
| if interval <= 0: |
There was a problem hiding this comment.
zero interval is also fine
test/functional/test_helper.py
Outdated
| result = method() | ||
| if result: | ||
| break | ||
| sleep(interval) |
Background