コード例 #1
0
        public void AddUserGrouptoApplication(string applicationName, string usergroup, log4net.ILog log)
        {
            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();


            Create_New_User_Group_link.Click();
            Name_text.SendKeys(usergroup);
            Description_text.SendKeys(usergroup);
            Application_dropdown.SendKeys(applicationName);
            Save_link.Click();

            //Asertion Section:

            string actualUserGroupName;

            try
            {
                actualUserGroupName = Name_text.Text;
            }
            catch
            {
                Thread.Sleep(1000);
                PageFactory.InitElements(driver, this);
                actualUserGroupName = Name_text.Text;
            }
            Assert.AreEqual(usergroup, actualUserGroupName);

            log.Info(Name_text.Text);

            //Go back to home page...
            USERS_link.Click();
        }
コード例 #2
0
        public void RemoveUserGroupFromApplication(string applicationName, string usergroup, log4net.ILog log, IWebDriver driver)
        {
            USER_GROUPS_link.Click();



            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();

            Delete_user_group_link.Click();

            Confirm_Deletion_checkbox.Click();
            Confirm_Deletion_Of_User_link.Click();


            //ASsertion delete successful
            try
            {
                USER_GROUPS_link.Click();
            }
            catch (TargetInvocationException)
            {
                Thread.Sleep(1000);
                PageFactory.InitElements(driver, this);
                USER_GROUPS_link.Click();
            }
            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            Assert.IsFalse(isElementPresent(SEARCH_RESULTS_links));


            //back to home page
            USERS_link.Click();
        }
コード例 #3
0
        public void DisableUser(string emailaddress, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage
            LAFAdmin_ManageUsers_Page usersPage = new LAFAdmin_ManageUsers_Page(driver);

            USERS_link.Click();
            Email_Address_Text.SendKeys(emailaddress);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();

            try
            {
                Disable_user_account_link.Click();
                driver.SwitchTo().ActiveElement().SendKeys("test");
                driver.SwitchTo().ActiveElement().SendKeys(Keys.Return);
            }
            catch (NoSuchElementException ex)
            {
                //If failed, this is most likely because the user is disabled
                Assert.IsTrue(isElementPresent(Enable_user_account_link));
                //If so continue test
                log.Info("User already disabled. Continue Test");
            }


            Assert.IsTrue(isElementPresent(Enable_user_account_link));

            try
            {
                USERS_link.Click();
            }
            catch
            {
                PageFactory.InitElements(driver, this);
                USERS_link.Click();
            }
            usersPage = null;

            log.Info("User '" + emailaddress + "' disabled successfully.");

            /**
             * try
             * {
             *  Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
             *
             * }
             * catch
             * {
             *
             *  Thread.Sleep(1000);
             *  usersPage = new LAFAdminManageusersPage(driver);
             *  Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
             *
             * }
             *
             **/
        }
コード例 #4
0
        public void DeleteUser(string emailaddress, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage

            PageFactory.InitElements(driver, this);
            USERS_link.Click();

            Email_Address_Text.SendKeys(emailaddress);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();

            Delete_user_account_link.Click();

            I_wish_to_delete_this_user_from_laf_checkbox.Click();
            Confirm_Deletion_Of_User_link.Click();


            try
            {
                Email_Address_Text.SendKeys(emailaddress);
            }
            catch
            {
                PageFactory.InitElements(driver, this);
                Email_Address_Text.SendKeys(emailaddress);
            }


            Search_link.Click();


            Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
            USERS_link.Click();


            log.Info("User '" + emailaddress + "' deleted successfully.");

            /**
             * try
             * {
             *  Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
             *
             * }
             * catch
             * {
             *
             *  Thread.Sleep(1000);
             *  usersPage = new LAFAdminManageusersPage(driver);
             *  Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
             *
             * }
             *
             **/
        }
コード例 #5
0
        //Methods:

        public void CreateNewUser(string emailaddress, string firstName, log4net.ILog log)
        {
            //Create an instance of the LAFAdmin_ManageUsers_Page
            //I will just call this instance 'usersPage' for short:
            log.Info("Test Start: CreateNewUser, username="******"Mr");
            First_Name_text.SendKeys(firstName);
            Last_Name_text.SendKeys("Test");
            Country_of_Residence_dropdown.SendKeys("United Kingdom");
            Contact_Telephone_Number_text.SendKeys("123");
            Are_you_an_insurance_professional_dropdown.SendKeys("No");
            Job_title_text.SendKeys("Tester");
            Company_name_text.SendKeys("Testing LTD");
            Organisation_type_dropdown.SendKeys("Lloyds corporation");

            Save_link.Click();

            //Assertion:

            Email_Address_Text.SendKeys(emailaddress);
            Search_link.Click();
            Assert.IsTrue(SEARCH_RESULTS_links.Displayed);

            log.Info("New User Created Successfully");


            try
            {
                USERS_link.Click();
            }
            catch
            {
                PageFactory.InitElements(driver, this);
                USERS_link.Click();
            }
        }
コード例 #6
0
        public void DeleteUserFromUserGroup(string emailaddress, string usergroup, log4net.ILog log)
        {
            PageFactory.InitElements(driver, this);
            Thread.Sleep(1000);
            USER_GROUPS_link.Click();
            User_Group_Name_text.SendKeys(usergroup);

            try
            {
                Search_link.Click();
                SEARCH_RESULTS_links.Click();
            }
            catch
            {
                PageFactory.InitElements(driver, this);
                Search_link.Click();
                SEARCH_RESULTS_links.Click();
            }

            User_Search_text.SendKeys(emailaddress);
            Filter_Users_link.Click();

            SEARCH_RESULTS_checkbox.Click();
            Remove_Users_link.Click();
            //Now asserting that removal was successful:

            try
            {
                User_Search_text.SendKeys(emailaddress);
            }
            catch (TargetInvocationException)
            {
                //Thread.Sleep(1000);
                PageFactory.InitElements(driver, this);

                User_Search_text.SendKeys(emailaddress);
            }

            Filter_Users_link.Click();
            Thread.Sleep(1000);
            Assert.IsFalse(isElementPresent(SEARCH_RESULTS_links));


            log.Info("User '" + emailaddress + "' removed from user group '" + usergroup + "'successfully.");
            USERS_link.Click();
        }
コード例 #7
0
        //Add New Users To USer Groups Screen:

        public void AddUserToUserGroup(string emailaddress, string usergroup, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage
            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();
            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();

            //Thread.Sleep(1000);
            Add_New_User_link.Click();
            //LAFAdminManageusersPage usersPage = new LAFAdminManageusersPage(driver);

            Email_Address_Text.SendKeys(emailaddress);

            PageFactory.InitElements(driver, this);

            Search_link.Click();



            try
            {
                SEARCH_RESULTS_checkbox.Click();
            }
            catch (TargetInvocationException)
            {
                PageFactory.InitElements(driver, this);
                SEARCH_RESULTS_checkbox.Click();
            }
            Add_Users_to_User_Group_link.Click();
            Thread.Sleep(1000);


            User_Search_text.SendKeys(emailaddress);
            Filter_Users_link.Click();
            Thread.Sleep(1000);
            Assert.IsTrue(isElementPresent(SEARCH_RESULTS_links));

            log.Info("User '" + emailaddress + "' added to user group '" + usergroup + "'successfully.");
            USERS_link.Click();
        }
コード例 #8
0
        public void AddCredentialToUserGroup(string credentialName, string credentialValue, string usergroup, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage
            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();
            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();


            Add_Credentials_link.Click();

            Credential_name_text.SendKeys(credentialName);
            Credential_value_text.SendKeys(credentialValue);
            try
            {
                Search_link.Click();
            }
            catch
            {
                PageFactory.InitElements(driver, this);
                Search_link.Click();
            }

            SEARCH_RESULTS_checkbox.Click();

            Add_Credentials_to_User_Group_link.Click();

            //Assertion of the above:
            //This should prob be wrapped up in function on the actual page?
            Credential_Search_text.SendKeys(credentialValue);
            Filter_Users_link.Click();

            Assert.IsTrue(isElementPresent(Credential_Search_Results_table));



            log.Info("Credential '" + credentialName + ", value: " + credentialValue + " added to user group '" + usergroup + "'successfully.");

            USERS_link.Click();
        }
コード例 #9
0
        public void RemoveCredentialFromUserGroup(string credentialName, string credentialValue, string usergroup, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage
            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();
            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();


            //Assuming here that only one credential will exist with a given value in each group, not neccessarily true
            //in terms of funcitonality, but operationally, this should be the case, fair assumption to make for
            //this level of testing

            Credential_Search_text.SendKeys(credentialValue);
            Credential_Search_Results_checkbox.Click();
            Remove_Selected_Credentials_link.Click();

            //Now asserting if removed...
            try
            {
                Credential_Search_text.SendKeys(credentialValue);
            }
            catch
            {
                Thread.Sleep(1000);
                PageFactory.InitElements(driver, this);
                Credential_Search_text.SendKeys(credentialValue);
            }

            Filter_Users_link.Click();

            Assert.IsFalse(isElementPresent(SEARCH_RESULTS_table));



            USERS_link.Click();
        }
コード例 #10
0
        public void EnableUser(string emailaddress, log4net.ILog log, IWebDriver driver)
        {
            //instantiate new Adduserdetailspage


            try
            {
                USERS_link.Click();
                Email_Address_Text.SendKeys(emailaddress);
            }
            catch (Exception ex)
            {
                PageFactory.InitElements(driver, this);

                log.Info("Staleblock" + ex.ToString());
                USERS_link.Click();
                Email_Address_Text.SendKeys(emailaddress);
            }

            Search_link.Click();
            try
            {
                SEARCH_RESULTS_links.Click();
            }
            catch (Exception)
            {
                PageFactory.InitElements(driver, this);
                SEARCH_RESULTS_links.Click();
            }

            Enable_user_account_link.Click();

            driver.SwitchTo().ActiveElement().SendKeys("test");
            driver.SwitchTo().ActiveElement().SendKeys(Keys.Return);

            Assert.IsTrue(isElementPresent(Disable_user_account_link));

            //Now check if reset password link is available - if it is click this too, to ensure that user is actually enabled
            //May move this to another test eventually



            try
            {
                USERS_link.Click();
            }
            catch (Exception)
            {
                PageFactory.InitElements(driver, this);
                USERS_link.Click();
            }


            log.Info("User '" + emailaddress + "' deleted successfully.");

            /**
             * try
             * {
             *  Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
             *
             * }
             * catch
             * {
             *
             *  Thread.Sleep(1000);
             *  usersPage = new LAFAdminManageusersPage(driver);
             *  Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
             *
             * }
             *
             **/
        }
コード例 #11
0
        public void ResetPasswordAttempts(string emailaddress, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage

            USERS_link.Click();
            try
            {
                Email_Address_Text.SendKeys(emailaddress);
            }
            catch (StaleElementReferenceException ex)
            {
                log.Info("Staleblock" + ex.ToString());
                PageFactory.InitElements(driver, this);
                Email_Address_Text.SendKeys(emailaddress);
            }

            Search_link.Click();
            try
            {
                SEARCH_RESULTS_links.Click();
            }
            catch (Exception)
            {
                PageFactory.InitElements(driver, this);
                SEARCH_RESULTS_links.Click();
            }

            //Check that it is visible (i.e. USer needs to have attempts reset)
            Assert.IsTrue(isElementPresent(Reset_password_attempts_link));

            Reset_password_attempts_link.Click();

            driver.SwitchTo().ActiveElement().SendKeys("test");
            driver.SwitchTo().ActiveElement().SendKeys(Keys.Return);

            //Ensure that it has been clicked
            Assert.IsFalse(isElementPresent(Reset_password_attempts_link));



            try
            {
                USERS_link.Click();
            }
            catch (Exception)
            {
                PageFactory.InitElements(driver, this);
                USERS_link.Click();
            }


            log.Info("User '" + emailaddress + "' password reset  successfully.");

            /**
             * try
             * {
             *  Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
             *
             * }
             * catch
             * {
             *
             *  Thread.Sleep(1000);
             *  usersPage = new LAFAdminManageusersPage(driver);
             *  Assert.IsFalse(isElementPresent((SEARCH_RESULTS_links)));
             *
             * }
             *
             **/
        }