/// <summary> /// Takes the screenshots using the currently configured options. /// /// The app will be automated using the implemented SetAppStateForScreenshotX methods /// for all available simulators given the selected device type. /// /// The SetAppStateForScreenshotX methods will be run in sequence /// and screenshots taken after each one if configured. /// </summary> public void TakeScreenshots() { ClearScreenshotsDirectory(); var simulators = DeviceSetParser.GetAvailableSimulators(osVersion, deviceNames); foreach (var device in simulators) { App = ConfigureApp .Debug().EnableLocalScreenshots() .iOS .AppBundle(appBundlePath) .DeviceIdentifier(device.UUID) .StartApp(Xamarin.UITest.Configuration.AppDataMode.DoNotClear); TakeScreenShot(device.Name); } }
static void RunTests(Simulator sim) { try { ss = 1; Console.WriteLine("Running {0}", sim.Name); var app = ConfigureApp.Debug().iOS.EnableLocalScreenshots() .AppBundle("../../../../MusicPlayer.iOS/bin/iPhoneSimulator/Debug/MusicPlayeriOS.app") .DeviceIdentifier(sim.UDID).StartApp(); if (sim.Name.Contains("iPad")) { app.SetOrientationLandscape(); } AppInitializer.App = app; //PlayMusicTest.PlaySong (app); LoginTest.CheckLogin(); MenuTests.GotoArtist(app); sim.TakeScreenshot(app); Console.WriteLine("Took Screenshot {0} - {1}", sim.Name, "Artist"); MenuTests.GotoAlbums(app); sim.TakeScreenshot(app); Console.WriteLine("Took Screenshot {0} - {1}", sim.Name, "Albums"); MenuTests.GotoGenres(app); sim.TakeScreenshot(app); Console.WriteLine("Took Screenshot {0} - {1}", sim.Name, "Genres"); MenuTests.GotoSongs(app); sim.TakeScreenshot(app); Console.WriteLine("Took Screenshot {0} - {1}", sim.Name, "Songs"); MenuTests.GotoPlaylists(app); sim.TakeScreenshot(app); Console.WriteLine("Took Screenshot {0} - {1}", sim.Name, "Playlists"); MenuTests.GotoEqualizer(app); sim.TakeScreenshot(app); Console.WriteLine("Took Screenshot {0} - {1}", sim.Name, "Equalizer"); } catch (Exception ex) { Console.WriteLine(ex); } }