public void GenerateElemIDFile()
        {
            // First we build the list of FindParam objects we want serialized
            // and add them to a FindParamCollection object.

            HtmlFindExpression param1 = new HtmlFindExpression("TagIndex=table:0");
            HtmlFindExpression param2 = new HtmlFindExpression("TextContent=~test1", "class=mystyle");
            HtmlFindExpression param3 = new HtmlFindExpression("id=input1");

            // Now add each FindParam defined above to the FindParamCollection
            // and give it a key that you can use to access it with later on.
            FindExpressionCollection <HtmlFindExpression> paramCol = new FindExpressionCollection <HtmlFindExpression>();

            paramCol.Add("DataTable", param1);
            paramCol.Add("TargetDataCell", param2);
            paramCol.Add("InputTextBox", param3);

            // Now you can serialize this list to a string or a file
            // you can store with the test code.
            paramCol.Save("C:\\AppParams.xml");

            // Or you can serialize to a string to be stored
            // in your choice of storage medium.
            //
            //Dim serializedParams As String = paramCol.ToXml()
        }
        /// <summary>
        /// Verifies the tips.
        /// </summary>
        /// <param name="text">The text.</param>
        public void VerifyTips(string text)
        {
            HtmlFindExpression expression = new HtmlFindExpression("tagname=a", "sf-popover-title=Tips");

            ActiveBrowser.WaitForElement(expression, 60000, false);
            ActiveBrowser.Find.ByExpression <HtmlAnchor>("tagname=a", "sf-popover-title=Tips", "sf-popover-content=~" + text).AssertIsPresent("Tips");
        }
        public void WaitingForMultiplePageChanges()
        {
            // Using the same example above but instead of only waiting for the new div by checking the h3
            // element and then we want to also wait for the backcolor of the div to change to red.

            // Wait for the h3 to be added.
            HtmlFindExpression h3 = new HtmlFindExpression("TagIndex=h3:0"); // Basically the first occurrence of an h3 element.

            // Wait for the div with index=1 to appear in addition to the style having partial value:
            // background-color: red
            HtmlFindExpression newDiv = new HtmlFindExpression("TagIndex=div:1", "style=~background-color: red");

            // Invoke the action
            Actions.Click(this.Elements.GetHtml("activationDiv"));

            // Wait for all changes using a chained Find Expression
            HtmlFindExpression expr = new HtmlFindExpression();

            expr.AppendClauses(false, newDiv.Clauses);
            expr.AppendChain(h3);
            ActiveBrowser.WaitForElement(expr, 4000, false);

            // All elements should be found at this point. To verify.
            ActiveBrowser.RefreshDomTree();

            Element h3Element = Find.ByExpression(h3); // find the element

            Assert.IsTrue(h3Element.InnerText.Equals("We are back!"));

            Element newDivElement = Find.ByExpression(newDiv);

            Assert.IsTrue(newDivElement.GetAttribute("style").Value.ToLower().
                          Contains("background-color: red"));
        }
        /// <summary>
        /// Set To date by date picker to custom date selector
        /// </summary>
        /// <param name="dayForward">Day forward</param>
        public void SetToDateByDatePicker(int dayForward)
        {
            DateTime publicationDateEnd       = DateTime.UtcNow.AddDays(dayForward);
            string   publicationDateEndFormat = publicationDateEnd.ToString("dd", CultureInfo.CreateSpecificCulture("en-US"));

            List <HtmlSpan> buttonDate = ActiveBrowser.Find.AllByExpression <HtmlSpan>("tagname=span", "class=input-group-btn").ToList <HtmlSpan>();

            Manager.Current.Desktop.Mouse.Click(MouseClickType.LeftClick, buttonDate[1].GetRectangle());

            HtmlFindExpression expression = new HtmlFindExpression("tagname=table", "role=grid");

            ActiveBrowser.WaitForElement(expression, 60000, false);

            List <HtmlTable>     dateTable = ActiveBrowser.Find.AllByExpression <HtmlTable>("tagname=table", "role=grid").ToList <HtmlTable>();
            List <HtmlTableCell> toDay     = dateTable[0].Find.AllByExpression <HtmlTableCell>("tagname=td", "InnerText=" + publicationDateEndFormat).ToList <HtmlTableCell>();
            HtmlButton           buttonToDay;

            if (toDay.Count == 2)
            {
                buttonToDay = toDay[1].Find.ByExpression <HtmlButton>("tagname=button");

                if (buttonToDay == null)
                {
                    buttonToDay = toDay[0].Find.ByExpression <HtmlButton>("tagname=button");
                }
            }
            else
            {
                buttonToDay = toDay[0].Find.ByExpression <HtmlButton>("tagname=button");
            }

            Manager.Current.Desktop.Mouse.Click(MouseClickType.LeftClick, buttonToDay.GetRectangle());
            Manager.Current.ActiveBrowser.WaitUntilReady();
        }
        /// <summary>
        /// Edit widget by name
        /// </summary>
        /// <param name="widgetName">The widget name</param>
        /// <param name="dropZoneIndex">The drop zone index</param>
        public void EditWidget(string widgetName, int dropZoneIndex = 0, bool isMediaWidgetEdited = false)
        {
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
            ActiveBrowser.WaitUntilReady();
            var widgetHeader = ActiveBrowser
                               .Find
                               .AllByCustom <HtmlDiv>(d => d.CssClass.StartsWith("rdTitleBar") && d.ChildNodes.First().InnerText.Equals(widgetName))[dropZoneIndex]
                               .AssertIsPresent(widgetName);

            widgetHeader.ScrollToVisible();
            HtmlAnchor editLink = widgetHeader.Find
                                  .ByCustom <HtmlAnchor>(a => a.TagName == "a" && a.Title.Equals("Edit"))
                                  .AssertIsPresent("edit link");

            editLink.Focus();
            editLink.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncOperations();
            ActiveBrowser.WaitForAjax(TimeOut);
            ActiveBrowser.RefreshDomTree();

            if (!isMediaWidgetEdited)
            {
                HtmlFindExpression expression = new HtmlFindExpression("class=modal-title", "InnerText=" + widgetName);
                ActiveBrowser.WaitForElement(expression, TimeOut, false);
                Manager.Current.Wait.For(this.WaitForSaveButton, TimeOut);
            }
        }
Exemple #6
0
        /// <summary>
        /// Sets a maximum time in milliseconds for the manager to wait for the page to load.
        /// Uses the page footer image as a reference.
        /// </summary>
        /// <param name="time"></param>
        public void Implicit(int time)
        {
            this.manager.ActiveBrowser.WaitUntilReady();

            var siteFooter = new HtmlFindExpression("id=FooterLogo");
            this.manager.ActiveBrowser.WaitForElement(siteFooter, time, false);
        }
        /// <summary>
        /// Edit widget by name
        /// </summary>
        /// <param name="widgetName">The widget name</param>
        /// <param name="dropZoneIndex">The drop zone index</param>
        public void EditWidget(string widgetName, int dropZoneIndex = 0, bool isMediaWidgetEdited = false)
        {
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
            ActiveBrowser.WaitUntilReady();
            var widgetHeader = ActiveBrowser
                                      .Find
                                      .AllByCustom<HtmlDiv>(d => d.CssClass.StartsWith("rdTitleBar") && d.ChildNodes.First().InnerText.Equals(widgetName))[dropZoneIndex]
                                      .AssertIsPresent(widgetName);
            widgetHeader.ScrollToVisible();
            HtmlAnchor editLink = widgetHeader.Find
                                              .ByCustom<HtmlAnchor>(a => a.TagName == "a" && a.Title.Equals("Edit"))
                                              .AssertIsPresent("edit link");
            editLink.Focus();
            editLink.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncOperations();
            ActiveBrowser.WaitForAjax(TimeOut);
            ActiveBrowser.RefreshDomTree();

            if (!isMediaWidgetEdited)
            {
                HtmlFindExpression expression = new HtmlFindExpression("class=modal-title", "InnerText=" + widgetName);
                ActiveBrowser.WaitForElement(expression, TimeOut, false);
                Manager.Current.Wait.For(this.WaitForSaveButton, TimeOut);
            }
        }
        public void WaitingForSinglePageChange()
        {
            // The test page performs two operations async; each with 1 second delay
            // after the box is clicked:
            // 1.Creates a new Div with a child H3 element and adds it to the page.
            // 2.Changes the back color of the new div to red

            // Let's invoke the actions and wait for the H3 element to appear.

            // To do so, we will simply use the FindExpression object as described in FindingElements.cs
            // to define how an element should be identified.
            HtmlFindExpression h3 = new HtmlFindExpression("TagIndex=h3:0"); // Basically the first occurrence of an h3 element.

            // Initiate the action.
            Actions.Click(this.Elements.GetHtml("activationDiv"));

            // Wait for the element to appear on the page. Timeout: 2 seconds.
            ActiveBrowser.WaitForElement(h3, 3000, false);

            // Element should be found at this point. To verify.
            ActiveBrowser.RefreshDomTree();            // refresh the current DOM to reflect the javascript changes
            Element h3Element = Find.ByExpression(h3); // find the element

            Assert.IsTrue(h3Element.InnerText.Equals("We are back!"));
        }
Exemple #9
0
        /// <summary>
        /// Sets a maximum time in milliseconds for the manager to wait for the page to load.
        /// Uses the page footer image as a reference.
        /// </summary>
        /// <param name="time"></param>
        public void Implicit(int time)
        {
            this.manager.ActiveBrowser.WaitUntilReady();

            var siteFooter = new HtmlFindExpression("id=FooterLogo");

            this.manager.ActiveBrowser.WaitForElement(siteFooter, time, false);
        }
Exemple #10
0
        private HtmlVideo GetContentBlockVideoDesignMode()
        {
            Browser frame = this.GetContentBlockFrame();

            HtmlFindExpression expression = new HtmlFindExpression("tagname=video");

            frame.WaitForElement(expression, TimeOut, false);

            return(frame.Find.AllByTagName("video").FirstOrDefault().As <HtmlVideo>());
        }
        /// <summary>
        /// Verifies the checked radio button option.
        /// </summary>
        /// <param name="optionId">The option id.</param>
        public void VerifyCheckedRadioButtonOption(WidgetDesignerRadioButtonIds optionId)
        {
            HtmlFindExpression expression = new HtmlFindExpression("tagname=input", "id=" + optionId);

            ActiveBrowser.WaitForElement(expression, 60000, false);
            HtmlInputRadioButton radioButton = ActiveBrowser.Find.ByExpression <HtmlInputRadioButton>("tagname=input", "id=" + optionId)
                                               .AssertIsPresent("radio button");

            Assert.IsTrue(radioButton.Checked);
        }
Exemple #12
0
        /// <summary>
        /// Checks if document or image title is populated correctly.
        /// </summary>
        /// <param name="imageTitle">The document or image title.</param>
        /// <returns>true or false depending on the document or image  title in the textbox.</returns>
        public bool IsTitlePopulated(string imageTitle)
        {
            HtmlFindExpression expression = new HtmlFindExpression("tagName=input", "name=title");

            ActiveBrowser.WaitForElement(expression, 30000, false);

            HtmlInputText titleField = this.EM.Media.MediaPropertiesBaseScreen.TitleField
                                       .AssertIsPresent("title field");

            return(imageTitle.Equals(titleField.Text));
        }
        /// <summary>
        /// Verifies the selected option in aspect ratio selector
        /// </summary>
        /// <param name="option">The aspect ratio option.</param>
        public void VerifySelectedOptionAspectRatioSelector(string option)
        {
            HtmlFindExpression expression = new HtmlFindExpression("tagName=select", "ng-model=model.aspectRatio");

            ActiveBrowser.WaitForElement(expression, 60000, false);

            HtmlSelect selector = this.EM.Media.VideoPropertiesScreen.AspectRatioSelector
                                  .AssertIsPresent("aspect ration selector");

            Assert.AreEqual(option, selector.SelectedOption.Text);
        }
 private void WaitForExists(IDriver driver, string findExpression)
 {
     try
     {
         driver.WaitUntilReady();
         var hfe = new HtmlFindExpression(findExpression);
         Manager.Current.ActiveBrowser.WaitForElement(hfe, 5000, false);
     }
     catch (Exception)
     {
         ThrowTimeoutExceptionIfElementIsNull(driver, findExpression);
     }
 }
 public static HtmlSelect FindSelectElement(string[] FindExpression, Browser frameHandle = null)
 {
     Manager.Current.ActiveBrowser.RefreshDomTree();
     HtmlFindExpression ExprLogic = new HtmlFindExpression(FindExpression);
     if (frameHandle == null)
     {
         return Manager.Current.ActiveBrowser.Find.ByExpression(ExprLogic, true).As<HtmlSelect>();
     }
     else
     {
         return FrameElement.Find.ByExpression(ExprLogic, true).As<HtmlSelect>();
     }
 }
        /// <summary>
        /// Selects option from thumbnail selector.
        /// </summary>
        /// <param name="optionValue">Option value.</param>
        public void SelectResizeImageOption(string optionValue)
        {
            HtmlFindExpression expression = new HtmlFindExpression("class=modal-title", "InnerText=Custom thumbnail size");

            ActiveBrowser.WaitForElement(expression, 30000, false);

            HtmlSelect selector = this.EM.Media.ImagePropertiesScreen.ResizeImageSelector
                                  .AssertIsPresent("resize image selector");

            selector.SelectByText(optionValue);
            selector.AsjQueryControl().InvokejQueryEvent(jQueryControl.jQueryControlEvents.click);
            selector.AsjQueryControl().InvokejQueryEvent(jQueryControl.jQueryControlEvents.change);
        }
Exemple #17
0
        private HtmlDiv GetSocialShareOptionDivByName(string optionName)
        {
            HtmlFindExpression socialShareDivFindExpression = new HtmlFindExpression("class=checkbox ng-scope", "ng-repeat=group in socialGroups.Groups", "InnerText=" + optionName);
            HtmlDiv            socialShareOptionDiv         = ActiveBrowser.WaitForElement(socialShareDivFindExpression, TimeOut, false).As <HtmlDiv>();

            if (socialShareOptionDiv != null && socialShareOptionDiv.IsVisible())
            {
                return(socialShareOptionDiv);
            }
            else
            {
                throw new ArgumentException("Social share option div was not found");
            }
        }
        /// <summary>
        /// Verifies the video info.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="type">The type.</param>
        /// <param name="size">The size.</param>
        public void VerifyVideoInfo(string title, string type, string size)
        {
            DateTime           dateTime   = DateTime.Now;
            var                date       = dateTime.Date;
            CultureInfo        ci         = CultureInfo.InvariantCulture;
            var                dateString = date.ToString("M/d/yyyy", ci);
            HtmlFindExpression expression = new HtmlFindExpression("ng-bind=sfMedia.Title.Value", "innertext=" + title);

            ActiveBrowser.WaitForElement(expression, 60000, false);
            ActiveBrowser.Find.ByExpression <HtmlSpan>("ng-bind=sfMedia.Title.Value", "innertext=" + title).AssertIsPresent("title");
            ActiveBrowser.Find.ByExpression <HtmlSpan>("ng-bind=sfMedia.Extension", "innertext=" + type).AssertIsPresent("type");
            ActiveBrowser.Find.ByExpression <HtmlSpan>("ng-bind=mediaSize", "innertext=" + size).AssertIsPresent("size");
            ActiveBrowser.Find.ByExpression <HtmlSpan>("ng-bind=uploaded | date : 'M/d/yyyy h:mm'", "innertext=~" + dateString).AssertIsPresent("date");
        }
        /// <summary>
        /// Provide access to "Create content" link
        /// </summary>
        public void CreateContentLink()
        {
            HtmlAnchor createContent = EM.GenericContent
                                         .ContentBlockWidget
                                         .CreateContent
                                         .AssertIsPresent("Create content");
            createContent.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncRequests();
            ActiveBrowser.RefreshDomTree();

            HtmlFindExpression expression = new HtmlFindExpression("class=modal-title", "InnerText=ContentBlock");
            ActiveBrowser.WaitForElement(expression, TimeOut, false);
            Manager.Current.Wait.For(this.WaitForSaveButton, Manager.Current.Settings.ClientReadyTimeout);
        }
Exemple #20
0
        /// <summary>
        /// Verifies the video.
        /// </summary>
        /// <param name="src">The SRC.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        public void VerifyVideo(string src, int width = 0, int height = 0)
        {
            HtmlFindExpression expression = new HtmlFindExpression("src=~" + src);

            ActiveBrowser.WaitForElement(expression, 60000, false);

            HtmlVideo video = ActiveBrowser.Find.ByExpression <HtmlVideo>("src=~" + src)
                              .AssertIsPresent("video");

            if (width != 0 && height != 0)
            {
                Assert.IsTrue(video.Width.Equals(width), "width is not correct");
                Assert.IsTrue(video.Height.Equals(height), "height is not correct");
            }
        }
        /// <summary>
        /// Verifies the selected value in anchor dropdown.
        /// </summary>
        /// <param name="anchorName">Name of the anchor.</param>
        public void VerifySelectedValueInAnchorDropdown(string anchorName)
        {
            var anchorSelector = EM.GenericContent
                                 .ContentBlockLinkSelector
                                 .AnchorSelector
                                 .AssertIsNotNull("select anchor dropdown");

            if (!anchorSelector.IsVisible())
            {
                HtmlFindExpression expression = new HtmlFindExpression("tagname=select", "ng-model=sfSelectedItem.selectedAnchor");
                ActiveBrowser.WaitForElement(expression, 60000, false);
            }

            Assert.AreEqual(anchorName, anchorSelector.SelectedOption.Text);
        }
        public bool IsElementPresent(Find findContext, By by)
        {
            try
            {
                var controlFindExpression = by.ToTestingFrameworkExpression();
                Manager.Current.ActiveBrowser.RefreshDomTree();
                var hfe = new HtmlFindExpression(controlFindExpression);
                Manager.Current.ActiveBrowser.WaitForElement(hfe, 5000, false);
            }
            catch (TimeoutException)
            {
                return(false);
            }

            return(true);
        }
Exemple #23
0
        /// <summary>
        /// Provide access to "Create content" link
        /// </summary>
        public void CreateContentLink()
        {
            HtmlAnchor createContent = EM.GenericContent
                                       .ContentBlockWidget
                                       .CreateContent
                                       .AssertIsPresent("Create content");

            createContent.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncRequests();
            ActiveBrowser.RefreshDomTree();

            HtmlFindExpression expression = new HtmlFindExpression("class=modal-title", "InnerText=ContentBlock");

            ActiveBrowser.WaitForElement(expression, TimeOut, false);
            Manager.Current.Wait.For(this.WaitForSaveButton, Manager.Current.Settings.ClientReadyTimeout);
        }
        /// <summary>
        /// Enters the email.
        /// </summary>
        /// <param name="content">The content.</param>
        public void EnterEmail(string content)
        {
            ActiveBrowser.RefreshDomTree();

            HtmlInputEmail email = EM.GenericContent
                                     .ContentBlockLinkSelector
                                     .Email
                                     .AssertIsNotNull("email address");
            if (!email.IsVisible())
            {
                HtmlFindExpression expression = new HtmlFindExpression("tagname=input", "ng-model=sfSelectedItem.emailAddress");
                ActiveBrowser.WaitForElement(expression, 60000, false);
            }

            email.MouseClick();

            email.Text = string.Empty;
            Manager.Current.Desktop.KeyBoard.TypeText(content);
        }
        public void WhenPress(string ButtonText)
        {
            int        number;
            HtmlButton button;

            if (int.TryParse(ButtonText, out number))
            {
                // IDs of simple numbers are Btn1, Btn2, etc.
                button = Calc.Find.ById <HtmlButton>("Btn" + number);
            }
            else
            {
                // Locate operation buttons by text content
                var expression = new HtmlFindExpression("id=^Btn", "InnerText=~" + ButtonText);
                button = Calc.Find.AllByExpression <HtmlButton>(expression).FirstOrDefault();
            }

            button.MouseClick();
        }
        /// <summary>
        /// Selects the item.
        /// </summary>
        /// <param name="itemName">Name of the item.</param>
        public void SelectUnselectAllSocialShareOptions(bool isSelectMode = true)
        {
            HtmlFindExpression expression = new HtmlFindExpression("ng-model=group.IsChecked");
            ActiveBrowser.WaitForElement(expression, TimeOut, false);
            var inputs = ActiveBrowser.Find.AllByExpression<HtmlInputCheckBox>("ng-model=group.IsChecked");
            foreach (var input in inputs)
            {
                if (isSelectMode && !input.Checked)
                {
                    input.Click();
                }
                else if (!isSelectMode && input.Checked)
                {
                    input.Click();
                }

                ActiveBrowser.RefreshDomTree();
            }
        }
        public void WhenPress(string ButtonText)
        {
            int number;
            HtmlButton button;

            if (int.TryParse(ButtonText, out number))
            {
                // IDs of simple numbers are Btn1, Btn2, etc.
                button = Calc.Find.ById<HtmlButton>("Btn" + number);
            }
            else 
            {
                // Locate operation buttons by text content 
                var expression = new HtmlFindExpression("id=^Btn", "InnerText=~" + ButtonText);
                button = Calc.Find.AllByExpression<HtmlButton>(expression).FirstOrDefault();
            }

            button.MouseClick();
        }
        /// <summary>
        /// Enters the email.
        /// </summary>
        /// <param name="content">The content.</param>
        public void EnterEmail(string content)
        {
            ActiveBrowser.RefreshDomTree();

            HtmlInputEmail email = EM.GenericContent
                                   .ContentBlockLinkSelector
                                   .Email
                                   .AssertIsNotNull("email address");

            if (!email.IsVisible())
            {
                HtmlFindExpression expression = new HtmlFindExpression("tagname=input", "ng-model=sfSelectedItem.emailAddress");
                ActiveBrowser.WaitForElement(expression, 60000, false);
            }

            email.MouseClick();

            email.Text = string.Empty;
            Manager.Current.Desktop.KeyBoard.TypeText(content);
        }
Exemple #29
0
 public static void WaitForExists(this Browser browser, params string[] customExpression)
 {
     EventWaiter.WaitForEvent(
         () =>
     {
         try
         {
             browser.RefreshDomTree();
             HtmlFindExpression hfe = new HtmlFindExpression(customExpression);
             browser.WaitForElement(hfe, 500, false);
         }
         catch
         {
             Thread.Sleep(100);
             return(false);
         }
         return(true);
     },
         200000);
 }
 public static void WaitForExists(this Browser browser, params string[] customExpression)
 {
     EventWaiter.WaitForEvent(
     () =>
     {
         try
         {
             browser.RefreshDomTree();
             HtmlFindExpression hfe = new HtmlFindExpression(customExpression);
             browser.WaitForElement(hfe, 500, false);
         }
         catch
         {
             Thread.Sleep(100);
             return false;
         }
         return true;
     },
     200000);
 }       
Exemple #31
0
        /// <summary>
        /// Selects the item.
        /// </summary>
        /// <param name="itemName">Name of the item.</param>
        public void SelectUnselectAllSocialShareOptions(bool isSelectMode = true)
        {
            HtmlFindExpression expression = new HtmlFindExpression("ng-model=group.IsChecked");

            ActiveBrowser.WaitForElement(expression, TimeOut, false);
            var inputs = ActiveBrowser.Find.AllByExpression <HtmlInputCheckBox>("ng-model=group.IsChecked");

            foreach (var input in inputs)
            {
                if (isSelectMode && !input.Checked)
                {
                    input.Click();
                }
                else if (!isSelectMode && input.Checked)
                {
                    input.Click();
                }

                ActiveBrowser.RefreshDomTree();
            }
        }
Exemple #32
0
        public void InvalidLogin()
        {
            // Start browser and navigate to Telerik Academy home page
            this.Manager.LaunchNewBrowser();
            this.ActiveBrowser.NavigateTo("http://stage.telerikacademy.com/");

            // Find login button and clik it
            this.Find.ById <HtmlAnchor>("EntranceButton").Click();

            // Wait for User and Password elements
            this.ActiveBrowser.WaitForElement(new HtmlFindExpression("textcontent=Вход в системата"), 30000, false);

            // Populate user and password
            this.Find.ById <HtmlInputText>("UsernameOrEmail").Text = "fakeUser";
            this.Find.ById <HtmlInputPassword>("Password").Text    = "fakePassword";

            // Click "Вход"
            var exp = new HtmlFindExpression("tagname=input", "value=Вход");

            this.Find.ByExpression <HtmlInputSubmit>(exp).Click();

            // Verity error message
            Assert.IsTrue(ActiveBrowser.ContainsText("Невалидни данни за достъп!"));
        }
Exemple #33
0
        public void TestKendo()
        {
            ActiveBrowser.NavigateTo(@"http://www.telerik.com/support/demos");
            int defaultWaitTime = 2500;
            int expectedColumnsCount = 5;
            int expectedRowsCount = 21;

            var demosLink = Find.ByExpression<HtmlAnchor>("TextContent=Launch Kendo UI demos", "class=Link--next");
            Assert.IsNotNull(demosLink);
            demosLink.Click();
            ActiveBrowser.WaitForElement(new HtmlFindExpression("XPath=//*[@id=\"widgets-all\"]/ul[1]/li[1]/ul/li[1]/a", "TextContent=Grid"), defaultWaitTime, false);
            Assert.AreEqual("http://demos.telerik.com/kendo-ui/", ActiveBrowser.Url);

            var gridLink = Find.ById<HtmlDiv>("widgets-all").Find.ByContent<HtmlAnchor>("Grid");
            Assert.IsNotNull(gridLink);
            gridLink.Click();

            var initFromTableLink = Find.ById<HtmlDiv>("example-nav").Find.ByContent<HtmlAnchor>("Initialization from table");
            Assert.IsNotNull(initFromTableLink);
            initFromTableLink.Click();

            var expression = new HtmlFindExpression("id=exampleTitle", "InnerText=~Initialization from table");
            var exampleTitle = ActiveBrowser.WaitForElement(expression, defaultWaitTime, false);
            Assert.IsNotNull(exampleTitle);

            var grid = Find.ById<HtmlDiv>("example");
            Assert.IsNotNull(grid);
            var columnsHeader = grid.Find.ByAttributes<HtmlDiv>("class=k-grid-header-wrap");
            var columnsCount = columnsHeader.Find.AllByExpression<HtmlControl>("class=k-header", "TagName=th").Count;
            Assert.AreEqual(expectedColumnsCount, columnsCount);

            var rowsCount = grid.Find.ById<HtmlTable>("grid").Find.AllByTagName<HtmlTableRow>("tr").Count;
            Assert.AreEqual(expectedRowsCount, rowsCount);

            var yearHeader = columnsHeader.Find.ByAttributes<HtmlTableCell>("data-field=year");
            yearHeader.Click();
            var sortArrow = ActiveBrowser.WaitForElement(
                defaultWaitTime, 
                "xpath=//*[@id='example']/div/div[1]/div/table/thead/tr/th[3]/a/span", 
                "class=k-icon k-i-arrow-n");
            Assert.IsNotNull(sortArrow);

            int rowCount = 1;
            int previousYear = new int();
            do
            {
                var yearCell = Find.ByXPath<HtmlTableCell>(string.Format("//*[@id='grid']/tbody/tr[{0}]/td[3]", rowCount));
                var currentYear = int.Parse(yearCell.TextContent);
                Assert.IsTrue(previousYear <= currentYear);
                previousYear = currentYear;
                currentYear = 0;
                rowCount++;
            } 
            while (rowCount < rowsCount);
        }
        /// <summary>
        /// Verifies the video.
        /// </summary>
        /// <param name="src">The SRC.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        public void VerifyVideo(string src, int width = 0, int height = 0)
        {
            HtmlFindExpression expression = new HtmlFindExpression("src=~" + src);
            ActiveBrowser.WaitForElement(expression, 60000, false);

            HtmlVideo video = ActiveBrowser.Find.ByExpression<HtmlVideo>("src=~" + src)
                .AssertIsPresent("video");

            if (width != 0 && height != 0)
            {
                Assert.IsTrue(video.Width.Equals(width), "width is not correct");
                Assert.IsTrue(video.Height.Equals(height), "height is not correct");
            }
        }
Exemple #35
0
        public void TestKendo()
        {
            ActiveBrowser.NavigateTo(@"http://www.telerik.com/support/demos");
            int defaultWaitTime      = 2500;
            int expectedColumnsCount = 5;
            int expectedRowsCount    = 21;

            var demosLink = Find.ByExpression <HtmlAnchor>("TextContent=Launch Kendo UI demos", "class=Link--next");

            Assert.IsNotNull(demosLink);
            demosLink.Click();
            ActiveBrowser.WaitForElement(new HtmlFindExpression("XPath=//*[@id=\"widgets-all\"]/ul[1]/li[1]/ul/li[1]/a", "TextContent=Grid"), defaultWaitTime, false);
            Assert.AreEqual("http://demos.telerik.com/kendo-ui/", ActiveBrowser.Url);

            var gridLink = Find.ById <HtmlDiv>("widgets-all").Find.ByContent <HtmlAnchor>("Grid");

            Assert.IsNotNull(gridLink);
            gridLink.Click();

            var initFromTableLink = Find.ById <HtmlDiv>("example-nav").Find.ByContent <HtmlAnchor>("Initialization from table");

            Assert.IsNotNull(initFromTableLink);
            initFromTableLink.Click();

            var expression   = new HtmlFindExpression("id=exampleTitle", "InnerText=~Initialization from table");
            var exampleTitle = ActiveBrowser.WaitForElement(expression, defaultWaitTime, false);

            Assert.IsNotNull(exampleTitle);

            var grid = Find.ById <HtmlDiv>("example");

            Assert.IsNotNull(grid);
            var columnsHeader = grid.Find.ByAttributes <HtmlDiv>("class=k-grid-header-wrap");
            var columnsCount  = columnsHeader.Find.AllByExpression <HtmlControl>("class=k-header", "TagName=th").Count;

            Assert.AreEqual(expectedColumnsCount, columnsCount);

            var rowsCount = grid.Find.ById <HtmlTable>("grid").Find.AllByTagName <HtmlTableRow>("tr").Count;

            Assert.AreEqual(expectedRowsCount, rowsCount);

            var yearHeader = columnsHeader.Find.ByAttributes <HtmlTableCell>("data-field=year");

            yearHeader.Click();
            var sortArrow = ActiveBrowser.WaitForElement(
                defaultWaitTime,
                "xpath=//*[@id='example']/div/div[1]/div/table/thead/tr/th[3]/a/span",
                "class=k-icon k-i-arrow-n");

            Assert.IsNotNull(sortArrow);

            int rowCount     = 1;
            int previousYear = new int();

            do
            {
                var yearCell    = Find.ByXPath <HtmlTableCell>(string.Format("//*[@id='grid']/tbody/tr[{0}]/td[3]", rowCount));
                var currentYear = int.Parse(yearCell.TextContent);
                Assert.IsTrue(previousYear <= currentYear);
                previousYear = currentYear;
                currentYear  = 0;
                rowCount++;
            }while (rowCount < rowsCount);
        }
Exemple #36
0
        public static IEnumerable<Element> GetListChildren(string elementId)
        {
            // Create a hierarchical HtmlFindExpression constraint 
            var listItemExpression = new HtmlFindExpression("tagname=li");
            var listExpression = new HtmlFindExpression("id=" + elementId);
            listItemExpression.AddHierarchyConstraint(new HierarchyConstraint(listExpression, -1));

            // Wait for the list to have children
            WebBrowser.CurrentBrowser.WaitForElement(listItemExpression, 5000, false);
            var list = WebBrowser.CurrentBrowser.WaitForElement(listExpression, 5000, false);

            // Validate that the element is of ElementType.OrderedList or ElementType.UnorderedList
            Assert.IsTrue((list.ElementType == ElementType.OrderedList) || (list.ElementType == ElementType.UnorderedList), string.Format("{0} element not of expected type List", elementId));

            return list.Children;
        }
        /// <summary>
        /// Checks if document or image title is populated correctly.
        /// </summary>
        /// <param name="imageTitle">The document or image title.</param>
        /// <returns>true or false depending on the document or image  title in the textbox.</returns>
        public bool IsTitlePopulated(string imageTitle)
        {
            HtmlFindExpression expression = new HtmlFindExpression("tagName=input", "name=title");
            ActiveBrowser.WaitForElement(expression, 30000, false);

            HtmlInputText titleField = this.EM.Media.MediaPropertiesBaseScreen.TitleField
                                           .AssertIsPresent("title field");

            return imageTitle.Equals(titleField.Text);
        }
Exemple #38
0
        public void InvalidLogin()
        {
            // Start browser and navigate to Telerik Academy home page
            this.Manager.LaunchNewBrowser();
            this.ActiveBrowser.NavigateTo("http://stage.telerikacademy.com/");

            // Find login button and clik it
            this.Find.ById<HtmlAnchor>("EntranceButton").Click();

            // Wait for User and Password elements
            this.ActiveBrowser.WaitForElement(new HtmlFindExpression("textcontent=Вход в системата"), 30000, false);

            // Populate user and password
            this.Find.ById<HtmlInputText>("UsernameOrEmail").Text = "fakeUser";
            this.Find.ById<HtmlInputPassword>("Password").Text = "fakePassword";

            // Click "Вход"
            var exp = new HtmlFindExpression("tagname=input", "value=Вход");
            this.Find.ByExpression<HtmlInputSubmit>(exp).Click();

            // Verity error message
            Assert.IsTrue(ActiveBrowser.ContainsText("Невалидни данни за достъп!"));
        }
        // *********Creating of the Number type indicator**********
        public static void CreateNewIndicator()
        {
            //* Create tab checking
            //   var tabCreate = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlAnchor>("Create");
            //    Assert.IsNotNull(tabCreate, "Create page is null");
            //  tabCreate.AssertAttribute().Value("class", ArtOfTest.Common.StringCompareType.Contains, "edit");
            //      tabCreate.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Same, "Create");

            //1. Title filling
            var newTitle = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlInputText>("type=text");
            //var title = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlInputText>("type=text",);
            //	* Store the title in variable _title for further testing
            newTitle[0].Text = "";
            string id;
            string titleString;
            titleString = TTFPostCreator.CreatPost(out id);
            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, newTitle[0].GetRectangle());
            TTFDriver.myManager.Desktop.KeyBoard.TypeText(titleString);

            newTitle[0].Text = titleString;
            newTitle[1].Text = id;
            allNewValues.Add(newTitle[0].Text);

            //3. Description adding
            var textArea = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlTextArea>("placeholder=Enter Indicator description in  English");
            textArea.Text = "This indictor was created with Teleric Test Framework";

            //	4. Category select (n)
            //* Store the previous Category choice in the _category variable for further testing

            /*            TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlSelect>("k-option-label=~-- Select category --").Wait.ForCondition(
                        (a_0, a_1) => ArtOfTest.Common.CompareUtils.StringCompare(
                        a_0.InnerText,
                        "-- Select category --",
                        ArtOfTest.Common.StringCompareType.Contains),
                        false, null, 10000);*/

            var previousCategory2 = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlSelect>("k-option-label=~-- Select category --")
            .Find.ByExpression<HtmlOption>("value=32");
            var aaa = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlSelect>("k-option-label=~-- Select category --");
            aaa.MouseClick(MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);

            TTFDriver.myManager.ActiveBrowser.WaitForElement(2000, previousCategory2.Value);
            previousCategory2.MouseClick(MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);

            /*
                  previousCategory2.SelectByIndex(1, true);
                 TTFDriver.myManager.ActiveBrowser.RefreshDomTree();
                 previousCategory2.Click();*/

            var previousCategory = TTFDriver.myManager.ActiveBrowser.Find.ByXPath<HtmlSpan>("/ html / body / div[1] / section / div[2] / div[2] / div / form / fieldset / div[2] / div[8] / span[1] / span / span[1]");
            previousCategory.MouseClick();

            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            //Thread.Sleep(1000);

            //        var rectangle = previousValueUnit.GetRectangle();
            //        previousValueUnit.MouseClick(MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);

            int x = previousCategory.GetRectangle().X;
            int y = previousCategory.GetRectangle().Y;

            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, x + 50, y + 100);
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.RefreshDomTree();

            var newCategory = TTFDriver.myManager.ActiveBrowser.Find.ByXPath<HtmlSpan>("/html/body/div[1]/section/div[2]/div[2]/div/form/fieldset/div[2]/div[8]/span[1]/span/span[1]");

            //* Verify that new value doesn't equal the previous one,
            //   Assert.AreNotEqual(newCategory.TextContent, previousCategory.TextContent, " Category select failed");

            //* Store the new Category choice in the _category variable for further testing
            allNewValues.Add(newCategory);

            //5. Indicator type selecting (Primary)
            //* Primary is default so make radio-button checking, must be true
            HtmlInputRadioButton radioPrimapry2 = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlControl>("Primary").
            Find.ByAttributes<HtmlInputRadioButton>("type=radio");
               // radioPrimapry2.AssertCheck().IsTrue();

            HtmlInputRadioButton radioCalculated = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlControl>("Calculated").
            Find.ByAttributes<HtmlInputRadioButton>("type=radio");
               // radioCalculated.AssertCheck().IsFalse();

            //* Store the name of label in the _indicator_type variable for further testing
            HtmlContainerControl newIndicatorType;
            if (radioCalculated.Checked && !radioPrimapry2.Checked)
            {
                newIndicatorType = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlContainerControl>("tagname =label", "innertext =~Calculated");
                allNewValues.Add(newIndicatorType);
            }
            if (!radioCalculated.Checked && radioPrimapry2.Checked)
            {
                newIndicatorType = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlContainerControl>("tagname =label", "innertext =~Primary");
                allNewValues.Add(newIndicatorType);
            }
            else
            {
                throw new Exception("Indicator type radiobuttons are failed");
            }

            //6. Value type selecting (Number)
            //* Number type is Primary and set as default so just value type checking
            var newValueType = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("p:Number");
            Assert.IsNotNull(newValueType);
            allNewValues.Add(newValueType);

            //7. Aggregation type selecting (None)
            //var previousAggregationType = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("p:Select aggregation type");
            var previousAggregationType =  TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlSpan>("class=~k-dropdown-wrap").ElementAt(2).Find.ByTagIndex<HtmlSpan>("span", 0);

            allNewValues.Add(previousAggregationType);

            previousAggregationType.ScrollToVisible();
            //previousAggregationType.Capture("56482dot");

            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();

            x = previousAggregationType.GetRectangle().X;
            y = previousAggregationType.GetRectangle().Y;

            previousAggregationType.MouseClick();
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            //Thread.Sleep(1000);

            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, x + 50, y + 85);
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.RefreshDomTree();

            //* Store the new Aggregation type (None) in the _category variable for further testing

            var newAggregationType = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlSpan>("class=~k-dropdown-wrap").ElementAt(2).Find.ByTagIndex<HtmlSpan>("span", 0);
            var newAggregationType1 = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes("class=~k-dropdown-wrap").ElementAt(2).GetNextSibling().ChildNodes; //Find.ByTagIndex<HtmlSpan>("span", 1); ;
            allNewValues.Add(newAggregationType);

            //* Verify that new value doesn't equal the previous one,
             //   Assert.AreNotEqual(newAggregationType.TextContent, previousAggregationType.TextContent, " Aggregation type select failed");
            //* Verify the aggregation type is None
             //   Assert.AreEqual(newAggregationType.TextContent, "NONE", "Aggregation type is note 'NONE'");

            //8. Active check-box checking (must be true)
            // find active checkbox>assert
            var checkboxes = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlInputCheckBox>("type=checkbox");
            //* Check the check-box status if it's true put the value "active" in the  _active_staus variable
            Assert.IsTrue(checkboxes[0].Checked, "Active checkbox is unchecked");
            string newIndicatorActiveStausString = "null";
            if (checkboxes[0].Checked) newIndicatorActiveStausString = "Active";
            else newIndicatorActiveStausString = "Inactive";
            allNewValues.Add(checkboxes[0]);
            Assert.IsFalse(checkboxes[1].Checked);
            Assert.IsFalse(checkboxes[2].Checked);

            //9. Value unit selecting
            //var previousValueUnit = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("p:Select Value Unit");
            var previousValueUnit = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlSpan>("class=~k-dropdown-wrap").ElementAt(3).Find.ByTagIndex<HtmlSpan>("span", 0);

            previousValueUnit.MouseClick();
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();

            previousValueUnit.ScrollToVisible();

            //Thread.Sleep(1000);
            x = previousValueUnit.GetRectangle().X;
            y = previousValueUnit.GetRectangle().Y;

            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, x + 50, y + 85);
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.RefreshDomTree();

            //* Store the value unit choice in the  newValueUnit variable for further testing
            var newValueUnit = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlSpan>("class=~k-dropdown-wrap").ElementAt(3).Find.ByTagIndex<HtmlSpan>("span", 0);
            allNewValues.Add(newValueUnit);
            //* Verify that current value doesn't equal to previous one
               // Assert.AreNotEqual(newValueUnit.TextContent, previousValueUnit.TextContent, " Value unit selecting was failed");

            //10. Order number choice
            var currentOrderNumber = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info").
            Find.ByExpression<HtmlInputText>("aria-valuenow=+");
            string valueOfAtributeCurrenOrder = currentOrderNumber.Attributes.Single(xx => xx.Name == "aria-valuenow").Value;
            string valueExpected = (int.Parse(valueOfAtributeCurrenOrder)+1).ToString();
            /*int currentOrderNumberInt;
            bool res = int.TryParse(currentOrderNumber.Text, out currentOrderNumberInt);
            if (res == false)
            {
                throw new Exception("Order number is not a number");
            }*/

            var increaseOrderNumber = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info").
            Find.ByAttributes<HtmlSpan>("title=Increase value");
            increaseOrderNumber.MouseClick();

            //* Store the current value  in the  _order_number variable for further testing
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info").
            Find.ByExpression<HtmlInputText>("aria-valuenow=+")
            .Wait.ForCondition(
                          (a_0, a_1) => ArtOfTest.Common.CompareUtils.StringCompare(
                          a_0.Attributes.Single(xx => xx.Name == "aria-valuenow").Value,
                          valueExpected,
                          ArtOfTest.Common.StringCompareType.Contains),
                          false, null, 5000);

            var newOrderNumber = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info").
            Find.ByExpression<HtmlInputText>("aria-valuenow=+");
            string valueOfAtributeNewNumberOrder = newOrderNumber.Attributes.Single(xx => xx.Name == "aria-valuenow").Value;

            //Find.ByAttributes<HtmlInputText>("type=text");
            allNewValues.Add(newOrderNumber);

            /*int newOrderNumberInt;
            bool res1 = int.TryParse(currentOrderNumber.Text, out newOrderNumberInt);
            if (res1 == false)
            {
                throw new Exception("Order number is not a number");
            }*/

            //* Verify that current value doesn't equal to previous one
            Assert.AreNotEqual(valueOfAtributeNewNumberOrder, valueOfAtributeCurrenOrder, "the Previous order number equales the current");
            Assert.AreNotEqual(int.Parse(valueOfAtributeNewNumberOrder), int.Parse(valueOfAtributeCurrenOrder));
            newOrderNumber.AssertAttribute().Value("aria-valuenow", ArtOfTest.Common.StringCompareType.Exact, valueExpected);
            //Assert.AreNotEqual(currentOrderNumberInt, newOrderNumberInt, "Increase order number doesn't work");

            //11. Saving
            TTFDriver.myManager.ActiveBrowser.AutoWaitUntilReady = true;
            TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlButton>("type=submit").Click();
            // TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            // TTFDriver.myManager.ActiveBrowser.WaitForAjax(5);

            //* Redirecting to the Indicator grid checking
            //Title checking in the row

            // HtmlFindExpression exp = new HtmlFindExpression("XPath=/html/body/div[1]/section/div[2]/ul/li[1]/a");
            HtmlFindExpression exp = new HtmlFindExpression("TagName=h2", "InnerText=" + titleString);
            TTFDriver.myManager.ActiveBrowser.WaitForElement(exp, 10000, false);
            var tagname = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlContainerControl>(exp);
            tagname.AssertContent().InnerText(ArtOfTest.Common.StringCompareType.Contains, titleString);

            //TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            //TTFDriver.myManager.ActiveBrowser.WaitForAjax(5000);

            var a1 = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlControl>("class=~nav-tabs").
              Find.ByContent<HtmlAnchor>("p:Edit");
            var b2 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("InnerText =~Edit", "tagname = a");
            var b1 = TTFDriver.myManager.ActiveBrowser.Find.AllByContent<HtmlAnchor>("p:Edit");
            var b3 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("href=~/Indicators/Edit");
            var b4 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("href=/Indicators/Edit/222");
            var b7 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("InnerText=~Edit");
            var b5 = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlAnchor>("href=/Indicators/Edit/222");
            var b6 = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlAnchor>("href=~/Indicators/Edit");

            TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlAnchor>("href=/Indicators").Click();

            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.WaitForAjax(5000);

            var newIndicatorRow = TTFDriver.myManager.ActiveBrowser.Find.AllByTagName<HtmlTableRow>("tr").
               Where(c => c.InnerText.Contains(titleString));

                    //Order Number checking in the row
                    var OrderNumberInRow = newIndicatorRow.FirstOrDefault().Find.ByContent<HtmlControl>(valueExpected, FindContentType.TextContent);
            Assert.IsNotNull(OrderNumberInRow, "the order numebr is wrong");

            //Value type checking in the row
            var valueTypeInRow = newIndicatorRow.FirstOrDefault().Find.ByContent<HtmlControl>(newValueType.TextContent, FindContentType.TextContent);
            Assert.IsNotNull(valueTypeInRow, "the order numebr is wrong");
            //Value unit checking in the row

            //Category checking in the row
            var CategoryInRow = newIndicatorRow.FirstOrDefault().Find.ByContent<HtmlControl>(newCategory.TextContent, FindContentType.TextContent);
            Assert.IsNotNull(CategoryInRow, "is absent");

            //Indicator type checking in the row
            HtmlContainerControl newIndicatorTypeInRow = newIndicatorRow.FirstOrDefault().Find.ByContent<HtmlContainerControl>(newIndicatorType.TextContent, FindContentType.TextContent);
            Assert.IsNotNull(newIndicatorTypeInRow, "is absent");
            //Value unit  checking in the row
            var newValueUnitInRow = newIndicatorRow.FirstOrDefault().Find.ByContent<HtmlControl>(newValueUnit.TextContent, FindContentType.TextContent);
            Assert.IsNotNull(newValueUnitInRow, "is absent");
            //Active/Inactive status  checking in the row
            var newActiveStatus1 = newIndicatorRow.FirstOrDefault().Find.ByTagIndex<HtmlSpan>("span",0).AssertAttribute().Value("title", ArtOfTest.Common.StringCompareType.Same, newIndicatorActiveStausString);
            var newActiveStatus = newIndicatorRow.FirstOrDefault().Find.ByExpression<HtmlControl>("title=" + newIndicatorActiveStausString);
            Assert.IsNotNull(newActiveStatus, "is absent");
            var b = 0; ;
        }
        private HtmlVideo GetContentBlockVideoDesignMode()
        {
            Browser frame = this.GetContentBlockFrame();

            HtmlFindExpression expression = new HtmlFindExpression("tagname=video");
            frame.WaitForElement(expression, TimeOut, false);

            return frame.Find.AllByTagName("video").FirstOrDefault().As<HtmlVideo>();
        }
 /// <summary>
 /// Verifies the video info.
 /// </summary>
 /// <param name="title">The title.</param>
 /// <param name="type">The type.</param>
 /// <param name="size">The size.</param>
 public void VerifyVideoInfo(string title, string type, string size)
 {
     DateTime dateTime = DateTime.Now;
     var date = dateTime.Date;
     var dateString = date.ToString("M/d/yyyy");
     HtmlFindExpression expression = new HtmlFindExpression("ng-bind=sfMedia.Title.Value");
     ActiveBrowser.WaitForElement(expression, 60000, false);
     ActiveBrowser.Find.ByExpression<HtmlSpan>("ng-bind=sfMedia.Title.Value", "innertext=" + title).AssertIsPresent("title");
     ActiveBrowser.Find.ByExpression<HtmlSpan>("ng-bind=sfMedia.Extension", "innertext=" + type).AssertIsPresent("type");
     ActiveBrowser.Find.ByExpression<HtmlSpan>("ng-bind=mediaSize", "innertext=" + size).AssertIsPresent("size");
     ActiveBrowser.Find.ByExpression<HtmlSpan>("ng-bind=uploaded | date : 'M/d/yyyy h:mm'", "innertext=~" + dateString).AssertIsPresent("date");
 }
Exemple #42
0
        /// <summary>
        /// Verifies the selectedtag.
        /// </summary>
        /// <param name="tagName">Name of the tag.</param>
        public void VerifySelectedTag(string tagName)
        {
            HtmlFindExpression expression = new HtmlFindExpression("tagname=span", "InnerText=" + tagName);

            ActiveBrowser.WaitForElement(expression, 20000, false);
        }
        public static void CreateNewIndicator(string aggregationType, string valueTypeOfIndicator)
        {
            //1 and 2. Title filling
            var newTitle = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlInputText>("type=text");
            //var title = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlInputText>("type=text",);
            //	* Store the title in variable _title for further testing
            newTitle[0].Text = "";
            string id;
            string titleString = TTFPostCreator.CreatPost(out id);
            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, newTitle[0].GetRectangle());
            TTFDriver.myManager.Desktop.KeyBoard.TypeText(titleString);

            newTitle[1].MouseClick();
            TTFDriver.myManager.Desktop.KeyBoard.TypeText(id);
            allNewValuesList.Add(titleString);

            //3. Description adding
            var textArea = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlTextArea>("placeholder=Enter Indicator description in  English");
            textArea.MouseClick();
            TTFDriver.myManager.Desktop.KeyBoard.TypeText("Test with TTF");

            // 4-7 dropdown selecting algoritm

            allNewValuesList.AddRange(TTFCreatingIndicatorAssistant.SelectDropdownsValue(aggregationType, valueTypeOfIndicator));

            //	4. Category select - skipped

            //5. Indicator type selecting (Primary)
            //* Primary is default so make radio-button checking, must be true
            HtmlInputRadioButton radioPrimapry2 = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlControl>("Primary").
            Find.ByAttributes<HtmlInputRadioButton>("type=radio");

            HtmlInputRadioButton radioCalculated = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlControl>("Calculated").
            Find.ByAttributes<HtmlInputRadioButton>("type=radio");

            // Store the name of label in the _indicator_type variable for further tfaileesting
            HtmlContainerControl newIndicatorType;
            if (radioCalculated.Checked && !radioPrimapry2.Checked)
            {
                newIndicatorType = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlContainerControl>("tagname =label", "innertext =~Calculated");
                allNewValuesList.Add(newIndicatorType.InnerText);
            }
            if (!radioCalculated.Checked && radioPrimapry2.Checked)
            {
                newIndicatorType = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlContainerControl>("tagname =label", "innertext =~Primary");
                allNewValuesList.Add(newIndicatorType.InnerText);
            }
            else
            {
                throw new Exception("Indicator type radiobuttons are failed");
            }
            ////6. Value type selecting (Number) - skipped
            //7. Aggregation type selecting (None) - skipped

            //8. Active check-box checking (must be true)
            // find active checkbox>assert
            var checkboxes = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlInputCheckBox>("type=checkbox");
            checkboxes[0].ScrollToVisible();
            //* Check the check-box status if it's true put the value "active" in the  _active_staus variable
            Assert.IsTrue(checkboxes[0].Checked, "Active checkbox is unchecked");
            string newIndicatorActiveStausString;
            if (checkboxes[0].Checked) newIndicatorActiveStausString = "Active";
            else newIndicatorActiveStausString = "Inactive";
            Assert.IsFalse(checkboxes[1].Checked);
            Assert.IsFalse(checkboxes[2].Checked);
            allNewValuesList.Add(newIndicatorActiveStausString);

            //9. Value unit selecting - skkiped

            //10. Order number choice
            string valueOfAtributeCurrenOrder = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info").
            Find.ByExpression<HtmlInputText>("aria-valuenow=+").Attributes.Single(xx => xx.Name == "aria-valuenow").Value;

            string valueExpected = (int.Parse(valueOfAtributeCurrenOrder) + 1).ToString();

            var increaseOrderNumber = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info")
            .Find.ByAttributes<HtmlSpan>("title=Increase value");

            increaseOrderNumber.ScrollToVisible();
            increaseOrderNumber.MouseClick(MouseClickType.LeftClick, 0, 0, OffsetReference.AbsoluteCenter);

            //* Store the current value  in the  _order_number variable for further testing
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info").
            Find.ByExpression<HtmlInputText>("aria-valuenow=+")
            .Wait.ForCondition(
                          (a_0, a_1) => ArtOfTest.Common.CompareUtils.StringCompare(
                          a_0.Attributes.Single(xx => xx.Name == "aria-valuenow").Value,
                          valueExpected,
                          ArtOfTest.Common.StringCompareType.Contains),
                          false, null, 5000);

            TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info").MouseClick();
            string valueOfAtributeNewNumberOrder = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlDiv>("ng-include=~additional-info").
            Find.ByExpression<HtmlInputText>("aria-valuenow=+").Attributes.Single(xx => xx.Name == "aria-valuenow").Value;

            allNewValuesList.Add(valueOfAtributeNewNumberOrder);
            //* Verify that current value doesn't equal to previous one
            Assert.AreNotEqual(valueOfAtributeNewNumberOrder, valueOfAtributeCurrenOrder, "the Previous order number equales the current");
            Assert.AreNotEqual(int.Parse(valueOfAtributeNewNumberOrder), int.Parse(valueOfAtributeCurrenOrder));

            //11. Saving
            TTFDriver.myManager.ActiveBrowser.AutoWaitUntilReady = true;
            TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlButton>("type=submit").Click();

            HtmlFindExpression exp = new HtmlFindExpression("TagName=h2", "InnerText=" + titleString);
            TTFDriver.myManager.ActiveBrowser.WaitForElement(exp, 10000, false);
            var tagname = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlContainerControl>(exp);
            tagname.AssertContent().InnerText(ArtOfTest.Common.StringCompareType.Contains, titleString);
            var b7 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("InnerText=Edit");

            TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlAnchor>("href=/Indicators").Click();
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.WaitForAjax(5000);

            // 12. New values checking in the grid

               var     newIndicatorRow = TTFDriver.myManager.ActiveBrowser.Find.AllByTagName<HtmlTableRow>("tr").
                    Where(c => c.InnerText.Contains(titleString)).FirstOrDefault().Find.AllByTagName<HtmlTableCell>("td")
                    .Where(c => c.InnerText != "");

                foreach (var item in newIndicatorRow)
                {
                    allNewValuesListInGrid.Add(item.InnerText);
                }
                string activeInactiveCell = TTFDriver.myManager.ActiveBrowser.Find.AllByTagName<HtmlTableRow>("tr")
                .Where(c => c.InnerText.Contains(titleString)).FirstOrDefault().Find.ByTagIndex<HtmlSpan>("span", 0).Attributes.Single(x => x.Name == "title").Value;
                var activeInactiveCell2 = TTFDriver.myManager.ActiveBrowser.Find.AllByTagName<HtmlTableRow>("tr")
                .Where(c => c.InnerText.Contains(titleString)).FirstOrDefault().Find.ByExpression<HtmlSpan>("title=+").Attributes.Single(x => x.Name == "title").Value;
                allNewValuesListInGrid.Add(activeInactiveCell);

                Assert.IsTrue(allNewValuesList.Count == allNewValuesListInGrid.Count, "count of elements in the compared list don't match");
                foreach (var item in allNewValuesListInGrid)
                    {
                        Assert.IsTrue(allNewValuesList.Contains(item), "new values in the indicator's grid don't match with the created values");
                    }
        }
        // *********Creating of the Number type indicator**********
        public static void CreateNewIndicator()
        {
            //* Create tab checking
            //   var tabCreate = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlAnchor>("Create");
            //    Assert.IsNotNull(tabCreate, "Create page is null");
            //  tabCreate.AssertAttribute().Value("class", ArtOfTest.Common.StringCompareType.Contains, "edit");
            //      tabCreate.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Same, "Create");


            //1. Title filling
            var newTitle = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlInputText>("type=text");

            //var title = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlInputText>("type=text",);
            //	* Store the title in variable _title for further testing
            newTitle[0].Text = "";
            string id;
            string titleString;

            titleString = TTFPostCreator.CreatPost(out id);
            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, newTitle[0].GetRectangle());
            TTFDriver.myManager.Desktop.KeyBoard.TypeText(titleString);

            newTitle[0].Text = titleString;
            newTitle[1].Text = id;
            allNewValues.Add(newTitle[0].Text);

            //3. Description adding
            var textArea = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlTextArea>("placeholder=Enter Indicator description in  English");

            textArea.Text = "This indictor was created with Teleric Test Framework";

            //	4. Category select (n)
            //* Store the previous Category choice in the _category variable for further testing

            /*            TTFDriver.myManager.ActiveBrowser.Find.ByAttributes<HtmlSelect>("k-option-label=~-- Select category --").Wait.ForCondition(
             *          (a_0, a_1) => ArtOfTest.Common.CompareUtils.StringCompare(
             *          a_0.InnerText,
             *          "-- Select category --",
             *          ArtOfTest.Common.StringCompareType.Contains),
             *          false, null, 10000);*/


            var previousCategory2 = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlSelect>("k-option-label=~-- Select category --")
                                    .Find.ByExpression <HtmlOption>("value=32");
            var aaa = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlSelect>("k-option-label=~-- Select category --");

            aaa.MouseClick(MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);

            TTFDriver.myManager.ActiveBrowser.WaitForElement(2000, previousCategory2.Value);
            previousCategory2.MouseClick(MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);

            /*
             *    previousCategory2.SelectByIndex(1, true);
             *   TTFDriver.myManager.ActiveBrowser.RefreshDomTree();
             *   previousCategory2.Click();*/

            var previousCategory = TTFDriver.myManager.ActiveBrowser.Find.ByXPath <HtmlSpan>("/ html / body / div[1] / section / div[2] / div[2] / div / form / fieldset / div[2] / div[8] / span[1] / span / span[1]");

            previousCategory.MouseClick();

            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            //Thread.Sleep(1000);


            //        var rectangle = previousValueUnit.GetRectangle();
            //        previousValueUnit.MouseClick(MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);

            int x = previousCategory.GetRectangle().X;
            int y = previousCategory.GetRectangle().Y;

            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, x + 50, y + 100);
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.RefreshDomTree();

            var newCategory = TTFDriver.myManager.ActiveBrowser.Find.ByXPath <HtmlSpan>("/html/body/div[1]/section/div[2]/div[2]/div/form/fieldset/div[2]/div[8]/span[1]/span/span[1]");

            //* Verify that new value doesn't equal the previous one,
            //   Assert.AreNotEqual(newCategory.TextContent, previousCategory.TextContent, " Category select failed");

            //* Store the new Category choice in the _category variable for further testing
            allNewValues.Add(newCategory);

            //5. Indicator type selecting (Primary)
            //* Primary is default so make radio-button checking, must be true
            HtmlInputRadioButton radioPrimapry2 = TTFDriver.myManager.ActiveBrowser.Find.ByContent <HtmlControl>("Primary").
                                                  Find.ByAttributes <HtmlInputRadioButton>("type=radio");
            // radioPrimapry2.AssertCheck().IsTrue();

            HtmlInputRadioButton radioCalculated = TTFDriver.myManager.ActiveBrowser.Find.ByContent <HtmlControl>("Calculated").
                                                   Find.ByAttributes <HtmlInputRadioButton>("type=radio");
            // radioCalculated.AssertCheck().IsFalse();

            //* Store the name of label in the _indicator_type variable for further testing
            HtmlContainerControl newIndicatorType;

            if (radioCalculated.Checked && !radioPrimapry2.Checked)
            {
                newIndicatorType = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlContainerControl>("tagname =label", "innertext =~Calculated");
                allNewValues.Add(newIndicatorType);
            }
            if (!radioCalculated.Checked && radioPrimapry2.Checked)
            {
                newIndicatorType = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlContainerControl>("tagname =label", "innertext =~Primary");
                allNewValues.Add(newIndicatorType);
            }
            else
            {
                throw new Exception("Indicator type radiobuttons are failed");
            }


            //6. Value type selecting (Number)
            //* Number type is Primary and set as default so just value type checking
            var newValueType = TTFDriver.myManager.ActiveBrowser.Find.ByContent <HtmlSpan>("p:Number");

            Assert.IsNotNull(newValueType);
            allNewValues.Add(newValueType);

            //7. Aggregation type selecting (None)
            //var previousAggregationType = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("p:Select aggregation type");
            var previousAggregationType = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlSpan>("class=~k-dropdown-wrap").ElementAt(2).Find.ByTagIndex <HtmlSpan>("span", 0);

            allNewValues.Add(previousAggregationType);

            previousAggregationType.ScrollToVisible();
            //previousAggregationType.Capture("56482dot");

            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();

            x = previousAggregationType.GetRectangle().X;
            y = previousAggregationType.GetRectangle().Y;

            previousAggregationType.MouseClick();
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            //Thread.Sleep(1000);

            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, x + 50, y + 85);
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.RefreshDomTree();

            //* Store the new Aggregation type (None) in the _category variable for further testing

            var newAggregationType  = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlSpan>("class=~k-dropdown-wrap").ElementAt(2).Find.ByTagIndex <HtmlSpan>("span", 0);
            var newAggregationType1 = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes("class=~k-dropdown-wrap").ElementAt(2).GetNextSibling().ChildNodes; //Find.ByTagIndex<HtmlSpan>("span", 1); ;

            allNewValues.Add(newAggregationType);


            //* Verify that new value doesn't equal the previous one,
            //   Assert.AreNotEqual(newAggregationType.TextContent, previousAggregationType.TextContent, " Aggregation type select failed");
            //* Verify the aggregation type is None
            //   Assert.AreEqual(newAggregationType.TextContent, "NONE", "Aggregation type is note 'NONE'");

            //8. Active check-box checking (must be true)
            // find active checkbox>assert
            var checkboxes = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlInputCheckBox>("type=checkbox");

            //* Check the check-box status if it's true put the value "active" in the  _active_staus variable
            Assert.IsTrue(checkboxes[0].Checked, "Active checkbox is unchecked");
            string newIndicatorActiveStausString = "null";

            if (checkboxes[0].Checked)
            {
                newIndicatorActiveStausString = "Active";
            }
            else
            {
                newIndicatorActiveStausString = "Inactive";
            }
            allNewValues.Add(checkboxes[0]);
            Assert.IsFalse(checkboxes[1].Checked);
            Assert.IsFalse(checkboxes[2].Checked);


            //9. Value unit selecting
            //var previousValueUnit = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("p:Select Value Unit");
            var previousValueUnit = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlSpan>("class=~k-dropdown-wrap").ElementAt(3).Find.ByTagIndex <HtmlSpan>("span", 0);



            previousValueUnit.MouseClick();
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();

            previousValueUnit.ScrollToVisible();



            //Thread.Sleep(1000);
            x = previousValueUnit.GetRectangle().X;
            y = previousValueUnit.GetRectangle().Y;

            TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, x + 50, y + 85);
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.RefreshDomTree();

            //* Store the value unit choice in the  newValueUnit variable for further testing
            var newValueUnit = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlSpan>("class=~k-dropdown-wrap").ElementAt(3).Find.ByTagIndex <HtmlSpan>("span", 0);

            allNewValues.Add(newValueUnit);
            //* Verify that current value doesn't equal to previous one
            // Assert.AreNotEqual(newValueUnit.TextContent, previousValueUnit.TextContent, " Value unit selecting was failed");

            //10. Order number choice
            var currentOrderNumber = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info").
                                     Find.ByExpression <HtmlInputText>("aria-valuenow=+");
            string valueOfAtributeCurrenOrder = currentOrderNumber.Attributes.Single(xx => xx.Name == "aria-valuenow").Value;
            string valueExpected = (int.Parse(valueOfAtributeCurrenOrder) + 1).ToString();

            /*int currentOrderNumberInt;
             * bool res = int.TryParse(currentOrderNumber.Text, out currentOrderNumberInt);
             * if (res == false)
             * {
             *  throw new Exception("Order number is not a number");
             * }*/

            var increaseOrderNumber = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info").
                                      Find.ByAttributes <HtmlSpan>("title=Increase value");

            increaseOrderNumber.MouseClick();

            //* Store the current value  in the  _order_number variable for further testing
            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info").
            Find.ByExpression <HtmlInputText>("aria-valuenow=+")
            .Wait.ForCondition(
                (a_0, a_1) => ArtOfTest.Common.CompareUtils.StringCompare(
                    a_0.Attributes.Single(xx => xx.Name == "aria-valuenow").Value,
                    valueExpected,
                    ArtOfTest.Common.StringCompareType.Contains),
                false, null, 5000);

            var newOrderNumber = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info").
                                 Find.ByExpression <HtmlInputText>("aria-valuenow=+");
            string valueOfAtributeNewNumberOrder = newOrderNumber.Attributes.Single(xx => xx.Name == "aria-valuenow").Value;

            //Find.ByAttributes<HtmlInputText>("type=text");
            allNewValues.Add(newOrderNumber);

            /*int newOrderNumberInt;
             * bool res1 = int.TryParse(currentOrderNumber.Text, out newOrderNumberInt);
             * if (res1 == false)
             * {
             *  throw new Exception("Order number is not a number");
             * }*/

            //* Verify that current value doesn't equal to previous one
            Assert.AreNotEqual(valueOfAtributeNewNumberOrder, valueOfAtributeCurrenOrder, "the Previous order number equales the current");
            Assert.AreNotEqual(int.Parse(valueOfAtributeNewNumberOrder), int.Parse(valueOfAtributeCurrenOrder));
            newOrderNumber.AssertAttribute().Value("aria-valuenow", ArtOfTest.Common.StringCompareType.Exact, valueExpected);
            //Assert.AreNotEqual(currentOrderNumberInt, newOrderNumberInt, "Increase order number doesn't work");

            //11. Saving
            TTFDriver.myManager.ActiveBrowser.AutoWaitUntilReady = true;
            TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlButton>("type=submit").Click();
            // TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            // TTFDriver.myManager.ActiveBrowser.WaitForAjax(5);

            //* Redirecting to the Indicator grid checking
            //Title checking in the row

            // HtmlFindExpression exp = new HtmlFindExpression("XPath=/html/body/div[1]/section/div[2]/ul/li[1]/a");
            HtmlFindExpression exp = new HtmlFindExpression("TagName=h2", "InnerText=" + titleString);

            TTFDriver.myManager.ActiveBrowser.WaitForElement(exp, 10000, false);
            var tagname = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlContainerControl>(exp);

            tagname.AssertContent().InnerText(ArtOfTest.Common.StringCompareType.Contains, titleString);


            //TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            //TTFDriver.myManager.ActiveBrowser.WaitForAjax(5000);

            var a1 = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlControl>("class=~nav-tabs").
                     Find.ByContent <HtmlAnchor>("p:Edit");
            var b2 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlAnchor>("InnerText =~Edit", "tagname = a");
            var b1 = TTFDriver.myManager.ActiveBrowser.Find.AllByContent <HtmlAnchor>("p:Edit");
            var b3 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlAnchor>("href=~/Indicators/Edit");
            var b4 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlAnchor>("href=/Indicators/Edit/222");
            var b7 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlAnchor>("InnerText=~Edit");
            var b5 = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlAnchor>("href=/Indicators/Edit/222");
            var b6 = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlAnchor>("href=~/Indicators/Edit");



            TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlAnchor>("href=/Indicators").Click();

            TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
            TTFDriver.myManager.ActiveBrowser.WaitForAjax(5000);

            var newIndicatorRow = TTFDriver.myManager.ActiveBrowser.Find.AllByTagName <HtmlTableRow>("tr").
                                  Where(c => c.InnerText.Contains(titleString));

            //Order Number checking in the row
            var OrderNumberInRow = newIndicatorRow.FirstOrDefault().Find.ByContent <HtmlControl>(valueExpected, FindContentType.TextContent);

            Assert.IsNotNull(OrderNumberInRow, "the order numebr is wrong");

            //Value type checking in the row
            var valueTypeInRow = newIndicatorRow.FirstOrDefault().Find.ByContent <HtmlControl>(newValueType.TextContent, FindContentType.TextContent);

            Assert.IsNotNull(valueTypeInRow, "the order numebr is wrong");
            //Value unit checking in the row

            //Category checking in the row
            var CategoryInRow = newIndicatorRow.FirstOrDefault().Find.ByContent <HtmlControl>(newCategory.TextContent, FindContentType.TextContent);

            Assert.IsNotNull(CategoryInRow, "is absent");

            //Indicator type checking in the row
            HtmlContainerControl newIndicatorTypeInRow = newIndicatorRow.FirstOrDefault().Find.ByContent <HtmlContainerControl>(newIndicatorType.TextContent, FindContentType.TextContent);

            Assert.IsNotNull(newIndicatorTypeInRow, "is absent");
            //Value unit  checking in the row
            var newValueUnitInRow = newIndicatorRow.FirstOrDefault().Find.ByContent <HtmlControl>(newValueUnit.TextContent, FindContentType.TextContent);

            Assert.IsNotNull(newValueUnitInRow, "is absent");
            //Active/Inactive status  checking in the row
            var newActiveStatus1 = newIndicatorRow.FirstOrDefault().Find.ByTagIndex <HtmlSpan>("span", 0).AssertAttribute().Value("title", ArtOfTest.Common.StringCompareType.Same, newIndicatorActiveStausString);
            var newActiveStatus  = newIndicatorRow.FirstOrDefault().Find.ByExpression <HtmlControl>("title=" + newIndicatorActiveStausString);

            Assert.IsNotNull(newActiveStatus, "is absent");
            var b = 0;;
        }
        /// <summary>
        /// Verifies the checked radio button option.
        /// </summary>
        /// <param name="optionId">The option id.</param>
        public void VerifyCheckedRadioButtonOption(WidgetDesignerRadioButtonIds optionId)
        {
            HtmlFindExpression expression = new HtmlFindExpression("tagname=input", "id=" + optionId);
            ActiveBrowser.WaitForElement(expression, 60000, false);
            HtmlInputRadioButton radioButton = ActiveBrowser.Find.ByExpression<HtmlInputRadioButton>("tagname=input", "id=" + optionId)
                  .AssertIsPresent("radio button");

            Assert.IsTrue(radioButton.Checked);
        }
            // *********Creating of the Number type indicator**********
            public void CreateNewIndicator()
            {
                //* Create tab checking
                //   var tabCreate = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlAnchor>("Create");
                //    Assert.IsNotNull(tabCreate, "Create page is null");
                //  tabCreate.AssertAttribute().Value("class", ArtOfTest.Common.StringCompareType.Contains, "edit");
                //      tabCreate.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Same, "Create");


                //1. Title filling
                var newTitle = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlInputText>("type=text");

                //var title = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlInputText>("type=text",);
                //	* Store the title in variable _title for further testing
                newTitle[0].Text = "";
                string id;
                string titleString;

                titleString = TTFPostCreator.CreatPost(out id);
                TTFDriver.myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, newTitle[0].GetRectangle());
                TTFDriver.myManager.Desktop.KeyBoard.TypeText(titleString);

                newTitle[1].MouseClick();
                TTFDriver.myManager.Desktop.KeyBoard.TypeText(id);

                allNewValuesList.Add(titleString);

                //3. Description adding
                var textArea = TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlTextArea>("placeholder=Enter Indicator description in  English");

                textArea.MouseClick();
                TTFDriver.myManager.Desktop.KeyBoard.TypeText("This indictor was created with Teleric Test Framework");

                // 4-7 dropdown selecting algoritm

                allNewValuesList.AddRange(TTFCreatingIndicatorAssistant.SelectDropdownsValue(_aggregationType, _valueTypeOfIndicator));

                //	4. Category select (n)
                //* Store the previous Category choice in the _category variable for further testing
                //int drodoownsCount = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlDiv>("data-role=popup").Count;
                //for (int i = 0; i < drodoownsCount; i++)
                //{
                //    string previousItem = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(i);
                //    TTFCreatingIndicatorAssistant.DoSelecting(i);
                //    string newItem = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(i);
                //    Assert.IsNotNull(previousItem);
                //    Assert.IsNotNull(newItem);
                //    Assert.AreNotEqual(previousItem, newItem, " Category select failed");

                //}

                //string previousCategory = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(0);
                //TTFCreatingIndicatorAssistant.DoSelecting(0);
                //string newCategory = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(0);

                ////* Verify that new value doesn't equal the previous one,
                //Assert.AreNotEqual(newCategory, previousCategory, " Category select failed");

                ////* Store the new Category choice in the _category variable for further testing
                //allNewValuesList.Add(newCategory);

                //5. Indicator type selecting (Primary)
                //* Primary is default so make radio-button checking, must be true
                HtmlInputRadioButton radioPrimapry2 = TTFDriver.myManager.ActiveBrowser.Find.ByContent <HtmlControl>("Primary").
                                                      Find.ByAttributes <HtmlInputRadioButton>("type=radio");

                HtmlInputRadioButton radioCalculated = TTFDriver.myManager.ActiveBrowser.Find.ByContent <HtmlControl>("Calculated").
                                                       Find.ByAttributes <HtmlInputRadioButton>("type=radio");

                // Store the name of label in the _indicator_type variable for further tfaileesting
                HtmlContainerControl newIndicatorType;

                if (radioCalculated.Checked && !radioPrimapry2.Checked)
                {
                    newIndicatorType = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlContainerControl>("tagname =label", "innertext =~Calculated");
                    allNewValuesList.Add(newIndicatorType.InnerText);
                }
                if (!radioCalculated.Checked && radioPrimapry2.Checked)
                {
                    newIndicatorType = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlContainerControl>("tagname =label", "innertext =~Primary");
                    allNewValuesList.Add(newIndicatorType.InnerText);
                }
                else
                {
                    throw new Exception("Indicator type radiobuttons are failed");
                }


                ////6. Value type selecting (Number)
                ////* Number type is Primary and set as default so just value type checking
                //string previousValueType = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(3);//1
                //                                                                                   //var newValueType = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("p:Number");
                //if (previousValueType != "Number")
                //{
                //    if (TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlAnchor>("Create") != null)
                //        throw new Exception("Default value type is broken");
                //    else
                //        TTFCreatingIndicatorAssistant.DoSelecting(3);
                //}
                //string newValueType = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(3);//1

                //Assert.IsNotNull(newValueType);
                ////Assert.AreNotEqual(newValueType, previousValueType, " Category select failed");
                //allNewValuesList.Add(newValueType);

                //7. Aggregation type selecting (None)
                //var previousAggregationType = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("p:Select aggregation type");
                //var previousAggregationType = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlSpan>("class=~k-dropdown-wrap").ElementAt(2).Find.ByTagIndex<HtmlSpan>("span", 0);
                //string previousAggregationType = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(2);
                //TTFCreatingIndicatorAssistant.DoSelecting(2);
                //string newAggregationType = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(2);

                //Assert.IsNotNull(newAggregationType);
                //Assert.AreNotEqual(previousAggregationType, newAggregationType, " Aggregation type select failed");
                //allNewValuesList.Add(newAggregationType);

                //8. Active check-box checking (must be true)
                // find active checkbox>assert
                var checkboxes = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes <HtmlInputCheckBox>("type=checkbox");

                checkboxes[0].ScrollToVisible();
                //* Check the check-box status if it's true put the value "active" in the  _active_staus variable
                Assert.IsTrue(checkboxes[0].Checked, "Active checkbox is unchecked");
                string newIndicatorActiveStausString;

                if (checkboxes[0].Checked)
                {
                    newIndicatorActiveStausString = "Active";
                }
                else
                {
                    newIndicatorActiveStausString = "Inactive";
                }
                Assert.IsFalse(checkboxes[1].Checked);
                Assert.IsFalse(checkboxes[2].Checked);
                allNewValuesList.Add(newIndicatorActiveStausString);

                //9. Value unit selecting
                //var previousValueUnit = TTFDriver.myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("p:Select Value Unit");
                //var previousValueUnit = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlSpan>("class=~k-dropdown-wrap").ElementAt(3).Find.ByTagIndex<HtmlSpan>("span", 0);

                //string previousValueUnit = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(1);//3
                //TTFCreatingIndicatorAssistant.DoSelecting(1);
                //string newValueUnit = TTFCreatingIndicatorAssistant.CurrentDropdownValuGet(1);//3

                //Assert.IsNotNull(newValueUnit);
                //Assert.AreNotEqual(previousValueUnit, newValueUnit, " Value Unit select failed");
                //allNewValuesList.Add(newValueUnit);

                //10. Order number choice
                string valueOfAtributeCurrenOrder = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info").
                                                    Find.ByExpression <HtmlInputText>("aria-valuenow=+").Attributes.Single(xx => xx.Name == "aria-valuenow").Value;

                string valueExpected = (int.Parse(valueOfAtributeCurrenOrder) + 1).ToString();

                var increaseOrderNumber = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info")
                                          .Find.ByAttributes <HtmlSpan>("title=Increase value");

                increaseOrderNumber.ScrollToVisible();
                increaseOrderNumber.MouseClick(MouseClickType.LeftClick, 0, 0, OffsetReference.AbsoluteCenter);

                //* Store the current value  in the  _order_number variable for further testing
                TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
                TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info").
                Find.ByExpression <HtmlInputText>("aria-valuenow=+")
                .Wait.ForCondition(
                    (a_0, a_1) => ArtOfTest.Common.CompareUtils.StringCompare(
                        a_0.Attributes.Single(xx => xx.Name == "aria-valuenow").Value,
                        valueExpected,
                        ArtOfTest.Common.StringCompareType.Contains),
                    false, null, 5000);

                TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info").MouseClick();
                string valueOfAtributeNewNumberOrder = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlDiv>("ng-include=~additional-info").
                                                       Find.ByExpression <HtmlInputText>("aria-valuenow=+").Attributes.Single(xx => xx.Name == "aria-valuenow").Value;

                allNewValuesList.Add(valueOfAtributeNewNumberOrder);
                //* Verify that current value doesn't equal to previous one
                Assert.AreNotEqual(valueOfAtributeNewNumberOrder, valueOfAtributeCurrenOrder, "the Previous order number equales the current");
                Assert.AreNotEqual(int.Parse(valueOfAtributeNewNumberOrder), int.Parse(valueOfAtributeCurrenOrder));

                //11. Saving
                TTFDriver.myManager.ActiveBrowser.AutoWaitUntilReady = true;
                TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlButton>("type=submit").Click();

                HtmlFindExpression exp = new HtmlFindExpression("TagName=h2", "InnerText=" + titleString);

                TTFDriver.myManager.ActiveBrowser.WaitForElement(exp, 10000, false);

                var tagname = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlContainerControl>(exp);

                tagname.AssertContent().InnerText(ArtOfTest.Common.StringCompareType.Contains, titleString);

                var b7 = TTFDriver.myManager.ActiveBrowser.Find.ByExpression <HtmlAnchor>("InnerText=Edit");

                TTFDriver.myManager.ActiveBrowser.Find.ByAttributes <HtmlAnchor>("href=/Indicators").Click();

                TTFDriver.myManager.ActiveBrowser.WaitUntilReady();
                TTFDriver.myManager.ActiveBrowser.WaitForAjax(5000);

                var newIndicatorRow = TTFDriver.myManager.ActiveBrowser.Find.AllByTagName <HtmlTableRow>("tr").
                                      Where(c => c.InnerText.Contains(titleString)).FirstOrDefault().Find.AllByTagName <HtmlTableCell>("td")
                                      .Where(c => c.InnerText != "");

                foreach (var item in newIndicatorRow)
                {
                    allNewValuesListInGrid.Add(item.InnerText);
                }
                string activeInactiveCell = TTFDriver.myManager.ActiveBrowser.Find.AllByTagName <HtmlTableRow>("tr")
                                            .Where(c => c.InnerText.Contains(titleString)).FirstOrDefault().Find.ByTagIndex <HtmlSpan>("span", 0).Attributes.Single(x => x.Name == "title").Value;
                var activeInactiveCell2 = TTFDriver.myManager.ActiveBrowser.Find.AllByTagName <HtmlTableRow>("tr")
                                          .Where(c => c.InnerText.Contains(titleString)).FirstOrDefault().Find.ByExpression <HtmlSpan>("title=+").Attributes.Single(x => x.Name == "title").Value;

                allNewValuesListInGrid.Add(activeInactiveCell);
                Assert.IsTrue(allNewValuesList.Count == allNewValuesListInGrid.Count, "count of elements in the compared list don't match");
                foreach (var item in allNewValuesListInGrid)
                {
                    Assert.IsTrue(allNewValuesList.Contains(item), "new values in the indicator's grid don't match with the created values");
                }
            }
        /// <summary>
        /// Verifies the selected value in anchor dropdown.
        /// </summary>
        /// <param name="anchorName">Name of the anchor.</param>
        public void VerifySelectedValueInAnchorDropdown(string anchorName)
        {
            var anchorSelector = EM.GenericContent
                                   .ContentBlockLinkSelector
                                   .AnchorSelector
                                   .AssertIsNotNull("select anchor dropdown");
            if (!anchorSelector.IsVisible())
            {
                HtmlFindExpression expression = new HtmlFindExpression("tagname=select", "ng-model=sfSelectedItem.selectedAnchor");
                ActiveBrowser.WaitForElement(expression, 60000, false);
            }

            Assert.AreEqual(anchorName, anchorSelector.SelectedOption.Text);
        }
        /// <summary>
        /// Selects option from thumbnail selector.
        /// </summary>
        /// <param name="optionValue">Option value.</param>
        public void SelectResizeImageOption(string optionValue)
        {
            HtmlFindExpression expression = new HtmlFindExpression("class=modal-title", "InnerText=Custom thumbnail size");
            ActiveBrowser.WaitForElement(expression, 30000, false);

            HtmlSelect selector = this.EM.Media.ImagePropertiesScreen.ResizeImageSelector
                                      .AssertIsPresent("resize image selector");

            selector.SelectByText(optionValue);
            selector.AsjQueryControl().InvokejQueryEvent(jQueryControl.jQueryControlEvents.click);
            selector.AsjQueryControl().InvokejQueryEvent(jQueryControl.jQueryControlEvents.change);
        }
 /// <summary>
 /// Verifies the selectedtag.
 /// </summary>
 /// <param name="tagName">Name of the tag.</param>
 public void VerifySelectedTag(string tagName)
 {
     HtmlFindExpression expression = new HtmlFindExpression("tagname=span", "InnerText=" + tagName);
     ActiveBrowser.WaitForElement(expression, 20000, false);
 }
        /// <summary>
        /// Verifies the selected option in aspect ratio selector
        /// </summary>
        /// <param name="option">The aspect ratio option.</param>
        public void VerifySelectedOptionAspectRatioSelector(string option)
        {
            HtmlFindExpression expression = new HtmlFindExpression("tagName=select", "ng-model=model.aspectRatio");
            ActiveBrowser.WaitForElement(expression, 60000, false);

            HtmlSelect selector = this.EM.Media.VideoPropertiesScreen.AspectRatioSelector
                                      .AssertIsPresent("aspect ration selector");

            Assert.AreEqual(option, selector.SelectedOption.Text);
        }
        private HtmlDiv GetSocialShareOptionDivByName(string optionName)
        {
            HtmlFindExpression socialShareDivFindExpression = new HtmlFindExpression("class=checkbox ng-scope", "ng-repeat=group in socialGroups.Groups", "InnerText=" + optionName);
            HtmlDiv socialShareOptionDiv = ActiveBrowser.WaitForElement(socialShareDivFindExpression, TimeOut, false).As<HtmlDiv>();

            if (socialShareOptionDiv != null && socialShareOptionDiv.IsVisible())
            {
                return socialShareOptionDiv;
            }
            else
            {
                throw new ArgumentException("Social share option div was not found");
            }
        }