/// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public ActionResult SignOut()
 {
     Session.Abandon();
     Session.Clear();
     FormAuthentication.SignOut();
     return(RedirectToAction("Login", "Account"));
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            IWebDriver WebDriver = null;

            try
            {
                WebBrowser BrowserSession = new WebBrowser();
                WebDriver = BrowserSession.LaunchBrowser(Configuration.Browser);
                BrowserSession.MaximizeBrowser(WebDriver);

                //TestCases.DropDownList.TestDropDownList();
                // test
                #region Test Case: Click the dropdown link and select the second option
                // Coded the DropDownList as Static for this example - this was how we coded framework at previous job.  The goal was to make it easy for QAers without coding experience to create test cases.
                WebDriver.Navigate().GoToUrl(Configuration.HomePageURL);
                HomePage.ClickLinkText(WebDriver, HomePageLinks.Dropdown);
                Pages.DropDownList.SelectOption(WebDriver, "Option 2");
                Pages.DropDownList.VerifyOption(WebDriver, "Option 2");
                #endregion

                #region Test Case Go the Javascript Alerts page and launch/dismiss the JS Alert
                WebDriver.Navigate().GoToUrl(Configuration.HomePageURL);
                HomePage.ClickLinkText(WebDriver, HomePageLinks.JavaScriptAlerts);
                JavaScriptAlerts Alert = new JavaScriptAlerts();
                Alert.ClickJavascriptButton(WebDriver, JavaScriptAlerts.JSButtons.JSAlert);
                WebDriver.SwitchTo().Alert().Accept();
                #endregion

                #region Test Case: Go to the Form Authentication Page, Login and Logout
                WebDriver.Navigate().GoToUrl(Configuration.HomePageURL);
                HomePage.ClickLinkText(WebDriver, HomePageLinks.FormAuthentication);
                FormAuthentication Login = new FormAuthentication();
                Login.EnterUsername(WebDriver, Configuration.Username);
                Login.EnterPassword(WebDriver, Configuration.Password);
                Login.ClickLogin(WebDriver);
                SecureArea LogoutForm = new SecureArea();
                LogoutForm.ClickLogout(WebDriver);
                #endregion

                #region Test Case: Go to the WYSIWYG Page, clear out existing text and add new text
                WebDriver.Navigate().GoToUrl(Configuration.HomePageURL);
                HomePage.ClickLinkText(WebDriver, HomePageLinks.WYSIWYGEditor);
                WYSIWYG WYSIWYGFrame = new WYSIWYG();
                WYSIWYGFrame.AddText(WebDriver, "Add this text to the WYSIWYG Text field.", true);
                WebDriver.SwitchTo().ParentFrame();
                #endregion
            }
            catch (Exception e)
            {
                Console.WriteLine("Encountered unexpected exception: " + e.Message);
            }
            finally
            {
                // Close the browser and driver
                WebDriver.Quit();

                Environment.Exit(1);
            }
        }
Exemplo n.º 3
0
 public void GivenIAmLoggedInToMyAccount()
 {
     MainPage.GoTo();
     MainPage.ClickOn(MainPage.formAuthenticationLink);
     FormAuthentication.EnterUsername(FormAuthentication.username);
     FormAuthentication.EnterPassword(FormAuthentication.password);
     FormAuthentication.LogIn();
 }
Exemplo n.º 4
0
        public void ThenIShouldBeSuccesfullyLoggedOutOfMyAccount()
        {
            bool check = FormAuthentication.LogOutCheck();

            Assert.IsTrue(check);
        }
Exemplo n.º 5
0
        public void ThenIShouldBeToldMyUsernameIsInvalid()
        {
            string error = FormAuthentication.ErrorText();

            Assert.AreEqual("Your username is invalid!", error);
        }
Exemplo n.º 6
0
 public void WhenIPressLogin()
 {
     FormAuthentication.LogIn();
 }
Exemplo n.º 7
0
 public void GivenIEnterMyPassword(string password)
 {
     FormAuthentication.EnterPassword(password);
 }
Exemplo n.º 8
0
 public void GivenIEnterMyUsername(string username)
 {
     FormAuthentication.EnterUsername(username);
 }