feat: simplify DSH tool navigation and remove account onboarding
This commit is contained in:
1 parent
96227eed2e
commit
f437df2a83
10 files changed
+109
-50
No files matched your search
+15
-17
@@ -1,4 +1,4 @@
|
||||
"""Click the real task-center menus, then test its embedded official page."""
|
||||
"""Click the real task-center navigation, then test its embedded official page."""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
@@ -44,17 +44,14 @@ def main():
|
||||
window = TrialTaskCenterWindow(service)
|
||||
window.resize(1380, 860)
|
||||
|
||||
def click_menu(action):
|
||||
def click_navigation(action):
|
||||
window.activateWindow()
|
||||
bar = window.menuBar()
|
||||
top = bar.actions()[0]
|
||||
menu = top.menu()
|
||||
QTest.mouseClick(bar, Qt.MouseButton.LeftButton, pos=bar.actionGeometry(top).center())
|
||||
QApplication.processEvents()
|
||||
if not menu.isVisible():
|
||||
raise AssertionError('The tool menu did not open after mouse click')
|
||||
QTest.mouseClick(menu, Qt.MouseButton.LeftButton, pos=menu.actionGeometry(action).center())
|
||||
button = window.dsh_navigation if action is window.dsh_action else window.task_center_navigation
|
||||
assert button.isVisible() and button.defaultAction() is action
|
||||
assert window.task_center_navigation.geometry().right() < window.dsh_navigation.geometry().left()
|
||||
QTest.mouseClick(button, Qt.MouseButton.LeftButton)
|
||||
QApplication.processEvents()
|
||||
assert button.isChecked()
|
||||
|
||||
def failed(error):
|
||||
report.update(status='failed', error=type(error).__name__ + ': ' + str(error))
|
||||
@@ -80,9 +77,10 @@ def main():
|
||||
pos=window.task_list.list.visualItemRect(item).center())
|
||||
state['phase'] = 'menu'
|
||||
elif state['phase'] == 'menu' and window._context is not None and not window._loading:
|
||||
click_menu(window.dsh_action)
|
||||
window.grab().save(str(output / 'task-center.png'))
|
||||
click_navigation(window.dsh_action)
|
||||
assert window.content_stack.currentWidget() is window._dsh_view
|
||||
report['checks'].append('clicked task row and Tools > DSH assistant in the real main window')
|
||||
report['checks'].append('clicked task row and opened DSH with one click on the right navigation item')
|
||||
state['phase'] = 'ready'
|
||||
elif state['phase'] == 'ready' and window._dsh_view._started:
|
||||
command = ['node', str(REPO / 'tools/verify_dsh_native_ui.mjs'), str(output), str(args.port), '--confirm-cancel']
|
||||
@@ -96,17 +94,17 @@ def main():
|
||||
if state['child'].returncode:
|
||||
raise RuntimeError(stderr.decode('utf8', 'replace'))
|
||||
report['web'] = json.loads((output / 'report.json').read_text(encoding='utf8'))
|
||||
click_menu(window.task_center_action)
|
||||
click_navigation(window.task_center_action)
|
||||
assert window.content_stack.currentIndex() == 0
|
||||
click_menu(window.dsh_action)
|
||||
click_navigation(window.dsh_action)
|
||||
assert window.content_stack.currentWidget() is window._dsh_view
|
||||
report['checks'].append('clicked back to task center and returned to the same native page')
|
||||
report['checks'].append('clicked left navigation for task center and right navigation for the same native page')
|
||||
state['phase'] = 'check-preserved'
|
||||
def preserved(text):
|
||||
if '请分析当前任务' not in (text or ''):
|
||||
failed(AssertionError('Composer draft was lost when switching tool menus'))
|
||||
failed(AssertionError('Composer draft was lost when switching navigation items'))
|
||||
return
|
||||
report['checks'].append('native composer draft survived tool-menu navigation')
|
||||
report['checks'].append('native composer draft survived direct navigation')
|
||||
window.grab().save(str(output / 'dsh-in-tool.png'))
|
||||
report['status'] = 'passed'
|
||||
(output / 'desktop-report.json').write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf8')
|
||||
|
||||
Reference in new issue
Block a user