@@ -44,6 +44,8 @@ def tearDownModule():
4444
4545class TestVtctldWeb (unittest .TestCase ):
4646
47+ WEBDRIVER_TIMEOUT_S = 10
48+
4749 @classmethod
4850 def setUpClass (cls ):
4951 """Set up two keyspaces: one unsharded, one with two shards."""
@@ -95,7 +97,7 @@ def _get_keyspaces(self):
9597 def _get_keyspace_element (self , keyspace_name ):
9698 """Get a specific keyspace element given a keyspace name."""
9799 element_id = '%s-card' % keyspace_name
98- wait = WebDriverWait (self .driver , 5 )
100+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
99101 wait .until (expected_conditions .visibility_of_element_located (
100102 (By .ID , element_id )))
101103 return self .driver .find_element_by_id (element_id )
@@ -130,7 +132,7 @@ def _get_tablet_names(self):
130132 [(x .split (' ' )[0 ], x .split (' ' )[1 ][1 :- 1 ]) for x in tablet_titles ])
131133
132134 def _get_shard_record_keyspace_shard (self ):
133- wait = WebDriverWait (self .driver , 5 )
135+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
134136 wait .until (expected_conditions .visibility_of_element_located (
135137 (By .ID , 'keyspace-shard' )))
136138 return self .driver .find_element_by_id ('keyspace-shard' ).text
@@ -248,7 +250,7 @@ def _check_new_view(
248250 def _navigate_to_dashboard (self ):
249251 logging .info ('Fetching main vtctld page: %s' , self .vtctld_addr )
250252 self .driver .get ('%s/app2' % self .vtctld_addr )
251- wait = WebDriverWait (self .driver , 10 )
253+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
252254 wait .until (expected_conditions .visibility_of_element_located (
253255 (By .ID , 'test_keyspace' )))
254256
@@ -261,7 +263,7 @@ def _navigate_to_keyspace_view(self):
261263 first_keyspace_card = keyspace_cards [0 ]
262264 shard_stats = first_keyspace_card .find_element_by_tag_name ('md-list' )
263265 shard_stats .click ()
264- wait = WebDriverWait (self .driver , 10 )
266+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
265267 wait .until (expected_conditions .visibility_of_element_located (
266268 (By .CLASS_NAME , 'vt-card' )))
267269
@@ -274,14 +276,14 @@ def _navigate_to_shard_view(self):
274276
275277 first_shard_card = shard_cards [0 ]
276278 first_shard_card .click ()
277- wait = WebDriverWait (self .driver , 10 )
279+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
278280 wait .until (expected_conditions .visibility_of_element_located (
279281 (By .ID , '1' )))
280282
281283 # Get Elements
282284 def _get_dashboard_keyspaces (self ):
283285 """Get list of all present keyspaces."""
284- wait = WebDriverWait (self .driver , 10 )
286+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
285287 wait .until (expected_conditions .visibility_of_element_located (
286288 (By .TAG_NAME , 'vt-dashboard' )))
287289 dashboard_content = self .driver .find_element_by_tag_name ('vt-dashboard' )
@@ -290,23 +292,23 @@ def _get_dashboard_keyspaces(self):
290292
291293 def _get_dashboard_shards (self ):
292294 """Get list of all present shards."""
293- wait = WebDriverWait (self .driver , 10 )
295+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
294296 wait .until (expected_conditions .visibility_of_element_located (
295297 (By .TAG_NAME , 'vt-dashboard' )))
296298 dashboard_content = self .driver .find_element_by_tag_name ('vt-dashboard' )
297299 return [sh .text for sh in
298300 dashboard_content .find_elements_by_class_name ('vt-shard-stats' )]
299301
300302 def _get_keyspace_shards (self ):
301- wait = WebDriverWait (self .driver , 10 )
303+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
302304 wait .until (expected_conditions .visibility_of_element_located (
303305 (By .TAG_NAME , 'vt-keyspace-view' )))
304306 keyspace_content = self .driver .find_element_by_tag_name ('vt-keyspace-view' )
305307 return [sh .text for sh in
306308 keyspace_content .find_elements_by_class_name ('vt-serving-shard' )]
307309
308310 def _get_shard_tablets (self ):
309- wait = WebDriverWait (self .driver , 10 )
311+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
310312 wait .until (expected_conditions .visibility_of_element_located (
311313 (By .TAG_NAME , 'vt-shard-view' )))
312314 shard_content = self .driver .find_element_by_tag_name ('vt-shard-view' )
@@ -543,7 +545,7 @@ def test_realtime_stats(self):
543545 self .driver .get ('%s/app2' % self .vtctld_addr )
544546 status_button = self .driver .find_element_by_partial_link_text ('Status' )
545547 status_button .click ()
546- wait = WebDriverWait (self .driver , 10 )
548+ wait = WebDriverWait (self .driver , self . WEBDRIVER_TIMEOUT_S )
547549 wait .until (expected_conditions .visibility_of_element_located (
548550 (By .TAG_NAME , 'vt-status' )))
549551
0 commit comments