Index: components/proximity_auth/e2e_test/cros.py |
diff --git a/components/proximity_auth/e2e_test/cros.py b/components/proximity_auth/e2e_test/cros.py |
index 4c10226c2cfd94ab24ca2b4cbe5791a12ff5cd9a..fcc1e14aa932645e78f09c803b96ba22438c0c71 100644 |
--- a/components/proximity_auth/e2e_test/cros.py |
+++ b/components/proximity_auth/e2e_test/cros.py |
@@ -217,6 +217,7 @@ class SmartLockApp(object): |
PAIR = 'pair' |
CLICK_FOR_TRIAL_RUN = 'click_for_trial_run' |
TRIAL_RUN_COMPLETED = 'trial_run_completed' |
+ PROMOTE_SMARTLOCK_FOR_ANDROID = 'promote-smart-lock-for-android' |
def __init__(self, app_page, chromeos): |
""" |
@@ -240,6 +241,8 @@ class SmartLockApp(object): |
return SmartLockApp.PairingState.SCAN |
elif state == 'pair': |
return SmartLockApp.PairingState.PAIR |
+ elif state == 'promote-smart-lock-for-android': |
+ return SmartLockApp.PairingState.PROMOTE_SMARTLOCK_FOR_ANDROID |
elif state == 'complete': |
button_text = self._app_page.EvaluateJavaScript( |
'document.getElementById("pairing-button").textContent') |
@@ -282,6 +285,9 @@ class SmartLockApp(object): |
""" |
assert(self.pairing_state == self.PairingState.PAIR) |
self._ClickPairingButton() |
+ assert( |
Tim Song
2015/08/03 21:42:19
The PROMOTE_SMARTLOCK_FOR_ANDROID state doesn't al
vsankar
2015/08/03 22:32:13
Done.
|
+ self.pairing_state == self.PairingState.PROMOTE_SMARTLOCK_FOR_ANDROID) |
+ self._ClickPairingButton() |
return self.pairing_state == self.PairingState.CLICK_FOR_TRIAL_RUN |
def StartTrialRun(self): |
@@ -309,10 +315,14 @@ class SmartLockApp(object): |
'document.getElementById("pairing-button").click()') |
def _ClickPairingButton(self): |
+ # Waits are needed because the clicks occur before the button label changes. |
+ time.sleep(2) |
Tim Song
2015/08/03 21:42:18
Can you reduce the time to 1 second? I think that
vsankar
2015/08/03 22:32:13
Done.
|
self._app_page.EvaluateJavaScript( |
'document.getElementById("pairing-button").click()') |
+ time.sleep(2) |
util.WaitFor(lambda: self._app_page.EvaluateJavaScript( |
'!document.getElementById("pairing-button").disabled'), 60) |
+ time.sleep(2) |
util.WaitFor(lambda: self._app_page.EvaluateJavaScript( |
'!document.getElementById("pairing-button-title")' |
'.classList.contains("animated-fade-out")'), 5) |