Exemplo n.º 1
0
        public Post AddPost(PostCreator postCreator)
        {
            var user = new User()
            {
                Name = postCreator.Owner
            };

            if (redditContext.Users.Any(x => x.Name == postCreator.Owner))
            {
                user = redditContext.Users.First(x => x.Name == postCreator.Owner);
            }
            redditContext.SaveChanges();

            Post post = new Post()
            {
                Title = postCreator.Title,
                Url   = postCreator.Url,
                Owner = user
            };

            user.PostsOfTheUser.Add(post);

            redditContext.Reddit.Add(post);
            redditContext.SaveChanges();

            return(post);
        }
Exemplo n.º 2
0
        public void Added_Post_Show_Up()
        {
            #region Manual test case
            //Go to login page
            //Login as “admin” user with correct password “ha tran”
            //Click Login button
            //Hover mouse on the “Posts” menu on the left navigation panel
            //Click “All Posts” menu
            //Observe and record the posts count at the top right corner of the posts list
            //Add a new post and publish it
            //Go to All Posts list
            //Verify that the posts count increase by 1
            //Verify that the added post exists in the list
            #endregion Manual test case
            //Go to Posts, get post count, store
            ListPostsPage.GoTo(PostType.Posts);
            ListPostsPage.StoreCount();

            //Add a new post
            PostCreator.CreatePost();
            //Go to Posts, get new post count
            ListPostsPage.GoTo(PostType.Posts);
            Assert.AreEqual(ListPostsPage.PreviousPostsCount + 1, ListPostsPage.CurrentPostsCount, "Count of posts didn't increase");

            //Check for added post
            Assert.IsTrue(ListPostsPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));

            //Trash post(clean up)
            ListPostsPage.TrashPost(PostCreator.PreviousTitle);
            Assert.AreEqual(ListPostsPage.PreviousPostsCount, ListPostsPage.CurrentPostsCount, "Couldn't trash post");
        }
 public void Init()
 {
     Driver.Initialize();
     PostCreator.Initialize();
     LoginPage.GoTo();
     LoginPage.LoginAs("test").WithPassword("z$olpR5FSaVJU^A#c!").Login();
 }
Exemplo n.º 4
0
            public void Castr_PnPost()
            {
                string urbanAirShipUrl = _params["Url"].ToString();
                var    user            = _params["Credentials"];

                _browser.Navigate(_config.Url);
                HomePage homePage = new HomePage(_browser);

                homePage.Login(_config.ConfigObject.Users.AdminUser);
                PostCreator postCreator = new PostCreator(_browser);

                postCreator.Create();
                CastrPage castrPage = homePage.GoToCastr();
                CastrPage newPosts  = castrPage.SelectStatus(Statuses.New);
                CastrPost post      = newPosts.ClickOnPost(postCreator.Title);

                post.SendPn(Platforms.mobile, 0);
                _browser.OpenNewTab($"{_config.Url}/management/push_notifications?test=test");
                PnDashBoardPage pnDashBoardPage = new PnDashBoardPage(_browser);

                Assert.True(pnDashBoardPage.ValidatePost(0, postCreator.Title));

                _browser.Navigate(urbanAirShipUrl);
                UrbanAirShipLoginPage urbanAirShipLoginPage = new UrbanAirShipLoginPage(_browser);

                urbanAirShipLoginPage.Login(user);
                Assert.True(urbanAirShipLoginPage.SearchPost(postCreator.Title));
            }
Exemplo n.º 5
0
 public void Init()
 {
     Driver.Initialize();
     PostCreator.Initialize();
     LoginPage.GoTo();
     LoginPage.LoginAs("admin").WithPassword("hatran").Login();
 }
Exemplo n.º 6
0
        public void Can_Search_Posts()
        {
            #region Manual test case
            //Go to login page
            //Login as “admin” user with correct password “ha tran”
            //Click Login button
            //Hover mouse on the “Posts” menu on the left navigation panel
            //Click “All Posts” menu
            //Enter a search string that matches to at least a post title to the Search text box
            //Click “Search Posts” button
            //Verify that the matching post titles show up in the list
            #endregion Manual test case

            //Create a new post
            PostCreator.CreatePost();

            //Go to list posts
            ListPostsPage.GoTo(PostType.Posts);

            //Search for posts
            ListPostsPage.SearchForPosts(PostCreator.PreviousTitle);

            //Check that post show up in results
            Assert.IsTrue(ListPostsPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));
        }
        public void CleanUp()
        {
            PostCreator.CleanUp();

            // close selenium driver
            Driver.Close();
        }
Exemplo n.º 8
0
            public void Castr_ResetAndFeatureAPost()
            {
                var feedUrl  = _params["PremierLeague"].ToString();
                var feedUrl2 = _params["ChampionLeague"].ToString();

                _browser.Navigate(_config.Url);
                HomePage homePage = new HomePage(_browser);

                homePage.Login(_config.ConfigObject.Users.AdminUser);
                PostCreator postCreator = new PostCreator(_browser);

                postCreator.Create();
                CastrPage castrPage = homePage.GoToCastr();
                CastrPage newPosts  = castrPage.SelectStatus(Statuses.New);
                CastrPost post      = newPosts.ClickOnPost(postCreator.Title);

                post.UnCheckLeague(0);
                post.PublishPostToFeed(Platforms.ftbpro, 1);
                CastrPage publishedPosts = newPosts.SelectStatus(Statuses.published);

                post = publishedPosts.ClickOnPost(postCreator.Title);
                post.ResetPost();
                newPosts = newPosts.SelectStatus(Statuses.New);
                post     = newPosts.ClickOnPost(postCreator.Title);
                post.PublishPostToFeed(Platforms.ftbpro, 0);

                _browser.Navigate($"{_config.Url}/{feedUrl}");
                FeedPage feedPage = new FeedPage(_browser);

                Assert.True(feedPage.ValidateArticleByTitle(postCreator.Title), $"Post {postCreator.Title} was not shown on {feedUrl} after it was reseted.");

                feedPage = new FeedPage(_browser);
                _browser.Navigate($"{_config.Url}/{feedUrl2}");
                Assert.True(feedPage.ValidateArticleByTitle(postCreator.Title), $"Post {postCreator.Title} was not shown on {feedUrl2} after it was reseted.");
            }
Exemplo n.º 9
0
            public void Castr_FTB90_CheckIDPostsFromDiffrentDomains()
            {
                _browser.Navigate(_config.GlobalConfigObject["90Min"]["Url"].ToString());
                HomePage homePage = new HomePage(_browser);

                homePage.Login(_config.ConfigObject.Users.AdminUser);
                PostCreator postCreator = new PostCreator(_browser);

                postCreator.Create();
                var url = $"http://{_config.Env}.{_config.GlobalConfigObject["Ftb90"]["Url"]}";

                _browser.Navigate(url);
                HomePage homePageFtb = new HomePage(_browser);

                homePage.ClickOnConnectBtnWithCoockies();
                PostCreator postCreatorFtb90 = new PostCreator(_browser);
                PostPage    postPageFTb90    = postCreatorFtb90.Create(typeof(ArticleBase));
                CastrPage   castrPage        = homePageFtb.GoToCastr();
                CastrPage   newPosts         = new CastrPage(_browser);
                CastrPost   castrPostFTB90   = newPosts.ClickOnPost(postCreatorFtb90.Title);

                Assert.True(castrPostFTB90.ValidatePublishAlsoTo());
                CastrPost castrPost = newPosts.ClickOnPost(postCreator.Title);

                Assert.True(castrPostFTB90.ValidatePublishAlsoTo());
            }
Exemplo n.º 10
0
        public void Can_Search_Posts()
        {
            PostCreator.CreatePost();

            ListPostPage.SearchForPost(PostCreator.PreviousTitle);

            Assert.IsTrue(ListPostPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));
        }
Exemplo n.º 11
0
        public void Init()
        {
            Driver.Initialize();
            PostCreator.Initialize();

            LoginPage.GoTo();
            LoginPage.LoginAs("andytestsite395540309").WithPassword("Password1!").Login();
        }
Exemplo n.º 12
0
        public void Init()
        {
            Driver.Initialize();

            PostCreator.Initialize();
            LoginPage.GoTo();
            LoginPage.LoginAs("dgrandfield").WithPassword("$t0rmTr00per").Login();
        }
        public void Init()
        {
            Driver.Initialize();
            PostCreator.Initialize();

            LoginPage.GoTo();
            LoginPage.LoginAs("opensourcecms").WithPassword("opensourcecms").Login();
        }
Exemplo n.º 14
0
        public void Init()
        {
            Driver.Initialize();
            PostCreator.Initialize();

            LoginPage.GoTo();
            LoginPage.LoginAs("mrmax").WithPassword("vfrcbvrf").Login();
        }
Exemplo n.º 15
0
        public void Init()
        {
            Driver.Initialize();
            PostCreator.Initialize();

            LoginPage.GoTo();
            LoginPage.LoginAs("boyuanf").WithPassword("password").Login();
        }
Exemplo n.º 16
0
        public void Init()
        {
            Driver.Initialize();

            PostCreator.Initialize();

            LoginPage.GoTo();
            LoginPage.LoginAs("ehealth").WithPassword("1QAZ2wsx").Login();
        }
Exemplo n.º 17
0
 public PostController(PostFinderByNew postFinderByNew, PostFinderById postFinderById, PostFinderByUser postFinderByUser, CommentFinderByPost commentFinderByPost, PostCreator postAdder, PostUpdater postUpdater, PostDeleter postDeleter)
 {
     this.postFinderByNew     = postFinderByNew;
     this.postFinderById      = postFinderById;
     this.postFinderByUser    = postFinderByUser;
     this.commentFinderByPost = commentFinderByPost;
     this.postCreator         = postAdder;
     this.postUpdater         = postUpdater;
     this.postDeleter         = postDeleter;
 }
        public void Can_Search_Posts()
        {
            //create a new post
            PostCreator.CreatePost();

            //search for post
            ListPostsPage.SearchForPost(PostCreator.PreviousTitle);
            //check the post shows up in the results
            Assert.IsTrue(ListPostsPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));
        }
 public void Added_Posts_Show_Up()
 {
     ListPostPage.GoTo(PostType.Posts);
     ListPostPage.StoreCount();
     PostCreator.CreatePost();
     ListPostPage.GoTo(PostType.Posts);
     Assert.AreEqual(ListPostPage.PreviousPostCount + 1, ListPostPage.CurrentPostCount, "Could of posts did not increase");
     Assert.IsTrue(ListPostPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));
     ListPostPage.TrashPost(PostCreator.PreviousTitle);
     Assert.AreEqual(ListPostPage.PreviousPostCount, ListPostPage.CurrentPostCount, "Could not trash post");
 }
Exemplo n.º 20
0
        public void Init()
        {
            Driver.Initialize();

            PostCreator.Initialize();

            #region login
            LoginPage.GoTo();
            LoginPage.LoginAs("user")
            .WithPassword("admintoor")
            .Login();
            #endregion
        }
        public void Can_Search_Posts()
        {
            //Create a new post
            PostCreator.CreatePost();

            //Search for post
            ListsPostPage.SearchForPost(PostCreator.PreviousTitle);

            //Check that post show up in results
            Assert.IsTrue(ListsPostPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));

            //Clean up(Trash post)
            ListsPostPage.TrashPost(PostCreator.PreviousTitle);
        }
Exemplo n.º 22
0
            public void Castr_CheckNewStatus()
            {
                _browser.Navigate(_config.Url);
                HomePage homePage = new HomePage(_browser);

                homePage.Login(_config.ConfigObject.Users.AdminUser);
                PostCreator postCreator = new PostCreator(_browser);

                postCreator.Create();
                CastrPage castrPage = homePage.GoToCastr();
                CastrPage newPosts  = castrPage.SelectStatus(Statuses.New);

                Assert.True(newPosts.SearchPostByTitle(postCreator.Title), "Post was not shown under 'New' after posted.");
            }
Exemplo n.º 23
0
        public void Can_Search_Posts()
        {
            // Create a new post
            PostCreator.CreatePost();

            // Search for post
            ListPostsPage.SearchForPost(PostCreator.PreviousTitle);

            // Check that post shows up in results
            Assert.IsTrue(ListPostsPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));

            // Cleanup (Trash post)
            // Automatically clean up by WordpressTests class
        }
Exemplo n.º 24
0
        public IActionResult AddPost(PostCreator postCreator)
        {
            postCreator.Owner = Request.Headers["Owner"].FirstOrDefault();

            if (string.IsNullOrEmpty(postCreator.Owner))
            {
                postCreator.Owner = "Anyád";
                // postCreator.Owner = Request.Body["Owner"].FirstOrDefault();
            }

            Post newPost = redditService.CreatePost(postCreator);

            return(Json(newPost));
        }
Exemplo n.º 25
0
        public void Can_Search_Posts()
        {
            PostCreator.CreatePost();
            //NewPostPage.GoTo();
            //NewPostPage.CreatePost("Searching posts, title")
            //    .WithBody("Searching posts, body")
            //    .Publish();

            //ListPostsPage.GoTo(PostType.Post);  change to Is At

            ListPostsPage.SearchForPost(PostCreator.PreviousTitle);

            Assert.IsTrue(ListPostsPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));

            //Trash post(clean up)  - moved to PostCreator in TestCleanup(WOrdpressTests)
            //ListPostsPage.TrashPost(PostCreator.PreviousTitle);
        }
        public void Initialize()
        {
            // initialize selenium driver
            Driver.Initialize();

            PostCreator.Initialize();

            // navigate to site under automation
            LoginPage
            .GoTo();

            // test the login functionality
            LoginPage
            .LoginAs("selenium")
            .WithPassword("selenium")
            .Login();
        }
Exemplo n.º 27
0
        public void Added_Posts_Show_Up()
        {
            // get post count and store
            ListPostPage.StoreCount();

            // add a new post
            PostCreator.CreatePost();

            // get new post count
            Assert.AreEqual(ListPostPage.PreviousPostCount + 1, ListPostPage.CurrentPostCount, "Post count did not match");

            // check for added post
            Assert.IsTrue(ListPostPage.DoesPostExistWithTitle(PostCreator.PreviousTitle));

            // delete post
            ListPostPage.DeletePost(PostCreator.PreviousTitle);
            Assert.AreEqual(ListPostPage.PreviousPostCount, ListPostPage.CurrentPostCount, "Could not delete post");
        }
Exemplo n.º 28
0
            public void Castr_CheckPublishStatus()
            {
                _browser.Navigate(_config.Url);
                HomePage homePage = new HomePage(_browser);

                homePage.Login(_config.ConfigObject.Users.AdminUser);
                PostCreator postCreator = new PostCreator(_browser);

                postCreator.Create();
                CastrPage castrPage = homePage.GoToCastr();
                CastrPage newPosts  = castrPage.SelectStatus(Statuses.New);
                CastrPost post      = newPosts.ClickOnPost(postCreator.Title);

                post.PublishPost();
                CastrPage publishedPosts = castrPage.SelectStatus(Statuses.published);

                Assert.True(publishedPosts.SearchPostByTitle(postCreator.Title), "Was was not shown under 'Published' after published.");
            }
Exemplo n.º 29
0
            public void Castr_Social_Networks_Facebook()
            {
                _browser.Navigate(_config.Url);
                HomePage homePage = new HomePage(_browser);

                homePage.Login(_config.ConfigObject.Users.AdminUser);
                PostCreator postCreator = new PostCreator(_browser);

                postCreator.Create();
                CastrPage castrPage = homePage.GoToCastr();
                CastrPage newPosts  = castrPage.SelectStatus(Statuses.New);
                CastrPost post      = newPosts.ClickOnPost(postCreator.Title);

                post.PublishToSocialNetwork(0, 2, 0);
                FacebookClient facebookClient = new FacebookClient();

                Assert.True(facebookClient.SearchPost(postCreator.Title), $"Post {postCreator.Title} was not created");
            }
Exemplo n.º 30
0
            public void Caster_Schedulr_PostBox()
            {
                _browser.Navigate(_config.Url);
                HomePage homePage = new HomePage(_browser);

                homePage.Login(_config.ConfigObject.Users.AdminUser);
                PostCreator postCreator = new PostCreator(_browser);

                postCreator.Create();
                CastrPage castrPage = homePage.GoToCastr();
                CastrPage newPosts  = castrPage.SelectStatus(Statuses.New);
                CastrPost post      = newPosts.ClickOnPost(postCreator.Title);

                post.PublishToSocialNetworksSchedul(0, 2, "16");
                _browser.Navigate($"{ _config.Url}/management/schedulr");
                SchedulrPage schdulrPage = new SchedulrPage(_browser);

                Assert.False(schdulrPage.ValidatePostFacebook(postCreator.Title) && schdulrPage.ValidatePostTwitter(postCreator.Title));
            }