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(); }
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)); } }
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"); } }
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(); }