From b623ecf898e1ac35b0a6093978203a7b5c13c42e Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 24 Dec 2022 17:48:57 +1100 Subject: add helper functions for popups in tests --- pkg/integration/tests/cherry_pick/cherry_pick.go | 12 +++++------- .../tests/cherry_pick/cherry_pick_conflicts.go | 22 ++++++++-------------- 2 files changed, 13 insertions(+), 21 deletions(-) (limited to 'pkg/integration/tests/cherry_pick') diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go index 7cbf6a70a..444cf35e4 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick.go @@ -35,23 +35,21 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("subCommits") assert.SelectedLine(Contains("four")) - input.PressKeys(keys.Commits.CherryPickCopy) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() assert.SelectedLine(Contains("three")) - input.PressKeys(keys.Commits.CherryPickCopy) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") assert.SelectedLine(Contains("two")) - input.PressKeys(keys.Commits.PasteCommits) - assert.InAlert() - assert.CurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) + input.Press(keys.Commits.PasteCommits) + input.Alert(Equals("Cherry-Pick"), Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) - input.Confirm() assert.CurrentViewName("commits") assert.SelectedLine(Contains("four")) input.NextItem() @@ -60,7 +58,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("two")) assert.ViewContent("information", Contains("2 commits copied")) - input.PressKeys(keys.Universal.Return) + input.Press(keys.Universal.Return) assert.ViewContent("information", NotContains("commits copied")) }, }) diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index 99005ad8e..377e21e76 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -26,42 +26,36 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("subCommits") assert.SelectedLine(Contains("second-change-branch unrelated change")) - input.PressKeys(keys.Commits.CherryPickCopy) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() assert.SelectedLine(Contains("second change")) - input.PressKeys(keys.Commits.CherryPickCopy) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") assert.SelectedLine(Contains("first change")) - input.PressKeys(keys.Commits.PasteCommits) - assert.InAlert() - assert.CurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) + input.Press(keys.Commits.PasteCommits) + input.Alert(Equals("Cherry-Pick"), Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) - input.Confirm() - - assert.CurrentViewContent(Contains("Conflicts!")) - input.Confirm() + input.AcceptConfirmation(Equals("Auto-merge failed"), Contains("Conflicts!")) assert.CurrentViewName("files") assert.SelectedLine(Contains("file")) // not using Confirm() convenience method because I suspect we might change this // keybinding to something more bespoke - input.PressKeys(keys.Universal.Confirm) + input.Press(keys.Universal.Confirm) assert.CurrentViewName("mergeConflicts") // picking 'Second change' input.NextItem() input.PrimaryAction() - assert.InConfirm() - assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) - input.Confirm() + input.AcceptConfirmation(Equals("continue"), Contains("all merge conflicts resolved. Continue?")) assert.CurrentViewName("files") assert.WorkingTreeFileCount(0) @@ -81,7 +75,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("first change")) assert.ViewContent("information", Contains("2 commits copied")) - input.PressKeys(keys.Universal.Return) + input.Press(keys.Universal.Return) assert.ViewContent("information", NotContains("commits copied")) }, }) -- cgit v1.2.3