feat: add daily commission history for Web 2.0.8

This commit is contained in:
AttilaNet
2026-11-13 09:59:43 +08:00
parent ad25d5b403
commit 296653d8d3
25 changed files with 2179 additions and 96 deletions
@@ -51,8 +51,22 @@ class PageLoadingBrowserTests(unittest.TestCase):
"details": {"help": "STATIC_HELP_SENTINEL", "note": "STATIC_NOTE_SENTINEL",
"notes": ["金币不足,等待补货"]}}}
self.hold, self.fail = False, False
self.hold_after_real_retry_click = False
self.page.add_init_script("""(() => {
window.__loadingRetryClicked = false;
document.addEventListener('click', event => {
if (event.target instanceof Element && event.target.closest('.page-panel[data-page="bag"] .page-error button')) {
window.__loadingRetryClicked = true;
}
}, true);
})();""")
def view(route):
if self.hold_after_real_retry_click:
if not self.page.evaluate("window.__loadingRetryClicked"):
route.fulfill(status=503, content_type="application/json", body='{"detail":"读取失败"}')
return
self.hold_after_real_retry_click = False
if self.hold:
self.pending.append(route)
elif self.fail:
@@ -156,8 +170,16 @@ class PageLoadingBrowserTests(unittest.TestCase):
expect(panel.locator(".page-error")).to_be_visible()
expect(panel).to_have_attribute("aria-busy", "false")
expect(panel.locator(".page-loading")).to_be_hidden()
# Passive polling must keep returning the error until the native click.
# Holding a passive request here would hide the button before it can click.
self.hold_after_real_retry_click = True
self.hold, self.fail = True, False
with self.page.expect_response(lambda response: "/views/bag?" in response.url and response.status == 503):
pass # Exercise a real passive refresh during this transition.
expect(panel.locator(".page-error")).to_be_visible()
self.assertEqual(self.pending, [], "Passive errors must not park a request before the retry click")
panel.get_by_role("button", name="重新读取").click()
self.assertTrue(self.page.evaluate("window.__loadingRetryClicked"))
route = self.wait_request()
self.assert_centered(panel)
self.summary.update(connection_state="offline", connected=False, connection_message="连接已中断")