Beispiel #1
0
        public static int AlertCount(this IWidgetContainer container, AlertCurrentState state)
        {
            var result = (string)container.Selenium.ExecuteScript("return $('{0} span.sf-widget-count.{1}').html()".FormatWith(
                                                                      container.WidgetContainerLocator().CssSelector(),
                                                                      GetCssClass(state)));

            return(int.Parse(result));
        }
Beispiel #2
0
        static string GetCssClass(AlertCurrentState state)
        {
            if (state == AlertCurrentState.Future)
            {
                return("sf-alert-future");
            }

            if (state == AlertCurrentState.Alerted)
            {
                return("sf-alert-alerted");
            }

            if (state == AlertCurrentState.Attended)
            {
                return("sf-alert-attended");
            }

            throw new InvalidOperationException("Unexpected state {0}".FormatWith(state));
        }
Beispiel #3
0
        private void btnAlerts_Click(object sender, RoutedEventArgs e)
        {
            if (DataContext == null)
            {
                return;
            }

            Entity    entity = DataContext as Entity;
            ResultRow row    = (ResultRow)((Button)sender).DataContext;

            AlertCurrentState state = (AlertCurrentState)row[0];

            var func = CustomFilter.TryGetValue(DataContext.GetType());

            var eo = new ExploreOptions(typeof(AlertEntity))
            {
                ShowFilters   = false,
                SearchOnLoad  = true,
                FilterOptions =
                {
                    func != null ? func(entity) : new FilterOption("Target", DataContext)
                    {
                        Frozen = true
                    },
                    new FilterOption("Entity.CurrentState", state)
                },
                Closed = (o, ea) => Dispatcher.Invoke(() => ReloadAlerts()),
            };

            if (func == null)
            {
                eo.ColumnOptions = new List <ColumnOption> {
                    new ColumnOption("Target")
                };
                eo.ColumnOptionsMode = ColumnOptionsMode.Remove;
            }

            Finder.Explore(eo);
        }
        public static SearchPopupProxy AlertsViewClick(this IWidgetContainer container, AlertCurrentState state)
        {
            container.Selenium.FindElement(container.WidgetContainerLocator().CombineCss(" .sf-alerts-toggler")).Click();

            By viewSelector = container.WidgetContainerLocator().CombineCss(" .sf-alert-view .{0}.sf-alert-count-label".FormatWith(GetCssClass(state)));

            container.Selenium.WaitElementVisible(viewSelector);
            container.Selenium.FindElement(viewSelector).Click();

            SearchPopupProxy result = new SearchPopupProxy(container.Selenium, "alerts");
            container.Selenium.WaitElementPresent(result.PopupLocator);
            result.SearchControl.WaitInitialSearchCompleted();
            return result;
        }
        public static int AlertCount(this IWidgetContainer container, AlertCurrentState state)
        {
            var result = (string)container.Selenium.ExecuteScript("return $('{0} span.sf-widget-count.{1}').html()".FormatWith(
                container.WidgetContainerLocator().CssSelector(),
                GetCssClass(state)));

            return int.Parse(result);
        }
        static string GetCssClass(AlertCurrentState state)
        {
            if (state == AlertCurrentState.Future)
                return "sf-alert-future";

            if (state == AlertCurrentState.Alerted)
                return "sf-alert-alerted";

            if(state == AlertCurrentState.Attended)
                return "sf-alert-attended";

            throw new InvalidOperationException("Unexpected state {0}".FormatWith(state)); 
        }
Beispiel #7
0
        public static SearchPopupProxy AlertsViewClick(this IWidgetContainer container, AlertCurrentState state)
        {
            container.Selenium.FindElement(container.WidgetContainerLocator().CombineCss(" .sf-alerts-toggler")).Click();

            By viewSelector = container.WidgetContainerLocator().CombineCss(" .sf-alert-view .{0}.sf-alert-count-label".FormatWith(GetCssClass(state)));

            container.Selenium.WaitElementVisible(viewSelector);
            container.Selenium.FindElement(viewSelector).Click();

            SearchPopupProxy result = new SearchPopupProxy(container.Selenium, "alerts");

            container.Selenium.WaitElementPresent(result.PopupLocator);
            result.SearchControl.WaitInitialSearchCompleted();
            return(result);
        }