예제 #1
0
        internal bool Has(ExampleNote testNote)
        {
            var title   = _browser.FindElement(By.CssSelector("h1.entry-title"));
            var content = _browser.FindElement(By.CssSelector(".entry-content"));

            return(testNote.Title == title.Text && testNote.Text == content.Text);
        }
예제 #2
0
        internal bool HasNote(string noteLink, ExampleNote note)
        {
            browser.Navigate().GoToUrl(noteLink);
            var title = browser.FindElement(By.ClassName("entry-title")).Text;
            var post  = browser.FindElement(By.ClassName("entry-content")).Text;

            return(title == note.Title && post == note.Post);
        }
예제 #3
0
        internal bool HasNote(ExampleNote exampleNote)

        {
            var notes = browser.FindElement(By.CssSelector("#main"));

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

            return(title.Text == exampleNote.Title && content.Text == exampleNote.Content);
        }
예제 #4
0
        private void AddTitle(ExampleNote testNote)
        {
            var noteTitle = _browser.FindElement(By.Id("title-prompt-text"));

            noteTitle.Click();

            var titleElement = _browser.FindElement(By.Id("title"));

            titleElement.SendKeys(testNote.Title);
        }
예제 #5
0
        private void AddContentNote(ExampleNote testNote)
        {
            _browser.FindElement(By.Id("content-html")).Click();

            WaitForClickable(By.Id("publish"), 5);
            WaitForClickable(By.CssSelector(".edit-slug.button"), 5);

            var contentElement = _browser.FindElement(By.Id("content"));

            contentElement.SendKeys(testNote.Text);
        }
예제 #6
0
        public void CanPublishNewNote()
        {
            var blogAdminPage = MainPage.OpenAdminPage(GetBrowser());
            var note          = blogAdminPage.LoginAsAdmin();
            var exampleNote   = new ExampleNote();
            var noteLink      = note.AddNewNote(exampleNote);

            Assert.True(note.LogOut());
            var blogStartPage = MainPage.Open(GetBrowser());

            Assert.True(blogStartPage.HasNote(noteLink, exampleNote));
        }
예제 #7
0
        public void CanPublishNewNote()
        {
            var startPage = LoginPage.Open(GetBrowser());
            var adminPage = startPage.LetsLogIn();

            var testNote = new ExampleNote();
            var newNote  = adminPage.AddNote(testNote);
            var notePage = new NotePage(GetBrowser()); //var bo zwraca stringa (link)

            notePage.Open(newNote);
            Assert.True(notePage.Has(testNote)); //sprawdzamy czy ta notatka ma notatke wpisana notatke przez nas wczesniej HAS=czy ma
        }
예제 #8
0
        public void Can_publish_new_note()
        {
            var loginPage   = LoginPage.Open(GetBrowser());
            var adminPanel  = loginPage.Login("automatyzacja", "auto@Zima2019");
            var exampleNote = new ExampleNote();
            var newNoteUrl  = adminPanel.CreateNewNote(exampleNote);

            adminPanel.LogOut();
            var notePage = new NotePage(GetBrowser());

            notePage.GoTo(newNoteUrl);
            Assert.True(notePage.HasNote(exampleNote));
        }
예제 #9
0
        internal string AddNote(ExampleNote testNote) // void aby nic nie zwracał
        {
            ClickOnAddNote();
            AddTitle(testNote);
            AddContentNote(testNote);
            PublishNote();

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

            LogOut();

            return(url);
        }
예제 #10
0
        internal String AddNewNote(ExampleNote exampleNote)
        {
            WebDriverWait wait    = new WebDriverWait(browser, TimeSpan.FromSeconds(5));
            var           element = wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#menu-posts > a > div.wp-menu-name")));

            element.Click();
            // browser.FindElement(By.CssSelector("#menu-posts > a > div.wp-menu-name")).Click();
            browser.FindElement(By.CssSelector("#wpbody-content > div.wrap > a")).Click();
            browser.FindElement(By.CssSelector("#title")).SendKeys(exampleNote.Title);
            browser.FindElement(By.CssSelector("#content")).SendKeys(exampleNote.Post);
            browser.FindElement(By.CssSelector("#publish")).Submit();
            var link     = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#sample-permalink > a")));
            var noteLink = link.GetAttribute("href");

            return(noteLink);
        }
예제 #11
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();
            //WaitForClickable(By.Id("publish"), 5);
            //WaitForClickable(By.CssSelector(".edit-slug.button"), 5);
            var postUrl = browser.FindElement(By.CssSelector("#sample-permalink > a"));
            var url     = postUrl.GetAttribute("href");

            return(url);
        }