forked from cory/tildefriends
test: Use -t=auto to generate some screenshots, detect -t=auto failure more reliably, exercise setting the initial profile, and fix various bugs that fell out.
This commit is contained in:
@ -6,8 +6,8 @@ import sys
|
||||
import time
|
||||
|
||||
if sys.platform == 'haiku1':
|
||||
print('Automation tests are disabled on Haiku.')
|
||||
exit(0)
|
||||
print('Automation tests are disabled on Haiku.')
|
||||
exit(0)
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.firefox.service import Service
|
||||
@ -58,6 +58,39 @@ try:
|
||||
driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'loginButton').click()
|
||||
|
||||
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
||||
|
||||
driver.switch_to.default_content()
|
||||
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'create_identity').click()
|
||||
wait.until(expected_conditions.alert_is_present()).accept()
|
||||
|
||||
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
||||
|
||||
driver.switch_to.default_content()
|
||||
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'identity').click()
|
||||
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'id_dropdown').find_element(By.XPATH, '//button[position()=2]').click()
|
||||
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
||||
driver.switch_to.frame(driver.find_element(By.ID, 'document'))
|
||||
# NoSuchShadowRootException
|
||||
while True:
|
||||
try:
|
||||
tf_app = wait.until(expected_conditions.presence_of_element_located((By.TAG_NAME, 'tf-app'))).shadow_root
|
||||
break
|
||||
except:
|
||||
pass
|
||||
tf_tab_news = wait.until(exists_in_shadow_root(tf_app, By.ID, 'tf-tab-news')).shadow_root
|
||||
while True:
|
||||
try:
|
||||
tf_profile = wait.until(exists_in_shadow_root(tf_tab_news, By.CLASS_NAME, 'tf-profile')).shadow_root
|
||||
tf_profile.find_element(By.ID, 'edit_profile').click()
|
||||
break
|
||||
except:
|
||||
pass
|
||||
tf_profile.find_element(By.ID, 'name').send_keys('user')
|
||||
tf_profile.find_element(By.ID, 'save_profile').click()
|
||||
driver.switch_to.default_content()
|
||||
wait.until(expected_conditions.presence_of_element_located((By.XPATH, '//button[text()="✅ Allow"]'))).click()
|
||||
|
||||
driver.switch_to.default_content()
|
||||
driver.get('http://localhost:8888/~testuser/test/')
|
||||
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
||||
while True:
|
||||
@ -71,13 +104,18 @@ try:
|
||||
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.LINK_TEXT, 'edit').click()
|
||||
editor = driver.find_element(By.ID, 'editor').find_element(By.CLASS_NAME, 'cm-content')
|
||||
editor.click()
|
||||
editor.send_keys('app.setDocument("<div id=\'test-div\'>Hello, world!</div>")');
|
||||
editor.send_keys('app.setDocument(\n\t"<div id=\'test-div\'>Hello, world!</div>"\n);');
|
||||
driver.find_element(By.ID, 'save').click()
|
||||
|
||||
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, 'test-div')))
|
||||
|
||||
size = driver.get_window_size()
|
||||
driver.set_window_size(1200, 540)
|
||||
driver.save_screenshot('out/screenshot0.png')
|
||||
driver.set_window_size(size['width'], size['height'])
|
||||
|
||||
driver.switch_to.default_content()
|
||||
editor = driver.find_element(By.ID, 'editor').find_element(By.CLASS_NAME, 'cm-content')
|
||||
editor.click()
|
||||
@ -101,17 +139,20 @@ try:
|
||||
break
|
||||
except:
|
||||
pass
|
||||
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.LINK_TEXT, 'edit').click()
|
||||
|
||||
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'))
|
||||
wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'identity')))
|
||||
driver.switch_to.default_content()
|
||||
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'create_identity').click()
|
||||
wait.until(expected_conditions.alert_is_present()).accept()
|
||||
|
||||
driver.switch_to.frame(driver.find_element(By.ID, 'document'))
|
||||
wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'identity')))
|
||||
|
||||
size = driver.get_window_size()
|
||||
driver.set_window_size(540, 1200)
|
||||
driver.save_screenshot('out/screenshot1.png')
|
||||
driver.set_window_size(size['width'], size['height'])
|
||||
|
||||
wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'identity'))).click()
|
||||
|
||||
# StaleElementReferenceException
|
||||
|
Reference in New Issue
Block a user