Example #1
0
 /// <summary>
 /// Attempts to log out
 /// </summary>
 /// <returns>false if failed to logout, not if already logged out</returns>
 public bool LogOut()
 {
     Console.WriteLine("Logging out  if can");
     try
     {
         if (IsLoggedIn())
         {
             return(true);
         }
         WebDriverWait wait = TestingConfig.GetWaitDriver(Driver);
         UserDropDown.Click();
         wait.Until(dr => SignOutButton);
         SignOutButton.Click();
         wait.Until(dr => HomeButton);
         HomeButton.Click();
         wait.Until(dr => LoginButton);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         Console.WriteLine("Cannot log out");
         return(false);
     }
     return(true);
 }
Example #2
0
        public override void RunBaseTests()
        {
            base.RunBaseTests();

            Console.WriteLine("nav bar base tests");

            Console.WriteLine("Allways on buttons");
            Assert.IsTrue(NewPostButton.Displayed, "New post button not visible");
            Assert.IsTrue(TopCommentsButton.Displayed, "top comments button not visible");
            Assert.IsTrue(HomeButton.Displayed, "Home button not visible");

            LogOut();
            Console.WriteLine("Is logged out buttons not visible");
            Assert.IsTrue(LoginButton.Displayed, "loggin button not visible");
            Assert.IsTrue(SignUpButton.Displayed, "signup button not visible");

            LogIn();

            Console.WriteLine("Is Logged in buttons not visible");
            Assert.IsTrue(MessagesButton.Displayed, "Messages button not visible");
            Assert.IsTrue(NotificationsButton.Displayed, "Notifications button not visible");
            Assert.IsTrue(UserDropDown.Displayed, "user options dropdown button not visible");

            WebDriverWait wait = TestingConfig.GetWaitDriver(Driver);

            UserDropDown.Click();
            wait.Until(dr => PostsButton.Displayed);
            Assert.IsTrue(PostsButton.Displayed, "User posts button not visible");
            Assert.IsTrue(FavoritesButton.Displayed, "User favorites button not visible");
            Assert.IsTrue(CommentsButton.Displayed, "Comments button not visible");
            Assert.IsTrue(AboutButton.Displayed, "About button not visible");
            Assert.IsTrue(ImagesButton.Displayed, "Images button not visible");
            Assert.IsTrue(AlbumsButton.Displayed, "Albums button not visible");
            Assert.IsTrue(SettingsButton.Displayed, "settings button not visible");
            Assert.IsTrue(SignOutButton.Displayed, "Signout button not visible");
        }