Ejemplo n.º 1
0
        public void CanAddCommentToTheComment()
        {
            IWebDriver  driver      = OpenBrowser();
            MainPage    mainPage    = new MainPage(driver);
            FirstNote   firstNote   = new FirstNote(driver);
            CommentPage commentPage = new CommentPage(driver);

            FillCommentData(out commentText, out email, out authorText);

            mainPage.GoTo();
            mainPage.OpenFirstNote();
            firstNote.AddComment(commentText, email, authorText);

            firstNote.ClickFirstReplyButton();

            firstNote.AddComment(commentText, email, authorText);
            var result = commentPage.FindComment(commentText);

            Assert.True(result);
        }
Ejemplo n.º 2
0
        public void AddPostAndCommentItAsGuest()
        {
            IWebDriver    driver        = OpenBrowser();
            DashboardPage dashboardPage = new DashboardPage(driver);
            AddPostPage   addPostPage   = new AddPostPage(driver);
            PostsPage     postsPage     = new PostsPage(driver);
            NewPostPage   newPostPage   = new NewPostPage(driver);
            FirstNote     firstNote     = new FirstNote(driver);
            CommentPage   commentPage   = new CommentPage(driver);
            AdminPage     adminPage     = new AdminPage(driver);

            LogIn(adminPage);

            dashboardPage.WaitForPageToLoad();
            dashboardPage.ClickPostsMenuItem();

            postsPage.ClickNewPost();

            addPostPage.WaitForPageToLoad();

            string title   = "msz" + DateTime.Now;
            string content = "To jest testowy post" + DateTime.Now;

            addPostPage.FillPostContent(title, content);
            addPostPage.PublishPost();

            addPostPage.ClickPostLink(newPostPage);

            bool result1 = newPostPage.CheckIfNewPostExists(title, content);

            Assert.True(result1);

            newPostPage.Logout();
            newPostPage.GoTo();

            FillCommentData(out commentText, out email, out authorText);

            firstNote.AddComment(commentText, email, authorText);
            bool result2 = commentPage.FindComment(commentText);

            Assert.True(result2);
        }
Ejemplo n.º 3
0
        public void AddPostAndCommentItAsGuestAndDeleteIt()
        {
            IWebDriver    driver        = OpenBrowser();
            DashboardPage dashboardPage = new DashboardPage(driver);
            AddPostPage   addPostPage   = new AddPostPage(driver);
            PostsPage     postsPage     = new PostsPage(driver);
            NewPostPage   newPostPage   = new NewPostPage(driver);
            FirstNote     firstNote     = new FirstNote(driver);
            CommentPage   commentPage   = new CommentPage(driver);
            EditPostPage  editPostPage  = new EditPostPage(driver);
            AdminPage     adminPage     = new AdminPage(driver);

            string title   = "msz" + DateTime.Now;
            string content = "To jest testowy post" + DateTime.Now;

            // ADD
            LogIn(adminPage);
            dashboardPage.WaitForPageToLoad();
            dashboardPage.ClickPostsMenuItem();

            postsPage.ClickNewPost();

            addPostPage.WaitForPageToLoad();

            addPostPage.FillPostContent(title, content);
            addPostPage.PublishPost();

            addPostPage.ClickPostLink(newPostPage);

            bool newPostExists = newPostPage.CheckIfNewPostExists(title, content);

            Assert.True(newPostExists);

            // COMMENT
            newPostPage.Logout();
            newPostPage.GoTo();

            FillCommentData(out commentText, out email, out authorText);

            firstNote.AddComment(commentText, email, authorText);
            bool commentIsFound = commentPage.FindComment(commentText);

            Assert.True(commentIsFound);

            //DELETE
            LogIn(adminPage);
            dashboardPage.WaitForPageToLoad();
            dashboardPage.ClickPostsMenuItem();
            postsPage.ClickPostByTitle(title);
            editPostPage.DeletePost();

            // ASSERT
            var postIsDeletedMessage = editPostPage.CheckIfPostIsDeleted();

            Assert.True(postIsDeletedMessage);

            dashboardPage.ClickPostsMenuItem();
            var postExists = postsPage.CheckIfPostExists(title);

            Assert.False(postExists);
        }