public void DeletePost() { var user = AccessExcelData.GetTestData("TryToLoggingIn"); var accountPage = new AccountPage.AccountPage(this.driver); var loginPage = new LoginPage.LoginPage(this.driver); // string newPostLink = accountPage.FindNewPostTitle.Text; // try // { loginPage.Login(user); accountPage.NavigateTo(); var postCountbefore = this.driver.FindElements(By.TagName("a")); accountPage.FindNewPostTitle.Click(); this.driver.FindElement(By.PartialLinkText("Delete")).Click(); this.driver.FindElement(By.XPath("/html/body/div[2]/div/div/form/div[3]/div/input")).Click(); Assert.AreEqual(postCountbefore.Count - 1, this.driver.FindElements(By.TagName("a")).Count); // if(accountPage.FindNewPostTitle.Text == null) // { // CreatePostPageAsserter.AsserterForMissingElement("NoSuchElementException"); // } // } // catch (NoSuchElementException ) // { // CreatePostPageAsserter.AsserterForMissingElement("NoSuchElementException"); // // } }
public void CreateNewPost(string titleOfPost, string contentOfPost) { var loginPage = new LoginPage.LoginPage(this.Driver); var accountPage = new AccountPage.AccountPage(this.Driver); var createPostPage = new CreatePostPage(this.Driver); //string titleOfPost = "New Important Post"; //string contentOfPost = "That is new post created"; loginPage.Login(); createPostPage.NavigateTo(); //loginPage.CreateButton.Click(); createPostPage.Type(createPostPage.Title, titleOfPost); createPostPage.Type(createPostPage.Content, contentOfPost); createPostPage.CreatelButton.Click(); }
public void CreateNewPost() { var user = AccessExcelData.GetTestData("TryToLoggingIn"); var accountPage = new AccountPage.AccountPage(this.driver); var loginPage = new LoginPage.LoginPage(this.driver); var createPostPage = new CreatePostPage.CreatePostPage(this.driver); accountPage.NavigateTo(); if (accountPage.LoginLink.Displayed) { accountPage.LoginLink.Click(); loginPage.NavigateTo(); loginPage.Login(user); } createPostPage.CreateNewPost(); var logo = driver.FindElement(By.XPath("/html/body/div[1]/div/div[1]/a")); Assert.AreEqual("SOFTUNI BLOG", logo.Text); //Assert.AreNotEqual(postsNumber.Size, homePage.PostContainer); }