public void ClickOnNewProjectCrashTest() { Application app = Application.Launch(designer_executable); Assert.IsNotNull(app); Core.UIItems.WindowItems.Window window = app.GetWindow("Designer"); //Create new schema IUIItem new_project_button = window.Get(SearchCriteria.ByText("New Project")); Assert.IsNotNull(new_project_button); System.Drawing.Point pt = new System.Drawing.Point(System.Convert.ToInt32(new_project_button.Location.X) + 5, System.Convert.ToInt32(new_project_button.Location.Y) + 5); //Do click several times window.Mouse.Click(pt); System.Threading.Thread.Sleep(1000); window.Mouse.Click(pt); System.Threading.Thread.Sleep(1000); window.Mouse.Click(pt); window.Close(); Assert.IsTrue(window.IsClosed); Assert.IsTrue(app.HasExited); }
public ToolBoxWrapper(Core.UIItems.WindowItems.Window mainWindow) { Assert.IsNotNull(mainWindow); uiItem = mainWindow.Get <Panel>(SearchCriteria.ByAutomationId("_toolBox")); Assert.IsNotNull(uiItem); this.mainWindow = mainWindow; }
static public void CreateNewSchema(Core.UIItems.WindowItems.Window mainWindow) { IUIItem new_schema_button = mainWindow.Get(SearchCriteria.ByText("New Schema")); Assert.IsNotNull(new_schema_button); Point pt = new Point(Convert.ToInt32(new_schema_button.Location.X) + 5, Convert.ToInt32(new_schema_button.Location.Y) + 5); mainWindow.Mouse.Click(pt); }
public void CreateRectangularElements() { ToolBoxWrapper.Entries[] elements = new ToolBoxWrapper.Entries[] { ToolBoxWrapper.Entries.Rectangle, ToolBoxWrapper.Entries.TextBox, ToolBoxWrapper.Entries.Button, ToolBoxWrapper.Entries.ProgressBar, ToolBoxWrapper.Entries.ScrollBar, ToolBoxWrapper.Entries.Image, ToolBoxWrapper.Entries.Slider, ToolBoxWrapper.Entries.Checkbox }; foreach (ToolBoxWrapper.Entries entry in elements) { Helpers.CreateNewSchema(mainWindow); Panel schemaView = mainWindow.Get <Panel>(SearchCriteria.ByAutomationId("SchemaCanvas")); Assert.IsNotNull(schemaView); ToolBoxWrapper toolbox = new ToolBoxWrapper(mainWindow); toolbox.Select(entry); //Draw rect DoRectCreationByMouse(schemaView, 100, 100, 200, 200); //Select Selection tool toolbox.Select(ToolBoxWrapper.Entries.Selection); //Select object System.Drawing.Point pt = new System.Drawing.Point(); pt.X = Convert.ToInt32(schemaView.Bounds.Left + 150); pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 150); mainWindow.Mouse.Location = pt; mainWindow.Mouse.Click(); //Check values of property grid Assert.IsTrue(Helpers.GetPropertyGridValue(mainWindow, "Height") as string == "100"); Assert.IsTrue(Helpers.GetPropertyGridValue(mainWindow, "Width") as string == "100"); } }
public void TearDown() { mainWindow.Close(); //Check that there is Save dialog Core.UIItems.WindowItems.Window saveDlg = Helpers.FindTopWindow(app, "SaveDocumentsDialog"); if (saveDlg != null) { Button saveDlgNoBtn = saveDlg.Get <Button>(SearchCriteria.ByAutomationId("noButton")); Assert.IsNotNull(saveDlgNoBtn); saveDlgNoBtn.Click(); } Assert.IsTrue(mainWindow.IsClosed); Assert.IsTrue(app.HasExited); }
static public object GetPropertyGridValue(Core.UIItems.WindowItems.Window mainWindow, string Name) { Panel propertyView = mainWindow.Get <Panel>(SearchCriteria.ByAutomationId("propertyGrid")); Assert.IsNotNull(propertyView); System.Windows.Automation.AutomationElement elem = propertyView.GetElement(SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Table)); Assert.IsNotNull(elem); Core.UIItems.TableItems.Table table = new Core.UIItems.TableItems.Table(elem, new Core.UIItems.Actions.ProcessActionListener(elem)); Assert.IsNotNull(table); System.Windows.Automation.AutomationElement row = table.GetElement(SearchCriteria.ByText(Name)); Assert.IsNotNull(row); object obj = row.GetCurrentPropertyValue(ValuePattern.ValueProperty); Assert.IsNotNull(obj); return(obj); }
public void SaveProjectOnClosing() { Application app = Application.Launch(designer_executable); Assert.IsNotNull(app); Core.UIItems.WindowItems.Window window = app.GetWindow("Designer"); //Create new schema IUIItem new_schema_button = window.Get(SearchCriteria.ByText("New Schema")); Assert.IsNotNull(new_schema_button); System.Drawing.Point pt = new System.Drawing.Point(System.Convert.ToInt32(new_schema_button.Location.X) + 5, System.Convert.ToInt32(new_schema_button.Location.Y) + 5); window.Mouse.Click(pt); window.Close(); Assert.IsFalse(window.IsClosed); //Check that there is Save dialog Core.UIItems.WindowItems.Window saveDlg = null; foreach (Core.UIItems.WindowItems.Window wnd in app.GetWindows()) { if (wnd.PrimaryIdentification == "SaveDocumentsDialog") { saveDlg = wnd; break; } } Assert.IsNotNull(saveDlg); Button saveDlgNoBtn = saveDlg.Get <Button>(SearchCriteria.ByAutomationId("noButton")); Assert.IsNotNull(saveDlgNoBtn); saveDlgNoBtn.Click(); Assert.IsTrue(window.IsClosed); Assert.IsTrue(app.HasExited); }