internal string CreateNewNote(ExampleNote exampleNote)
        {
            var noteBox = browser.FindElement(By.LinkText("Wpisy"));

            noteBox.Click();
            var newNoteBox = browser.FindElement(By.CssSelector(".page-title-action"));

            newNoteBox.Click();
            var title = browser.FindElement(By.Id("title"));

            title.SendKeys(exampleNote.Title);
            var content = browser.FindElement(By.Id("content"));

            content.SendKeys(exampleNote.Content);

            browser.FindElement(By.Id("publish")).Submit();

            var postUrl = browser.FindElement(By.CssSelector("#sample-permalink > a"));
            var url     = postUrl.GetAttribute("href");

            //var link = browser.FindElement(By.Id("content"));
            //var linkText = link.GetAttribute("href");



            return(url);
        }
Example #2
0
        internal bool HasNote(ExampleNote exampleNote)
        {
            var note = browser.FindElement(By.CssSelector("#main"));

            var title   = note.FindElement(By.CssSelector(".entry.title"));
            var content = note.FindElement(By.CssSelector(".entry-content"));


            return(title.Text == exampleNote.Title && content.Text == exampleNote.Content);
        }
            public void Can_publish_new_note()
            {
                var loginPage     = LoginPage.Open(GetBrowser());
                var adminPanel    = loginPage.Login("automatyzacja", "auto@Zima2019");
                var exampleNote   = new ExampleNote();
                var CreateNewNote = adminPanel.CreateNewNote(exampleNote);
                var logOut        = adminPanel.LogOut();
                var notePage      = new NotePage(GetBrowser());

                notePage.GoTo(CreateNewNote);
                Assert.True(notePage.HasNote(exampleNote));
            }