public void GivenMyAppIsInstalled() { AssertDeviceExceptions(() => { bool installSucceeded = false; try { AttemptToInstallApp(); installSucceeded = true; } catch (System.IO.FileLoadException fileLoadException) { StepFlowOutputHelpers.WriteException( "File load problem seen while installing - will try workaround of waiting 15 seconds and then installing again", fileLoadException); } if (!installSucceeded) { System.Threading.Thread.Sleep(TimeSpan.FromSeconds(15.0)); AttemptToInstallApp(); StepFlowOutputHelpers.Write("app installed - workaround worked"); } }); }
public void ThenIMaySeeText(string contents) { var position = Emu.ApplicationAutomationController.GetPositionOfText(contents); var seen = IsPositionVisible(position); StepFlowOutputHelpers.Write( seen ? "I saw the optional text '{0}'" : "I didn't see the optional text '{0}'", contents); }
public void ThenTakeAPicture() { var fileName = StepFlowContextHelpers.GetNextPictureName(); Bitmap picture; Assert.IsTrue(Emu.ApplicationAutomationController.TakePicture(out picture), "Failed to get screenshot"); picture.Save(fileName, ImageFormat.Png); StepFlowOutputHelpers.Write("Picture saved to _startEmuShot_{0}_endEmuShot_", fileName); }
protected bool IsPositionVisible(RectangleF position) { bool result = true; var phoneOrientation = Emu.DisplayInputController.GuessOrientation(); try { StepFlowOutputHelpers.Write("IsVisible checking position {0}, {1}, {2}, {3} in orientation {4}", position.Left, position.Top, position.Width, position.Height, phoneOrientation); position.IsVisible(phoneOrientation); } catch (Exception ex) { StepFlowOutputHelpers.Write("IsVisible exception {0}, {1}", ex.GetType().Name, ex.Message); result = false; } return(result); }