|
| 1 | +package branch |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/jesseduffield/lazygit/pkg/config" |
| 5 | + . "github.com/jesseduffield/lazygit/pkg/integration/components" |
| 6 | +) |
| 7 | + |
| 8 | +var ShowDivergenceFromUpstream = NewIntegrationTest(NewIntegrationTestArgs{ |
| 9 | + Description: "Show divergence from upstream", |
| 10 | + ExtraCmdArgs: []string{}, |
| 11 | + Skip: false, |
| 12 | + SetupConfig: func(config *config.AppConfig) {}, |
| 13 | + SetupRepo: func(shell *Shell) { |
| 14 | + shell.CreateFileAndAdd("file", "content1") |
| 15 | + shell.Commit("one") |
| 16 | + shell.UpdateFileAndAdd("file", "content2") |
| 17 | + shell.Commit("two") |
| 18 | + shell.CreateFileAndAdd("file3", "content3") |
| 19 | + shell.Commit("three") |
| 20 | + |
| 21 | + shell.CloneIntoRemote("origin") |
| 22 | + |
| 23 | + shell.SetBranchUpstream("master", "origin/master") |
| 24 | + |
| 25 | + shell.HardReset("HEAD^^") |
| 26 | + shell.CreateFileAndAdd("file4", "content4") |
| 27 | + shell.Commit("four") |
| 28 | + }, |
| 29 | + Run: func(t *TestDriver, keys config.KeybindingConfig) { |
| 30 | + t.Views().Commits(). |
| 31 | + Lines( |
| 32 | + Contains("four"), |
| 33 | + Contains("one"), |
| 34 | + ) |
| 35 | + |
| 36 | + t.Views().Branches(). |
| 37 | + Focus(). |
| 38 | + Lines(Contains("master")). |
| 39 | + Press(keys.Branches.SetUpstream) |
| 40 | + |
| 41 | + t.ExpectPopup().Menu().Title(Contains("upstream")).Select(Contains("View divergence from upstream")).Confirm() |
| 42 | + |
| 43 | + t.Views().SubCommits(). |
| 44 | + IsFocused(). |
| 45 | + Title(Contains("Commits (master <-> origin/master)")). |
| 46 | + Lines( |
| 47 | + DoesNotContainAnyOf("↓", "↑").Contains("--- Remote ---"), |
| 48 | + Contains("↓").Contains("three"), |
| 49 | + Contains("↓").Contains("two"), |
| 50 | + DoesNotContainAnyOf("↓", "↑").Contains("--- Local ---"), |
| 51 | + Contains("↑").Contains("four"), |
| 52 | + ) |
| 53 | + }, |
| 54 | +}) |
0 commit comments