Skip to content

Commit 3a84492

Browse files
committed
WIP Band-aid fix for the failing integration tests
The problem here is that the view selection is out of sync with the list model selection, because section headers have been added or removed since the last refresh, but the view selection hasn't been updated accordingly. The synchronization of list model selection to view selection is part of the HandleFocus call that runs at the end of postRefreshUpdate, but it only runs if the view is focused. In these two tests, a different view is focused at the time we check the selection, hence the failures. Fix it by focusing the view whose selection we want to check. For the rebase_and_drop test this fix is good enough because you don't see the selection while the other panel is focused; for the other test though there is actually a visual bug (although very minor): as long as the error panel is showing, we show the selection in the underlying view in bold text, and you can see that the wrong item is selected as long as the error panel is showing. This is even more obvious when setting the gui.theme.inactiveViewSelectedLineBgColor config. A better fix would be to untangle the responsibilities of the HandleFocus call. Right now it does two things: FocusLine, which sets the view selection, and render to main view. The latter is the reason why we can only call it if the view is focused, but the former needs to happen unconditionally. However, this feels like a bigger refactoring that I'm not sure we should do as part of this PR.
1 parent 576c8f6 commit 3a84492

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

Diff for: pkg/integration/tests/branch/rebase_and_drop.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
8585

8686
t.Views().Information().Content(DoesNotContain("Rebasing"))
8787

88-
t.Views().Commits().TopLines(
89-
Contains("to keep"),
90-
Contains("second-change-branch unrelated change").IsSelected(),
91-
Contains("second change"),
92-
Contains("original"),
93-
)
88+
t.Views().Commits().
89+
Focus().
90+
TopLines(
91+
Contains("to keep"),
92+
Contains("second-change-branch unrelated change").IsSelected(),
93+
Contains("second change"),
94+
Contains("original"),
95+
)
9496
},
9597
})

Diff for: pkg/integration/tests/interactive_rebase/reword_commit_with_editor_and_fail.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ var RewordCommitWithEditorAndFail = NewIntegrationTest(NewIntegrationTestArgs{
3131
Title(Equals("Reword in editor")).
3232
Content(Contains("Are you sure you want to reword this commit in your editor?")).
3333
Confirm()
34+
35+
t.ExpectPopup().Alert().
36+
Title(Equals("Error")).
37+
Content(Contains("exit status 1")).
38+
Confirm()
3439
}).
3540
Lines(
3641
Contains("--- Pending rebase todos ---"),
@@ -39,9 +44,5 @@ var RewordCommitWithEditorAndFail = NewIntegrationTest(NewIntegrationTestArgs{
3944
Contains("commit 02").IsSelected(),
4045
Contains("commit 01"),
4146
)
42-
43-
t.ExpectPopup().Alert().
44-
Title(Equals("Error")).
45-
Content(Contains("exit status 1"))
4647
},
4748
})

0 commit comments

Comments
 (0)