You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
I noticed Monkey seems to always tap on the very first element of my screen. Is there a way to get it to scroll down randomly so that it won't always tap on the same element of my screen?
func monkeyAround(_ iterationsToMonkey: Int) {
bringAppToForeground()
// Rotate back to Portrait, to avoid Plus size iPhone locking issues
XCUIDevice.shared.orientation = UIDeviceOrientation.portrait
// Sleep while the animation completes
sleep(1)
// Now we setup the Monkey, to tap objects randomly, and - if an alert displays - tap a random button on any alert that pops-up
_ = app.descendants(matching: .any).element(boundBy: 0).frame
let monkey = Monkey(frame: app.frame)
//monkey.addDefaultXCTestPrivateActions()
monkey.addXCTestTapAlertAction(interval: 100, application: app)
monkey.addUIAutomationShakeAction(weight: 3)
monkey.addUIAutomationLockAction(weight: 2)
//monkey.addUIAutomationClickVolumeDownAction(weight: 5)
monkey.addUIAutomationTapAction(weight: Double(arc4random_uniform(UInt32(80) - UInt32(60)) + UInt32(60)))
monkey.addUIAutomationDragAction(weight: 4)
monkey.addUIAutomationFlickAction(weight: 2)
// Begin taking a screenshot each second, until timer is stopped below with stopTimer()
// If persistScreenshotsOnSuccess = true, then we'll save the values of the screenshots even if the test passes
// If persistScreenshotsOnSuccess = false, then we'll only save the values of the screenshots if the tests fail. Otherwise, we'll ditch the screenshots
startTimerToTakeScreenshots()
// Don't set this much lower than 10, as sometimes it can't escape what's already on-screen
monkey.monkeyAround(iterations: iterationsToMonkey)
// Stop the timer, then ensure the app is foregrounded again, just in case it's gone off to Safari or the home screen
stopTimer()
bringAppToForeground()
}
Cheers,
Lucas
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I noticed Monkey seems to always tap on the very first element of my screen. Is there a way to get it to scroll down randomly so that it won't always tap on the same element of my screen?
func monkeyAround(_ iterationsToMonkey: Int) {
bringAppToForeground()
// Rotate back to Portrait, to avoid Plus size iPhone locking issues
XCUIDevice.shared.orientation = UIDeviceOrientation.portrait
// Sleep while the animation completes
sleep(1)
Cheers,
Lucas
The text was updated successfully, but these errors were encountered: