mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	add view asserter getter struct
This commit is contained in:
		| @@ -8,7 +8,7 @@ type AlertAsserter struct { | ||||
| } | ||||
|  | ||||
| func (self *AlertAsserter) getViewAsserter() *ViewAsserter { | ||||
| 	return self.assert.View("confirmation") | ||||
| 	return self.assert.Views().ByName("confirmation") | ||||
| } | ||||
|  | ||||
| // asserts that the alert view has the expected title | ||||
|   | ||||
| @@ -182,34 +182,44 @@ func (self *Assert) FileSystemPathNotPresent(path string) { | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| func (self *Assert) CurrentView() *ViewAsserter { | ||||
| func (self *Assert) Views() *ViewAsserterGetter { | ||||
| 	return &ViewAsserterGetter{ | ||||
| 		assert: self, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| type ViewAsserterGetter struct { | ||||
| 	assert *Assert | ||||
| } | ||||
|  | ||||
| func (self *ViewAsserterGetter) Current() *ViewAsserter { | ||||
| 	return &ViewAsserter{ | ||||
| 		context: "current view", | ||||
| 		getView: func() *gocui.View { return self.gui.CurrentContext().GetView() }, | ||||
| 		assert:  self, | ||||
| 		getView: func() *gocui.View { return self.assert.gui.CurrentContext().GetView() }, | ||||
| 		assert:  self.assert, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (self *Assert) View(viewName string) *ViewAsserter { | ||||
| 	return &ViewAsserter{ | ||||
| 		context: fmt.Sprintf("%s view", viewName), | ||||
| 		getView: func() *gocui.View { return self.gui.View(viewName) }, | ||||
| 		assert:  self, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (self *Assert) MainView() *ViewAsserter { | ||||
| func (self *ViewAsserterGetter) Main() *ViewAsserter { | ||||
| 	return &ViewAsserter{ | ||||
| 		context: "main view", | ||||
| 		getView: func() *gocui.View { return self.gui.MainView() }, | ||||
| 		assert:  self, | ||||
| 		getView: func() *gocui.View { return self.assert.gui.MainView() }, | ||||
| 		assert:  self.assert, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (self *Assert) SecondaryView() *ViewAsserter { | ||||
| func (self *ViewAsserterGetter) Secondary() *ViewAsserter { | ||||
| 	return &ViewAsserter{ | ||||
| 		context: "secondary view", | ||||
| 		getView: func() *gocui.View { return self.gui.SecondaryView() }, | ||||
| 		assert:  self, | ||||
| 		getView: func() *gocui.View { return self.assert.gui.SecondaryView() }, | ||||
| 		assert:  self.assert, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (self *ViewAsserterGetter) ByName(viewName string) *ViewAsserter { | ||||
| 	return &ViewAsserter{ | ||||
| 		context: fmt.Sprintf("%s view", viewName), | ||||
| 		getView: func() *gocui.View { return self.assert.gui.View(viewName) }, | ||||
| 		assert:  self.assert, | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -6,7 +6,7 @@ type CommitMessagePanelAsserter struct { | ||||
| } | ||||
|  | ||||
| func (self *CommitMessagePanelAsserter) getViewAsserter() *ViewAsserter { | ||||
| 	return self.assert.View("commitMessage") | ||||
| 	return self.assert.Views().ByName("commitMessage") | ||||
| } | ||||
|  | ||||
| // asserts on the text initially present in the prompt | ||||
|   | ||||
| @@ -8,7 +8,7 @@ type ConfirmationAsserter struct { | ||||
| } | ||||
|  | ||||
| func (self *ConfirmationAsserter) getViewAsserter() *ViewAsserter { | ||||
| 	return self.assert.View("confirmation") | ||||
| 	return self.assert.Views().ByName("confirmation") | ||||
| } | ||||
|  | ||||
| // asserts that the confirmation view has the expected title | ||||
|   | ||||
| @@ -48,7 +48,7 @@ func (self *Input) SwitchToStatusWindow() { | ||||
| // switch to status window and assert that the status view is on top | ||||
| func (self *Input) SwitchToStatusView() { | ||||
| 	self.SwitchToStatusWindow() | ||||
| 	self.assert.CurrentView().Name("status") | ||||
| 	self.assert.Views().Current().Name("status") | ||||
| } | ||||
|  | ||||
| func (self *Input) SwitchToFilesWindow() { | ||||
| @@ -59,7 +59,7 @@ func (self *Input) SwitchToFilesWindow() { | ||||
| // switch to files window and assert that the files view is on top | ||||
| func (self *Input) SwitchToFilesView() { | ||||
| 	self.SwitchToFilesWindow() | ||||
| 	self.assert.CurrentView().Name("files") | ||||
| 	self.assert.Views().Current().Name("files") | ||||
| } | ||||
|  | ||||
| func (self *Input) SwitchToBranchesWindow() { | ||||
| @@ -70,7 +70,7 @@ func (self *Input) SwitchToBranchesWindow() { | ||||
| // switch to branches window and assert that the branches view is on top | ||||
| func (self *Input) SwitchToBranchesView() { | ||||
| 	self.SwitchToBranchesWindow() | ||||
| 	self.assert.CurrentView().Name("localBranches") | ||||
| 	self.assert.Views().Current().Name("localBranches") | ||||
| } | ||||
|  | ||||
| func (self *Input) SwitchToCommitsWindow() { | ||||
| @@ -81,7 +81,7 @@ func (self *Input) SwitchToCommitsWindow() { | ||||
| // switch to commits window and assert that the commits view is on top | ||||
| func (self *Input) SwitchToCommitsView() { | ||||
| 	self.SwitchToCommitsWindow() | ||||
| 	self.assert.CurrentView().Name("commits") | ||||
| 	self.assert.Views().Current().Name("commits") | ||||
| } | ||||
|  | ||||
| func (self *Input) SwitchToStashWindow() { | ||||
| @@ -92,7 +92,7 @@ func (self *Input) SwitchToStashWindow() { | ||||
| // switch to stash window and assert that the stash view is on top | ||||
| func (self *Input) SwitchToStashView() { | ||||
| 	self.SwitchToStashWindow() | ||||
| 	self.assert.CurrentView().Name("stash") | ||||
| 	self.assert.Views().Current().Name("stash") | ||||
| } | ||||
|  | ||||
| func (self *Input) Type(content string) { | ||||
| @@ -133,7 +133,7 @@ func (self *Input) PreviousItem() { | ||||
|  | ||||
| func (self *Input) ContinueMerge() { | ||||
| 	self.Press(self.keys.Universal.CreateRebaseOptionsMenu) | ||||
| 	self.assert.CurrentView().SelectedLine(Contains("continue")) | ||||
| 	self.assert.Views().Current().SelectedLine(Contains("continue")) | ||||
| 	self.Confirm() | ||||
| } | ||||
|  | ||||
| @@ -197,20 +197,20 @@ func (self *Input) NavigateToListItem(matcher *matcher) { | ||||
|  | ||||
| 	selectedLineIdx := view.SelectedLineIdx() | ||||
| 	if selectedLineIdx == matchIndex { | ||||
| 		self.assert.CurrentView().SelectedLine(matcher) | ||||
| 		self.assert.Views().Current().SelectedLine(matcher) | ||||
| 		return | ||||
| 	} | ||||
| 	if selectedLineIdx < matchIndex { | ||||
| 		for i := selectedLineIdx; i < matchIndex; i++ { | ||||
| 			self.NextItem() | ||||
| 		} | ||||
| 		self.assert.CurrentView().SelectedLine(matcher) | ||||
| 		self.assert.Views().Current().SelectedLine(matcher) | ||||
| 		return | ||||
| 	} else { | ||||
| 		for i := selectedLineIdx; i > matchIndex; i-- { | ||||
| 			self.PreviousItem() | ||||
| 		} | ||||
| 		self.assert.CurrentView().SelectedLine(matcher) | ||||
| 		self.assert.Views().Current().SelectedLine(matcher) | ||||
| 		return | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -7,7 +7,7 @@ type MenuAsserter struct { | ||||
| } | ||||
|  | ||||
| func (self *MenuAsserter) getViewAsserter() *ViewAsserter { | ||||
| 	return self.assert.View("menu") | ||||
| 	return self.assert.Views().ByName("menu") | ||||
| } | ||||
|  | ||||
| // asserts that the popup has the expected title | ||||
|   | ||||
| @@ -7,7 +7,7 @@ type PromptAsserter struct { | ||||
| } | ||||
|  | ||||
| func (self *PromptAsserter) getViewAsserter() *ViewAsserter { | ||||
| 	return self.assert.View("confirmation") | ||||
| 	return self.assert.Views().ByName("confirmation") | ||||
| } | ||||
|  | ||||
| // asserts that the popup has the expected title | ||||
| @@ -55,27 +55,27 @@ func (self *PromptAsserter) checkNecessaryChecksCompleted() { | ||||
| } | ||||
|  | ||||
| func (self *PromptAsserter) SuggestionLines(matchers ...*matcher) *PromptAsserter { | ||||
| 	self.assert.View("suggestions").Lines(matchers...) | ||||
| 	self.assert.Views().ByName("suggestions").Lines(matchers...) | ||||
|  | ||||
| 	return self | ||||
| } | ||||
|  | ||||
| func (self *PromptAsserter) SuggestionTopLines(matchers ...*matcher) *PromptAsserter { | ||||
| 	self.assert.View("suggestions").TopLines(matchers...) | ||||
| 	self.assert.Views().ByName("suggestions").TopLines(matchers...) | ||||
|  | ||||
| 	return self | ||||
| } | ||||
|  | ||||
| func (self *PromptAsserter) SelectFirstSuggestion() *PromptAsserter { | ||||
| 	self.input.Press(self.input.keys.Universal.TogglePanel) | ||||
| 	self.assert.CurrentView().Name("suggestions") | ||||
| 	self.assert.Views().Current().Name("suggestions") | ||||
|  | ||||
| 	return self | ||||
| } | ||||
|  | ||||
| func (self *PromptAsserter) SelectSuggestion(matcher *matcher) *PromptAsserter { | ||||
| 	self.input.Press(self.input.keys.Universal.TogglePanel) | ||||
| 	self.assert.CurrentView().Name("suggestions") | ||||
| 	self.assert.Views().Current().Name("suggestions") | ||||
|  | ||||
| 	self.input.NavigateToListItem(matcher) | ||||
|  | ||||
|   | ||||
| @@ -34,28 +34,28 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
|  | ||||
| 		assert.CurrentView().SelectedLine(Contains("commit 10")) | ||||
| 		assert.Views().Current().SelectedLine(Contains("commit 10")) | ||||
|  | ||||
| 		input.NavigateToListItem(Contains("commit 09")) | ||||
|  | ||||
| 		markCommitAsBad() | ||||
|  | ||||
| 		assert.View("information").Content(Contains("bisecting")) | ||||
| 		assert.Views().ByName("information").Content(Contains("bisecting")) | ||||
|  | ||||
| 		assert.CurrentView().Name("commits").SelectedLine(Contains("<-- bad")) | ||||
| 		assert.Views().Current().Name("commits").SelectedLine(Contains("<-- bad")) | ||||
|  | ||||
| 		input.NavigateToListItem(Contains("commit 02")) | ||||
|  | ||||
| 		markCommitAsGood() | ||||
|  | ||||
| 		// lazygit will land us in the commit between our good and bad commits. | ||||
| 		assert.CurrentView(). | ||||
| 		assert.Views().Current(). | ||||
| 			Name("commits"). | ||||
| 			SelectedLine(Contains("commit 05").Contains("<-- current")) | ||||
|  | ||||
| 		markCommitAsBad() | ||||
|  | ||||
| 		assert.CurrentView(). | ||||
| 		assert.Views().Current(). | ||||
| 			Name("commits"). | ||||
| 			SelectedLine(Contains("commit 04").Contains("<-- current")) | ||||
|  | ||||
| @@ -64,7 +64,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		// commit 5 is the culprit because we marked 4 as good and 5 as bad. | ||||
| 		input.Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("commits").Content(Contains("commit 04")) | ||||
| 		assert.View("information").Content(DoesNotContain("bisecting")) | ||||
| 		assert.Views().Current().Name("commits").Content(Contains("commit 04")) | ||||
| 		assert.Views().ByName("information").Content(DoesNotContain("bisecting")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -24,13 +24,13 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		assert *Assert, | ||||
| 		keys config.KeybindingConfig, | ||||
| 	) { | ||||
| 		assert.View("information").Content(Contains("bisecting")) | ||||
| 		assert.Views().ByName("information").Content(Contains("bisecting")) | ||||
|  | ||||
| 		assert.AtLeastOneCommit() | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
|  | ||||
| 		assert.CurrentView().TopLines( | ||||
| 		assert.Views().Current().TopLines( | ||||
| 			MatchesRegexp(`<-- bad.*commit 08`), | ||||
| 			MatchesRegexp(`<-- current.*commit 07`), | ||||
| 			MatchesRegexp(`\?.*commit 06`), | ||||
| @@ -44,10 +44,10 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm() | ||||
|  | ||||
| 		assert.View("information").Content(DoesNotContain("bisecting")) | ||||
| 		assert.Views().ByName("information").Content(DoesNotContain("bisecting")) | ||||
|  | ||||
| 		// back in master branch which just had the one commit | ||||
| 		assert.CurrentView().Name("commits").Lines( | ||||
| 		assert.Views().Current().Name("commits").Lines( | ||||
| 			Contains("only commit on master"), | ||||
| 		) | ||||
| 	}, | ||||
|   | ||||
| @@ -20,7 +20,7 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToBranchesView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("master"), | ||||
| 			Contains("@"), | ||||
| 		) | ||||
| @@ -32,7 +32,7 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.Alert().Title(Equals("Branch not found")).Content(Equals("Branch not found. Create a new branch named new-branch?")).Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("localBranches"). | ||||
| 		assert.Views().Current().Name("localBranches"). | ||||
| 			Lines( | ||||
| 				MatchesRegexp(`\*.*new-branch`), | ||||
| 				Contains("master"), | ||||
|   | ||||
| @@ -19,7 +19,7 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToBranchesView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			MatchesRegexp(`\*.*branch-two`), | ||||
| 			MatchesRegexp(`branch-one`), | ||||
| 			MatchesRegexp(`master`), | ||||
| @@ -36,7 +36,7 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Content(Contains("Are you sure you want to delete the branch 'branch-one'?")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("localBranches"). | ||||
| 		assert.Views().Current().Name("localBranches"). | ||||
| 			Lines( | ||||
| 				MatchesRegexp(`\*.*branch-two`), | ||||
| 				MatchesRegexp(`master`).IsSelected(), | ||||
|   | ||||
| @@ -17,13 +17,13 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToBranchesView() | ||||
|  | ||||
| 		assert.View("localBranches").Lines( | ||||
| 		assert.Views().ByName("localBranches").Lines( | ||||
| 			Contains("first-change-branch"), | ||||
| 			Contains("second-change-branch"), | ||||
| 			Contains("original-branch"), | ||||
| 		) | ||||
|  | ||||
| 		assert.View("commits").TopLines( | ||||
| 		assert.Views().ByName("commits").TopLines( | ||||
| 			Contains("first change"), | ||||
| 			Contains("original"), | ||||
| 		) | ||||
| @@ -40,25 +40,25 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Content(Contains("Conflicts!")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("files").SelectedLine(Contains("file")) | ||||
| 		assert.Views().Current().Name("files").SelectedLine(Contains("file")) | ||||
|  | ||||
| 		// not using Confirm() convenience method because I suspect we might change this | ||||
| 		// keybinding to something more bespoke | ||||
| 		input.Press(keys.Universal.Confirm) | ||||
|  | ||||
| 		assert.CurrentView().Name("mergeConflicts") | ||||
| 		assert.Views().Current().Name("mergeConflicts") | ||||
| 		input.PrimaryAction() | ||||
|  | ||||
| 		assert.View("information").Content(Contains("rebasing")) | ||||
| 		assert.Views().ByName("information").Content(Contains("rebasing")) | ||||
|  | ||||
| 		input.Confirmation(). | ||||
| 			Title(Equals("continue")). | ||||
| 			Content(Contains("all merge conflicts resolved. Continue?")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.View("information").Content(DoesNotContain("rebasing")) | ||||
| 		assert.Views().ByName("information").Content(DoesNotContain("rebasing")) | ||||
|  | ||||
| 		assert.View("commits").TopLines( | ||||
| 		assert.Views().ByName("commits").TopLines( | ||||
| 			Contains("second-change-branch unrelated change"), | ||||
| 			Contains("second change"), | ||||
| 			Contains("original"), | ||||
|   | ||||
| @@ -20,13 +20,13 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToBranchesView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("first-change-branch"), | ||||
| 			Contains("second-change-branch"), | ||||
| 			Contains("original-branch"), | ||||
| 		) | ||||
|  | ||||
| 		assert.View("commits").TopLines( | ||||
| 		assert.Views().ByName("commits").TopLines( | ||||
| 			Contains("to keep").IsSelected(), | ||||
| 			Contains("to remove"), | ||||
| 			Contains("first change"), | ||||
| @@ -41,19 +41,19 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Content(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.View("information").Content(Contains("rebasing")) | ||||
| 		assert.Views().ByName("information").Content(Contains("rebasing")) | ||||
|  | ||||
| 		input.Confirmation(). | ||||
| 			Title(Equals("Auto-merge failed")). | ||||
| 			Content(Contains("Conflicts!")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.CurrentView(). | ||||
| 		assert.Views().Current(). | ||||
| 			Name("files"). | ||||
| 			SelectedLine(MatchesRegexp("UU.*file")) | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
| 		assert.CurrentView(). | ||||
| 		assert.Views().Current(). | ||||
| 			TopLines( | ||||
| 				MatchesRegexp(`pick.*to keep`).IsSelected(), | ||||
| 				MatchesRegexp(`pick.*to remove`), | ||||
| @@ -65,7 +65,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		input.NextItem() | ||||
| 		input.Press(keys.Universal.Remove) | ||||
|  | ||||
| 		assert.CurrentView(). | ||||
| 		assert.Views().Current(). | ||||
| 			TopLines( | ||||
| 				MatchesRegexp(`pick.*to keep`), | ||||
| 				MatchesRegexp(`drop.*to remove`).IsSelected(), | ||||
| @@ -80,7 +80,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		// keybinding to something more bespoke | ||||
| 		input.Press(keys.Universal.Confirm) | ||||
|  | ||||
| 		assert.CurrentView().Name("mergeConflicts") | ||||
| 		assert.Views().Current().Name("mergeConflicts") | ||||
| 		input.PrimaryAction() | ||||
|  | ||||
| 		input.Confirmation(). | ||||
| @@ -88,9 +88,9 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Content(Contains("all merge conflicts resolved. Continue?")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.View("information").Content(DoesNotContain("rebasing")) | ||||
| 		assert.Views().ByName("information").Content(DoesNotContain("rebasing")) | ||||
|  | ||||
| 		assert.View("commits").TopLines( | ||||
| 		assert.Views().ByName("commits").TopLines( | ||||
| 			Contains("to keep"), | ||||
| 			Contains("second-change-branch unrelated change").IsSelected(), | ||||
| 			Contains("second change"), | ||||
|   | ||||
| @@ -21,14 +21,14 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		shell.EmptyCommit("current-branch commit") | ||||
| 	}, | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		assert.View("commits").Lines( | ||||
| 		assert.Views().ByName("commits").Lines( | ||||
| 			Contains("current-branch commit"), | ||||
| 			Contains("root commit"), | ||||
| 		) | ||||
|  | ||||
| 		input.SwitchToBranchesView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("current-branch"), | ||||
| 			Contains("other-branch"), | ||||
| 		) | ||||
| @@ -39,11 +39,11 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		input.Menu().Title(Contains("reset to other-branch")).Select(Contains("hard reset")).Confirm() | ||||
|  | ||||
| 		// ensure that we've returned from the menu before continuing | ||||
| 		assert.CurrentView().Name("localBranches") | ||||
| 		assert.Views().Current().Name("localBranches") | ||||
|  | ||||
| 		// assert that we now have the expected commits in the commit panel | ||||
| 		input.SwitchToCommitsView() | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("other-branch commit"), | ||||
| 			Contains("root commit"), | ||||
| 		) | ||||
|   | ||||
| @@ -26,7 +26,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToBranchesView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("first-branch"), | ||||
| 			Contains("second-branch"), | ||||
| 			Contains("master"), | ||||
| @@ -36,7 +36,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.Enter() | ||||
|  | ||||
| 		assert.CurrentView().Name("subCommits").Lines( | ||||
| 		assert.Views().Current().Name("subCommits").Lines( | ||||
| 			Contains("four"), | ||||
| 			Contains("three"), | ||||
| 			Contains("base"), | ||||
| @@ -44,14 +44,14 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		// copy commits 'four' and 'three' | ||||
| 		input.Press(keys.Commits.CherryPickCopy) | ||||
| 		assert.View("information").Content(Contains("1 commit copied")) | ||||
| 		assert.Views().ByName("information").Content(Contains("1 commit copied")) | ||||
| 		input.NextItem() | ||||
| 		input.Press(keys.Commits.CherryPickCopy) | ||||
| 		assert.View("information").Content(Contains("2 commits copied")) | ||||
| 		assert.Views().ByName("information").Content(Contains("2 commits copied")) | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("two"), | ||||
| 			Contains("one"), | ||||
| 			Contains("base"), | ||||
| @@ -63,7 +63,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("commits").Lines( | ||||
| 		assert.Views().Current().Name("commits").Lines( | ||||
| 			Contains("four"), | ||||
| 			Contains("three"), | ||||
| 			Contains("two"), | ||||
| @@ -71,8 +71,8 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Contains("base"), | ||||
| 		) | ||||
|  | ||||
| 		assert.View("information").Content(Contains("2 commits copied")) | ||||
| 		assert.Views().ByName("information").Content(Contains("2 commits copied")) | ||||
| 		input.Press(keys.Universal.Return) | ||||
| 		assert.View("information").Content(DoesNotContain("commits copied")) | ||||
| 		assert.Views().ByName("information").Content(DoesNotContain("commits copied")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -16,7 +16,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	}, | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToBranchesView() | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("first-change-branch"), | ||||
| 			Contains("second-change-branch"), | ||||
| 			Contains("original-branch"), | ||||
| @@ -26,21 +26,21 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.Enter() | ||||
|  | ||||
| 		assert.CurrentView().Name("subCommits").TopLines( | ||||
| 		assert.Views().Current().Name("subCommits").TopLines( | ||||
| 			Contains("second-change-branch unrelated change"), | ||||
| 			Contains("second change"), | ||||
| 		) | ||||
|  | ||||
| 		input.Press(keys.Commits.CherryPickCopy) | ||||
| 		assert.View("information").Content(Contains("1 commit copied")) | ||||
| 		assert.Views().ByName("information").Content(Contains("1 commit copied")) | ||||
|  | ||||
| 		input.NextItem() | ||||
| 		input.Press(keys.Commits.CherryPickCopy) | ||||
| 		assert.View("information").Content(Contains("2 commits copied")) | ||||
| 		assert.Views().ByName("information").Content(Contains("2 commits copied")) | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
|  | ||||
| 		assert.CurrentView().TopLines( | ||||
| 		assert.Views().Current().TopLines( | ||||
| 			Contains("first change"), | ||||
| 		) | ||||
|  | ||||
| @@ -52,14 +52,14 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Content(Contains("Conflicts!")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("files") | ||||
| 		assert.CurrentView().SelectedLine(Contains("file")) | ||||
| 		assert.Views().Current().Name("files") | ||||
| 		assert.Views().Current().SelectedLine(Contains("file")) | ||||
|  | ||||
| 		// not using Confirm() convenience method because I suspect we might change this | ||||
| 		// keybinding to something more bespoke | ||||
| 		input.Press(keys.Universal.Confirm) | ||||
|  | ||||
| 		assert.CurrentView().Name("mergeConflicts") | ||||
| 		assert.Views().Current().Name("mergeConflicts") | ||||
| 		// picking 'Second change' | ||||
| 		input.NextItem() | ||||
| 		input.PrimaryAction() | ||||
| @@ -69,12 +69,12 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Content(Contains("all merge conflicts resolved. Continue?")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("files") | ||||
| 		assert.Views().Current().Name("files") | ||||
| 		assert.WorkingTreeFileCount(0) | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
|  | ||||
| 		assert.CurrentView().TopLines( | ||||
| 		assert.Views().Current().TopLines( | ||||
| 			Contains("second-change-branch unrelated change"), | ||||
| 			Contains("second change"), | ||||
| 			Contains("first change"), | ||||
| @@ -83,12 +83,12 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		// because we picked 'Second change' when resolving the conflict, | ||||
| 		// we now see this commit as having replaced First Change with Second Change, | ||||
| 		// as opposed to replacing 'Original' with 'Second change' | ||||
| 		assert.MainView(). | ||||
| 		assert.Views().Main(). | ||||
| 			Content(Contains("-First Change")). | ||||
| 			Content(Contains("+Second Change")) | ||||
|  | ||||
| 		assert.View("information").Content(Contains("2 commits copied")) | ||||
| 		assert.Views().ByName("information").Content(Contains("2 commits copied")) | ||||
| 		input.Press(keys.Universal.Return) | ||||
| 		assert.View("information").Content(DoesNotContain("commits copied")) | ||||
| 		assert.Views().ByName("information").Content(DoesNotContain("commits copied")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -25,6 +25,6 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		assert.HeadCommitMessage(Equals("first line")) | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
| 		assert.MainView().Content(MatchesRegexp("first line\n\\s*\n\\s*third line")) | ||||
| 		assert.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -20,7 +20,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		assert.CommitCount(3) | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("commit 3"), | ||||
| 			Contains("commit 2"), | ||||
| 			Contains("commit 1"), | ||||
| @@ -34,7 +34,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		assert.CurrentBranchName(branchName) | ||||
|  | ||||
| 		assert.View("commits").Lines( | ||||
| 		assert.Views().ByName("commits").Lines( | ||||
| 			Contains("commit 2"), | ||||
| 			Contains("commit 1"), | ||||
| 		) | ||||
|   | ||||
| @@ -20,7 +20,7 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.SwitchToCommitsView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("first commit"), | ||||
| 		) | ||||
|  | ||||
| @@ -30,13 +30,13 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Content(MatchesRegexp(`Are you sure you want to revert \w+?`)). | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("commits"). | ||||
| 		assert.Views().Current().Name("commits"). | ||||
| 			Lines( | ||||
| 				Contains("Revert \"first commit\"").IsSelected(), | ||||
| 				Contains("first commit"), | ||||
| 			) | ||||
|  | ||||
| 		assert.MainView().Content(Contains("-myfile content")) | ||||
| 		assert.Views().Main().Content(Contains("-myfile content")) | ||||
| 		assert.FileSystemPathNotPresent("myfile") | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -18,26 +18,26 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		assert.CommitCount(0) | ||||
|  | ||||
| 		assert.CurrentView().Name("files") | ||||
| 		assert.CurrentView().SelectedLine(Contains("myfile")) | ||||
| 		assert.Views().Current().Name("files") | ||||
| 		assert.Views().Current().SelectedLine(Contains("myfile")) | ||||
| 		// stage the file | ||||
| 		input.PrimaryAction() | ||||
| 		input.Enter() | ||||
| 		assert.CurrentView().Name("stagingSecondary") | ||||
| 		assert.Views().Current().Name("stagingSecondary") | ||||
| 		// we start with both lines having been staged | ||||
| 		assert.View("stagingSecondary").Content(Contains("+myfile content")) | ||||
| 		assert.View("stagingSecondary").Content(Contains("+with a second line")) | ||||
| 		assert.View("staging").Content(DoesNotContain("+myfile content")) | ||||
| 		assert.View("staging").Content(DoesNotContain("+with a second line")) | ||||
| 		assert.Views().ByName("stagingSecondary").Content(Contains("+myfile content")) | ||||
| 		assert.Views().ByName("stagingSecondary").Content(Contains("+with a second line")) | ||||
| 		assert.Views().ByName("staging").Content(DoesNotContain("+myfile content")) | ||||
| 		assert.Views().ByName("staging").Content(DoesNotContain("+with a second line")) | ||||
|  | ||||
| 		// unstage the selected line | ||||
| 		input.PrimaryAction() | ||||
|  | ||||
| 		// the line should have been moved to the main view | ||||
| 		assert.View("stagingSecondary").Content(DoesNotContain("+myfile content")) | ||||
| 		assert.View("stagingSecondary").Content(Contains("+with a second line")) | ||||
| 		assert.View("staging").Content(Contains("+myfile content")) | ||||
| 		assert.View("staging").Content(DoesNotContain("+with a second line")) | ||||
| 		assert.Views().ByName("stagingSecondary").Content(DoesNotContain("+myfile content")) | ||||
| 		assert.Views().ByName("stagingSecondary").Content(Contains("+with a second line")) | ||||
| 		assert.Views().ByName("staging").Content(Contains("+myfile content")) | ||||
| 		assert.Views().ByName("staging").Content(DoesNotContain("+with a second line")) | ||||
|  | ||||
| 		input.Press(keys.Files.CommitChanges) | ||||
| 		commitMessage := "my commit message" | ||||
|   | ||||
| @@ -19,16 +19,16 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		assert.CommitCount(0) | ||||
|  | ||||
| 		// stage the file | ||||
| 		assert.CurrentView().Name("files") | ||||
| 		assert.CurrentView().SelectedLine(Contains("myfile")) | ||||
| 		assert.Views().Current().Name("files") | ||||
| 		assert.Views().Current().SelectedLine(Contains("myfile")) | ||||
| 		input.PrimaryAction() | ||||
| 		input.Enter() | ||||
| 		assert.CurrentView().Name("stagingSecondary") | ||||
| 		assert.Views().Current().Name("stagingSecondary") | ||||
| 		// we start with both lines having been staged | ||||
| 		assert.View("stagingSecondary").Content( | ||||
| 		assert.Views().ByName("stagingSecondary").Content( | ||||
| 			Contains("+myfile content").Contains("+with a second line"), | ||||
| 		) | ||||
| 		assert.View("staging").Content( | ||||
| 		assert.Views().ByName("staging").Content( | ||||
| 			DoesNotContain("+myfile content").DoesNotContain("+with a second line"), | ||||
| 		) | ||||
|  | ||||
| @@ -36,8 +36,8 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		input.PrimaryAction() | ||||
|  | ||||
| 		// the line should have been moved to the main view | ||||
| 		assert.View("stagingSecondary").Content(DoesNotContain("+myfile content").Contains("+with a second line")) | ||||
| 		assert.View("staging").Content(Contains("+myfile content").DoesNotContain("+with a second line")) | ||||
| 		assert.Views().ByName("stagingSecondary").Content(DoesNotContain("+myfile content").Contains("+with a second line")) | ||||
| 		assert.Views().ByName("staging").Content(Contains("+myfile content").DoesNotContain("+with a second line")) | ||||
|  | ||||
| 		input.Press(keys.Files.CommitChangesWithoutHook) | ||||
|  | ||||
| @@ -46,7 +46,7 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		assert.CommitCount(1) | ||||
| 		assert.HeadCommitMessage(Equals("WIP" + commitMessage)) | ||||
| 		assert.CurrentView().Name("stagingSecondary") | ||||
| 		assert.Views().Current().Name("stagingSecondary") | ||||
|  | ||||
| 		// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed) | ||||
| 	}, | ||||
|   | ||||
| @@ -20,14 +20,14 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		assert.CommitCount(0) | ||||
|  | ||||
| 		assert.CurrentView().Name("files").SelectedLine(Contains("myfile")) | ||||
| 		assert.Views().Current().Name("files").SelectedLine(Contains("myfile")) | ||||
| 		input.Enter() | ||||
| 		assert.CurrentView().Name("staging") | ||||
| 		assert.View("stagingSecondary").Content(DoesNotContain("+myfile content")) | ||||
| 		assert.Views().Current().Name("staging") | ||||
| 		assert.Views().ByName("stagingSecondary").Content(DoesNotContain("+myfile content")) | ||||
| 		// stage the first line | ||||
| 		input.PrimaryAction() | ||||
| 		assert.View("staging").Content(DoesNotContain("+myfile content")) | ||||
| 		assert.View("stagingSecondary").Content(Contains("+myfile content")) | ||||
| 		assert.Views().ByName("staging").Content(DoesNotContain("+myfile content")) | ||||
| 		assert.Views().ByName("stagingSecondary").Content(Contains("+myfile content")) | ||||
|  | ||||
| 		input.Press(keys.Files.CommitChanges) | ||||
|  | ||||
|   | ||||
| @@ -31,7 +31,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.Press("a") | ||||
|  | ||||
| 		assert.View("files").Lines( | ||||
| 		assert.Views().ByName("files").Lines( | ||||
| 			Contains("myfile"), | ||||
| 		) | ||||
| 	}, | ||||
|   | ||||
| @@ -75,7 +75,7 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.WorkingTreeFileCount(1) | ||||
| 		assert.CurrentView().SelectedLine(Contains("my file")) | ||||
| 		assert.MainView().Content(Contains(`"BAR"`)) | ||||
| 		assert.Views().Current().SelectedLine(Contains("my file")) | ||||
| 		assert.Views().Main().Content(Contains(`"BAR"`)) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -60,7 +60,7 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		input.SwitchToFilesView() | ||||
|  | ||||
| 		assert.WorkingTreeFileCount(1) | ||||
| 		assert.CurrentView().SelectedLine(Contains("output.txt")) | ||||
| 		assert.MainView().Content(Contains("bar Branch: #feature/foo my branch feature/foo")) | ||||
| 		assert.Views().Current().SelectedLine(Contains("output.txt")) | ||||
| 		assert.Views().Main().Content(Contains("bar Branch: #feature/foo my branch feature/foo")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -55,7 +55,7 @@ var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		input.Press("a") | ||||
|  | ||||
| 		assert.InPrompt() | ||||
| 		assert.CurrentView(). | ||||
| 		assert.Views().Current(). | ||||
| 			Title(Equals("Which git command do you want to run?")). | ||||
| 			SelectedLine(Equals("branch")) | ||||
| 		input.Confirm() | ||||
|   | ||||
| @@ -73,7 +73,7 @@ var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Confirm() | ||||
|  | ||||
| 		assert.WorkingTreeFileCount(1) | ||||
| 		assert.CurrentView().SelectedLine(Contains("myfile")) | ||||
| 		assert.MainView().Content(Contains("BAR")) | ||||
| 		assert.Views().Current().SelectedLine(Contains("myfile")) | ||||
| 		assert.Views().Main().Content(Contains("BAR")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -24,35 +24,35 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToBranchesView() | ||||
|  | ||||
| 		assert.CurrentView().TopLines( | ||||
| 		assert.Views().Current().TopLines( | ||||
| 			Contains("branch-a"), | ||||
| 			Contains("branch-b"), | ||||
| 		) | ||||
| 		input.Press(keys.Universal.DiffingMenu) | ||||
| 		input.Menu().Title(Equals("Diffing")).Select(Contains(`diff branch-a`)).Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("localBranches") | ||||
| 		assert.Views().Current().Name("localBranches") | ||||
|  | ||||
| 		assert.View("information").Content(Contains("showing output for: git diff branch-a branch-a")) | ||||
| 		assert.Views().ByName("information").Content(Contains("showing output for: git diff branch-a branch-a")) | ||||
| 		input.NextItem() | ||||
| 		assert.View("information").Content(Contains("showing output for: git diff branch-a branch-b")) | ||||
| 		assert.MainView().Content(Contains("+second line")) | ||||
| 		assert.Views().ByName("information").Content(Contains("showing output for: git diff branch-a branch-b")) | ||||
| 		assert.Views().Main().Content(Contains("+second line")) | ||||
|  | ||||
| 		input.Enter() | ||||
| 		assert.CurrentView().Name("subCommits") | ||||
| 		assert.MainView().Content(Contains("+second line")) | ||||
| 		assert.CurrentView().SelectedLine(Contains("update")) | ||||
| 		assert.Views().Current().Name("subCommits") | ||||
| 		assert.Views().Main().Content(Contains("+second line")) | ||||
| 		assert.Views().Current().SelectedLine(Contains("update")) | ||||
| 		input.Enter() | ||||
| 		assert.CurrentView().Name("commitFiles").SelectedLine(Contains("file1")) | ||||
| 		assert.MainView().Content(Contains("+second line")) | ||||
| 		assert.Views().Current().Name("commitFiles").SelectedLine(Contains("file1")) | ||||
| 		assert.Views().Main().Content(Contains("+second line")) | ||||
|  | ||||
| 		input.Press(keys.Universal.Return) | ||||
| 		input.Press(keys.Universal.Return) | ||||
| 		assert.CurrentView().Name("localBranches") | ||||
| 		assert.Views().Current().Name("localBranches") | ||||
|  | ||||
| 		input.Press(keys.Universal.DiffingMenu) | ||||
| 		input.Menu().Title(Equals("Diffing")).Select(Contains("reverse diff direction")).Confirm() | ||||
| 		assert.View("information").Content(Contains("showing output for: git diff branch-a branch-b -R")) | ||||
| 		assert.MainView().Content(Contains("-second line")) | ||||
| 		assert.Views().ByName("information").Content(Contains("showing output for: git diff branch-a branch-b -R")) | ||||
| 		assert.Views().Main().Content(Contains("-second line")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -23,7 +23,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	}, | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToBranchesView() | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("branch-a"), | ||||
| 			Contains("branch-b"), | ||||
| 		) | ||||
| @@ -32,21 +32,21 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.Menu().Title(Equals("Diffing")).Select(Equals("diff branch-a")).Confirm() | ||||
|  | ||||
| 		assert.CurrentView().Name("localBranches") | ||||
| 		assert.Views().Current().Name("localBranches") | ||||
|  | ||||
| 		assert.View("information").Content(Contains("showing output for: git diff branch-a branch-a")) | ||||
| 		assert.Views().ByName("information").Content(Contains("showing output for: git diff branch-a branch-a")) | ||||
| 		input.NextItem() | ||||
| 		assert.View("information").Content(Contains("showing output for: git diff branch-a branch-b")) | ||||
| 		assert.MainView().Content(Contains("+second line")) | ||||
| 		assert.Views().ByName("information").Content(Contains("showing output for: git diff branch-a branch-b")) | ||||
| 		assert.Views().Main().Content(Contains("+second line")) | ||||
|  | ||||
| 		input.Enter() | ||||
| 		assert.CurrentView().Name("subCommits") | ||||
| 		assert.MainView().Content(Contains("+second line")) | ||||
| 		assert.CurrentView().SelectedLine(Contains("update")) | ||||
| 		assert.Views().Current().Name("subCommits") | ||||
| 		assert.Views().Main().Content(Contains("+second line")) | ||||
| 		assert.Views().Current().SelectedLine(Contains("update")) | ||||
| 		input.Enter() | ||||
| 		assert.CurrentView().Name("commitFiles") | ||||
| 		assert.CurrentView().SelectedLine(Contains("file1")) | ||||
| 		assert.MainView().Content(Contains("+second line")) | ||||
| 		assert.Views().Current().Name("commitFiles") | ||||
| 		assert.Views().Current().SelectedLine(Contains("file1")) | ||||
| 		assert.Views().Main().Content(Contains("+second line")) | ||||
|  | ||||
| 		// add the file to the patch | ||||
| 		input.PrimaryAction() | ||||
| @@ -54,7 +54,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		input.Press(keys.Universal.DiffingMenu) | ||||
| 		input.Menu().Title(Equals("Diffing")).Select(Contains("exit diff mode")).Confirm() | ||||
|  | ||||
| 		assert.View("information").Content(DoesNotContain("building patch")) | ||||
| 		assert.Views().ByName("information").Content(DoesNotContain("building patch")) | ||||
|  | ||||
| 		input.Press(keys.Universal.CreatePatchOptionsMenu) | ||||
| 		// adding the regex '$' here to distinguish the menu item from the 'apply patch in reverse' item | ||||
| @@ -62,7 +62,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.SwitchToFilesView() | ||||
|  | ||||
| 		assert.CurrentView().SelectedLine(Contains("file1")) | ||||
| 		assert.MainView().Content(Contains("+second line")) | ||||
| 		assert.Views().Current().SelectedLine(Contains("file1")) | ||||
| 		assert.Views().Main().Content(Contains("+second line")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -21,7 +21,7 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToCommitsView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("third commit"), | ||||
| 			Contains("second commit"), | ||||
| 			Contains("first commit"), | ||||
| @@ -32,23 +32,23 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		assert.NotInPopup() | ||||
|  | ||||
| 		assert.View("information").Content(Contains("showing output for: git diff")) | ||||
| 		assert.Views().ByName("information").Content(Contains("showing output for: git diff")) | ||||
|  | ||||
| 		input.NextItem() | ||||
| 		input.NextItem() | ||||
| 		assert.CurrentView().SelectedLine(Contains("first commit")) | ||||
| 		assert.Views().Current().SelectedLine(Contains("first commit")) | ||||
|  | ||||
| 		assert.MainView().Content(Contains("-second line\n-third line")) | ||||
| 		assert.Views().Main().Content(Contains("-second line\n-third line")) | ||||
|  | ||||
| 		input.Press(keys.Universal.DiffingMenu) | ||||
| 		input.Menu().Title(Equals("Diffing")).Select(Contains("reverse diff direction")).Confirm() | ||||
| 		assert.NotInPopup() | ||||
|  | ||||
| 		assert.MainView().Content(Contains("+second line\n+third line")) | ||||
| 		assert.Views().Main().Content(Contains("+second line\n+third line")) | ||||
|  | ||||
| 		input.Enter() | ||||
|  | ||||
| 		assert.CurrentView().Name("commitFiles").SelectedLine(Contains("file1")) | ||||
| 		assert.MainView().Content(Contains("+second line\n+third line")) | ||||
| 		assert.Views().Current().Name("commitFiles").SelectedLine(Contains("file1")) | ||||
| 		assert.Views().Main().Content(Contains("+second line\n+third line")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -24,7 +24,7 @@ var DirWithUntrackedFile = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		assert.CommitCount(1) | ||||
|  | ||||
| 		assert.MainView(). | ||||
| 		assert.Views().Main(). | ||||
| 			Content(DoesNotContain("error: Could not access")). | ||||
| 			// we show baz because it's a modified file but we don't show bar because it's untracked | ||||
| 			// (though it would be cool if we could show that too) | ||||
|   | ||||
| @@ -82,7 +82,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		discardOneByOne := func(files []statusFile) { | ||||
| 			for _, file := range files { | ||||
| 				assert.CurrentView().SelectedLine(Contains(file.status + " " + file.label)) | ||||
| 				assert.Views().Current().SelectedLine(Contains(file.status + " " + file.label)) | ||||
| 				input.Press(keys.Universal.Remove) | ||||
| 				input.Menu().Title(Equals(file.menuTitle)).Select(Contains("discard all changes")).Confirm() | ||||
| 			} | ||||
|   | ||||
| @@ -46,7 +46,7 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		assert.HeadCommitMessage(Contains(mergeCommitMessage)) | ||||
|  | ||||
| 		// assuring the post-merge file shows up in the merge commit. | ||||
| 		assert.MainView(). | ||||
| 		assert.Views().Main(). | ||||
| 			Content(Contains(postMergeFilename)). | ||||
| 			Content(Contains("++" + postMergeFileContent)) | ||||
| 	}, | ||||
|   | ||||
| @@ -16,7 +16,7 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	}, | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToCommitsView() | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("commit 05"), | ||||
| 			Contains("commit 04"), | ||||
| 			Contains("commit 03"), | ||||
| @@ -27,7 +27,7 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		input.NavigateToListItem(Contains("commit 02")) | ||||
| 		input.Press(keys.Universal.Edit) | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			MatchesRegexp("pick.*commit 05"), | ||||
| 			MatchesRegexp("pick.*commit 04"), | ||||
| 			MatchesRegexp("pick.*commit 03"), | ||||
| @@ -37,7 +37,7 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.PreviousItem() | ||||
| 		input.Press(keys.Commits.MarkCommitAsFixup) | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			MatchesRegexp("pick.*commit 05"), | ||||
| 			MatchesRegexp("pick.*commit 04"), | ||||
| 			MatchesRegexp("fixup.*commit 03"), | ||||
| @@ -47,7 +47,7 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.PreviousItem() | ||||
| 		input.Press(keys.Universal.Remove) | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			MatchesRegexp("pick.*commit 05"), | ||||
| 			MatchesRegexp("drop.*commit 04"), | ||||
| 			MatchesRegexp("fixup.*commit 03"), | ||||
| @@ -58,7 +58,7 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 		input.PreviousItem() | ||||
| 		input.Press(keys.Commits.SquashDown) | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			MatchesRegexp("squash.*commit 05"), | ||||
| 			MatchesRegexp("drop.*commit 04"), | ||||
| 			MatchesRegexp("fixup.*commit 03"), | ||||
| @@ -68,7 +68,7 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.ContinueRebase() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Contains("commit 02"), | ||||
| 			Contains("commit 01"), | ||||
| 		) | ||||
|   | ||||
| @@ -21,7 +21,7 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { | ||||
| 		input.SwitchToStashView() | ||||
|  | ||||
| 		assert.CurrentView().Lines( | ||||
| 		assert.Views().Current().Lines( | ||||
| 			Equals("On master: bar"), | ||||
| 			Equals("On master: foo"), | ||||
| 		) | ||||
| @@ -30,6 +30,6 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
|  | ||||
| 		input.Prompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm() | ||||
|  | ||||
| 		assert.CurrentView().SelectedLine(Equals("On master: foo baz")) | ||||
| 		assert.Views().Current().SelectedLine(Equals("On master: foo baz")) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user