Skip to content

`MenuAnnotations` not updated on a parameterized property

Steps to reproduce:

  1. Parameterize "Time Delay" on Test Plan in a plan that only contains a Delay Step
  2. Get MenuAnnotation for "Time Delay" on Delay Step

Actual result:

Menu Items Readonly and Enabled is acting if the property was not parameterized, e.g. "Parameterize" is enabled.

Expected result:

  • "Parameterize" & "Parameterize on Test Plan" to be disabled and not visible
  • "Unparameterize" to be visible and enabled

This is a unittest that demonstrates the issue:

[Test]
        public void MenuAnnotationTest2()
        {
            var currentUserInterface = UserInput.Interface;
            var menuInterface = new MenuTestUserInterface();
            UserInput.SetInterface(menuInterface);
            try
            {
                var plan = new TestPlan();
                var delay = new DelayStep();
                plan.Steps.Add(delay);

                { // basic functionalities test 
                    var member = AnnotationCollection.Annotate(delay).GetMember(nameof(DelayStep.DelaySecs));
                    var menu = member.Get<MenuAnnotation>();
                    var items = menu.MenuItems;

                    var icons = items.ToLookup(item =>
                        item.Get<IIconAnnotation>()?.IconName ?? "");
                    var parameterizeOnTestPlan = icons[IconNames.ParameterizeOnTestPlan].First();
                    Assert.IsNotNull(parameterizeOnTestPlan);

                    // invoking this method should
                    var method = parameterizeOnTestPlan.Get<IMethodAnnotation>();
                    method.Invoke();
                    Assert.IsNotNull(plan.ExternalParameters.Get("Time Delay"));

                    member = AnnotationCollection.Annotate(delay).GetMember(nameof(DelayStep.DelaySecs));
                    menu = member.Get<MenuAnnotation>();
                    items = menu.MenuItems;

                    icons = items.ToLookup(item =>
                        item.Get<IIconAnnotation>()?.IconName ?? "");
                    parameterizeOnTestPlan = icons[IconNames.ParameterizeOnTestPlan].First();
                    Assert.IsNotNull(parameterizeOnTestPlan);
                    
                    // This fails, which it should not.
                    Assert.IsFalse(parameterizeOnTestPlan.Get<IEnabledAnnotation>().IsEnabled);
                }
            }
            finally
            {
                UserInput.SetInterface(currentUserInterface as IUserInputInterface);
            }

        }

ATT @romadsen-ks

Edited by Vivienne Spence