Example #1
0
        public void LoginIntoThePegasus(User.UserTypeEnum userTypeEnum,
                                        BrowsePegasusUserURL.PegasusLoginSpace loginMode)
        {
            //Login in Pegasus
            Logger.LogMethodEntry("LoginLogout", "LoginIntoThePegasus",
                                  base.IsTakeScreenShotDuringEntryExit);
            Boolean isUserAlreadyLoggedIn = base.IsElementPresent
                                                (By.PartialLinkText(LoginLogoutResource.
                                                                    LoginLogout_Signout_Link_Title_Locator),
                                                Convert.ToInt32(LoginLogoutResource.
                                                                LoginLogout_Custom_TimeToWait_Element));

            // check user already logged in
            if (!isUserAlreadyLoggedIn)
            {
                //Get the user of the given type from Memory Data Store
                User user = User.Get(userTypeEnum);
                //Login as according to the Pegasus Login Mode
                try
                {
                    switch (loginMode)
                    {
                    case BrowsePegasusUserURL.PegasusLoginSpace.WorkSpace:
                        //Login as the given user with password in workspace
                        loginPage.Authenticate(user.Name, user.Password,
                                               BrowsePegasusUserURL.PegasusLoginSpace.WorkSpace, userTypeEnum);
                        LoginSpace = BrowsePegasusUserURL.PegasusLoginSpace.WorkSpace.ToString();
                        break;

                    case BrowsePegasusUserURL.PegasusLoginSpace.CourseSpace:
                        //Login as the given user with password in course space
                        loginPage.Authenticate(user.Name, user.Password,
                                               BrowsePegasusUserURL.PegasusLoginSpace.CourseSpace, userTypeEnum);
                        LoginSpace = BrowsePegasusUserURL.PegasusLoginSpace.CourseSpace.ToString();
                        break;
                    }
                    UserName = user.Name;
                    Password = user.Password;
                    UserType = userTypeEnum.ToString();
                }
                catch (Exception)
                {
                    LoginSpace = "";
                    UserName   = "";
                    UserType   = "";
                    Password   = "";
                    throw;
                }
            }

            Logger.LogMethodExit("LoginLogout", "LoginIntoThePegasus",
                                 base.IsTakeScreenShotDuringEntryExit);
        }
Example #2
0
        public void LoginIntoThePegasus(User.UserTypeEnum userTypeEnum,
                                        BrowsePegasusUserURL.PegasusLoginSpace loginMode)
        {
            //Login in Pegasus
            Logger.LogMethodEntry("LoginLogout", "LoginIntoThePegasus",
                                  base.IsTakeScreenShotDuringEntryExit);
            Boolean isUserAlreadyLoggedIn = base.IsElementPresent
                                                (By.PartialLinkText(LoginLogoutResource.
                                                                    LoginLogout_Signout_Link_Title_Locator),
                                                Convert.ToInt32(LoginLogoutResource.
                                                                LoginLogout_Custom_TimeToWait_Element));

            if (!isUserAlreadyLoggedIn)
            {
                //Get the user of the given type from Memory Data Store
                User user = User.Get(userTypeEnum);
                //Login as according to the Pegasus Login Mode
                this.CommonLoginIntoThePegasus(userTypeEnum, loginMode, user);
            }
            Logger.LogMethodExit("LoginLogout", "LoginIntoThePegasus",
                                 base.IsTakeScreenShotDuringEntryExit);
        }
Example #3
0
        /// <summary>
        /// Common LoginInto The Pegasus.
        /// </summary>
        /// <param name="userTypeEnum">This is user type emun.</param>
        /// <param name="loginMode">This is pegasus login mode.</param>
        /// <param name="user">This is user.</param>
        public void CommonLoginIntoThePegasus(User.UserTypeEnum userTypeEnum,
                                              BrowsePegasusUserURL.PegasusLoginSpace loginMode, User user)
        {
            //Common LoginInto The Pegasus
            Logger.LogMethodEntry("LoginLogout", "CommonLoginIntoThePegasus",
                                  base.IsTakeScreenShotDuringEntryExit);
            try
            {
                switch (loginMode)
                {
                case BrowsePegasusUserURL.PegasusLoginSpace.WorkSpace:
                    //Login as the given user with password in workspace
                    _loginPage.Authenticate(user.Name, user.Password,
                                            BrowsePegasusUserURL.PegasusLoginSpace.WorkSpace, userTypeEnum);
                    LoginSpace = BrowsePegasusUserURL.PegasusLoginSpace.WorkSpace.ToString();
                    break;

                case BrowsePegasusUserURL.PegasusLoginSpace.CourseSpace:
                    //Login as the given user with password in course space
                    _loginPage.Authenticate(user.Name, user.Password,
                                            BrowsePegasusUserURL.PegasusLoginSpace.CourseSpace, userTypeEnum);
                    LoginSpace = BrowsePegasusUserURL.PegasusLoginSpace.CourseSpace.ToString();
                    break;
                }
                UserName = user.Name;
                Password = user.Password;
                UserType = userTypeEnum.ToString();
            }
            catch (Exception)
            {
                LoginSpace = "";
                UserName   = "";
                UserType   = "";
                Password   = "";
                throw;
            }
            Logger.LogMethodExit("LoginLogout", "CommonLoginIntoThePegasus",
                                 base.IsTakeScreenShotDuringEntryExit);
        }
Example #4
0
        public void LoginToThePegasus(User.UserTypeEnum userTypeEnum,
                                      BrowsePegasusUserURL.PegasusLoginSpace loginMode)
        {
            Course newCourse = new Course
            {
                Name       = "e49c0491-3017-424d-90e6-55b1292f00dd",
                CourseType = Course.CourseTypeEnum.MasterLibrary,
                IsCreated  = true
            };

            newCourse.StoreCourseInMemory();

            Program newprog = new Program
            {
                Name        = "353b7263-8f1b-4bdc-9074-fdc2f3bde668",
                ProgramType = Program.ProgramTypeEnum.DigitalPath,
                IsCreated   = true
            };

            newprog.StoreProgramInMemory();

            Product newprod = new Product
            {
                Name        = "a2f092f3-a886-4864-842b-b0c2a994b3b9",
                ProductType = Product.ProductTypeEnum.DigitalPath,
                IsCreated   = true
            };

            newprod.StoreProductInMemory();

            //Organization neworga = new Organization
            //{
            // Name = "7373ae36-17b7-4745-b2a5-7c2153f8df3e",
            // OrganizationLevel = Organization.OrganizationLevelEnum.PowerSchool,
            // OrganizationType=Organization.OrganizationTypeEnum.DigitalPath,
            // IsCreated = true
            //};
            //neworga.StoreOrganizationInMemory();


            //Login in Pegasus
            Logger.LogMethodEntry("LoginLogout", "LoginToThePegasus",
                                  base.IsTakeScreenShotDuringEntryExit);
            Boolean isUserAlreadyLoggedIn = base.IsElementPresent
                                                (By.PartialLinkText(LoginLogoutResource.
                                                                    LoginLogout_Signout_Link_Title_Locator),
                                                Convert.ToInt32(LoginLogoutResource.
                                                                LoginLogout_Custom_TimeToWait_Element)) || base.IsElementPresent
                                                (By.ClassName(LoginLogoutResource.LoginLogout_DPUser_LN_FN_Class_Locator),
                                                Convert.ToInt32(LoginLogoutResource.LoginLogout_Custom_TimeToWait_Element));

            if (!isUserAlreadyLoggedIn)
            {
                //Get the user of the given type from Memory Data Store
                User user = User.Get(userTypeEnum);
                try
                {
                    //Login According To The Pegasus Login Mode
                    switch (loginMode)
                    {
                    case BrowsePegasusUserURL.PegasusLoginSpace.WorkSpace:
                        //Login as the given user with password in workspace
                        loginPage.Authenticate(user.Name, user.Password,
                                               BrowsePegasusUserURL.PegasusLoginSpace.WorkSpace, userTypeEnum);
                        break;

                    case BrowsePegasusUserURL.PegasusLoginSpace.CourseSpace:
                        //Login as the given user with password in course space
                        loginPage.Authenticate(user.Name, user.Password,
                                               BrowsePegasusUserURL.PegasusLoginSpace.CourseSpace, userTypeEnum);
                        break;
                    }
                    UserName = user.Name;
                    Password = user.Password;
                    UserType = userTypeEnum.ToString();
                }
                catch (Exception)
                {
                    LoginSpace = "";
                    UserName   = "";
                    UserType   = "";
                    Password   = "";
                    throw;
                }
            }
            Logger.LogMethodExit("LoginLogout", "LoginToThePegasus",
                                 base.IsTakeScreenShotDuringEntryExit);
        }