![]() ![]() Here's a console app in F# that ties this all together: open System All we need to do is copy that file over to wherever we need it, and we have our screenshot! If you've used Test Cloud before you're already familiar with how it takes screenshots every time you call app.Screenshot(), but what you might not have noticed is that the method actually returns a FileInfo object for the locally saved file. For this example, we'll launch the app in each simulator and grab a couple screenshots while tapping through it. In our system we have classes defined already that represent each screen in our app, in order to make it easy to write UI tests around these screens. Now that the list of simulators is available, we can pass those to Xamarin.UITest and run our tests. Let getValue = fun(key) -> values |> Seq.pick (fun (k, v) -> if key = k then Some(v) else None) |> Seq.map (fun i -> (dictNodes.Item(i).InnerText, dictNodes.Item(i + 1).InnerText))) Let dictNodes = plistDoc.GetElementsByTagName("dict").Item(0).ChildNodes Let listAvailableSimulators = fun simulatorRoot ->ĭirectory.EnumerateFiles(simulatorRoot, "ist", SearchOption.AllDirectories) Here's some code in F# that returns a list of all the available iOS simulators: module SimulatorHelpers ![]() Eventually I'll probably fine tune this to only pick the ones it absolutely needs. To start out I wanted to just pull screenshots for every iOS simulator configuration on my system. These days it's necessary to submit screenshots for your apps across many different screen sizes for iOS. You can run these tests both locally as well as in Test Cloud, which means you can easily take your tests and run them across Test Cloud's large device farm.įor this example I'll focus on iOS, but the same code will also work for Android, minus the iOS-specific parts. Under the hood, Xamarin.UITest uses Calabash in order to facilitate this functionality. Xamarin.UITest is a great library from Xamarin that makes it really easy to write UI tests in C#/F# for your iOS and Android apps. If you haven't noticed already, we're big on automation, so I set out to see if we could automate this as well. It makes sense for us to use simulators/emulators to do this, given the large number of device sizes we need to generate for, so it's not something we can easily farm out to a non-engineer to do manually without them spending an obscene amount of time on it. With a white label app platform like ours at Olo, generating screenshots for every app we publish can be a real chore. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |