private void btnAudacity_Click(object sender, EventArgs e) { if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe")) { MessageBox.Show("Audacity is not installed..."); return; } try { System.Diagnostics.ProcessStartInfo audacityProcess = new System.Diagnostics.ProcessStartInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe"); appAudacity = TestStack.White.Application.AttachOrLaunch(audacityProcess); audacityWindow = appAudacity.GetWindow("Audacity", TestStack.White.Factory.InitializeOption.NoCache); audacityToolDock = (TestStack.White.UIItems.Panel)audacityWindow.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("ToolDock"))[0]; audacityTransportToolbar = (TestStack.White.UIItems.Panel)audacityToolDock.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Audacity Transport ToolBar"))[0]; AudacityButton_Record = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Record"))[0]; AudacityButton_Pause = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Pause"))[0]; AudacityButton_Play = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Play"))[0]; AudacityButton_Stop = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Stop"))[0]; AudacityButton_SkipToStart = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to Start"))[0]; AudacityButton_SkipToEnd = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to End"))[0]; this.TopMost = true; this.TopMost = false; this.Activate(); } catch (Exception ex) { MessageBox.Show("Window Unavailable\n" + ex.Message); } }
public static void ClassInit(TestContext context) { var applicationPath = "WhiteTest.exe"; application = Application.Launch(applicationPath); window = application.GetWindow("MainWindow", InitializeOption.NoCache); }
static void Main(string[] args) { Process proc = Process.GetProcessesByName("QBW32").FirstOrDefault(); TestStack.White.Application app = TestStack.White.Application.Attach(proc); SearchCriteria sc = SearchCriteria.ByClassName("MauiFrame"); var mainWindow = app.GetWindow(sc, InitializeOption.WithCache); mainWindow.Focus(); SendKeys.SendWait("%+{y}{P}{U}"); Thread.Sleep(3000); var modelWindows = mainWindow.ModalWindows() .Where(w => w.Title == "Enter Payroll Information") .FirstOrDefault(); //var table = GetTableElement(modelWindows); //AutomationElement elm = modelWindows // .GetElement(SearchCriteria.ByControlType(ControlType.HeaderItem)); //SearchCriteria tableSearch = SearchCriteria.ByControlType(ControlType.HeaderItem); //var table = modelWindows.Get<TestStack.White.UIItems.TableItems.TableHeader>(tableSearch); var x = 0; }
public void ThenIStartLabWareAndProcessedResults() { System.Media.SystemSounds.Beep.Play(); //System.Media.SoundPlayer sp = new System.Media.SoundPlayer(@"D:\STalkToME.wav"); //sp.Play(); application = TestStack.White.Application.Launch("\\\\tst10-lwapp.medlinx.corp\\LW-LIMS-V6\\lw-lims.lnk"); Window mainWindow = application.GetWindow("LabWare LIMS"); TestStack.White.UIItems.Button btnbuttonintoolbar = mainWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByText("Log into LIMS")); btnbuttonintoolbar.Click(); Window logInWindow = application.GetWindow("Please Log In"); TestStack.White.UIItems.TextBox loginField = logInWindow.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("101")); loginField.BulkText = "testopr"; TestStack.White.UIItems.TextBox passField = logInWindow.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("102")); passField.BulkText = "123456"; TestStack.White.UIItems.Button okButton = logInWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("104")); okButton.Click(); Window locationWin = application.GetWindow("Выберите расположение"); TestStack.White.UIItems.ListViewRow chooseSPB = locationWin.Get <TestStack.White.UIItems.ListViewRow>(SearchCriteria.ByText("HELIX-SPB")); //= locationWin.Get<TestStack.White.UIItems.TextBox>(SearchCriteria.ByClassName("HELIX-SPB")); chooseSPB.Click(); TestStack.White.UIItems.Button okLocationButton = locationWin.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("104")); okLocationButton.Click(); Window windowAfterLogin = Desktop.Instance.Windows().Find(obj => obj.Title.Contains("User TESTOPR logged")); var menuBar = windowAfterLogin.Get <MenuBar>(SearchCriteria.ByText("Приложение")); var menu = menuBar.MenuItem("Configure", "System", "Client..."); menu.Click(); Window passworDialogWindow = application.GetWindow("Password Dialog"); TestStack.White.UIItems.Button okButtonInPasswordDialog = passworDialogWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("102")); okButtonInPasswordDialog.Click(); Window configurationManagerWindow = application.GetWindow("Configuration Manager"); TestStack.White.UIItems.Button okButtonInConfigurationManager = configurationManagerWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("102")); okButtonInConfigurationManager.Click(); System.Threading.Thread.Sleep(3000); application.Close(); }
public void SetUp() { application = Application.Launch(Path.Combine(TestContext.CurrentContext.TestDirectory, "YodaSpeak.exe")); window = application.GetWindow("Yoda Speak"); txtOriginalText = window.Get <TextBox>(SearchCriteria.ByAutomationId("txtOriginalText")); button = window.Get <Button>(SearchCriteria.ByAutomationId("btnTranslate")); txtResult = window.Get <Label>(SearchCriteria.ByAutomationId("txtResult")); }
public Window GetMainWindow(Application application) { WaitForApplicationIdle(application); var mainWindow = application.GetWindow(SearchCriteria.ByAutomationId("ShellWindow"), InitializeOption.WithCache); //var mainWindowAdapter = new ProxyGenerator().CreateInterfaceProxyWithoutTarget<IMainWindow>(new ForwardIfExistsInterceptor(mainWindow)); //return mainWindowAdapter; return mainWindow; }
public void LoginWindow_Test() { SetupApp(); Window mainWindow = application.GetWindow("Login Window"); Button loginBtn = mainWindow.Get <Button>(SearchCriteria.ByText("OK")); loginBtn.Click(); Console.Write("Logged in"); }
public void TestMethod1() { string app_path = @"D:\RESOURCES\DataSuite\1245\Console\DataSuite.Administration.Console.WinClient.exe"; application = Application.Launch(app_path); Window mainWindow = application.GetWindow("DataSuite Console"); //Added Lines of Code Console.WriteLine(mainWindow.Title); mainWindow.WaitWhileBusy(); mainWindow.Close(); }
public void AnalyseMuliWindow() { m_Process = Process.Start(@"F:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe"); m_Application = Application.Attach(m_Process); var window = m_Application.GetWindow(SearchCriteria.ByAutomationId("VisualStudioMainWindow"), InitializeOption.NoCache); var element = window.GetElement(SearchCriteria.ByAutomationId("GetStarted_ItemsGroupList")); var result = BaseWindowFinder.GetBaseCondiction(element, window); Assert.AreEqual(result.Pairs.Count, 0); m_Process.Kill(); }
public AuctionSniperDriver(int timeoutMillis, string[] args) { this.timeoutMillis = timeoutMillis; int processId = startSniper(args); application = Application.Attach(processId); Assert.IsNotNull(application, "application is null"); window = application.GetWindow(Program.APPLICATION_TITLE, InitializeOption.NoCache); Assert.IsNotNull(window, "window is null"); itemIdField = window.Get <TextBox>(Program.NEW_ITEM_ID_NAME); stopPriceField = window.Get <TextBox>(Program.NEW_ITEM_STOP_PRICE_NAME); bidButton = window.Get <Button>(Program.JOIN_BUTTON_NAME); }
public void InitApplicationForTests() { app = TestStack.White.Application.Launch("C:\\Users\\Dima\\Documents\\Visual Studio 2017\\Projects\\UKPO2\\Interface\\bin\\Debug\\interface.exe"); window = app.GetWindow("MainWindow"); submitButton = window.Get <Button>(SearchCriteria.ByAutomationId("SubmitInputButton")); calculateButton = window.Get <Button>(SearchCriteria.ByAutomationId("FindPathsButton")); restartButton = window.Get <Button>(SearchCriteria.ByAutomationId("RestartButton")); moleculeName = window.Get <TextBox>(SearchCriteria.ByAutomationId("MoleculeInputTextBox")); fragmentsNum = window.Get <TextBox>(SearchCriteria.ByAutomationId("FragNumTextBox")); moleculeNameLabel = window.Get <Label>(SearchCriteria.ByAutomationId("MoleculeNameLabel")); fragmentsList = window.Get <ListBox>(SearchCriteria.ByAutomationId("FragmentsListBox")); pathsList = window.Get <ListBox>(SearchCriteria.ByAutomationId("OutputPathsListBox")); testCheckBox = window.Get <CheckBox>(SearchCriteria.ByAutomationId("TestDataCheckBox")); }
public void InitApplicationForTests() { app = TestStack.White.Application.Launch(@"..\..\..\..\Interface\bin\x64\Debug\Interface.exe"); window = app.GetWindow("MainWindow"); submitButton = window.Get <Button>(SearchCriteria.ByAutomationId("SubmitInputButton")); calculateButton = window.Get <Button>(SearchCriteria.ByAutomationId("FindPathsButton")); restartButton = window.Get <Button>(SearchCriteria.ByAutomationId("RestartButton")); moleculeName = window.Get <TextBox>(SearchCriteria.ByAutomationId("MoleculeInputTextBox")); fragmentsNum = window.Get <TextBox>(SearchCriteria.ByAutomationId("FragNumTextBox")); moleculeNameLabel = window.Get <Label>(SearchCriteria.ByAutomationId("MoleculeNameLabel")); fragmentsList = window.Get <ListBox>(SearchCriteria.ByAutomationId("FragmentsListBox")); pathsList = window.Get <ListBox>(SearchCriteria.ByAutomationId("OutputPathsListBox")); testCheckBox = window.Get <CheckBox>(SearchCriteria.ByAutomationId("TestDataCheckBox")); }
public static void BeforeWordCountingFeature() { WpfApplication = Application.Launch("WordCounter.UI\\WordCounter.UI.exe"); Window = WpfApplication.GetWindow("MainWindow"); }
private static bool AutomateSurroundSettings(Application application) { // Waiting for form to become visible var setupDialog = Utility.DefaultOnException( () => application.GetWindow(NVidiaLocalization.NVIDIA_Surround_Caption_NVIDIA_Set_Up_Surround)); if (setupDialog == null) { return true; // Control Panel somehow knows the settings } try { setupDialog.HideMinimize(); setupDialog.WaitWhileBusy(); setupDialog.ShowFocus(); SplashForm.Instance.Focus(); System.Windows.Forms.Application.DoEvents(); var topologyDropdown = Utility.DefaultOnException(() => setupDialog.Get<ComboBox>(SearchCriteria.ByAutomationId("3484"))); var resolutionDropdown = Utility.DefaultOnException(() => setupDialog.Get<ComboBox>(SearchCriteria.ByAutomationId("3486"))); var refreshRateDropdown = Utility.DefaultOnException(() => setupDialog.Get<ComboBox>(SearchCriteria.ByAutomationId("3487"))); setupDialog.HideMinimize(); setupDialog.WaitWhileBusy(); // Waiting a little for element to load, if not yet var enableButton = setupDialog.GetChildWindowWithControlId<Button>(3493, 5000); SplashForm.Instance.Focus(); System.Windows.Forms.Application.DoEvents(); var bezel1TextBox = setupDialog.GetChildWindowWithControlId<TextBox>(3506); var bezel2TextBox = setupDialog.GetChildWindowWithControlId<TextBox>(3507); var bezel3TextBox = setupDialog.GetChildWindowWithControlId<TextBox>(3508); var bezel4TextBox = setupDialog.GetChildWindowWithControlId<TextBox>(3509); // Lets keep the current display setting before going any further Utility.ContinueException( () => Settings.Default.DisplaySettings = DisplaySetting.ArrayToXml(GetDisplaySettings())); if (!string.IsNullOrWhiteSpace(Settings.Default.Arrangement)) { // List of all monitors var displays = setupDialog.GetChildWindowWithControlId<ListView>(3489) .AutomationElement.FindAll( TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.CheckBox)); if (topologyDropdown != null && Settings.Default.Topology > -1) { var topologyDropdownItems = topologyDropdown.Items; if (topologyDropdownItems.Count > Settings.Default.Topology) { topologyDropdownItems[Settings.Default.Topology].Select(); setupDialog.WaitWhileBusy(); Mouse.Instance.RestoreLocation(); SplashForm.Instance.Focus(); System.Windows.Forms.Application.DoEvents(); } } foreach (var monitor in Settings.Default.Arrangement.Split('|')) { foreach (AutomationElement display in displays) { var cb = new CheckBox(display, null); if (monitor.ToLower().Trim().Contains(cb.Text.ToLower().Trim())) { Utility.DoTimeout( () => { Mouse.Instance.Location = cb.Bounds.Location + new Vector(22, 7); setupDialog.ExecuteAutomationAction(() => Mouse.Instance.Click()); Mouse.Instance.RestoreLocation(); SplashForm.Instance.Focus(); System.Windows.Forms.Application.DoEvents(); return cb.Checked; }); break; } } } if (bezel1TextBox != null && Settings.Default.Bezel1 > -1) { bezel1TextBox.BulkText = Settings.Default.Bezel1.ToString(); setupDialog.WaitWhileBusy(); } if (bezel2TextBox != null && Settings.Default.Bezel2 > -1) { bezel2TextBox.BulkText = Settings.Default.Bezel2.ToString(); setupDialog.WaitWhileBusy(); } if (bezel3TextBox != null && Settings.Default.Bezel3 > -1) { bezel3TextBox.BulkText = Settings.Default.Bezel3.ToString(); setupDialog.WaitWhileBusy(); } if (bezel4TextBox != null && Settings.Default.Bezel4 > -1) { bezel4TextBox.BulkText = Settings.Default.Bezel4.ToString(); setupDialog.WaitWhileBusy(); } if (resolutionDropdown != null && Settings.Default.Resolution > -1) { var resolutionDropdownItems = resolutionDropdown.Items; if (resolutionDropdownItems.Count > Settings.Default.Resolution) { resolutionDropdownItems[Settings.Default.Resolution].Select(); setupDialog.WaitWhileBusy(); Mouse.Instance.RestoreLocation(); SplashForm.Instance.Focus(); System.Windows.Forms.Application.DoEvents(); } } if (refreshRateDropdown != null && Settings.Default.RefreshRate > -1) { var refreshRateDropdownItems = refreshRateDropdown.Items; if (refreshRateDropdownItems.Count > Settings.Default.RefreshRate) { refreshRateDropdownItems[Settings.Default.RefreshRate].Select(); setupDialog.WaitWhileBusy(); Mouse.Instance.RestoreLocation(); SplashForm.Instance.Focus(); System.Windows.Forms.Application.DoEvents(); } } // Let's see if the provided settings are satisfying if (Utility.DoTimeout( () => { setupDialog.WaitWhileBusy(); return enableButton.Enabled; })) { var result = Utility.DoTimeout( () => { setupDialog.ExecuteAutomationAction( () => Utility.ContinueException(() => enableButton.Click())); Mouse.Instance.RestoreLocation(); System.Windows.Forms.Application.DoEvents(); application.WaitWhileBusy(); return !enableButton.Enabled || enableButton.Text.ToLower() .Contains(NVidiaLocalization.NVIDIA_Surround_DisableButton_Disable.ToLower()); }); Utility.ContinueException(() => setupDialog.Close()); if (result) { Settings.Default.Save(); } return result; } } var arrangementPanel = setupDialog.GetChildWindowWithControlId<Button>(3490, 5000); if (arrangementPanel == null) { throw new Exception( Language.Surround_Arrangement_panel_is_not_accessible_from_our_side_can_t_save_your_settings_); } // Show the form and lets user to decide what to do setupDialog.ShowTopMost(); Mouse.Instance.Location = setupDialog.Location + new Vector(setupDialog.Bounds.Width/2, setupDialog.Bounds.Height/2); Mouse.Instance.SavePosition(); while (!setupDialog.IsClosed) { try { if (topologyDropdown != null) { Settings.Default.Topology = Methods.SendMessage(topologyDropdown.GetHWnd(), 0x0147, 0, ""); } if (resolutionDropdown != null) { Settings.Default.Resolution = Methods.SendMessage( resolutionDropdown.GetHWnd(), 0x0147, 0, ""); } if (refreshRateDropdown != null) { Settings.Default.RefreshRate = Methods.SendMessage( refreshRateDropdown.GetHWnd(), 0x0147, 0, ""); } Utility.ContinueException( () => { Settings.Default.Bezel1 = (!string.IsNullOrWhiteSpace(bezel1TextBox?.Text)) ? bezel1TextBox.Text.TryParseIntOrDefault() : 0; Settings.Default.Bezel2 = (!string.IsNullOrWhiteSpace(bezel2TextBox?.Text)) ? bezel2TextBox.Text.TryParseIntOrDefault() : 0; Settings.Default.Bezel3 = (!string.IsNullOrWhiteSpace(bezel3TextBox?.Text)) ? bezel3TextBox.Text.TryParseIntOrDefault() : 0; Settings.Default.Bezel4 = (!string.IsNullOrWhiteSpace(bezel4TextBox?.Text)) ? bezel4TextBox.Text.TryParseIntOrDefault() : 0; }); Utility.ContinueException( () => { if (!arrangementPanel.IsOffScreen) { Settings.Default.Arrangement = string.Join( "|", arrangementPanel.AutomationElement.FindAll( TreeScope.Children, Condition.TrueCondition) .Cast<AutomationElement>() .Select(el => new Panel(el, null)) .OrderBy(panel => panel.Bounds.Right) .ThenBy(panel => panel.Bounds.Bottom) .Select(panel => panel.Text)); } }); setupDialog.WaitWhileBusy(); if ( enableButton.Text.ToLower() .Contains(NVidiaLocalization.NVIDIA_Surround_DisableButton_Disable.ToLower())) { Settings.Default.Save(); setupDialog.Close(); System.Windows.Forms.Application.DoEvents(); setupDialog.WaitWhileBusy(); return true; } Thread.Sleep(100); setupDialog.WaitWhileBusy(); System.Windows.Forms.Application.DoEvents(); } catch (Exception) { break; } } Utility.ContinueException( () => { setupDialog.Close(); setupDialog.WaitWhileBusy(); }); Settings.Default.Reload(); return false; } catch (Exception) { setupDialog.Close(); setupDialog.WaitWhileBusy(); throw; } }
/// <summary> /// Tries to find the wizard after it is launched. /// </summary> /// <returns>the wizard element</returns> private Window GetWizard(string wizardName) { Trace.WriteLine(DateTime.Now.ToLongTimeString() + ":In GetWizard"); _visualStudio = Application.Attach(Process.GetCurrentProcess().Id); _visualStudioMainWindow = _visualStudio.GetWindow( SearchCriteria.ByAutomationId("VisualStudioMainWindow"), InitializeOption.NoCache); var wizard = _visualStudio.Find( x => x.Equals(_resourceHelper.GetEntityDesignResourceString(wizardName)), InitializeOption.NoCache); return wizard; }
private static bool AutomateControlPanel(Application application, bool? goSurround) { var window = application.GetWindow(NVidiaLocalization.NVIDIA_ControlPanel_Caption_NVIDIA_Control_Panel); try { window.HideMinimize(); // Hiding also applies the settings we want var surroundTreeItem = window.GetChildWindowWithControlId<UIItem>(4100, 5000); if (surroundTreeItem == null) { surroundTreeItem = window.GetChildWindowWithControlId<UIItem>(4112, 5000); if (surroundTreeItem == null) { throw new Exception(Language.Surround_Can_t_find_the_surround_settings); } } CheckBox surroundCheckbox = null; Utility.DoTimeout( () => { window.ExecuteAutomationAction( () => { Utility.ContinueException(() => surroundTreeItem.Click()); Mouse.Instance.RestoreLocation(); }); application.WaitWhileBusy(); surroundCheckbox = window.GetChildWindowWithControlId<CheckBox>(1866); return surroundCheckbox != null; }); if (surroundCheckbox == null) { throw new Exception(Language.Surround_Can_t_find_the_surround_settings); } if (goSurround != null && surroundCheckbox.Checked == goSurround) { window.Close(); window.WaitWhileBusy(); return false; } goSurround = !surroundCheckbox.Checked; var success = window.ExecuteAutomationAction( () => { if (Utility.DoTimeout( () => { Utility.ContinueException(() => surroundCheckbox.Checked = goSurround.Value); Mouse.Instance.RestoreLocation(); window.WaitWhileBusy(); application.WaitWhileBusy(); return surroundCheckbox.Checked == goSurround; })) { var applyButton = Utility.DefaultOnException( () => window.Get<Button>(SearchCriteria.ByAutomationId("1021"))); if (applyButton != null && Utility.DoTimeout( () => { window.ExecuteAutomationAction( () => Utility.ContinueException(() => applyButton.Click())); Mouse.Instance.RestoreLocation(); window.WaitWhileBusy(); application.WaitWhileBusy(); return applyButton.IsOffScreen || !applyButton.Enabled; })) { return true; } } return false; }); if (!success) { throw new Exception(Language.Surround_Failed_to_change_the_surround_settings); } var result = true; if (goSurround.Value) { result = AutomateSurroundSettings(application); } System.Windows.Forms.Application.DoEvents(); window.Close(); window.WaitWhileBusy(); if (!goSurround.Value) { ApplyExtendedSettings(); } System.Windows.Forms.Application.DoEvents(); Mouse.Instance.RestoreLocation(); return result; } catch (Exception) { window.Close(); window.WaitWhileBusy(); throw; } }
Window GetMainWindow(Application app) { var mainWindow = app.GetWindow(SearchCriteria.ByAutomationId("ShellWindow"), InitializeOption.NoCache); return mainWindow; }
public void AddModelFromExistingDBChangeDefaults() { Exception exceptionCaught = null; Trace.WriteLine(DateTime.Now.ToLongTimeString() + "Starting the test"); var project = Dte.CreateProject( TestContext.TestRunDirectory, "ExistingDBTestChangeDefaults", DteExtensions.ProjectKind.Executable, DteExtensions.ProjectLanguage.CSharp); Assert.IsNotNull(project, "Could not create project"); // We need to create this thread to keep polling for wizard to show up and // walk thru the wizard. DTE call just launches the wizard and stays there // taking up the main thread var wizardDiscoveryThread = ExecuteThreadedAction( () => { try { Trace.WriteLine(DateTime.Now.ToLongTimeString() + ":In thread wizardDiscoveryThread"); _visualStudio = Application.Attach(Process.GetCurrentProcess().Id); _visualStudioMainWindow = _visualStudio.GetWindow( SearchCriteria.ByAutomationId("VisualStudioMainWindow"), InitializeOption.NoCache); var newItemWindow = _visualStudioMainWindow.Popup; var extensions = newItemWindow.Get<ListView>(SearchCriteria.ByText("Extensions")); extensions.Select("ADO.NET Entity Data Model"); var addButton = newItemWindow.Get<Button>(SearchCriteria.ByAutomationId("btn_OK")); addButton.Click(); // This method polls for the the wizard to show up _wizard = GetWizard("WizardFormDialog_Title"); // Walk thru the Wizard with existing DB option CreateModelFromDBNonDefaults("School"); } catch (Exception ex) { exceptionCaught = ex; } }, "UIExecutor"); Dte.ExecuteCommand("Project.AddNewItem"); wizardDiscoveryThread.Join(); if (exceptionCaught != null) { throw exceptionCaught; } // Build the project var errors = Build(); Assert.IsTrue(errors == null || errors.Count == 0); }
public override Window GetMainWindow(Application application) { return application.GetWindow(Criteria(), InitializeOption.NoCache); }
public override Window GetMainWindow(Application application) { var ieWindow = (InternetExplorerWindow)application.GetWindow("TestSilverlightApplication - Windows Internet Explorer"); return ieWindow.SilverlightDocument; }
public static Window MainWindow(Application application, Log log) { const string prefix = "Dialogs - MainWindow"; if ((application == null) || application.HasExited) { throw new RegressionTestFailedException(prefix + ": Application does not exists or has already exited."); } // Note that the windows can't be found through an Automation ID for some reason, hence // using the title of the window. return Retry.Times( () => { log.Debug(prefix, "Trying to get main window."); var window = application.GetWindow("Project explorer", InitializeOption.NoCache); if (window == null) { log.Error(prefix, "Failed to get main window."); } return window; }); }
public Class1(Application app) { //_window = app.GetWindow("Operators WorkBench"); _window = app.GetWindow("Operators WorkBench"); }
public static Window EditModal(Application application) { return application.GetWindow("EditPerson", InitializeOption.NoCache); }
public void SetUp() { leraApp = Application.Launch("..\\..\\..\\MyPoker\\bin\\Debug\\MyPoker.exe"); mainWindow = leraApp.GetWindow("NLP"); }
public static void LaunchVsExperimentalInstance() { _application = _visualStudioInstance.Launch(); CoreAppXmlConfiguration.Instance.ApplyTemporarySetting( c => { c.BusyTimeout = c.FindWindowTimeout = TimeOutInMs; }); _mainWindow = _application.GetWindow( SearchCriteria.ByAutomationId("VisualStudioMainWindow"), InitializeOption.NoCache); }
public UserInterfaceTest() { app = Application.Launch("TikTak.UI.WinForms.exe"); window = app.GetWindow("Tik Tak"); }
public void AddModelFromExistingDB() { Exception exceptionCaught = null; Trace.WriteLine(DateTime.Now.ToLongTimeString() + "Starting the test"); // On the main thread create a project var project = Dte.CreateProject( TestContext.TestRunDirectory, GetRandomProjectName(), DteExtensions.ProjectKind.Executable, DteExtensions.ProjectLanguage.CSharp); Assert.IsNotNull(project, "Could not create project"); // We need to create this thread to keep polling for wizard to show up and // walk thru the wizard. DTE call just launches the wizard and stays there // taking up the main thread var wizardDiscoveryThread = ExecuteThreadedAction( () => { try { Trace.WriteLine(DateTime.Now.ToLongTimeString() + ":In thread wizardDiscoveryThread"); _visualStudio = Application.Attach(Process.GetCurrentProcess().Id); _visualStudioMainWindow = _visualStudio.GetWindow( SearchCriteria.ByAutomationId("VisualStudioMainWindow"), InitializeOption.NoCache); var newItemWindow = _visualStudioMainWindow.Popup; var extensions = newItemWindow.Get<ListView>(SearchCriteria.ByText("Extensions")); extensions.Select("ADO.NET Entity Data Model"); var addButton = newItemWindow.Get<Button>(SearchCriteria.ByAutomationId("btn_OK")); addButton.Click(); // This method polls for the the wizard to show up _wizard = GetWizard("WizardFormDialog_Title"); // Walk thru the Wizard with existing DB option CreateModelFromDB("School", codeFirst: false); } catch (Exception ex) { exceptionCaught = ex; Trace.WriteLine(DateTime.Now.ToLongTimeString() + "Wizard Discovery thread exception:" + ex); } }, "UIExecutor"); Dte.ExecuteCommand("Project.AddNewItem"); wizardDiscoveryThread.Join(); if (exceptionCaught != null) { throw exceptionCaught; } // Make sure all expected files are generated. // Make sure EDMX is what you expected. CheckFilesExistingModel(project); // Build the project var errors = Build(); Assert.IsTrue(errors == null || errors.Count == 0); // Check Model browser, mapping window, properties window to spot check them Dte.ExecuteCommand("View.EntityDataModelBrowser"); var modelBrowserTree = _visualStudioMainWindow.Get<Tree>(SearchCriteria.ByAutomationId("ExplorerTreeView")); // See if entities exist in diagram var diagramNode = modelBrowserTree.Node("Model1.edmx", "Diagrams Diagrams", "Diagram Diagram1"); ((ExpandCollapsePattern)diagramNode.AutomationElement.GetCurrentPattern(ExpandCollapsePattern.Pattern)).Expand(); foreach (var childNode in diagramNode.Nodes) { Dte.ExecuteCommand("View.EntityDataModelBrowser"); ((SelectionItemPattern)childNode.AutomationElement.GetCurrentPattern(SelectionItemPattern.Pattern)).Select(); var currentNode = _entityNames.Find(el => el.Equals(childNode.Text)); if (string.IsNullOrEmpty(currentNode) || currentNode.Contains("Migration")) { continue; } CheckProperties(ModelName + "." + currentNode + ":EntityType"); Assert.AreEqual("EntityTypeShape " + currentNode, childNode.Text); } // See if entities exist in model and have expected properties Dte.ExecuteCommand("View.EntityDataModelBrowser"); var modelNode = modelBrowserTree.Node( "Model1.edmx", "ConceptualEntityModel " + ModelName, "Entity Types"); CheckEntityProperties(modelNode, "ConceptualEntityType {0}", "ConceptualProperty ", "{0}.{1}.{2}:Property"); // See if entities exist in store and have expected properties Dte.ExecuteCommand("View.EntityDataModelBrowser"); var storeNode = modelBrowserTree.Node( "Model1.edmx", "StorageEntityModel " + ModelName + ".Store", "Tables / Views"); CheckEntityProperties(storeNode, "StorageEntityType {0}s", "StorageProperty ", "{0}.Store.{1}s.{2}:Property"); // Future: Automate the designer surface. // Make sure app.config is updated correctly CheckAppConfig(project); Trace.WriteLine(DateTime.Now.ToLongTimeString() + ":Close Solution"); Dte.CloseSolution(false); }
public void FrontDeskID_Test() { SetupApp(); Window mainWindow = application.GetWindow("Login Window"); string Username = "******"; TextBox loginBox = mainWindow.Get <TextBox>(SearchCriteria.ByAutomationId("LoginBox")); loginBox.Text = Username; ComboBox cb_Roles = mainWindow.Get <ComboBox>(SearchCriteria.ByAutomationId("RoleCombobox")); cb_Roles.Select("Front Desk"); Button loginBtn = mainWindow.Get <Button>(SearchCriteria.ByText("OK")); loginBtn.Click(); mainWindow = application.GetWindow("FrontDeskView"); Label WelcomeText = mainWindow.Get <Label>(SearchCriteria.ByAutomationId("WelcomeText")); Assert.AreEqual(Username, WelcomeText.Text); Console.Write("Logged in with username " + Username); var Grid = mainWindow.Get <ListView>(SearchCriteria.ByAutomationId("PatientSchedulingGrid")); Window PatientWindow; int index = 3; foreach (var row in Grid.Rows) { var DetailsButton = mainWindow.Get <Button>(SearchCriteria.Indexed(index++)); DetailsButton.Click(); PatientWindow = application.GetWindow("PatientScheduling"); TextBox name = PatientWindow.Get <TextBox>(SearchCriteria.ByAutomationId("PatientName")); Assert.AreEqual(name.Text, row.Cells["PatientName"].Text); PatientWindow.Close(); } Tab tabControl = mainWindow.Get <Tab>(SearchCriteria.ByClassName("TabControl")); tabControl.SelectTabPage("Appointments"); CheckBox ShowUpsFilter = mainWindow.Get <CheckBox>(SearchCriteria.ByAutomationId("ShowUpsOnly")); ShowUpsFilter.Click(); Grid = mainWindow.Get <ListView>(SearchCriteria.ByAutomationId("AppointmentsGrid")); int testedRows = 0; while (Grid.Rows.Count >= 0 && testedRows < 7) { var OpenListButton = mainWindow.Get <Button>(SearchCriteria.Indexed(5)); OpenListButton.Click(); PatientWindow = application.GetWindow("AddToOpenList"); string Name = PatientWindow.Get <Label>(SearchCriteria.ByAutomationId("TextBoxPatientName")).Text; Assert.AreEqual(Name, Grid.Rows[0].Cells[1].Text); Button Add = PatientWindow.Get <Button>(SearchCriteria.ByText("Add")); Add.Click(); tabControl.SelectTabPage("Open List"); var OpenListGrid = mainWindow.Get <ListView>(SearchCriteria.ByAutomationId("OpenListGrid")); var NewRow = OpenListGrid.Rows[testedRows++]; Assert.AreEqual(Name, NewRow.Cells[1].Text); tabControl.SelectTabPage("Appointments"); } application.Close(); }
public static Window MainWindow(Application application) { return application.GetWindow("WPFGrid", InitializeOption.NoCache); }
public void TestMethod1() { TestStack.White.Application app = base.Application; Window window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache); Delete_LevelData(); window.WaitWhileBusy(); //click the cont button Button contBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button2")); contBtn.Click(); // get cont window Window cont = app.GetWindow(SearchCriteria.ByAutomationId("ContinueGame"), InitializeOption.WithCache); cont.WaitWhileBusy(); IUIItem[] children1 = cont.GetMultiple(SearchCriteria.All); //get lvl 1 button Button lvl1Btn = (Button)children1[1]; lvl1Btn.Click(); // get game window Window game = app.GetWindow(SearchCriteria.ByAutomationId("Form1"), InitializeOption.NoCache); game.Focus(); UIItemCollection items = game.Items; items[24].Focus(); SendKeys.Send("{SPACE}"); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space); //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left); Window win = app.GetWindow(SearchCriteria.ByAutomationId("LevelComplete"), InitializeOption.WithCache); win.WaitWhileBusy(); children1 = win.GetMultiple(SearchCriteria.All); //35 Button saveBtn = (Button)children1[4]; saveBtn.Click(); win.WaitWhileBusy(); Button quitBtn = (Button)children1[5]; quitBtn.Click(); app.Close(); app.Dispose(); }
public void AddAnEmptyModel() { Exception exceptionCaught = null; Trace.WriteLine(DateTime.Now.ToLongTimeString() + "Starting the test"); var project = Dte.CreateProject( TestContext.TestRunDirectory, "EmptyModelTest", DteExtensions.ProjectKind.Executable, DteExtensions.ProjectLanguage.CSharp); Assert.IsNotNull(project, "Could not create project"); var wizardDiscoveryThread = ExecuteThreadedAction( () => { try { _visualStudio = Application.Attach(Process.GetCurrentProcess().Id); _visualStudioMainWindow = _visualStudio.GetWindow( SearchCriteria.ByAutomationId("VisualStudioMainWindow"), InitializeOption.NoCache); var newItemWindow = _visualStudioMainWindow.Popup; var extensions = newItemWindow.Get<ListView>(SearchCriteria.ByText("Extensions")); extensions.Select("ADO.NET Entity Data Model"); var addButton = newItemWindow.Get<Button>(SearchCriteria.ByAutomationId("btn_OK")); addButton.Click(); _wizard = GetWizard("WizardFormDialog_Title"); // Walk thru the Empty model selection CreateEmptyModel(); } catch (Exception ex) { exceptionCaught = ex; } }, "UIExecutor"); Dte.ExecuteCommand("Project.AddNewItem"); wizardDiscoveryThread.Join(); if (exceptionCaught != null) { throw exceptionCaught; } Trace.WriteLine(DateTime.Now.ToLongTimeString() + "wizardDiscoveryThread returned"); // Make sure the expected files are created var csfile = project.GetProjectItemByName("Model1.designer.cs"); Assert.IsNotNull(csfile, "csfile is not null"); var diagramFile = project.GetProjectItemByName("Model1.edmx.diagram"); Assert.IsNotNull(diagramFile, "diagramfile not null"); var errors = Build(); Assert.IsTrue(errors == null || errors.Count == 0); var entities = AddEntities(); AddAssociations(entities); var designerSurface = _visualStudioMainWindow.Get<Panel>(SearchCriteria.ByText("Modeling Design Surface")); AddInheritance(designerSurface, entities[1], entities[3]); AddEnum(designerSurface); project.Save(); CheckFilesEmptyModel(project); }
public void StartApplication() { var startInfo = new ProcessStartInfo("MontyHallKata.exe"); application = Application.Launch(startInfo); mainWindow = application.GetWindow("MainWindow", InitializeOption.NoCache); }
private void btnAudacity_Click(object sender, EventArgs e) { if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe")) { MessageBox.Show("Audacity is not installed..."); return; } try { System.Diagnostics.ProcessStartInfo audacityProcess = new System.Diagnostics.ProcessStartInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe"); appAudacity = TestStack.White.Application.AttachOrLaunch(audacityProcess); audacityWindow = appAudacity.GetWindow("Audacity", TestStack.White.Factory.InitializeOption.NoCache); audacityToolDock = (TestStack.White.UIItems.Panel)audacityWindow.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("ToolDock"))[0]; audacityTransportToolbar = (TestStack.White.UIItems.Panel)audacityToolDock.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Audacity Transport ToolBar"))[0]; AudacityButton_Record = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Record"))[0]; AudacityButton_Pause = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Pause"))[0]; AudacityButton_Play = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Play"))[0]; AudacityButton_Stop = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Stop"))[0]; AudacityButton_SkipToStart = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to Start"))[0]; AudacityButton_SkipToEnd = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to End"))[0]; this.TopMost = true; this.TopMost = false; this.Activate(); } catch (Exception ex) { MessageBox.Show("Window Unavailable\n"+ex.Message); } }
private void Given() { _application = Application.Launch(AppFileName); _mainWindow = _application.GetWindow("Music Manager", InitializeOption.NoCache); Menu selectFileMenuItem = _mainWindow.MenuBar.MenuItem("File", "Select Files (.mp3)"); selectFileMenuItem.Click(); }