patrol
patrol copied to clipboard
Have the ability to mock the device's location using XCUILocation on iOS
Use case
Hello,
I noticed the issue https://github.com/leancodepl/patrol/issues/1961 was recently closed, but I was wondering if there's any way we could implement mocking for the location of the phone by using XCUILocation as described here on Apple's doc?
Example:
import XCTest
import CoreLocation
final class SampleAppTests: XCTestCase {
func testExample() throws {
XCUIDevice.shared.location = XCUILocation(location: CLLocation(latitude: 37.334886, longitude: -122.008988))
// Launch your app and run the test.
}
}
Proposal
Ideally, we'd be able to use a method like await $.native.setLocation(LatLng(37.334886, -122.008988));
However if we're limited to before the app is launched, then perhaps we can pass coordinates to NativeAutomatorConfig()
?
Hi, nice find. It looks like a good starting point for implementing this feature if it's actually going to work.