예제 #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 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]!");
        }
예제 #4
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.");
        }
예제 #5
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.");
        }
예제 #6
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);
        }