google / EarlGrey

:tea: iOS UI Automation Test Framework
http://google.github.io/EarlGrey/
Apache License 2.0
5.61k stars 740 forks source link

[EarlGrey2] Host background port not assigned. Application under test may have failed to launch with latest Cocoapods #1891

Open badrinrs opened 1 year ago

badrinrs commented 1 year ago

When point the cocoapods to latest earlgrey2 branch, I am seeing an issue with a header (GREYDescribeVariable.h) not being accessible in GREYAssertionDefinesPrivate.h file. Once I made GREYAssertionDefinesPrivate.h public in Target membership section, The app and test compiled fine and were installed and launched.

After launching, I saw an error: 2023-01-23 10:07:29.305585-0800 [62174:24241479] [EARLGREY-LOG] Application Launch Completed. UI Test with EarlGrey Starting 2023-01-23 10:07:59.307334-0800 [62174:24241479] Fatal failure: Host background port not assigned. Application under test may have failed to launch and/or does not link to EarlGrey's AppFramework. in /Pods/EarlGreyTest/TestLib/DistantObject/GREYTestApplicationDistantObject.m:278

Podfile:

target 'TestApp' do use_frameworks! pod 'eDistantObject', :git => 'https://github.com/google/eDistantObject.git', :branch => 'master' pod 'EarlGreyApp', :git => 'https://github.com/google/EarlGrey.git', :branch => 'earlgrey2'

target 'TestAppUITests' do

Pods for testing

use_frameworks!
pod 'eDistantObject', :git => 'https://github.com/google/eDistantObject.git', :branch => 'master'
pod 'EarlGreyTest', :git => 'https://github.com/google/EarlGrey.git', :branch => 'earlgrey2'

end

end

@tirodkar

enlivn commented 11 months ago

@badrinrs I'm not sure if you managed to figure this out but this error usually happens if you're trying to use an EG function before your XCUIApplication has actually finished booting up.