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.
Some checks are pending
Build Tilde Friends / Build-All (push) Waiting to run
Some checks are pending
Build Tilde Friends / Build-All (push) Waiting to run
This commit is contained in:
parent
6e83c08535
commit
eb12ba6ed2
@ -233,7 +233,7 @@ class TfProfileElement extends LitElement {
|
||||
</button>`;
|
||||
}
|
||||
edit = html`
|
||||
<button class="w3-button w3-theme-d1" @click=${this.save_edits}>
|
||||
<button id="save_profile" class="w3-button w3-theme-d1" @click=${this.save_edits}>
|
||||
Save Profile
|
||||
</button>
|
||||
<button class="w3-button w3-theme-d1" @click=${this.discard_edits}>
|
||||
@ -242,7 +242,7 @@ class TfProfileElement extends LitElement {
|
||||
${server_follow}
|
||||
`;
|
||||
} else {
|
||||
edit = html`<button class="w3-button w3-theme-d1" @click=${this.edit}>
|
||||
edit = html`<button id="edit_profile" class="w3-button w3-theme-d1" @click=${this.edit}>
|
||||
Edit Profile
|
||||
</button>`;
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ class TfTabNewsElement extends LitElement {
|
||||
render() {
|
||||
let profile = this.hash.startsWith('#@')
|
||||
? html`<tf-profile
|
||||
class="tf-profile"
|
||||
id=${this.hash.substring(1)}
|
||||
whoami=${this.whoami}
|
||||
.users=${this.users}
|
||||
|
@ -172,6 +172,7 @@ class TfNavigationElement extends LitElement {
|
||||
Manage Identities...
|
||||
</button>
|
||||
<button
|
||||
id="edit_profile"
|
||||
class="w3-bar-item w3-button w3-border"
|
||||
@click=${self.edit_profile}
|
||||
>
|
||||
|
@ -642,7 +642,7 @@ static void _tf_ssb_getActiveIdentity_visit(const char* identity, void* user_dat
|
||||
active_identity_work_t* request = user_data;
|
||||
if (!*request->identity)
|
||||
{
|
||||
snprintf(request->identity, sizeof(request->identity), "%s", identity);
|
||||
snprintf(request->identity, sizeof(request->identity), "@%s", identity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -657,6 +657,11 @@ static void _tf_ssb_getActiveIdentity_work(tf_ssb_t* ssb, void* user_data)
|
||||
{
|
||||
tf_ssb_db_identity_visit(ssb, request->name, _tf_ssb_getActiveIdentity_visit, request);
|
||||
}
|
||||
|
||||
if (!*request->identity && tf_ssb_db_user_has_permission(ssb, request->name, "administration"))
|
||||
{
|
||||
tf_ssb_whoami(ssb, request->identity, sizeof(request->identity));
|
||||
}
|
||||
}
|
||||
|
||||
static void _tf_ssb_getActiveIdentity_after_work(tf_ssb_t* ssb, int status, void* user_data)
|
||||
|
@ -329,7 +329,7 @@ static void _taskstub_on_process_exit(uv_process_t* process, int64_t status, int
|
||||
if (!JS_IsUndefined(stub->_on_exit))
|
||||
{
|
||||
JSValue ref = JS_DupValue(context, stub->_on_exit);
|
||||
JSValue argv[] = { JS_NewInt32(context, status), JS_NewInt32(context, terminationSignal) };
|
||||
JSValue argv[] = { JS_NewInt64(context, status), JS_NewInt32(context, terminationSignal) };
|
||||
JSValue result = JS_Call(context, stub->_on_exit, JS_NULL, 2, argv);
|
||||
tf_util_report_error(context, result);
|
||||
JS_FreeValue(context, result);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "util.js.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -920,8 +921,8 @@ static void _test_pattern(const tf_test_options_t* options)
|
||||
|
||||
static void _test_auto_process_exit(uv_process_t* process, int64_t status, int termination_signal)
|
||||
{
|
||||
tf_printf("Process exit %d signal=%d.\n", (int)WEXITSTATUS(status), termination_signal);
|
||||
assert(WEXITSTATUS(status) == 0);
|
||||
tf_printf("Process exit %" PRId64 " signal=%d.\n", status, termination_signal);
|
||||
assert(status == 0);
|
||||
process->data = NULL;
|
||||
uv_close((uv_handle_t*)process, NULL);
|
||||
}
|
||||
@ -958,6 +959,7 @@ static void _test_auto(const tf_test_options_t* options)
|
||||
int spawn_result = uv_spawn(&loop, &process, &process_options);
|
||||
if (spawn_result)
|
||||
{
|
||||
tf_printf("uv_spawn: %s\n", uv_strerror(spawn_result));
|
||||
abort();
|
||||
}
|
||||
|
||||
@ -970,6 +972,7 @@ static void _test_auto(const tf_test_options_t* options)
|
||||
spawn_result = uv_spawn(&loop, &selenium, &process_options);
|
||||
if (spawn_result)
|
||||
{
|
||||
tf_printf("uv_spawn: %s\n", uv_strerror(spawn_result));
|
||||
abort();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user