Exemplo n.º 1
0
        public bool AddNewUser(BimTrackUser bimUser)
        {
//            IWebElement weTarget = GetRoot().FindElement(By.XPath("//input[@data-testid='validEmailCell']"));
//            weTarget.SendKeys(BimEmailProcessor.EMAILS_PREFIX + szUserSuffix +
//                              BimEmailProcessor.EMAILS_DOMAIN);
            var random = new Random();

            Thread.Sleep(random.Next(250, 500));
            _SetNewUserEmail(bimUser.email);
            Thread.Sleep(random.Next(250, 500));
            _SetNewUserRole(bimUser.isAdmin);
            Thread.Sleep(random.Next(250, 500));
            _ClickAddOrCancel(true, false);



            //TODO: Replace by ID, dependant on localized resource
            // Wait for a maximum time of x milliseconds for the out of users available message to pop in case the
            // maximum of users was reached
            const string warning = "You can not choose this plan. The hub user limit is reached.";
            var          byElem  = By.XPath(".//span[text() ='" + warning + "']");
            var          retElem = WebElementHelper.WaitUntilVisible(byElem, 2500);

            if (retElem != null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
        public int RemoveAllUsers()
        {
            WebElementHelper.WaitUntilVisible(By.XPath(".//div[@data-testid='body']"), 3000);
            var tableBody = weSectionRoot.FindElement(By.XPath(".//div[@data-testid='body']"));
            var tableRows = tableBody.FindElements(By.XPath(".//tr"));

            foreach (var currentRow in tableRows)
            {
                var rowCells = currentRow.FindElements(By.XPath(".//td"));
                _ClickAddOrCancel(false, rowCells[(int)TABLE_COLUMN.AcceptBtnBegin], true);

                var elem = WebElementHelper.WaitUntilVisible(By.XPath(".//button[@id='clickDelete']"), 10000);
                while (!WebElementHelper.SafeClickElement(elem))
                {
                    Thread.Sleep(1500);
                }
            }

            //TODO Implementation
            return(0);
        }