fix: preserve verification pagination and evidence during refresh
This commit is contained in:
1 parent
fe8765beec
commit
f91b4deb5e
5 files changed
+129
-40
No files matched your search
@@ -24,3 +24,41 @@ def test_page_keeps_selected_task_when_refreshed(ui,qtbot):
|
||||
page.refresh()
|
||||
qtbot.waitUntil(lambda:not page.controller.tasks_query.busy)
|
||||
assert page.controller.task_id==task
|
||||
|
||||
|
||||
def test_periodic_refresh_does_not_starve_a_slow_read(ui,qtbot,monkeypatch):
|
||||
from threading import Event
|
||||
from pathlib import Path
|
||||
import sys
|
||||
sys.path.insert(0,str(Path(__file__).parents[1]/'v1_1'))
|
||||
from test_independent_verification_contracts import payload
|
||||
page=ui.window.verification_panel;v=page.service
|
||||
task=v.create_task('慢查询',request_id='slow')['task_id'];row=payload();row['before_ref']=None
|
||||
v.repo.publish(task,(row,),submission_id='row')
|
||||
original=v.read_task
|
||||
def slow(*args,**kwargs):Event().wait(.15);return original(*args,**kwargs)
|
||||
monkeypatch.setattr(v,'read_task',slow)
|
||||
page.open_task(task);page._timer.setInterval(20);page._timer.start()
|
||||
try:qtbot.waitUntil(lambda:page.table.rowCount()==1,timeout=1500)
|
||||
finally:page._timer.stop()
|
||||
|
||||
|
||||
def test_engineering_pages_remain_bounded_and_keep_the_current_page(ui,qtbot):
|
||||
from pathlib import Path
|
||||
import sys
|
||||
sys.path.insert(0,str(Path(__file__).parents[1]/'v1_1'))
|
||||
from test_independent_verification_contracts import payload
|
||||
page=ui.window.verification_panel;v=page.service
|
||||
task=v.create_task('分页',request_id='pages')['task_id'];rows=[]
|
||||
for n in range(201):
|
||||
row=payload();row.update(item_key=str(n),display_name=f'Board{n:03}',before_ref=None);rows.append(row)
|
||||
v.repo.publish(task,rows,submission_id='rows');page.open_task(task)
|
||||
qtbot.waitUntil(lambda:page.table.rowCount()==100)
|
||||
page.more_button.click()
|
||||
qtbot.waitUntil(lambda:not page.controller.task_query.busy)
|
||||
assert page.table.rowCount()==100 and page.table.item(0,0).text()=='Board100'
|
||||
page.refresh_task();qtbot.waitUntil(lambda:not page.controller.task_query.busy)
|
||||
assert page.table.item(0,0).text()=='Board100'
|
||||
page.search.setText('Board000')
|
||||
qtbot.waitUntil(lambda:page.table.rowCount()==1)
|
||||
assert page.table.item(0,0).text()=='Board000'
|
||||
Reference in new issue
Block a user