3

Description

We are using appium in our cucumber suite within TeamCity 8 on an Apple MacMini running Mavericks. The problem is that appium seems to fail to interact with the iOS Simulator when it is ran from TeamCity at login (via Automator).

The only combination that I have found to work is to run the following from the Terminal in an interactive session:

sh /Applications/buildagent/bin/agent.sh start

What does not work?

  • running agent.sh start from an ssh session
  • creating a shell script with Automator that launches at login (the macmini is set to login automatically)

Theory

My theory is that it has something to do with Preferences -> Security & Privacy -> Accessibility. The only way that it works when launching from Terminal is if Terminal is added to this list of allowed applications. I'm not sure what I need to add to this list in order for this to work automatically at login.

Any help would be greatly appreciated.

Levi
  • 839
  • 2
  • 7
  • 21

2 Answers2

1

Many iOS tests will not run without an interactive session. For example, unit tests using the iOS simulator will not work.

Edit: By interactive session, I mean the TeamCity agent must be started from the desktop, not via an SSH session. Otherwise nothing can communicate with the Simulator.

danieljimenez
  • 1,390
  • 4
  • 17
  • 26
  • I'm not sure what you mean by interactive session. This issue is purely about giving Appium access to the Simulator – Jess Jul 07 '14 at 18:46
  • 1
    By interactive session, I mean the TeamCity agent must be started from the desktop, not via an SSH session. Otherwise nothing can communicate with the Simulator. – danieljimenez Jul 08 '14 at 00:55
  • @sheeptest not sure why you down voted me, the OP asked about the simulator and even mentioned an interactive session. – danieljimenez Jul 08 '14 at 00:56
  • Ah, I get what you mean now. Update your answer with that! – Jess Jul 08 '14 at 12:47
0

You are correct, you need to allow Appium to interact with Automator.

Solutions straight from the documentation:

  • If you're running Appium from an NPM install: sudo authorize_ios

  • If you're running Appium from source: sudo grunt authorize

  • If you are running Appium.app, you can authorize iOS through the GUI. This prompt pops up the first time you click "Launch/Run" on the GUI and it tries to open the simulator

Jess
  • 3,097
  • 2
  • 16
  • 42
  • I'll have to revisit this again; it's been awhile since I've looked at this. At the time, I'm fairly sure that I did the `sudo authorize_ios` and combinations of both. Also since then we moved away from Appium altogether due to speed (using instruments directly now, IIRC). – Levi Jul 08 '14 at 01:31
  • Ah. OK. How's that working for you? (The speed performances, and general reliability, are much improved in 1.X -- it was a huge concern for us, too) – Jess Jul 08 '14 at 12:45
  • 1
    Much better, actually. I was not on the team that did this (was only popping in to help out every now and again) but one of the team members wrote a gem called [`cumber`](https://rubygems.org/gems/cumber) that uses instruments directly. It could probably stand to have a page-object wrapper, but I know that the test suite has been much faster and more reliable in their experience. We still start the suite from the interactive session though, I know. – Levi Jul 08 '14 at 13:01
  • Good. Yeah, I've come to like parts of Appium. The biggest problem is that it's very undocumented, and a bit finicky to use. But it does provide a nice little API to use for instruments. Having all of Selenium's implicit wait commands, etc, is so helpful. I've never worked directly with Instruments before. Something I should try :) – Jess Jul 08 '14 at 13:20