From 5e265dfc83ee336ffb4d2a8716e8a344244645df Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 11 May 2024 09:03:56 -0400 Subject: [PATCH] Make sure the first user can admin. --- tools/autotest.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/autotest.py b/tools/autotest.py index 86320ebb..bcd28680 100755 --- a/tools/autotest.py +++ b/tools/autotest.py @@ -83,6 +83,13 @@ try: driver.switch_to.frame(wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))) id1 = wait.until(expected_conditions.presence_of_element_located((By.TAG_NAME, 'li'))).text.split(' ')[-1] + driver.get('http://localhost:8888/~core/admin/') + wait.until(expected_conditions.presence_of_element_located((By.ID, 'document'))) + driver.switch_to.frame(driver.find_element(By.ID, 'document')) + wait.until(expected_conditions.presence_of_element_located((By.ID, 'gs_room_name'))).send_keys('test room') + wait.until(expected_conditions.presence_of_element_located((By.XPATH, '//*[@id="gs_room_name"]/following-sibling::button'))).click() + driver.switch_to.alert.accept() + driver.get('http://localhost:8888') wait.until(expected_conditions.presence_of_element_located((By.ID, 'document'))) driver.switch_to.frame(driver.find_element(By.ID, 'document')) @@ -106,9 +113,15 @@ try: except: pass - tf_tab_news = wait.until(exists_in_shadow_root(tf_app, By.ID, 'tf-tab-news')).shadow_root - tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'edit').send_keys('Hello, world!') - tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'submit').click() + # WebDriverException (shadow root is detached) + while True: + try: + tf_tab_news = wait.until(exists_in_shadow_root(tf_app, By.ID, 'tf-tab-news')).shadow_root + tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'edit').send_keys('Hello, world!') + tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'submit').click() + break + except: + pass driver.switch_to.default_content() driver.find_element(By.ID, 'allow').click()