Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Find a quick way to see if the monkey manages to leave the application #4

Open
DagAgren opened this issue Nov 22, 2016 · 5 comments
Open

Comments

@DagAgren
Copy link
Collaborator

Try to find out if there is a way to detect from test code if the application has been exited so the test can stop.

@drptbl
Copy link

drptbl commented Dec 2, 2016

To detect if app is currently running or not:

let isRunning = XCUIApplication().running
print("Application is currently running: \(isRunning)")

To detect if app is currently active or not:

if ((FBApplication.fb_active()?.label)! == "YoursAppName") {
   // still in app
} else {
   // not in app anymore
}

it checks if current active application on screen has proper label - but it requires WebDriverAgentLib to be included in project. It also properly detects stuff like: notification bar overlay on app, control center, etc.

I'm not sure if checking for active app is possible with current XCTest API.

@DagAgren what would you like to achieve in this issue? if application gets crashed/is not running anymore - just finish the tests? as a fail?

DmitryBespalov pushed a commit that referenced this issue Oct 26, 2017
DmitryBespalov pushed a commit that referenced this issue Nov 1, 2017
DmitryBespalov added a commit that referenced this issue Nov 1, 2017
GH-4 Added reactivation of the app after each action is generated
@DmitryBespalov
Copy link
Contributor

Added functionality to return to the app if Monkey exited it accidentally

@drptbl
Copy link

drptbl commented Nov 1, 2017

Thank you!

@singh88
Copy link

singh88 commented Nov 7, 2017

This solution kind of solved the problem but this solution will start the test even after the test fails.

@DmitryBespalov
Copy link
Contributor

@singh88 even if continueAfterFailure = true for a test was set?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants