summaryrefslogtreecommitdiff
diff options
authorMaciej Kisielewski <maciej.kisielewski@canonical.com>2019-05-16 15:12:39 +0200
committerMaciej Kisielewski <maciej.kisielewski@canonical.com>2019-05-16 15:12:39 +0200
commit44ff09b1420e8c83405f10af61b51a40c10bd15f (patch)
treed61c802a0acf66a62e842fc29336cc4da3570133
parentdc41bc87e81b6dfd33311aff5af5ca62ae819722 (diff)
hotkey_tests: give terminal_hotkey test time to process the cmd
Signed-off-by: Maciej Kisielewski <maciej.kisielewski@canonical.com>
-rwxr-xr-xbin/hotkey_tests.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/hotkey_tests.py b/bin/hotkey_tests.py
index 2a9282b5..de7434d4 100755
--- a/bin/hotkey_tests.py
+++ b/bin/hotkey_tests.py
@@ -409,12 +409,16 @@ class HotKeyTesting:
time.sleep(2)
self.kb.type_text('touch {}'.format(filename))
self.kb.press_key(KeyCodes.KEY_ENTER)
- result = os.path.exists(filename)
- if not result:
- return result
- self.kb.press_key(KeyCodes.KEY_D, {'ctrl'})
- os.unlink(filename)
- return result
+ for attempt_no in range(10):
+ # let's wait some time to let X/terminal process the command
+ time.sleep(0.5)
+ if os.path.exists(filename):
+ self.kb.press_key(KeyCodes.KEY_D, {'ctrl'})
+ os.unlink(filename)
+ return True
+ else:
+ self.kb.press_key(KeyCodes.KEY_D, {'ctrl'})
+ return False
def main():