private void WhenIDoLogout()
        {
            //if user is already logged in, then Logout and go to login page
            //use base class to access navigation bar, independently of what page is loaded
            UnityPageBase navigationBar = new UnityPageBase(driver, null);

            navigationBar.Logout();
            RemovedSharedPageObjectFromCurrentContext("Dashboard");
        }
        public void GivenIEnterToUnityLoginPage()
        {
            try {
                //If user is not logged in, login page is loaded by default
                loginPage = new LoginPage(driver);
                SetSharedPageObjectInCurrentContext("Dashboard", new DashboardPage(driver));
                //TODO Added this until we know the correct behevior of logout action
                //the test need to make sure the page loaded fresh.
                loginPage.Reload();
            }

            catch (MissingElementException)
            {
                //if user is already logged in then dashboard is loaded, so Logout and go to login page
                UnityPageBase navigationBar = new UnityPageBase(driver, null);
                loginPage = navigationBar.Logout();
                //dashboardPage = null;
            }
        }
示例#3
0
        public static void LogoutAndClearScenarioContext()
        {
            TestsLogger.Log("Cleaning Scenario data... ");
            try
            {
                //Try to logout if Unity user is logged in, in any page of the App
                UnityPageBase navigationBar = new UnityPageBase(driver, null);
                if ((navigationBar != null) && (navigationBar.Title == "UNITY"))
                {
                    navigationBar.Logout();
                }
            }
            catch {
                //do nothing, USER COULD NOT BE LOGGED depending on the scenario
            }

            //Clear driver cookies
            driver.Manage().Cookies.DeleteAllCookies();
            //Clear ScenarioContext data
            ScenarioContext.Current.Clear();
        }