예제 #1
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));
            }
        }
예제 #2
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");
            }
        }