Exemplo n.º 1
0
        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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
            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));
            }