/// <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);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Confirms the image properties in image widget.
        /// </summary>
        public void ConfirmMediaPropertiesInWidget()
        {
            HtmlButton saveBtn = this.EM.Media.MediaPropertiesBaseScreen.SaveButtonInMediaWidget.AssertIsPresent("Done button");

            saveBtn.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncOperations();
            ActiveBrowser.WaitForAjax(10000);
            ActiveBrowser.RefreshDomTree();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Asserts message and count on page
        /// </summary>
        public void AssertMessageAndCountOnPage(string commentCount)
        {
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
            ActiveBrowser.WaitForAjax(10000);
            ActiveBrowser.WaitForAsyncJQueryRequests();

            HtmlDiv commentLinkOnPage = this.EM.CommentsAndReviews.CommentsFrontend.MessageAndCountOnPage.AssertIsPresent("Comments count on page");
            bool    isPresent         = commentLinkOnPage.InnerText.Contains(commentCount);

            Assert.IsTrue(isPresent);
        }
        /// <summary>
        /// Verifies the image thumbnail.
        /// </summary>
        /// <param name="altText">The alt text.</param>
        /// <param name="src">The SRC.</param>
        public void VerifyImageThumbnail(string altText, string src)
        {
            ActiveBrowser.WaitForAjax(10000);
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
            ActiveBrowser.WaitForElement("tagname=img", "alt=~" + altText);

            HtmlImage image = ActiveBrowser.Find.ByExpression <HtmlImage>("alt=~" + altText)
                              .AssertIsPresent(altText);

            Assert.IsTrue(image.Src.Contains(src), "src is not correct");
        }
        /// <summary>
        /// Verifies the image resizing properties.
        /// </summary>
        /// <param name="altText">The alt text.</param>
        /// <param name="src">The SRC.</param>
        public void VerifyImageResizingProperties(string altText, string srcWidth, string srcHeight, string srcQuality, string srcResizingOption)
        {
            ActiveBrowser.WaitForAjax(10000);
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
            ActiveBrowser.WaitForElement("tagname=img", "alt=~" + altText);

            HtmlImage image = ActiveBrowser.Find.ByExpression <HtmlImage>("alt=~" + altText)
                              .AssertIsPresent(altText);

            Assert.IsTrue(image.Src.Contains(srcWidth) && image.Src.Contains(srcHeight) && image.Src.Contains(srcQuality) && image.Src.Contains(srcResizingOption), "src is not correct");
        }
Exemplo n.º 6
0
        /// <summary>
        /// Type a message.
        /// </summary>
        /// <param name="message">Message.</param>
        public void TypeAMessage(string message)
        {
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
            ActiveBrowser.WaitForAjax(10000);
            ActiveBrowser.WaitForAsyncJQueryRequests();

            HtmlDiv editable = this.EM.CommentsAndReviews.CommentsFrontend.LeaveACommentArea
                               .AssertIsPresent("Leave area");

            editable.ScrollToVisible();
            editable.Focus();
            editable.MouseClick();

            Manager.Current.Desktop.KeyBoard.KeyDown(System.Windows.Forms.Keys.Control);
            Manager.Current.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.A);
            Manager.Current.Desktop.KeyBoard.KeyUp(System.Windows.Forms.Keys.Control);
            Manager.Current.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Delete);
            Manager.Current.Desktop.KeyBoard.TypeText(message);
        }
        /// <summary>
        /// Verify comments author and content
        /// </summary>
        /// <param name="commentsAuthor">Comments author</param>
        /// <param name="commentsContent">Comments content</param>
        public void VerifyCommentsAuthorAndContent(string[] commentsAuthor, string[] commentsContent)
        {
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
            ActiveBrowser.WaitForAsyncJQueryRequests();
            ActiveBrowser.WaitForAjax(10000);

            IList <HtmlDiv> allCommentsDivs = this.EM.CommentsAndReviews.CommentsFrontend.ResultsCommentsList;

            Assert.IsNotNull(allCommentsDivs, "Comments list is null");
            Assert.AreNotEqual(0, allCommentsDivs.Count, "Comments list has no elements");

            Assert.AreEqual(commentsContent.Count(), allCommentsDivs.Count, "Expected and actual count of comments are not equal");

            for (int i = 0; i < allCommentsDivs.Count(); i++)
            {
                Assert.AreEqual(commentsAuthor[i], allCommentsDivs[i].ChildNodes[0].InnerText);
                Assert.AreEqual(commentsContent[i], allCommentsDivs[i].ChildNodes[2].InnerText);
            }
        }