1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-20 05:19:24 +02:00

Merge pull request #2478 from stefanhaller/make-test-more-robust

This commit is contained in:
Jesse Duffield 2023-03-01 18:28:23 +11:00 committed by GitHub
commit c34e0deca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,17 +12,19 @@ var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell. shell.
CreateNCommits(3) CreateFileAndAdd("file1.txt", "File1 Content\n").Commit("First Commit").
CreateFileAndAdd("file2.txt", "Fixup Content\n").Commit("Fixup Commit Message").
CreateFileAndAdd("file3.txt", "File3 Content\n").Commit("Third Commit")
}, },
Run: func(t *TestDriver, keys config.KeybindingConfig) { Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits(). t.Views().Commits().
Focus(). Focus().
Lines( Lines(
Contains("commit 03"), Contains("Third Commit"),
Contains("commit 02"), Contains("Fixup Commit Message"),
Contains("commit 01"), Contains("First Commit"),
). ).
NavigateToLine(Contains("commit 02")). NavigateToLine(Contains("Fixup Commit Message")).
Press(keys.Commits.MarkCommitAsFixup). Press(keys.Commits.MarkCommitAsFixup).
Tap(func() { Tap(func() {
t.ExpectPopup().Confirmation(). t.ExpectPopup().Confirmation().
@ -31,14 +33,17 @@ var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
Confirm() Confirm()
}). }).
Lines( Lines(
Contains("commit 03"), Contains("Third Commit"),
Contains("commit 01").IsSelected(), Contains("First Commit").IsSelected(),
) )
t.Views().Main(). t.Views().Main().
Content(Contains("commit 01")). // Make sure that the resulting commit message doesn't contain the
Content(DoesNotContain("commit 02")). // message of the fixup commit; compare this to
Content(Contains("+file01 content")). // squash_down_second_commit.go, where it does.
Content(Contains("+file02 content")) Content(Contains("First Commit")).
Content(DoesNotContain("Fixup Commit Message")).
Content(Contains("+File1 Content")).
Content(Contains("+Fixup Content"))
}, },
}) })