internal string AddCommentNotes(ExampleComment exampleComment) { var note = browser.FindElement(By.LinkText("Wpisy")); note.Click(); var newNote = browser.FindElement(By.LinkText("Dodaj nowy")); newNote.Click(); var title = browser.FindElement(By.Name("post_title")); title.SendKeys(exampleComment.Title); var comment = browser.FindElement(By.Id("content")); comment.SendKeys(exampleComment.Content); var publish = browser.FindElement(By.Id("publish")); publish.Click(); WaitForClickable(By.CssSelector("#sample-permalink > a"), 5); var link = browser.FindElement(By.CssSelector("#sample-permalink > a")); var linkText = link.GetAttribute("href"); return(linkText); }
internal bool HasMyNotes(ExampleComment exampleComment) { var myTitle = browser.FindElement(By.CssSelector(".entry-title")); var myContent = browser.FindElement(By.CssSelector(".entry-content > p")); return(myTitle.Text == exampleComment.Title && myContent.Text == exampleComment.Content); }
public void Can_add_new_comment_to_latest_note() { var startPage = MainPage.Open(GetBrowser()); var notePage = startPage.NavigateToNewestNote(); var exampleComment = new ExampleComment(); var noteWithComment = notePage.AddComment(exampleComment); Assert.True(noteWithComment.Has(exampleComment)); }
internal bool Has(ExampleComment exampleComment) { var comments = browser.FindElements(By.CssSelector("article.comment-body")); var myComments = comments .Where(c => c.FindElement(By.CssSelector(".fn")).Text == exampleComment.Author) .Where(c => c.FindElement(By.CssSelector(".comment-content > p")).Text == exampleComment.Content); return(myComments.Count() == 1); }
internal bool Has(ExampleComment exampleComment) { var publishTitle = browser.FindElements(By.CssSelector(".entry_title")); var mypublishTitle = publishTitle .Where(c => c.FindElement(By.CssSelector(".fn")).Text == exampleComment.Author); var publishContent = browser.FindElement(By.CssSelector("")); return(false); }
internal NotePage AddComment(ExampleComment exampleComment) { var comment = _browser.FindElement(By.Id("comment")); comment.SendKeys(exampleComment.Content); var author = _browser.FindElement(By.Id("author")); author.SendKeys(exampleComment.Author); var mail = _browser.FindElement(By.Id("email")); mail.SendKeys(exampleComment.Email); MoveToElement(_browser.FindElement(By.CssSelector("div.nav-links"))); _browser.FindElement(By.Id("submit")).Submit(); return(new NotePage(_browser)); }
internal NotePage AddComment(ExampleComment exampleComment) { var comment = browser.FindElement(By.Id("comment")); comment.SendKeys(exampleComment.Content); var author = browser.FindElement(By.Id("author")); author.SendKeys(exampleComment.Author); var email = browser.FindElement(By.Id("email")); email.SendKeys(exampleComment.Email); MoveToElement(browser.FindElement(By.ClassName("meta-nav"))); browser.FindElement(By.Id("submit")).Submit(); return(new NotePage(browser)); }
public void Can_publish_new_note() { //zalogowa się do panelu administracyjnego //utworzyć notatkę //wylogowa //nowa notatka jest opublikowana var blogStartPage = MainPageAdmin.Open(GetBrowser()); var loginUser = blogStartPage.NavigateToAdminPanel(); var exampleComment = new ExampleComment(); var link = loginUser.AddCommentNotes(exampleComment); loginUser.LogOut(); var notePage = new NotePage(GetBrowser(), link); Assert.True(notePage.HasMyNotes(exampleComment)); }