Exemplo 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();
        }
Exemplo 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();
        }
Exemplo 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));
            }
        }
Exemplo 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");
        }
Exemplo 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");
            }
        }
Exemplo n.º 6
0
        public static bool CheckLastVersionAvailability()
        {
            var uploadDate = Driver.Instance.FindElement(By.XPath("/html/body/div/div[1]/table/tbody/tr[1]/td[1]")).Text;
            var title      = UploadDocsPage.Theme;

            ReviewPage.GoTo();
            var uploadDateReview = ReviewPage.GetUploadDate(title.Remove(0, 17));

            return(uploadDate == uploadDateReview);
        }
Exemplo n.º 7
0
        public void CheckAllFinal()
        {
            var map     = new Dictionary <string, string>();
            var rowSize = Driver.Instance.FindElements(By.XPath("/html/body/div/div[1]/table/tbody/tr/td[1]")).Count();

            for (int i = 1; i <= rowSize; i++)
            {
                var cellText = Driver.Instance.FindElement(By.XPath("/html/body/div/div[1]/table/tbody/tr[" + i + "]/td[1]")).Text;
                try
                {
                    ReviewPage.MakeReview(cellText).Review(this.review).SaveFinal();
                }
                catch
                {
                    try
                    {
                        var isAt = ReviewPage.IsAt;
                    }
                    catch
                    {
                        Driver.Instance.Navigate().Back();
                    }
                    map.Add(cellText + " Make", "Unable to make final review");
                }
                try
                {
                    ReviewPage.MakeReview(cellText).Review(this.review).CheckFinal();
                }
                catch
                {
                    try
                    {
                        var isAt = ReviewPage.IsAt;
                    }
                    catch
                    {
                        Driver.Instance.Navigate().Back();
                    }
                    map.Add(cellText + " Check", "Unable to check final review");
                }
            }
            if (map.Count > 0)
            {
                string Exception = "There is a problem with the following themes: ";
                foreach (var pair in map)
                {
                    string key   = pair.Key;
                    string value = pair.Value;
                    Exception = Exception + "Theme " + key + ": " + value + "; ";
                }
                throw new System.Exception(Exception);
            }
        }
Exemplo n.º 8
0
        public void MakeScreenshot(string actual, string expected, string result, string workingDir, string refPath)
        {
            ReviewPage.ViewModeActivate(theme);
            actual   = workingDir + "\\" + actual;
            expected = workingDir + "\\" + expected;
            result   = workingDir + "\\" + result;
            refPath  = workingDir + "\\" + refPath;
            Screenshot screenshot = ((ITakesScreenshot)Driver.Instance).GetScreenshot();

            screenshot.SaveAsFile(@actual, ScreenshotImageFormat.Png);
            Driver.Instance.Navigate().GoToUrl("file:///" + refPath);
            screenshot = ((ITakesScreenshot)Driver.Instance).GetScreenshot();
            screenshot.SaveAsFile(@expected, ScreenshotImageFormat.Png);
            Process process = new Process();

            process.StartInfo.FileName         = "cmd.exe";
            process.StartInfo.WorkingDirectory = @workingDir;
            process.StartInfo.Arguments        = "/c magick compare " + actual + " " + expected
                                                 + " " + result;
            process.Start();
        }
Exemplo n.º 9
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();
        }
Exemplo n.º 10
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();
        }