Skip to content

Commit

Permalink
chore: add action that will click Allow button during podman installa…
Browse files Browse the repository at this point in the history
…tion on Mac

Signed-off-by: Ondrej Dockal <odockal@redhat.com>
  • Loading branch information
odockal committed Dec 18, 2024
1 parent 827713c commit bed40f5
Showing 1 changed file with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ const (
installerBundleID = "com.apple.installer"
installerPodmanTitle = "Install Podman"

installerContinue = "Continue"
installerAgree = "Agree"
installerInstall = "Install"
installerClose = "Close"
installerContinue = "Continue"
installerAgree = "Agree"
installerAllow = "Allow"
installerInstall = "Install"
installerClose = "Close"

installerSelectLocationTitle = "Select a Destination"
)
Expand Down Expand Up @@ -49,22 +50,29 @@ func runInstaller(userPassword string) error {
if err := i.Click(installerAgree, delay.SMALL); err != nil {
return installerError(err)
}
if selectLocationExists, err := i.ExistsWithType(installerSelectLocationTitle, "text"); selectLocationExists {
if err != nil {
return installerError(err)
// get foreground App (Just a system dialog, contains buttons Allow and Don't Allow)
y, err := ax.GetForefront()
if err := y.Click(installerAllow, delay.SMALL); err != nil {
return installerError(err)
}
// reinitilize installer app
ii, err2 := ax.GetAppByTypeAndTitle(installerBundleID, installerPodmanTitle)
if selectLocationExists, err2 := ii.ExistsWithType(installerSelectLocationTitle, "text"); selectLocationExists {
if err2 != nil {
return installerError(err2)
}
if err := i.Click(installerContinue, delay.SMALL); err != nil {
return installerError(err)
if err2 := ii.Click(installerContinue, delay.SMALL); err2 != nil {
return installerError(err2)
}
}
if err := i.Click(installerInstall, delay.SMALL); err != nil {
return installerError(err)
if err2 := ii.Click(installerInstall, delay.SMALL); err2 != nil {
return installerError(err2)
}
if err := i.SetValueOnFocus(userPassword, delay.XLONG); err != nil {
return installerError(err)
if err2 := ii.SetValueOnFocus(userPassword, delay.XLONG); err2 != nil {
return installerError(err2)
}
if err := i.Click(installerClose, delay.SMALL); err != nil {
return installerError(err)
if err := ii.Click(installerClose, delay.SMALL); err != nil {
return installerError(err2)
}
return nil
}

0 comments on commit bed40f5

Please sign in to comment.