private void DontSave(AppUnderTest aut) { //Check for "Save Document?" dialog try { Window dialog = null; while (dialog == null) { var ws = aut.app.GetWindows(); foreach (var w in ws) { if (w.Title.StartsWith("SpeedCrunch")) { dialog = w; } } } //var b = dialog.Get<Button>("Don't Save"); //b.Click(); } catch { //Window went away. Do nothing } }
public void ShouldSetTitle() { var app = new AppUnderTest() .NavigateToCalendar() .OpenAddScreen() .MakeItem("TestTitel123"); Assert.That(app.Title.Equals("TestTitel123")); }
private void InterrogateApp() { AppUnderTest aut = StartApp(); if (aut.w != null) { InterrogateItem(aut.w); TerminateApp(aut); } }
public void LatestTaskShouldBeOnTop() { var app = new AppUnderTest().NavigateToTasksPage() .OpenAddTasks() .AddTask("Taks1") .AddTask("Taks2") .GotToFitrstTask(); Assert.That(app.Title.Equals("Taks2")); }
private AppUnderTest StartApp() { AppUnderTest aut = new AppUnderTest(); var appPath = Path.Combine(appPathUnderTest, appUnderTest); aut.app = Application.Launch(appPath); var ws = aut.app.GetWindows(); var start = DateTime.Now; var timeout = new TimeSpan(0, 0, 30); while ((ws == null || ws.Count == 0) && DateTime.Now - start < timeout) { ws = aut.app.GetWindows(); } while (aut.w == null && DateTime.Now - start < timeout) { System.Diagnostics.Debug.Write("."); try { foreach (var win in ws) { System.Diagnostics.Debug.Write(win.Title); if (win.Title.StartsWith(windowPrefix)) { aut.w = win; } } } catch { //Might end up here if the app has a splash screen, and that window goes away. Refresh the windows list ws = aut.app.GetWindows(); } } //maximize window and clicks input box try { if (aut.w != null) { var max = aut.w.Get <Button>("Maximize"); max.Click(); aut.w.Mouse.Location = new System.Windows.Point(10, 1030); aut.w.Click(); } } catch { aut.w.Mouse.Location = new System.Windows.Point(10, 1030); aut.w.Click(); } return(aut); }
private void TerminateApp(AppUnderTest aut) { //if (aut.w.MenuBar != null) //{ // var m = aut.w.MenuBar.MenuItem(); // if (m != null) // { // m.Click(); // } //} //else //{ aut.w.Close(); //} //DontSave(aut); }
public void Init() { aut = StartApp(); }
public void First_real_test() { var App = new AppUnderTest() .NavigateToCalendar() .ClickAround(); }