Thanks for your answer.
But I think this will not help.
So what is happening:
1. The app, that needs to be tested, is started:
return this.iStartMyAppInAFrame("./index.html");
2. Now the app will be started. One view has a afterRendering method, which calls the server.
3. Date will be shown...
Now the OPA test should not work with the real server. So we need a mock server...
The mock server can be injected as said in my previous post.
But before I start the app, as in point 1, I can not inject, because the SAP framework in the iframe is not initiated (I am too early).
The promise used to start the app in the iFrame will be resolved after point 2 (I am too late).
So I have no clue how to do that properly. I could of course try to delay it, that I come right into the spot between 1&2, but this depends on the load and so on.
So I do not think that a fixed delay would work.
Maybe I could try do defer the code until the "sap.ui.test.Opa5.getWindow().jQuery.sap"-object is resolved...