forked from cory/tildefriends
		
	tests: Work around an intermittent -t=auto failure. The 'Edit Profile' click is getting lost as things rapidly update? I haven't ever seen it as a human clicking.
This commit is contained in:
		@@ -16,8 +16,9 @@ from selenium.webdriver.common.by import By
 | 
			
		||||
from selenium.webdriver.support import expected_conditions
 | 
			
		||||
from selenium.webdriver.support.ui import WebDriverWait
 | 
			
		||||
 | 
			
		||||
def select(driver, path, action = None):
 | 
			
		||||
def select(driver, path, action = None, keep_trying = False):
 | 
			
		||||
	start_time = time.time()
 | 
			
		||||
	done = False
 | 
			
		||||
	while True:
 | 
			
		||||
		try:
 | 
			
		||||
			driver.switch_to.default_content()
 | 
			
		||||
@@ -47,13 +48,17 @@ def select(driver, path, action = None):
 | 
			
		||||
					context.clear()
 | 
			
		||||
				else:
 | 
			
		||||
					raise RuntimeError(f'Unexpected action: {action}.')
 | 
			
		||||
				break
 | 
			
		||||
				done = True
 | 
			
		||||
				if not keep_trying:
 | 
			
		||||
					break
 | 
			
		||||
			else:
 | 
			
		||||
				return context
 | 
			
		||||
		except (selenium.common.exceptions.NoSuchElementException,
 | 
			
		||||
				selenium.common.exceptions.NoSuchShadowRootException,
 | 
			
		||||
				selenium.common.exceptions.StaleElementReferenceException,
 | 
			
		||||
				selenium.common.exceptions.WebDriverException):
 | 
			
		||||
			if done and keep_trying:
 | 
			
		||||
				break
 | 
			
		||||
			if time.time() - start_time < 5.0:
 | 
			
		||||
				time.sleep(0.1)
 | 
			
		||||
				pass
 | 
			
		||||
@@ -99,7 +104,7 @@ try:
 | 
			
		||||
	select(driver, ['tf-navigation', 'shadow_root', '#identity'], ('click',))
 | 
			
		||||
	select(driver, ['tf-navigation', 'shadow_root', '#id_dropdown', '//button[position()=2]'], ('click',))
 | 
			
		||||
 | 
			
		||||
	select(driver, ['#document', 'frame', 'tf-app', 'shadow_root', '#tf-tab-news', 'shadow_root', '.tf-profile', 'shadow_root', '#edit_profile'], ('click',))
 | 
			
		||||
	select(driver, ['#document', 'frame', 'tf-app', 'shadow_root', '#tf-tab-news', 'shadow_root', '.tf-profile', 'shadow_root', '#edit_profile'], ('click',), keep_trying = True)
 | 
			
		||||
	select(driver, ['#document', 'frame', 'tf-app', 'shadow_root', '#tf-tab-news', 'shadow_root', '.tf-profile', 'shadow_root', '#name'], ('send_keys', 'user'))
 | 
			
		||||
	select(driver, ['#document', 'frame', 'tf-app', 'shadow_root', '#tf-tab-news', 'shadow_root', '.tf-profile', 'shadow_root', '#save_profile'], ('click',))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user