[TestProperty("Ignore", "True")] // GH#7282 - investigate and reenable public void CheckExperimentalDisableState() { using (RegistryHelper reg = new RegistryHelper()) { reg.BackupRegistry(); // manipulating the global v1/v2 state can affect the registry so back it up. using (CmdApp app = new CmdApp(CreateType.ProcessOnly, TestContext)) { using (PropertiesDialog properties = new PropertiesDialog(app)) { properties.Open(OpenTarget.Defaults); using (Tabs tabs = new Tabs(properties)) { // check everything stays enabled when global is on. AutoHelpers.LogInvariant("Check that items are all enabled when global is enabled."); tabs.SetGlobalState(Tabs.GlobalState.ConsoleV2); // iterate through each tab AutoHelpers.LogInvariant("Checking elements on all tabs."); foreach (TabBase tab in tabs.AllTabs) { tab.NavigateToTab(); IEnumerable <AppiumWebElement> itemsUnaffected = tab.GetObjectsUnaffectedByV1V2Switch(); IEnumerable <AppiumWebElement> itemsThatDisable = tab.GetObjectsDisabledForV1Console(); foreach (AppiumWebElement obj in itemsThatDisable.Concat(itemsUnaffected)) { Verify.IsTrue(obj.Enabled, AutoHelpers.FormatInvariant("Option: {0}", obj.Text)); } } // check that relevant boxes are disabled when global is off. AutoHelpers.LogInvariant("Check that necessary items are disabled when global is disabled."); tabs.SetGlobalState(Tabs.GlobalState.ConsoleV1); foreach (TabBase tab in tabs.AllTabs) { tab.NavigateToTab(); IEnumerable <AppiumWebElement> itemsUnaffected = tab.GetObjectsUnaffectedByV1V2Switch(); IEnumerable <AppiumWebElement> itemsThatDisable = tab.GetObjectsDisabledForV1Console(); foreach (AppiumWebElement obj in itemsThatDisable) { Verify.IsFalse(obj.Enabled, AutoHelpers.FormatInvariant("Option: {0}", obj.Text)); } foreach (AppiumWebElement obj in itemsUnaffected) { Verify.IsTrue(obj.Enabled, AutoHelpers.FormatInvariant("Option: {0}", obj.Text)); } } } } } } }
private void CheckWritebacks(RegistryHelper reg, ShortcutHelper shortcut, CmdApp app, OpenTarget target) { // either registry or shortcut are null if ((reg == null && shortcut == null) || (reg != null && shortcut != null)) { throw new NotSupportedException("Must leave either registry or shortcut null. And must supply one of the two."); } bool isRegMode = reg != null; // true is reg mode, false is shortcut mode string modeName = isRegMode ? "registry" : "shortcut"; AutoHelpers.LogInvariant("Beginning {0} writeback tests for {1}", modeName, target.ToString()); using (PropertiesDialog props = new PropertiesDialog(app)) { // STEP 1: VERIFY EVERYTHING SAVES IN AN ON/MAX STATE AutoHelpers.LogInvariant("Open dialog and check boxes."); props.Open(target); using (Tabs tabs = new Tabs(props)) { // Set V2 on. tabs.SetGlobalState(Tabs.GlobalState.ConsoleV2); AutoHelpers.LogInvariant("Toggling elements on all tabs."); foreach (TabBase tab in tabs.AllTabs) { tab.NavigateToTab(); foreach (CheckBoxMeta obj in tab.GetCheckboxesForVerification()) { obj.Check(); } foreach (SliderMeta obj in tab.GetSlidersForVerification()) { // adjust slider to the maximum obj.SetToMaximum(); } } AutoHelpers.LogInvariant("Hit OK to save."); props.Close(PropertiesDialog.CloseAction.OK); AutoHelpers.LogInvariant("Verify values changed as appropriate."); CheckWritebacksVerifyValues(isRegMode, reg, shortcut, target, tabs, SliderMeta.ExpectedPosition.Maximum, false, Tabs.GlobalState.ConsoleV2); } // STEP 2: VERIFY EVERYTHING SAVES IN AN OFF/MIN STATE AutoHelpers.LogInvariant("Open dialog and uncheck boxes."); props.Open(target); using (Tabs tabs = new Tabs(props)) { AutoHelpers.LogInvariant("Toggling elements on all tabs."); foreach (TabBase tab in tabs.AllTabs) { tab.NavigateToTab(); foreach (SliderMeta slider in tab.GetSlidersForVerification()) { // adjust slider to the minimum slider.SetToMinimum(); } foreach (CheckBoxMeta obj in tab.GetCheckboxesForVerification()) { obj.Uncheck(); } } tabs.SetGlobalState(Tabs.GlobalState.ConsoleV1); AutoHelpers.LogInvariant("Hit OK to save."); props.Close(PropertiesDialog.CloseAction.OK); AutoHelpers.LogInvariant("Verify values changed as appropriate."); CheckWritebacksVerifyValues(isRegMode, reg, shortcut, target, tabs, SliderMeta.ExpectedPosition.Minimum, true, Tabs.GlobalState.ConsoleV1); } // STEP 3: VERIFY CANCEL DOES NOT SAVE AutoHelpers.LogInvariant("Open dialog and check boxes."); props.Open(target); using (Tabs tabs = new Tabs(props)) { tabs.SetGlobalState(Tabs.GlobalState.ConsoleV2); AutoHelpers.LogInvariant("Toggling elements on all tabs."); foreach (TabBase tab in tabs.AllTabs) { tab.NavigateToTab(); foreach (CheckBoxMeta obj in tab.GetCheckboxesForVerification()) { obj.Check(); } foreach (SliderMeta obj in tab.GetSlidersForVerification()) { // adjust slider to the maximum obj.SetToMaximum(); } } AutoHelpers.LogInvariant("Hit cancel to not save."); props.Close(PropertiesDialog.CloseAction.Cancel); AutoHelpers.LogInvariant("Verify values did not change."); CheckWritebacksVerifyValues(isRegMode, reg, shortcut, target, tabs, SliderMeta.ExpectedPosition.Minimum, true, Tabs.GlobalState.ConsoleV1); } } }