Skip to content

Commit

Permalink
Make test_dataframe_to_type() more robust
Browse files Browse the repository at this point in the history
For some reason, this test started to fail on Windows, probably because
of the new menu item `Refresh`. This should fix the test.
  • Loading branch information
jitseniesen committed Nov 12, 2023
1 parent 2574f45 commit fb15821
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,19 @@ def test_dataframe_to_type(qtbot):
view = editor.dataTable
view.setCurrentIndex(view.model().index(0, 0))

# Show context menu and select option `To bool`
# Show context menu, go down until `Convert to`, and open submenu
view.menu.show()
qtbot.keyPress(view.menu, Qt.Key_Up)
qtbot.keyPress(view.menu, Qt.Key_Up)
qtbot.keyPress(view.menu, Qt.Key_Up)
qtbot.keyPress(view.menu, Qt.Key_Return)
submenu = view.menu.activeAction().menu()
for _ in range(100):
activeAction = view.menu.activeAction()
if activeAction and activeAction.text() == 'Convert to':
qtbot.keyPress(view.menu, Qt.Key_Return)
break
qtbot.keyPress(view.menu, Qt.Key_Down)
else:
raise RuntimeError('Item "Convert to" not found')

# Select first option, which is `To bool`
submenu = activeAction.menu()
qtbot.keyPress(submenu, Qt.Key_Return)
qtbot.wait(1000)

Expand Down

0 comments on commit fb15821

Please sign in to comment.