public HelloWebWithPageObjectTests()
 {
     driver = new ChromeDriver();
     driver.Manage().Window.Maximize();
     testComment = new ExampleComment();
     testNote    = new ExampleNote();
 }
        public void Can_add_comment_to_existing_note_with_autodata(ExampleComment comment)
        {
            //arrange
            var welcomeNote = new Note(driver, FirstNoteUrl);

            // act
            welcomeNote.AddComment(comment);

            //assert
            var comments = welcomeNote.SearchCommentsByText(comment);

            Assert.Single(comments);
        }
示例#3
0
        internal void AddComment(ExampleComment comment)
        {
            var commentElement = _driver.FindElement(By.Id("comment"));

            commentElement.SendKeys(comment.Text);

            var emailElement = _driver.FindElement(By.Id("email"));

            emailElement.SendKeys(comment.Email);

            var userElement = _driver.FindElement(By.Id("author"));

            userElement.SendKeys(comment.Name);

            var submitElement = _driver.FindElement(By.Id("comment-submit"));

            submitElement.Click();
        }
示例#4
0
        internal IEnumerable <IWebElement> SearchCommentsByText(ExampleComment comment)
        {
            var comments = _driver.FindElements(By.ClassName("comment-content"));

            return(comments.Where(c => c.Text.Contains(comment.Text)));
        }