0

After successfully adding EarlGrey to existing project (using CocoaPods) project is successfully built (both "for running" and "for testing"). The problem is that if I run the app from XCode it runs as expected. If I run it as a test only splash screen appears and then whole screen turns black. Have anyone encountered such issue? What might be a problem here?

There is somewhat similar question Black screen with EarlGrey but author did not share his solution.

Additional info:

  • XCode 8
  • CocoaPods 1.2.1
  • EarlGrey 1.9.3
Karol Gil
  • 95
  • 3
  • 8
  • Are there any logs you could please provide us to debug? Do you have a continuous animation or network request going on? EarlGrey will wait for it to complete before proceeding to the next step. – gran_profaci Jun 02 '17 at 16:31
  • 1
    You may want to debug your app delegate and see if it's behaving differently under normal runs and test runs. I would guess that the window or its root view controller isn't being set property. There could also be some issue related to resource loading (storyboard or xib). – khandpur Jun 02 '17 at 18:13

1 Answers1

0

I followed @khandpur advice and tried debugging my app first. So I found out, that in main.m file we're checking if current run is a test run, by

BOOL areWeRunningTests = NSClassFromString(@"XCTestCase") != nil;

Based on that we are running app differently.

To everyone in similar situation: I've added a check

BOOL areWeRunningUITests = NSClassFromString(@"EarlGreyImpl") != nil;

and if that's true app is starting normally.

Final comments - you have to know your app a little to be able to use EarlGrey easily... :)

Karol Gil
  • 95
  • 3
  • 8