Ejemplo n.º 1
0
        public void SetMark(string mark)
        {
            ReviewPage.ReviewModeActivate(theme);

            var finalReviewButton = Driver.Instance.FindElement(By.XPath("//div[contains(text(), 'Оцени')]"));

            finalReviewButton.Click();

            Actions action = new Actions(Driver.Instance);

            var commentField = Driver.Instance.FindElement(By.Id("__ht__finalcomment"));

            action.MoveToElement(commentField).Click();
            commentField.Clear();
            commentField.SendKeys(review);

            var markField = Driver.Instance.FindElement(By.Id("__ht__scoreslider"));

            action.MoveToElement(markField).ClickAndHold().MoveByOffset((int.Parse(mark) - 5) * 10, 0).Release().Perform();

            var saveButton = Driver.Instance.FindElement(By.LinkText("Изпрати"));

            saveButton.Click();
            Driver.Wait(TimeSpan.FromSeconds(2));

            ReviewPage.ReviewModeExit();
        }
Ejemplo n.º 2
0
        public void CheckMark(string mark)
        {
            Actions action = new Actions(Driver.Instance);

            if (mark + ".0000" != GetMark(theme))
            {
                throw new System.Exception("The mark is not correct. Expected: " + mark + ".0000, Got: " + GetMark(theme));
            }

            ReviewPage.ViewModeActivate(theme);

            var finalReviewButton = Driver.Instance.FindElement(By.XPath("//div[contains(text(), 'Коментари')]"));

            action.MoveToElement(finalReviewButton).Click().Release().Perform();
            //finalReviewButton.Click();

            var commentFieldText = Driver.Instance.FindElement(By.XPath("/html/body/div[4]/div[1]/div")).Text;

            //string firstline = str.Substring(0, str.IndexOf(Environment.NewLine));
            commentFieldText = commentFieldText.Substring(0, commentFieldText.IndexOf(Environment.NewLine));
            if (commentFieldText != mark + " от 10 точки")
            {
                ReviewPage.ReviewModeExit();
                throw new System.Exception("The mark is not correct. Expected: " + mark + " от 10 точки, Got: " + commentFieldText);
            }
            ReviewPage.ReviewModeExit();
        }
Ejemplo n.º 3
0
        public void Delete()
        {
            ReviewPage.StoreCount(theme);
            ReviewPage.ReviewModeActivate(theme);

            var elements = Driver.Instance.FindElements(By.TagName(type));

            for (int i = 0; i < elements.Count(); i++)
            {
                if (elements[i].Text == this.text)
                {
                    Actions action = new Actions(Driver.Instance);
                    action.MoveToElement(elements[i]).Click().Build().Perform();

                    var deleteButton = Driver.Instance.FindElement(By.LinkText("Изтрий"));
                    deleteButton.Click();
                    Driver.Wait(TimeSpan.FromSeconds(2));
                    break;
                }
            }

            ReviewPage.ReviewModeExit();
            if (ReviewPage.PreviousReviewsCount - 1 != ReviewPage.CurrentReviewsCount(theme))
            {
                throw new System.Exception("Unable to delete review. Previous: " + ReviewPage.PreviousReviewsCount + ", Current:" + ReviewPage.CurrentReviewsCount(theme));
            }
        }
Ejemplo n.º 4
0
        public void Check()
        {
            ReviewPage.ViewModeActivate(theme);

            var elements = Driver.Instance.FindElements(By.TagName(type));

            for (int i = 0; i < elements.Count(); i++)
            {
                if (elements[i].Text == this.text)
                {
                    Actions action = new Actions(Driver.Instance);
                    action.MoveToElement(elements[i]).Click().Build().Perform();

                    var commentFieldText = Driver.Instance.FindElement(By.XPath("/html/body/div[5]/div[2]/div")).Text;
                    if (commentFieldText != this.review)
                    {
                        ReviewPage.ReviewModeExit();
                        throw new System.Exception("The review is not correct or not saved. Expected: " + this.review + ", Got: " + commentFieldText);
                    }
                    ReviewPage.ReviewModeExit();
                    return;
                }
            }
            ReviewPage.ReviewModeExit();
            throw new System.Exception("The element, containing the comment, cannot be found");
        }
Ejemplo n.º 5
0
        public void Save()
        {
            ReviewPage.StoreCount(theme);
            ReviewPage.ReviewModeActivate(theme);

            var elements = Driver.Instance.FindElements(By.TagName(type));

            for (int i = 0; i < elements.Count(); i++)
            {
                if (elements[i].Text == this.text)
                {
                    Actions action = new Actions(Driver.Instance);
                    action.MoveToElement(elements[i]).Click().Build().Perform();

                    var commentField = Driver.Instance.FindElement(By.Id("__ht__elementcomment"));
                    action.MoveToElement(commentField).Click();
                    commentField.SendKeys(review);


                    var saveButton = Driver.Instance.FindElement(By.LinkText("Запази"));
                    saveButton.Click();
                    Driver.Wait(TimeSpan.FromSeconds(2));
                    break;
                }
            }

            ReviewPage.ReviewModeExit();
            if (ReviewPage.PreviousReviewsCount + 1 != ReviewPage.CurrentReviewsCount(theme))
            {
                throw new System.Exception("Count of reviews did not increase");
            }
        }
Ejemplo n.º 6
0
        public void CheckFinal()
        {
            Actions action = new Actions(Driver.Instance);

            ReviewPage.ViewModeActivate(theme);

            var finalReviewButton = Driver.Instance.FindElement(By.XPath("//div[contains(text(), 'Коментари')]"));

            action.MoveToElement(finalReviewButton).Click().Release().Perform();
            //finalReviewButton.Click();

            var commentFieldText = Driver.Instance.FindElement(By.ClassName("__ht__blockquote")).Text;

            //string firstline = str.Substring(0, str.IndexOf(Environment.NewLine));
            commentFieldText = commentFieldText.Substring(commentFieldText.IndexOf(Environment.NewLine) + 2);
            if (commentFieldText != this.review)
            {
                ReviewPage.ReviewModeExit();
                throw new System.Exception("The review is not correct or not saved. Expected: " + this.review + ", Got: " + commentFieldText);
            }
            ReviewPage.ReviewModeExit();
        }
Ejemplo n.º 7
0
        public void SaveFinal()
        {
            ReviewPage.ReviewModeActivate(theme);

            var finalReviewButton = Driver.Instance.FindElement(By.XPath("//div[contains(text(), 'Оцени')]"));

            finalReviewButton.Click();

            Actions action = new Actions(Driver.Instance);

            var commentField = Driver.Instance.FindElement(By.Id("__ht__finalcomment"));

            action.MoveToElement(commentField).Click();
            commentField.Clear();
            commentField.SendKeys(review);

            var saveButton = Driver.Instance.FindElement(By.LinkText("Изпрати"));

            saveButton.Click();
            Driver.Wait(TimeSpan.FromSeconds(3));

            ReviewPage.ReviewModeExit();
        }