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.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 19m8s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 19m8s
This commit is contained in:
parent
28d2539432
commit
d9972cb349
@ -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,6 +48,8 @@ def select(driver, path, action = None):
|
||||
context.clear()
|
||||
else:
|
||||
raise RuntimeError(f'Unexpected action: {action}.')
|
||||
done = True
|
||||
if not keep_trying:
|
||||
break
|
||||
else:
|
||||
return context
|
||||
@ -54,6 +57,8 @@ def select(driver, path, action = None):
|
||||
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',))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user