public DataInsertionLogSection(UIComponent component, object value, int? index = null)
     : base(component)
 {
     Message = new StringBuilder($"Insert \"{value}\" to {component.ComponentFullName}").
         AppendIf(index.HasValue, $" at index {index}").
         ToString();
 }
 public VerificationLogSection(UIComponent component, string dataProviderName, string verificationConstraint)
     : base(component)
 {
     Message = new StringBuilder($"Verify").
         AppendIf(!component.GetType().IsSubclassOfRawGeneric(typeof(PageObject<>)), $" {component.ComponentFullName}").
         AppendIf(!string.IsNullOrWhiteSpace(dataProviderName), $" {dataProviderName}").
         AppendIf(!string.IsNullOrWhiteSpace(verificationConstraint), $" {verificationConstraint}").
         ToString();
 }
 public static IWebElement GetScopeElement(this ScopeSource scopeSource, UIComponent parentComponent)
 {
     switch (scopeSource)
     {
         case ScopeSource.Parent:
             return parentComponent.Scope;
         case ScopeSource.Grandparent:
             return parentComponent.Parent.Scope;
         case ScopeSource.PageObject:
             return parentComponent.Owner.Scope;
         case ScopeSource.Page:
             return parentComponent.Driver.Get(By.TagName("body"));
         default:
             throw ExceptionFactory.CreateForUnsupportedEnumValue(scopeSource, nameof(scopeSource));
     }
 }
Example #4
0
 public StrategyScopeLocator(UIComponent component, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions)
 {
     this.component          = component;
     this.strategy           = strategy;
     this.scopeLocateOptions = scopeLocateOptions;
 }
Example #5
0
        private static Delegate CreateDelegatePropertyDelegate <TOwner>(PropertyInfo property, UIComponent <TOwner> component)
            where TOwner : PageObject <TOwner>
        {
            Type navigableInterfaceType = component.GetType().GetGenericInterfaceType(typeof(INavigable <,>));

            if (navigableInterfaceType != null)
            {
                var navigableGenericArguments = navigableInterfaceType.GetGenericArguments();

                var clickAndGoMethod = typeof(INavigableExtensions).
                                       GetMethod(nameof(INavigableExtensions.ClickAndGo)).
                                       MakeGenericMethod(navigableGenericArguments);

                return(Delegate.CreateDelegate(property.PropertyType, component, clickAndGoMethod));
            }
            else
            {
                return(Delegate.CreateDelegate(property.PropertyType, component, "Click"));
            }
        }
Example #6
0
 public static TComponent CreateComponent <TComponent, TOwner>(UIComponent <TOwner> parentComponent, string name, params Attribute[] attributes)
     where TComponent : UIComponent <TOwner>
     where TOwner : PageObject <TOwner>
 {
     return(CreateControl <TComponent, TOwner>(parentComponent, name, attributes));
 }
Example #7
0
 internal UIComponentTriggerSet(UIComponent <TOwner> component)
 {
     this.component = component;
 }
 public VerificationLogSection(UIComponent component, string verificationConstraint)
     : this(component, null, verificationConstraint)
 {
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataProvider{TData, TOwner}"/> class.
 /// </summary>
 /// <param name="component">The associated component.</param>
 /// <param name="valueGetFunction">The function that gets the value.</param>
 /// <param name="providerName">Name of the provider.</param>
 public DataProvider(UIComponent <TOwner> component, Func <TData> valueGetFunction, string providerName)
 {
     Component         = component.CheckNotNull(nameof(component));
     _valueGetFunction = valueGetFunction.CheckNotNull(nameof(valueGetFunction));
     ProviderName      = providerName.CheckNotNullOrWhitespace(nameof(providerName));
 }
 public UIComponentChildrenList(UIComponent <TOwner> component)
 {
     this.component = component;
 }
 public StrategyScopeLocator(UIComponent component, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions)
 {
     this.component = component;
     this.strategy = strategy;
     this.scopeLocateOptions = scopeLocateOptions;
 }
 public FindItemByLabelStrategy(UIComponent component)
 {
     this.component = component;
 }
Example #13
0
 public DataRemovalLogSection(UIComponent component, object value)
     : base(component)
 {
     Message = $"{ActionText} \"{value}\" from {component.ComponentFullName}";
 }
 public VerificationLogSection(UIComponent component, string verificationConstraint)
     : this(component, null, verificationConstraint)
 {
 }
Example #15
0
 public UIComponentSizeProvider(UIComponent <TOwner> component, Func <Size> valueGetFunction)
     : base(component, valueGetFunction, "size")
 {
 }