// Perry Hunter 07/10/2013 /// <summary> /// Tests the current "IsSelected" state of the requested mode selection radio button /// </summary> /// <param name="controlName">The constant defined in UI map for the desired radio button selection</param> /// <param name="expectedState">The selection state the button is expected to be in</param> public static void ModeRadioButtonShouldBe(string controlName, string expectedState) { //Decide which radio button is desired string radioButtonId = AWGUI.AwgButton; if (controlName == "Functions") { radioButtonId = AWGUI.FGenButton; } bool expectedValue = true; //Default expectedValue is "should" (true) if (expectedState == "should not") { expectedValue = false; } //Find the desired button, create a local instance of the RadioButton object RadioButton _radioButton = AWGUI.currentMainWindow.Get <RadioButton>(SearchCriteria.ByAutomationId(radioButtonId)); Assert.IsNotNull(_radioButton, "Requested " + controlName + " radio button was not found as " + radioButtonId); //Die if you did not find it //Test the _radioButton.IsSelected property against the expected value Assert.AreEqual(expectedValue, _radioButton.IsSelected); }
public void SecondWindowTestRadio() { Window mainWindow = application.GetWindow("MainWindow"); //TestStack.White.UIItems.TabItems.TabPage tabInput = mainWindow.Get<White.UIItems.TabItems.TabPage>(SearchCriteria.ByText("Input Controls")); //tabInput.Click(); TestStack.White.UIItems.RadioButton rdoBtn1 = mainWindow.Get <White.UIItems.RadioButton>(SearchCriteria.ByAutomationId("RadioButton1")); rdoBtn1.Click(); Thread.Sleep(2000); TestStack.White.UIItems.RadioButton rdoBtn2 = mainWindow.Get <White.UIItems.RadioButton>(SearchCriteria.ByAutomationId("RadioButton2")); rdoBtn2.Click(); Thread.Sleep(2000); application.Close(); }
// Perry Hunter 07/10/2013 /// <summary> /// Selects the Home tab in either the AWG or Functions mode windows /// </summary> public static void SelectTheHomeTab() { //Check the selected state of the AWG radiobutton, that will tell which "Home" tab needs to be selected RadioButton _radioButton = AWGUI.currentMainWindow.Get <RadioButton>(SearchCriteria.ByAutomationId(AWGUI.AwgButton)); Assert.IsNotNull(_radioButton, "Requested " + AWGUI.AwgButton + " radio button was not found"); //Die if you did not find it //Decide which Home tab to select based on the radio button IsSelected state string _tabName = AWGUI.AWGHomeWindow; if (_radioButton.IsSelected == false) { _tabName = AWGUI.FGHomeWindow; } //Select the tab AwgUITabControls.SelectMainTabControl(_tabName); }