예제 #1
0
 public WordpressTest()
 {
     driver = new OpenQA.Selenium.Chrome.ChromeDriver();
     driver.Manage().Window.Maximize();
     testPost        = new ExampleComment();
     testCredentials = new TestCredentials();
 }
예제 #2
0
        internal string InsertPost(ExampleComment testPost)
        {
            var LeftMenu            = _driver.FindElements(By.ClassName("wp-menu-name"));
            var PostBtnFromLeftMenu = LeftMenu.SingleOrDefault(c => c.Text.Contains("Posts"));

            PostBtnFromLeftMenu.Click();

            var SearchingBTN = _driver.FindElement(By.ClassName("page-title-action"));

            SearchingBTN.Click();

            var TitleField = _driver.FindElement(By.Id("title"));

            TitleField.Click();
            TitleField.SendKeys(testPost.Title);

            var TextField = _driver.FindElement(By.Id("content"));

            TextField.Click();
            TextField.SendKeys(testPost.Text);

            WaitForClickable(_driver.FindElement(By.Id("edit-slug-buttons")), 100000);

            var EditBtnWaitFor    = _driver.FindElement(By.Id("edit-slug-buttons"));
            var PublishBtnWaitFor = _driver.FindElement(By.Id("publish"));

            var    permamentLink   = _driver.FindElement(By.Id("edit-slug-box"));
            var    permamentLink_s = permamentLink.FindElement(By.TagName("a"));
            string CheckUrl        = permamentLink_s.GetAttribute("href");

            PublishBtnWaitFor.Click();

            return(CheckUrl);
        }
예제 #3
0
        internal bool CheckAssert(ExampleComment testPost)
        {
            bool AssertResult = false;

            var AssertTitle = _driver.FindElement(By.ClassName("entry-title")).Text;

            var AssertContent = _driver.FindElement(By.ClassName("entry-content"));
            var AssertText    = AssertContent.FindElement(By.TagName("p")).Text;

            if (testPost.Text == AssertText && testPost.Title == AssertTitle)
            {
                AssertResult = true;
            }

            return(AssertResult);
        }