Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c14bf98414 | ||
|
|
95c4233802 | ||
|
|
625940a017 |
@@ -57,10 +57,8 @@
|
||||
}
|
||||
|
||||
.auth-field-check input {
|
||||
width: auto;
|
||||
margin-top: 0.2rem;
|
||||
flex: none;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
|
||||
.auth-field-check a {
|
||||
|
||||
@@ -10,7 +10,6 @@ export class DeviiTerminal {
|
||||
this.avatar = null;
|
||||
this.bindEscapeTrigger();
|
||||
this.bindDoubleClickTrigger();
|
||||
this.bindOpenTrigger();
|
||||
this.ready = this.init();
|
||||
}
|
||||
|
||||
@@ -30,19 +29,16 @@ export class DeviiTerminal {
|
||||
this.element.setAttribute("avatar", "devii");
|
||||
document.body.appendChild(this.element);
|
||||
|
||||
this.maybeAutoOpen();
|
||||
this.bindTriggers();
|
||||
}
|
||||
|
||||
bindOpenTrigger() {
|
||||
document.addEventListener("click", (event) => {
|
||||
const trigger = event.target.closest("[data-devii-open]");
|
||||
if (!trigger) return;
|
||||
event.preventDefault();
|
||||
this.open(trigger.dataset.deviiPrompt || "");
|
||||
bindTriggers() {
|
||||
document.querySelectorAll("[data-devii-open]").forEach((trigger) => {
|
||||
trigger.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
this.open(trigger.dataset.deviiPrompt || "");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
maybeAutoOpen() {
|
||||
const stored = this.element && this.element.hasStoredState && this.element.hasStoredState();
|
||||
if (document.querySelector("[data-devii-autoopen]") && !stored) {
|
||||
this.open();
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<div class="auth-field auth-field-check">
|
||||
<label for="accept_terms">
|
||||
<input type="checkbox" id="accept_terms" name="accept_terms" value="1" required aria-required="true"{% if accept_terms %} checked{% endif %}>
|
||||
<span>I accept the <a href="/docs/terms.html" target="_blank" rel="noopener">Terms of Service</a> and the <a href="/docs/community-guidelines.html" target="_blank" rel="noopener">Community Guidelines</a>, and I have read the <a href="/docs/privacy.html" target="_blank" rel="noopener">Privacy Policy</a>.</span>
|
||||
I accept the <a href="/docs/terms.html" target="_blank" rel="noopener">Terms of Service</a> and the <a href="/docs/community-guidelines.html" target="_blank" rel="noopener">Community Guidelines</a>, and I have read the <a href="/docs/privacy.html" target="_blank" rel="noopener">Privacy Policy</a>.
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -125,13 +125,6 @@ def _port_in_use(port):
|
||||
return sock.connect_ex(("127.0.0.1", port)) == 0
|
||||
|
||||
|
||||
# Set once app_server has successfully started, so pytest_runtest_setup can
|
||||
# detect a mid-session crash (e.g. resource exhaustion on a constrained CI
|
||||
# runner) and fail every subsequent HTTP-dependent test with one clear
|
||||
# diagnostic instead of a wall of opaque connection-refused errors.
|
||||
_APP_SERVER_STATE = {"proc": None, "log_path": None}
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def app_server(test_db_path):
|
||||
if _port_in_use(PORT):
|
||||
@@ -199,11 +192,7 @@ def app_server(test_db_path):
|
||||
_set_setting("rate_limit_per_minute", "1000000")
|
||||
_set_setting("rate_limit_window_seconds", "60")
|
||||
|
||||
_APP_SERVER_STATE["proc"] = proc
|
||||
_APP_SERVER_STATE["log_path"] = log_file.name
|
||||
|
||||
yield proc
|
||||
_APP_SERVER_STATE["proc"] = None
|
||||
try:
|
||||
proc.terminate()
|
||||
proc.wait(timeout=10)
|
||||
@@ -218,27 +207,6 @@ def app_server(test_db_path):
|
||||
pass
|
||||
|
||||
|
||||
def pytest_runtest_setup(item):
|
||||
proc = _APP_SERVER_STATE["proc"]
|
||||
if proc is None or "tests/unit/" in item.nodeid:
|
||||
return
|
||||
exit_code = proc.poll()
|
||||
if exit_code is None:
|
||||
return
|
||||
log_path = _APP_SERVER_STATE["log_path"]
|
||||
try:
|
||||
with open(log_path, "r", errors="replace") as f:
|
||||
log_tail = f.read()[-5000:]
|
||||
except OSError:
|
||||
log_tail = "(log unavailable)"
|
||||
pytest.fail(
|
||||
f"app_server died mid-session (exit code {exit_code}). It was healthy "
|
||||
f"earlier in this run and has since crashed - this is a shared-server "
|
||||
f"failure, not a bug in {item.nodeid}. Server log tail:\n{log_tail}",
|
||||
pytrace=False,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def playwright_instance():
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
@@ -128,8 +128,7 @@ def test_steal_takes_build_and_pays_thief(bob):
|
||||
steal.click()
|
||||
confirm_btn = page.locator(".dialog-confirm")
|
||||
confirm_btn.wait_for(state="visible")
|
||||
with page.expect_response(lambda r: "/steal" in r.url and r.request.method == "POST"):
|
||||
confirm_btn.click()
|
||||
confirm_btn.click()
|
||||
expect(page.locator("form[data-game-action='steal']")).to_have_count(0)
|
||||
page.wait_for_timeout(400)
|
||||
assert _farm_coins("bob_test") == 18
|
||||
@@ -166,8 +165,7 @@ def test_victim_notification_names_the_raider_and_the_amount(bob):
|
||||
steal.click()
|
||||
confirm_btn = page.locator(".dialog-confirm")
|
||||
confirm_btn.wait_for(state="visible")
|
||||
with page.expect_response(lambda r: "/steal" in r.url and r.request.method == "POST"):
|
||||
confirm_btn.click()
|
||||
confirm_btn.click()
|
||||
expect(page.locator("form[data-game-action='steal']")).to_have_count(0)
|
||||
page.wait_for_timeout(400)
|
||||
note = get_table("notifications").find_one(
|
||||
|
||||
Reference in New Issue
Block a user