How can I get an XCUITest application (the XCUI Test application, not the SUT) to access the photos library? - xcode-ui-testing

I'd like to be able to have my XCUITest application post an image to a server. I've installed the image using the xcrun simctl addmedia command, but I can't figure out to how to access it from the XCUITest class.

I accomplished this by using UITest to access the default photos installed in the simulator Photos library, and then using the SUT to post to the server in question.

The recorder doesn't work inside UIRemoteViews like the photos library. What you can do is setup a ui test and get it to the point where the photos library is open then set a breakpoint and view/print the view hierarchy. That is how I figured out how to select one of the default photos in the iPhone simulator.
let app = XCUIApplication()
let tablesQuery = app.tables
//Get to the camera or library prompt
app.sheets.buttons["Choose From Library"].tap()
app.cells["Camera Roll"].tap()
app.cells["Photo, Landscape, March 12, 2011, 7:17 PM"].tap()

Related

Where to put Sqlite database on iPad

I'm writing an app for Apple's iPadOS that uses an SQLite database. I'm controlling the DB using FMDB. During my development I'm pointing FMDB to my local Mac development folder so that I can interrogate the DB using SQLiteStudio instead of digging it out of the development folders that Apple XCode defaults to. When I deploy the application I'd like to be able to put it on the iPad where the Apple "Files" app can see it. I'd like to be able to back it up using iTunes like I can the database of another app that I've purchased.
My question is how to configure the database location on the iPad to be able to achieve those goals. Right now in XCode development I point to:
let databaseFolder =
"/Users/robertpetruzzelli/Desktop/MyProjects/ManagingYourMoney"
and when I test on the iPad I change the file path to:
let databaseFolder = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as NSString) as String
which works for the app to see the DB on the iPad, but it isn't visible in the Files app...
Any assistance would be greatly appreciated.
Bob
Well in a round about way I solved my quandry. Using
let databaseFolder = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as NSString) as String
is the right thing to do, but I needed to do the steps in the link below:
Deploying SQLite DB to iPad app (via iTunes?)
By doing this I could see my app on my iPad in finder and see the file there. I could copy the file to my Macbook Air and work on anything I wanted to investigate there.

Appium WebView always rendered as NATIVE_APP (iOS and Android / Xamarin)

I am testing an iOS and Android Xamarin application using the Appium desktop tool (and therefore language agnostic). The application, when attempting to sign in, loads a webview. However, on both iOS and Android applications, Appium still sees the context as NATIVE_APP. I tried following the instructions here in case there was an issue with Appium desktop, but I got an array containing only NATIVE_APP when calling #driver.available_contexts (Ruby), so I don't believe that's the issue. I AM able to inspect the login page using Safari / Develop / Simulator, so I am unsure who Appium can't see the webview. Any help would be appreciated.
Note - I have another native application that uses the same login intercept webview, and appium DOES see the Webview. So it's entirely possible that this is related to Xamarin. But I have no way of knowing for certain
Can you check the below setup according to appium docs for android.
There is an additional step necessary within your app build, unfortunately. As described in the Android remote debugging docs it is necessary to set to true the setWebContentsDebuggingEnabled property on the android.webkit.WebView element.

App doesn't progress in Validate App in Windows App Certification Kit in UWP?

I am creating an application using Xamarin.Forms but when I try to verify my app using Windows App Certification Kit it fails on Platform version launch.
I also try with make new sample app and in that it works proper and display result pass.
Is there any one who knows this issue and step to stop this can you please suggest or what should I have to check in my application.
I attached screenshot for better understanding.

appcelerator - provisioning file is invalid or is the wrong type

Developing a camera based app in Appcelerator and want to test/debug. I have set up the necessary certificates in apple dev centre. When I select 'run as' and select my iPhone I progress through the setup (General->Certificates->Provisioning) and when I choose the apple provisioning file at step 3 I get "Specified provisioning file is invalid or is the wrong type". Any ideas?
Otherwise, are there alternatives to test the photo access during development?
Thank you.
Just to test the code of camera app - try these options
Replace the APP ID in tiapp.xml of your camera app with any other app which can be run on your device and set the certificates and profiles of camera app with the new app ones.
Or put the camera code you want to test in some other running app on your device. (no need to change the certificates and profiles in this case)
Regarding alternatives to test the photo access during development, if you only need to test the access, you may test on photo album instead using simulator.
Camera & album access are very similar: Ti.Media.showCamera vs Ti.Media.openPhotoGallery

UIImageWriteToSavedPhotosAlbum does not work in iOS 6 iPad 3

I'm using the next function to save photos in my app:
UIImageWriteToSavedPhotosAlbum(pngImage, self, #selector(image:didFinishSavingWithError:contextInfo:), NULL);
It works well on iOS 5.1.1 devices, and iPod/iPhone iOS 6.0 devices.
But strangely photo saving doesn't work on iPad 3 with iOS 6.0 and returns the following error:
Error Domain=ALAssetsLibraryErrorDomain Code=-3310 "Data unavailable" UserInfo=0x1cd6afc0 {NSLocalizedRecoverySuggestion=Launch the Photos application, NSUnderlyingError=0x1cdaa140 "Data unavailable", NSLocalizedDescription=Data unavailable}
Did anybody encounter this problem and what are the ways to deal with it?
I was able to save to the Camera Roll but when I upgraded to iOS 6 it stops working. It turns out my app needs (but does not have, this is new in iOS 6) permission to access the camera roll. To obtain permission, go to Settings -> Privacy -> Photos. I am able to save to the camera roll with
UIImageWriteToSavedPhotosAlbum()
again.
The image is being written to the Camera Roll album. When used on an iOS device without a camera, this method adds the image to the Saved Photos album rather than to the Camera Roll album. (UIKit Function Reference)
Looks like there are no Camera Roll or Saved Photos albums on your iPad and UIImageWriteToSavedPhotosAlbum() can't find the matching album to save photo.
Launch Photos app as it mentioned in error recovery suggestion: NSLocalizedRecoverySuggestion=Launch the Photos application
and then try to take photo via Camera app.

Resources