Ejemplo n.º 1
0
        public static void SelectTab(this ILineContainer lineContainer, string eventKey)
        {
            var element = lineContainer.Element.WaitElementVisible(By.CssSelector($"a.nav-item[data-rb-event-key={eventKey}]"));

            element.ScrollTo();
            element.Click();
        }
Ejemplo n.º 2
0
        public static EntityListCheckBoxProxy EntityListCheckBox <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property)
            where T : IModifiableEntity
        {
            var lineLocator = lineContainer.LineLocator(property);

            return(new EntityListCheckBoxProxy(lineLocator.ElementLocator.WaitVisible(), lineLocator.Route));
        }
Ejemplo n.º 3
0
        public static QueryTokenBuilderProxy QueryTokenBuilder <T>(this ILineContainer <T> lineContainer, Expression <Func <T, QueryTokenEmbedded> > property)
            where T : IModifiableEntity
        {
            var lineLocator = lineContainer.LineLocator(property);

            return(new QueryTokenBuilderProxy(lineLocator.ElementLocator.WaitVisible()));
        }
Ejemplo n.º 4
0
        public static V EntityLineValue <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property)
            where T : IModifiableEntity
        {
            var lite = lineContainer.EntityLine(property).GetLite();

            return(lite is V ? (V)lite : (V)(object)lite?.RetrieveAndRemember() !);
        }
Ejemplo n.º 5
0
        public static LineLocator <S> LineLocator <T, S>(this ILineContainer <T> lineContainer, Expression <Func <T, S> > property) where T : IModifiableEntity
        {
            PropertyRoute route = lineContainer.Route ?? PropertyRoute.Root(typeof(T));

            var element = lineContainer.Element;

            foreach (var mi in Reflector.GetMemberList(property))
            {
                if (mi is MethodInfo && ((MethodInfo)mi).IsInstantiationOf(MixinDeclarations.miMixin))
                {
                    route = route.Add(((MethodInfo)mi).GetGenericArguments()[0]);
                }
                else
                {
                    var newRoute = route.Add(mi);

                    if (newRoute.Parent != route && route != lineContainer.Route)
                    {
                        element = element.FindElement(By.CssSelector("[data-property-path='" + route.PropertyString() + "']"));
                    }

                    route = newRoute;
                }
            }

            return(new LineLocator <S>(
                       elementLocator: element.WithLocator(By.CssSelector("[data-property-path='" + route.PropertyString() + "']")),
                       route: route
                       ));
        }
Ejemplo n.º 6
0
        public static FileLineProxy FileLine <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property)
            where T : ModifiableEntity
        {
            var lineLocator = lineContainer.LineLocator(property);

            return(new FileLineProxy(lineLocator.ElementLocator.WaitVisible(), lineLocator.Route));
        }
Ejemplo n.º 7
0
        public static V EntityComboValue <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property)
            where T : ModifiableEntity
        {
            var lite = lineContainer.EntityCombo(property).LiteValue;

            return(lite is V ? (V)lite : (V)(object)lite.Retrieve());
        }
Ejemplo n.º 8
0
    public static void SelectTab(this ILineContainer lineContainer, string eventKey)
    {
        var element = lineContainer.Element.WaitElementVisible(By.CssSelector($".nav-tabs .nav-item .nav-link[data-rr-ui-event-key='{eventKey}']"));

        element.ScrollTo();
        element.Click();
    }
Ejemplo n.º 9
0
        public static void SelectTab(this ILineContainer lineContainer, string tabId)
        {
            var fullTabId = lineContainer.PrefixUnderscore() + tabId;

            lineContainer.Selenium.FindElement(By.CssSelector("a[href='#{0}']".FormatWith(fullTabId))).Click();
            lineContainer.Selenium.Wait(() => lineContainer.Selenium.IsElementVisible(By.Id(fullTabId)));
        }
Ejemplo n.º 10
0
        public static string[] Errors(this ILineContainer lineContainer)
        {
            var result = (string)lineContainer.Selenium
                         .ExecuteScript("return $('#" + lineContainer.PrefixUnderscore() + "sfGlobalValidationSummary > ul > li').toArray().map(function(e){return $(e).text()}).join('\\r\\n');");

            return(result.SplitNoEmpty("\r\n"));
        }
Ejemplo n.º 11
0
        public static SearchControlProxy GetSearchControl(this ILineContainer lineContainer, object queryName)
        {
            string queryKey = QueryUtils.GetKey(queryName);

            var element = lineContainer.Element.WaitElementVisible(By.CssSelector("div.sf-search-control[data-query-key={0}]".FormatWith(queryKey)));

            return(new SearchControlProxy(element));
        }
Ejemplo n.º 12
0
        public static LineContainer <S> SubContainer <T, S>(this ILineContainer <T> lineContainer, Expression <Func <T, S> > property)
            where T : IModifiableEntity
            where S : IModifiableEntity
        {
            var lineLocator = lineContainer.LineLocator(property);

            return(new LineContainer <S>(lineLocator.ElementLocator.WaitVisible(), lineLocator.Route));
        }
Ejemplo n.º 13
0
        public static DetailGridProxy DetailGrid(this ILineContainer <OrderEntity> container)
        {
            PropertyRoute route = container.GetRoute((OrderEntity o) => o.Details);

            var grid = container.Element.Element(TreeScope.Descendants, a => a.Current.ClassName == "ImmediateGrid" && a.Current.Name == route.ToString());

            return(new DetailGridProxy(grid));
        }//DetailGrid
Ejemplo n.º 14
0
        public static ILineContainer <S> EntityDetailControl <T, S>(this ILineContainer <T> container, Expression <Func <T, S> > property, TreeScope scope = TreeScope.Descendants)
            where T : ModifiableEntity
            where S : ModifiableEntity
        {
            PropertyRoute route = container.GetRoute(property);

            return(container.EntityDetail(route, scope).GetDetailControl <S>());
        }
Ejemplo n.º 15
0
        public static ValueSearchControlLineProxy GetValueSearchControlLine(this ILineContainer lineContainer, object queryName)
        {
            string queryKey = QueryUtils.GetKey(queryName);

            var element = lineContainer.Element.WaitElementVisible(By.CssSelector("[data-value-query-key={0}]".FormatWith(queryKey)));

            return(new ValueSearchControlLineProxy(element));
        }
Ejemplo n.º 16
0
        public static V EntityComboValue <T, V>(this ILineContainer <T> container, Expression <Func <T, V> > property, TreeScope scope = TreeScope.Descendants) where T : ModifiableEntity
        {
            PropertyRoute route = container.GetRoute(property);

            var lite = container.EntityCombo(route, scope).LiteValue;

            return(lite is V ? (V)lite : (V)lite.Retrieve());
        }
Ejemplo n.º 17
0
        public static SearchControlProxy GetSearchControl(this ILineContainer lineContainer, object queryName)
        {
            string query = QueryUtils.GetKey(queryName);

            var prefix = (string)lineContainer.Selenium.ExecuteScript("return $('div.sf-search-control[data-queryname=\"{0}\"]').data('prefix')".FormatWith(query));

            return(new SearchControlProxy(lineContainer.Selenium, prefix));
        }
Ejemplo n.º 18
0
        public static ValueLineProxy ValueLine <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property)
            where T : ModifiableEntity
        {
            string        newPrefix;
            PropertyRoute newRoute = lineContainer.GetRoute(property, out newPrefix);

            return(new ValueLineProxy(lineContainer.Selenium, newPrefix, newRoute));
        }
Ejemplo n.º 19
0
        public static bool HasError <T, S>(this ILineContainer <T> lineContainer, Expression <Func <T, S> > property)
            where T : ModifiableEntity
        {
            string        newPrefix;
            PropertyRoute newRoute = lineContainer.GetRoute(property, out newPrefix);

            return(lineContainer.Selenium.HasError(newPrefix));
        }
Ejemplo n.º 20
0
        public static QueryTokenBuilderProxy QueryTokenBuilder <T>(this ILineContainer <T> lineContainer, Expression <Func <T, QueryTokenEmbedded> > property)
            where T : ModifiableEntity
        {
            string        newPrefix;
            PropertyRoute newRoute = lineContainer.GetRoute(property, out newPrefix);

            return(new QueryTokenBuilderProxy(lineContainer.Selenium, newPrefix + "_"));
        }
Ejemplo n.º 21
0
        public static LineContainer <S> SubContainer <T, S>(this ILineContainer <T> lineContainer, Expression <Func <T, S> > property)
            where T : ModifiableEntity
            where S : ModifiableEntity
        {
            string        newPrefix;
            PropertyRoute newRoute = lineContainer.GetRoute(property, out newPrefix);

            return(new LineContainer <S>(lineContainer.Selenium, newPrefix, newRoute));
        }
Ejemplo n.º 22
0
        public static string PrefixUnderscore(this ILineContainer lineContainer)
        {
            if (lineContainer.Prefix.HasText())
            {
                return(lineContainer.Prefix + "_");
            }

            return("");
        }
Ejemplo n.º 23
0
        public static PropertyRoute GetRoute <T, S>(this ILineContainer <T> container, Expression <Func <T, S> > property) where T : ModifiableEntity
        {
            PropertyRoute result = container.PreviousRoute ?? PropertyRoute.Root(typeof(T));

            foreach (var mi in Reflector.GetMemberList(property))
            {
                result = result.Add(mi);
            }
            return(result);
        }
Ejemplo n.º 24
0
        public static void ValueLineValue <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property, V value, bool loseFocus = false)
            where T : ModifiableEntity
        {
            var valueLine = lineContainer.ValueLine(property);

            valueLine.Value = value;

            if (loseFocus)
            {
                lineContainer.Selenium.LoseFocus(valueLine.MainElement());
            }
        }
Ejemplo n.º 25
0
        public static void EntityComboValue <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property, V value, bool loseFocus = false)
            where T : ModifiableEntity
        {
            var combo = lineContainer.EntityCombo(property);

            combo.LiteValue = value as Lite <IEntity> ?? ((IEntity)value)?.ToLite();

            if (loseFocus)
            {
                lineContainer.Selenium.LoseFocus(lineContainer.Selenium.FindElement(combo.ComboLocator));
            }
        }
Ejemplo n.º 26
0
        public static void ValueLineValue <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property, V value, bool loseFocus = false)
            where T : IModifiableEntity
        {
            var valueLine = lineContainer.ValueLine(property);

            valueLine.SetValue(value);

            if (loseFocus)
            {
                valueLine.EditableElement.Find().LoseFocus();
            }
        }
Ejemplo n.º 27
0
        public static void EntityComboValue <T, V>(this ILineContainer <T> lineContainer, Expression <Func <T, V> > property, V value, bool loseFocus = false)
            where T : IModifiableEntity
        {
            var combo = lineContainer.EntityCombo(property);

            combo.LiteValue = value as Lite <IEntity> ?? ((IEntity?)value)?.ToLite();

            if (loseFocus)
            {
                combo.ComboElement.WrappedElement.LoseFocus();
            }
        }
Ejemplo n.º 28
0
        public static ILineContainer <C> SubContainer <T, C>(this ILineContainer <T> container, Expression <Func <T, C> > property, TreeScope scope = TreeScope.Descendants)
            where T : ModifiableEntity
            where C : ModifiableEntity
        {
            PropertyRoute route = property.Body.NodeType != ExpressionType.Convert ? container.GetRoute(property) :
                                  container.GetRoute(Expression.Lambda <Func <T, IEntity> >(((UnaryExpression)property.Body).Operand, property.Parameters));

            string str = route.PropertyRouteType == PropertyRouteType.LiteEntity ? route.Parent.ToString() : route.ToString();

            var subContainer = container.Element.Element(scope, a => a.Current.Name == str);

            return(new LineContainer <C> {
                Element = subContainer, PreviousRoute = typeof(C).IsEmbeddedEntity() ? route : null
            });
        }
Ejemplo n.º 29
0
        public static PropertyRoute GetRoute <T, S>(this ILineContainer <T> lineContainer, Expression <Func <T, S> > property, out string newPrefix) where T : ModifiableEntity
        {
            newPrefix = lineContainer.Prefix;

            PropertyRoute result = lineContainer.Route ?? PropertyRoute.Root(typeof(T));

            foreach (var mi in Reflector.GetMemberList(property))
            {
                if (mi is MethodInfo && ((MethodInfo)mi).IsInstantiationOf(MixinDeclarations.miMixin))
                {
                    result = result.Add(((MethodInfo)mi).GetGenericArguments()[0]);
                }
                else
                {
                    result = result.Add(mi);
                    if (newPrefix.HasText())
                    {
                        newPrefix += "_";
                    }
                    newPrefix += mi.Name;
                }
            }
            return(result);
        }
Ejemplo n.º 30
0
 public static SearchControlProxy GetSearchControlSuffix(this ILineContainer lineContainer, string suffix)
 {
     return(new SearchControlProxy(lineContainer.Selenium, lineContainer.PrefixUnderscore() + suffix));
 }