Testing Xcode UI on Travis for OSX with Xcode Helper Accessibility

How can I configure Travis to run my XCTest UI apps for OSX? The Travis test fails because OSX Xcode Helper requires permission to use Accessibility for the test instance. Is there a way to configure a Travis instance to grant permission for the Xcode helper to use accessibility before running xcodebuild?

I use the latest Xcode 7.2 Travis configuration with OSX 10.11.1, and I run my tests using xcodebuild as a Travis script, because xctool does not yet support UI tests . If you try to use xctool, you will receive an error message that the test suite does not contain an executable file.

I believe that other people run UI tests on Travis for iOS because they run in the simulator and do not require Xcode Helper to have access permissions.

Here is my .travis.yml file (slightly confusing):

osx_image: xcode7.2 language: objective-c xcode_workspace: MyApp.xcworkspace xcode_scheme: MyAppUITests jdk: - oraclejdk8 install: - pod install - gem install xcpretty --no-rdoc --no-ri --no-document --quiet - xcodebuild -workspace MyApp.xcworkspace -scheme MyAppUITests -destination 'platform=OS X,arch=x86_64' clean build | xcpretty -c || true script: - xcodebuild -workspace MyApp.xcworkspace -scheme MyAppUITests -destination 'platform=OS X,arch=x86_64' test 
+5
source share
2 answers

I found a secret sauce to fix this problem. Add the following spell to your .travis.yml in the installation section:

  - sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" "INSERT INTO access VALUES ('kTCCServiceAccessibility','com.apple.dt.Xcode-Helper',0,1,1,NULL,NULL);" 

This adds an entry to the access database used to determine access permissions. Bang bang!

+12
source

For those who find this page via Google: unfortunately, it no longer works. Starting with MacOS 10.12, the accessibility database is protected by SIP, so the sqlite3 command fails with a read-only file error.

I could not find a workaround.

0
source

Source: https://habr.com/ru/post/1237951/


All Articles