Since, XCTest requires its instances to launch with a code snippet like this :
let app = XCUIApplication()
let device = XCUIDevice()
app.launch()
and EarlGrey initialises the app instance in a different way. So when I tried to intertwine both code, tests failed, because the underlying hook is not able to switch between both of them. Can you please suggest me how to proceed with this?
That's XCUITest using a UI test target. The next version of EarlGrey will support the flow you mentioned but the current 1.x versions only work as a unit-test target. The first question in FAQ also talks about this.