fix: preserve strategy intent and recover accounts automatically

This commit is contained in:
AttilaNet
2026-11-11 19:37:15 +08:00
parent ccb945631d
commit 5c253d5cf9
26 changed files with 1628 additions and 236 deletions
@@ -72,7 +72,8 @@ class ConnectionBrowserTests(unittest.TestCase):
panel = self.go("ranch")
expect(panel.locator("tbody tr").first).to_be_visible()
row_count = panel.locator("tbody tr").count()
self.summary.update(connection_state="expired", connection_message="登录凭据已失效,请重新登录。")
failure_reason = "登录凭据已失效,请重新登录。"
self.summary.update(connection_state="expired", connection_message=failure_reason, error=failure_reason)
expect(self.page.locator("#connection")).to_have_text("登录已过期")
expect(self.page.locator("#data-summary")).to_contain_text(self.summary["connection_message"])
expect(panel.locator(".page-loading")).to_contain_text("缓存")
@@ -89,10 +90,14 @@ class ConnectionBrowserTests(unittest.TestCase):
self.assertTrue(panel.locator("input[data-config-path]").first.is_enabled())
self.summary.update(connection_state="online", connection_message="游戏连接正常", error="", last_game_success_at="2026-11-11T00:01:00Z")
expect(self.page.locator("#connection")).to_have_text("已登录")
expect(self.page.locator("#connection")).to_have_attribute("title", "游戏连接正常")
expect(self.page.locator("#strategy-toggle")).to_be_enabled()
expect(panel.locator("[data-connection-status]")).to_be_hidden()
expect(self.page.locator("#data-summary")).not_to_contain_text("凭据已失效")
expect(self.page.locator("#status-text")).not_to_contain_text("凭据已失效")
expect(panel.locator("[data-connection-status]")).to_have_text("")
for selector in ("#data-summary", "#status-text"):
expect(self.page.locator(selector)).to_be_visible()
expect(self.page.locator(selector)).to_contain_text(f"上次失败:{failure_reason}")
expect(self.page.locator(f'.account-tab[data-account="{self.first}"] .account-dot')).not_to_have_class("account-dot error")
expect(panel.locator(".page-loading")).not_to_contain_text("缓存")
self.assertEqual(self.page.locator("#page-tabs [role=tab]").count(), 15)
self.assertEqual(self.external_requests, [])