public void BringOnTop_TypesTextToDifferentWindows_TheWindowsGetsTheTextAccordingly() { var window1 = WindowFinder.Search(Use.AutomationId("CUI_WindowFocusTestsWindow_1")); var window2 = WindowFinder.Search(Use.AutomationId("CUI_WindowFocusTestsWindow_2")); var textBox1 = UI.GetChild <BasicEdit>(By.AutomationId("CUI_InputTextBox"), From.Element(window1)); var textBox2 = UI.GetChild <BasicEdit>(By.AutomationId("CUI_InputTextBox"), From.Element(window2)); WindowFocus.BringOnTop(window1); MouseEx.Click(window1); KeyboardEx.TypeText("First Window Text").And.Wait(1000); WindowFocus.BringOnTop(window2); MouseEx.Click(window2); KeyboardEx.TypeText("Second Window Text").And.Wait(1000); Assert.AreEqual("First Window Text", textBox1.Text); Assert.AreEqual("Second Window Text", textBox2.Text); }
void changeFocus(WindowFocus focus) { switch (focus) { case WindowFocus.ITEM: CurrentFocusMenu = this.Window; ButtonMenu.Focus = false; Window.Focus = true; break; case WindowFocus.BUTTON: CurrentFocusMenu = ButtonMenu; ButtonMenu.Focus = true; Window.Focus = false; break; } }