Files
dxdesigner-part-replacement/tests/ui/test_verification_workspace.py
T
阿白叔 b2a84404d8
Core regression / Python core, intervention UI and release configuration (push) Successful in 12m44s
Core regression / JavaScript syntax (push) Successful in 10s
Core regression / Python core, intervention UI and release configuration (pull_request) Failing after 24m33s
Core regression / JavaScript syntax (pull_request) Successful in 10s
fix: address independent verification review findings
2026-11-19 14:44:52 +08:00

82 lines
3.9 KiB
Python

from PySide6.QtCore import Qt
def test_fourth_navigation_is_independent_and_does_not_open_dsh(ui,qtbot):
window=ui.window
window.verification_action.trigger()
qtbot.waitUntil(lambda:window.content_stack.currentWidget() is window.verification_panel)
page=window.verification_panel
assert window.verification_action.isChecked() and not window.dsh_action.isChecked()
assert window._dsh_view is None and page.new_button.isEnabled()
task=ui.service.verification.create_task('独立校验',request_id='one')['task_id']
page.open_task(task)
qtbot.waitUntil(lambda:page.controller.task_id==task and not page.controller.task_query.busy)
assert page.new_button.isEnabled()
assert page.table.rowCount()==0
assert '来源' not in page.findChild(type(page.title),'verificationTitle').text()
def test_page_keeps_selected_task_when_refreshed(ui,qtbot):
page=ui.window.verification_panel
task=ui.service.verification.create_task('任务',request_id='one')['task_id']
page.open_task(task);page.set_active(True)
qtbot.waitUntil(lambda:page.tasks.count()==1)
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'
def test_older_verification_task_can_be_opened_after_paging(ui,qtbot):
page=ui.window.verification_panel
tasks=[page.service.create_task(f'任务 {n}',request_id=f'page-{n}')['task_id'] for n in range(51)]
page.open_task(tasks[-1])
qtbot.waitUntil(lambda:page.tasks.count()==50 and not page.controller.tasks_query.busy)
page.next_tasks_button.click()
qtbot.waitUntil(lambda:page.tasks.count()==1)
assert page.tasks.item(0).data(Qt.ItemDataRole.UserRole)==tasks[0]
page.tasks.setCurrentRow(0)
qtbot.waitUntil(lambda:page.controller.task_id==tasks[0] and not page.controller.tasks_query.busy)
page.refresh()
qtbot.waitUntil(lambda:not page.controller.tasks_query.busy)
assert page.tasks.currentItem().data(Qt.ItemDataRole.UserRole)==tasks[0]
page.previous_tasks_button.click()
qtbot.waitUntil(lambda:page.tasks.count()==50)