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>`;
|
</button>`;
|
||||||
}
|
}
|
||||||
edit = html`
|
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
|
Save Profile
|
||||||
</button>
|
</button>
|
||||||
<button class="w3-button w3-theme-d1" @click=${this.discard_edits}>
|
<button class="w3-button w3-theme-d1" @click=${this.discard_edits}>
|
||||||
@ -242,7 +242,7 @@ class TfProfileElement extends LitElement {
|
|||||||
${server_follow}
|
${server_follow}
|
||||||
`;
|
`;
|
||||||
} else {
|
} 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
|
Edit Profile
|
||||||
</button>`;
|
</button>`;
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,7 @@ class TfTabNewsElement extends LitElement {
|
|||||||
render() {
|
render() {
|
||||||
let profile = this.hash.startsWith('#@')
|
let profile = this.hash.startsWith('#@')
|
||||||
? html`<tf-profile
|
? html`<tf-profile
|
||||||
|
class="tf-profile"
|
||||||
id=${this.hash.substring(1)}
|
id=${this.hash.substring(1)}
|
||||||
whoami=${this.whoami}
|
whoami=${this.whoami}
|
||||||
.users=${this.users}
|
.users=${this.users}
|
||||||
|
@ -172,6 +172,7 @@ class TfNavigationElement extends LitElement {
|
|||||||
Manage Identities...
|
Manage Identities...
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
id="edit_profile"
|
||||||
class="w3-bar-item w3-button w3-border"
|
class="w3-bar-item w3-button w3-border"
|
||||||
@click=${self.edit_profile}
|
@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;
|
active_identity_work_t* request = user_data;
|
||||||
if (!*request->identity)
|
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);
|
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)
|
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))
|
if (!JS_IsUndefined(stub->_on_exit))
|
||||||
{
|
{
|
||||||
JSValue ref = JS_DupValue(context, 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);
|
JSValue result = JS_Call(context, stub->_on_exit, JS_NULL, 2, argv);
|
||||||
tf_util_report_error(context, result);
|
tf_util_report_error(context, result);
|
||||||
JS_FreeValue(context, result);
|
JS_FreeValue(context, result);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "util.js.h"
|
#include "util.js.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.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)
|
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);
|
tf_printf("Process exit %" PRId64 " signal=%d.\n", status, termination_signal);
|
||||||
assert(WEXITSTATUS(status) == 0);
|
assert(status == 0);
|
||||||
process->data = NULL;
|
process->data = NULL;
|
||||||
uv_close((uv_handle_t*)process, 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);
|
int spawn_result = uv_spawn(&loop, &process, &process_options);
|
||||||
if (spawn_result)
|
if (spawn_result)
|
||||||
{
|
{
|
||||||
|
tf_printf("uv_spawn: %s\n", uv_strerror(spawn_result));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,6 +972,7 @@ static void _test_auto(const tf_test_options_t* options)
|
|||||||
spawn_result = uv_spawn(&loop, &selenium, &process_options);
|
spawn_result = uv_spawn(&loop, &selenium, &process_options);
|
||||||
if (spawn_result)
|
if (spawn_result)
|
||||||
{
|
{
|
||||||
|
tf_printf("uv_spawn: %s\n", uv_strerror(spawn_result));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,39 @@ try:
|
|||||||
driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'loginButton').click()
|
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')))
|
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/')
|
driver.get('http://localhost:8888/~testuser/test/')
|
||||||
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
||||||
while True:
|
while True:
|
||||||
@ -71,13 +104,18 @@ try:
|
|||||||
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.LINK_TEXT, 'edit').click()
|
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 = driver.find_element(By.ID, 'editor').find_element(By.CLASS_NAME, 'cm-content')
|
||||||
editor.click()
|
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()
|
driver.find_element(By.ID, 'save').click()
|
||||||
|
|
||||||
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
||||||
driver.switch_to.frame(driver.find_element(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')))
|
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()
|
driver.switch_to.default_content()
|
||||||
editor = driver.find_element(By.ID, 'editor').find_element(By.CLASS_NAME, 'cm-content')
|
editor = driver.find_element(By.ID, 'editor').find_element(By.CLASS_NAME, 'cm-content')
|
||||||
editor.click()
|
editor.click()
|
||||||
@ -101,17 +139,20 @@ try:
|
|||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.LINK_TEXT, 'edit').click()
|
||||||
|
|
||||||
driver.get('http://localhost:8888')
|
driver.get('http://localhost:8888')
|
||||||
|
|
||||||
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
|
||||||
driver.switch_to.frame(driver.find_element(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()
|
wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'identity'))).click()
|
||||||
|
|
||||||
# StaleElementReferenceException
|
# StaleElementReferenceException
|
||||||
|
Loading…
Reference in New Issue
Block a user