Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to return to application once another application is activated #91

Closed
rfodge opened this issue Feb 8, 2020 · 2 comments
Closed

Comments

@rfodge
Copy link

rfodge commented Feb 8, 2020

Hi Again :),

So I posted this question
https://stackoverflow.com/questions/60120863/xctest-activate-not-working-when-ran-from-command-line

As I originally didn't think it was related to the tunnel, however when i went back to the branch using the tunnel version 3.x version of the tunnel the code worked fine. But when we are on the branch with the latest version of the tunnel, it does not.

Our application launches the Maps application and in the XCTest we do

let maps = XCUIApplication(bundleIdentifier: "com.apple.Maps")
let alert = maps.alerts.element(boundBy: 0)

However any time we did maps.anything() it would stay on the Maps application and not "return" to the application / end test until about 5 mins went by. And when I tried calling myapp.activate() after the Maps interaction it would not return to our application. It just stays on the Maps application.

Interestingly enough though, this only is an issue when running the tests thru the command line and not when the test via XCode.

In order to get around it for now, I did:

BaseTest.sbtApp?.terminate()
let maps = XCUIApplication(bundleIdentifier: "com.apple.Maps")
let alert = maps.alerts.element(boundBy: 0)

And here, I just relaunch the app and start the test workflow over.

Thoughts?

Thanks!

@tcamin
Copy link
Member

tcamin commented Feb 12, 2020

what is BaseTest.sbtApp? Can't you use the app property that the library adds to XCTestCases instead?

@rfodge
Copy link
Author

rfodge commented Feb 24, 2020

Oh its just the instance of SBTUITunneledApplication but yes as far as terminating the app, same thing. That piece works.

@tcamin tcamin closed this as completed Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants