コード例 #1
0
        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");
            //
            // }
        }
コード例 #2
0
        public void TryToLoggingIn()
        {
            var loginPage   = new LoginPage(this.driver);
            var accountPage = new AccountPage.AccountPage(this.driver);

            loginPage.Login();
            accountPage.NavigateTo();
            accountPage.AssertIsLogged("Hello [email protected]!");
        }
コード例 #3
0
        public void LoggingIn()
        {
            var loginPage   = new LoginPage.LoginPage(this.Driver);
            var accountPage = new AccountPage.AccountPage(this.Driver);

            loginPage.NavigateTo();
            loginPage.Type(loginPage.Email, "*****@*****.**");
            loginPage.Type(loginPage.Password, "123");
            loginPage.LoginButton.Click();
        }
コード例 #4
0
        public void TryToLoggingIn()
        {
            var user        = AccessExcelData.GetTestData("TryToLoggingIn");
            var loginPage   = new LoginPage(this.driver);
            var accountPage = new AccountPage.AccountPage(this.driver);

            accountPage.NavigateTo();
            accountPage.LoginLink.Click();
            loginPage.Login(user);

            accountPage.AssertIsLogged("Hello [email protected]!");
        }
コード例 #5
0
        public void LoginWithoutPassword()
        {
            var user        = AccessExcelData.GetTestData("LoginWithoutPassword");
            var loginPage   = new LoginPage(this.driver);
            var accountPage = new AccountPage.AccountPage(this.driver);

            accountPage.NavigateTo();
            accountPage.LoginLink.Click();
            loginPage.Login(user);
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));

            loginPage.AssertErrorMessageForPassword("Invalid login attempt.");
        }
コード例 #6
0
        public void LoginWithInvalidUser()
        {
            var user        = AccessExcelData.GetTestData("LoginWithInvalidUser");
            var loginPage   = new LoginPage(this.driver);
            var accountPage = new AccountPage.AccountPage(this.driver);

            accountPage.NavigateTo();
            accountPage.LoginLink.Click();
            loginPage.Login(user);
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));

            loginPage.AssertErrorMessageForMail("The Email field is not a valid e-mail address.");
        }
コード例 #7
0
        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();
        }
コード例 #8
0
        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);
        }
コード例 #9
0
 public static void AsserterForContentOfNewPost(this AccountPage.AccountPage page, string text)
 {
     Assert.AreEqual(text, page.FindContent);
 }
コード例 #10
0
 public static void AsserterForTitleOfNewPost(this AccountPage.AccountPage page, string text)
 {
     Assert.AreEqual(text, page.FindNewPostTitle);
 }