From cb240081a8d4eb04b58cac027700a200d285b47c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 21 Jun 2023 21:45:03 +0200 Subject: [PATCH] Improve updateRef test This test not only tests the correct handling and display of the updateRef command, but also the visualization of branch heads in the commits panel. Since we are about to change the behavior here, extend the test so that a master commit is added (we don't want this to be visualized as a branch head), and then a stack of two non-main branches. At the end of this branch we only want to visualize the head commit of the first. --- .../drop_todo_commit_with_update_ref.go | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go b/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go index 4bd738d6a..163973226 100644 --- a/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go +++ b/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go @@ -13,9 +13,11 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{ SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. - CreateNCommits(3). - NewBranch("mybranch"). - CreateNCommitsStartingAt(3, 4) + CreateNCommits(1). + NewBranch("branch1"). + CreateNCommitsStartingAt(3, 2). + NewBranch("branch2"). + CreateNCommitsStartingAt(3, 5) shell.SetConfig("rebase.updateRefs", "true") }, @@ -23,26 +25,28 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Commits(). Focus(). Lines( - Contains("commit 06").IsSelected(), + Contains("commit 07").IsSelected(), + Contains("commit 06"), Contains("commit 05"), Contains("commit 04"), Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ). - NavigateToLine(Contains("commit 01")). + NavigateToLine(Contains("commit 02")). Press(keys.Universal.Edit). Focus(). Lines( + Contains("pick").Contains("commit 07"), Contains("pick").Contains("commit 06"), Contains("pick").Contains("commit 05"), + Contains("update-ref").Contains("branch1"), Contains("pick").Contains("commit 04"), - Contains("update-ref").Contains("master"), Contains("pick").Contains("commit 03"), - Contains("pick").Contains("commit 02"), - Contains("<-- YOU ARE HERE --- commit 01"), + Contains("<-- YOU ARE HERE --- commit 02"), + Contains("commit 01"), ). - NavigateToLine(Contains("commit 05")). + NavigateToLine(Contains("commit 06")). Press(keys.Universal.Remove) t.Common().ContinueRebase() @@ -50,7 +54,8 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Commits(). IsFocused(). Lines( - Contains("commit 06"), + Contains("commit 07"), + Contains("commit 05"), Contains("commit 04"), Contains("commit 03"), Contains("commit 02"),