Exemplo n.º 1
0
        public void CreateUser(string user_name, string passwd, string group_name)
        {
            driver.Navigate().Refresh();
            // : Go to UserManagement and create user
            driver.Navigate().GoToUrl(baseURL + "/SubDomainV2/UserManagement/");
            driver.FindElement(By.XPath("//input[@value='New']")).Click();
            // : For, we are using the same user for each case if user is created in any of the case then test case fails
            driver.FindElement(By.Id("UserName")).Clear();
            driver.FindElement(By.Id("UserName")).SendKeys(user_name);
            // : For, we are using the same user for each case if user is created in any of the case then test case fails
            // : Now, we are passing the password values
            driver.FindElement(By.Id("Password")).Clear();
            driver.FindElement(By.Id("Password")).SendKeys(passwd);
            driver.FindElement(By.Id("VerifyPassword")).Clear();
            driver.FindElement(By.Id("VerifyPassword")).SendKeys(passwd);
            // Assign group
            // Get all the groups in available groups table
            IWebElement AvailableGroupsTable = driver.FindElement(By.Id("AvailableGroupID"));
            IReadOnlyCollection <IWebElement> AvailableGroup = (AvailableGroupsTable.FindElements(By.TagName("option"))).ToList();

            foreach (IWebElement AssignGroup in AvailableGroup)
            {
                if (AssignGroup.Text.Equals(group_name))
                {
                    AssignGroup.Click();
                    driver.FindElement(By.Id("MoveRight")).Click();
                    break;
                }
            }
            driver.FindElement(By.Id("saveuser")).Click();
        }
Exemplo n.º 2
0
		private static void RegisterGroup( int id, string name )
		{
			AssignGroup grp = new AssignGroup( id, name );
			m_AllUsers.Add( grp );
			m_Users[id] = grp;
		}