fix(web): remove duplicate inline runtime status notes (2.0.9)

This commit is contained in:
AttilaNet
2026-11-13 10:36:23 +08:00
parent 048be71ed1
commit cfce3e0bc5
14 changed files with 125 additions and 58 deletions
@@ -131,11 +131,12 @@ class PageLoadingBrowserTests(unittest.TestCase):
expect(panel.locator("tbody tr")).to_have_count(32)
self.page.screenshot(path=str(artifacts / "settled-dense.png"))
def test_passive_refresh_preserves_editing_table_and_business_reasons(self):
def test_passive_refresh_preserves_editing_table_without_inline_notes(self):
self.open()
panel = self.bag()
expect(panel.locator("tbody tr")).to_have_count(32)
expect(panel.locator('[data-view-status="planner_notes"]')).to_have_text("金币不足,等待补货")
expect(panel.locator('[data-view-status="planner_notes"]')).to_have_count(0)
expect(panel).not_to_contain_text("金币不足,等待补货")
self.assertNotIn("STATIC_HELP_SENTINEL", panel.inner_text())
self.assertNotIn("STATIC_NOTE_SENTINEL", panel.inner_text())
self.assertEqual(panel.locator(".info-note, .field-help").count(), 0)
@@ -156,6 +157,7 @@ class PageLoadingBrowserTests(unittest.TestCase):
expect(field).to_be_focused()
expect(field).to_have_value("")
self.assertTrue(field.evaluate("node => node === window.loadingField && window.loadingTable.isConnected && node.closest('.page-panel').querySelector('table') === window.loadingTable"))
expect(panel).not_to_contain_text("金币不足,等待补货")
expect(self.page.locator("#log-panel")).to_be_hidden()
self.assertEqual(self.page.locator("#log-panel").count(), 1)
@@ -148,7 +148,7 @@ class WorkbenchBrowserTests(unittest.TestCase):
expect(panel.locator('.form-section legend')).to_have_text('孵蛋策略')
panel.locator('.subtab[data-key="喂养策略"]').click()
expect(panel.locator('.form-section legend')).to_have_text('喂养策略')
expect(panel.locator('[data-view-status="feed_status"]')).to_be_visible()
expect(panel.locator('[data-view-status="feed_status"]')).to_have_count(0)
if key=='mainline':
expect(panel.locator('.subtab[data-key="policy"]')).to_be_visible()
panel.locator('.subtab[data-key="policy"]').click()
@@ -444,17 +444,20 @@ class WorkbenchBrowserTests(unittest.TestCase):
expect(panel.locator('td[data-column="per_stamina"]')).to_have_attribute('title','0.001')
self.assertEqual(self.errors,[])
def test_runtime_statuses_and_preset_without_confirmation(self):
def test_settings_omit_runtime_statuses_and_preset_without_confirmation(self):
def gifts_view(route):
self.fulfill(route,{'data':{'page':'gifts','title':'自动赠礼','summary':'离线状态','form':[],'filters':[],'columns':[],'rows':[],'actions':[],
'details':{'next_ready_at':1794294489}},'loading':False})
self.page.route(f'**/api/accounts/{self.first}/views/gifts?*',gifts_view)
self.open()
panel=self.go('hatching')
expect(panel.locator('[data-view-status="last_draw"]')).to_contain_text('最近抽蛋:')
expect(panel.locator('.form-section legend')).to_have_text('孵蛋策略')
expect(panel.locator('[data-view-status="last_draw"]')).to_have_count(0)
expect(panel).not_to_contain_text('最近抽蛋:')
panel.locator('.subtab[data-key="喂养策略"]').click()
data=self.manager.view(self.first,'hatching',{})['data']
expect(panel.locator('[data-view-status="feed_status"]')).to_contain_text(data['details']['feed_status'][1])
expect(panel.locator('.form-section legend')).to_have_text('喂养策略')
expect(panel.locator('[data-view-status="feed_status"]')).to_have_count(0)
expect(panel).not_to_contain_text('当前喂养状态:')
panel.locator('button[data-operation="apply_preset"]').click()
expect(self.page.locator('#action-dialog')).not_to_be_visible()
self.page.wait_for_timeout(1400)
@@ -462,9 +465,72 @@ class WorkbenchBrowserTests(unittest.TestCase):
self.assertTrue(self.manager.get_config(self.first)['config']['policy']['egg_rules']['1001010']['enabled'])
self.assertFalse(self.manager.status(self.first)['running'])
panel=self.go('gifts')
expect(panel.locator('[data-view-status="next_ready_at"]')).to_contain_text('北京时间')
expect(panel.locator('[data-view-status="next_ready_at"]')).to_have_count(0)
expect(panel).not_to_contain_text('下次可赠礼:')
expect(panel.locator('button[data-operation="configure_bag"]')).to_be_visible()
self.assertEqual(self.errors,[])
def test_bulk_runtime_notes_stay_out_of_settings_and_statistics_errors_retry(self):
keys = ('hatching', 'mainline', 'gifts', 'commissions', 'exploration', 'maps', 'ranch', 'daily', 'plans')
statistics_error = '本地统计读取失败,请查看服务器日志'
def diagnostics_view(route):
response = route.fetch().json() # Disposable loopback server and demo data only.
data = response.get('data')
if data is not None:
data.setdefault('details', {}).update({
'notes': [f'INLINE_RUNTIME_ONLY_{i}: retained primary / gift / potential / waiting' for i in range(40)],
'last_draw': 'INLINE_DRAW_ONLY', 'feed_status': ['waiting', 'INLINE_FEED_ONLY'],
'next_ready_at': 1794294489,
})
data['battle_mode'] = {'label': 'INLINE_BATTLE_MODE_ONLY'}
if data['page'] == 'statistics':
data['details']['statistics_error'] = statistics_error
self.fulfill(route, response)
self.page.route(f'**/api/accounts/{self.first}/views/*', diagnostics_view)
self.open()
for key in keys:
with self.subTest(page=key):
panel = self.go(key)
expect(panel.locator('[data-view-status]')).to_have_count(0)
self.assertNotIn('INLINE_', panel.evaluate('node => node.outerHTML'))
expect(panel.locator('.page-error')).to_be_hidden()
panel = self.go('hatching')
artifacts = Path(__file__).resolve().parents[3] / 'test-artifacts' / 'ui209'
artifacts.mkdir(parents=True, exist_ok=True)
for width, height in ((1280, 800), (390, 844)):
self.page.set_viewport_size({'width': width, 'height': height})
for tab in ('孵蛋策略', '牧场策略', '喂养策略'):
panel.locator(f'.subtab[data-key="{tab}"]').click()
expect(panel.locator('.form-section legend')).to_have_text(tab)
self.assertNotIn('INLINE_', panel.evaluate('node => node.outerHTML'))
panel.locator('.subtab[data-key="孵蛋策略"]').click()
first_control = panel.locator('.form-section input').first
expect(first_control).to_be_visible()
self.assertTrue(first_control.evaluate('''node => {
const r = node.getBoundingClientRect(), panel = node.closest('.page-panel').getBoundingClientRect();
return r.top >= panel.top && r.bottom <= Math.min(panel.bottom, innerHeight);
}'''), 'Settings must begin inside the visible workbench')
self.assertLessEqual(self.page.evaluate('document.documentElement.scrollWidth'), width)
self.page.screenshot(path=str(artifacts / f'hatching-{width}x{height}.png'))
expect(self.page.locator('#strategy-toggle')).to_be_visible()
expect(self.page.locator('#log-panel')).to_have_count(1)
expect(self.page.locator('#log-panel')).to_be_hidden()
self.page.locator('#log-toggle').click()
expect(self.page.locator('#log-panel')).to_be_visible()
self.page.locator('#log-toggle').click()
expect(self.page.locator('#log-panel')).to_be_hidden()
panel = self.go('statistics')
expect(panel.get_by_role('alert')).to_contain_text('本地统计读取失败,请查看服务器日志')
expect(panel.locator('.page-loading')).to_be_hidden()
statistics_error = ''
with self.page.expect_response(lambda response: '/views/statistics?' in response.url):
panel.get_by_role('button', name='重新读取', exact=True).click()
expect(panel.get_by_role('alert')).to_be_hidden()
expect(panel.locator('.statistics-table-host table')).to_be_visible()
self.assertEqual(self.errors, [])
def test_update_dialog_polls_host_progress_recovers_and_stops_on_close(self):
calls=[]
applied=False