Beispiel #1
0
        public IWebDriver CreateUser(IWebDriver webDriver, Help hpCode, UsrDataObject studentNew, ref string[] createdAccount)
        {
            string usrSrchCss = "div.media.cc-panel-header div.media-body div.pull-right input.form-control";

            string usrRegLink = "li.list-group-item.cc-panel-item.cc-panel-item-clickable.cc-panel-item-placeholder div.row div.col-md-12";

            IWebElement usrSrchBox = webDriver.FindElement(By.CssSelector(usrSrchCss));

            usrSrchBox.SendKeys(DateTime.UtcNow.Ticks.ToString());

            hpCode.RandomPause(3);

            IWebElement registrationClick = webDriver.FindElement(By.CssSelector(usrRegLink));

            registrationClick.Click();
            hpCode.RandomPause(2);

            IWebElement firstBox = webDriver.FindElement(By.Id("firstName"));

            firstBox.SendKeys(studentNew.FirstName);

            IWebElement lastBox = webDriver.FindElement(By.Id("lastName"));

            lastBox.SendKeys(studentNew.LastName);

            IWebElement sisBox = webDriver.FindElement(By.Id("sisId"));

            sisBox.SendKeys(studentNew.SiSiD);

            IWebElement crsBox = webDriver.FindElement(By.Id("crmId"));

            crsBox.SendKeys(studentNew.CRMid);

            IWebElement emailBox = webDriver.FindElement(By.Id("email"));

            emailBox.SendKeys(studentNew.Email);

            hpCode.RandomPause(3);

            var buttons = webDriver.FindElements(By.CssSelector("body.modal-open div div.fade.in.modal div.modal-dialog div.modal-content button"));

            hpCode.RandomPause(1.5);

            buttons[1].Click();

            hpCode.RandomPause(2);

            usrSrchBox.Clear();

            hpCode.RandomPause(2);

            usrSrchBox.SendKeys(studentNew.LastName);

            hpCode.RandomPause(2);

            createdAccount[0] = studentNew.LogInAlias;
            createdAccount[1] = studentNew.PassWord;
            createdAccount[2] = studentNew.Email;

            return(webDriver);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            string argsPassedIn = null;
            string usrListIs    = string.Empty;

            if (argsPassedIn == null)
            {
                usrListIs = "RawList.txt";
            }
            else if (argsPassedIn != null)
            {
                usrListIs = argsPassedIn;
            }

            /* *** Setup Steps *** */
            bool   keepGoing   = false;
            Size   browserSize = new Size(1650, 1000);
            string client      = @"https://wozu.qa.exeterlms.com/";
            string adminUser   = "******";
            string adminPwd    = "coder#1";
            string assetPath   = Directory.GetCurrentDirectory() + "\\assets\\";
            string runDatetime = DateTime.Now.ToString("_MM-dd-HHmm");

            UsrDataObject useThis2MakeUser = new UsrDataObject();

            string[] createdAccount = new string[3];

            string  logPath    = @"C:\ZlogZ\ANewUserSet";
            string  localPath  = Directory.GetCurrentDirectory();
            string  filePath   = localPath + "\\assets\\" + usrListIs;
            Help    hpCode     = new Help(logPath);
            Actions actionCode = new Actions();

            keepGoing = File.Exists(filePath);

            if (keepGoing)
            {
                var rawData = File.ReadAllLines(filePath);

                foreach (string UsrData in rawData)
                {
                    Console.WriteLine("\n~This User Data is == {0}", UsrData);
                }

                Console.Write("\n Space \n Space ");

                var usersNameList = rawData
                                    .Select(line => line.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries)).Select(split => new UsrDataObject
                {
                    FirstName  = split[0],
                    LastName   = split[1],
                    SiSiD      = split[2],
                    CRMid      = split[3],
                    Email      = split[4],
                    LogInAlias = split[5],
                    PassWord   = split[6]
                });

                foreach (UsrDataObject makeNewUser in usersNameList)
                {
                    Console.WriteLine("");
                    {
                        Console.WriteLine("A New User LoginAlias == {0}", makeNewUser.LogInAlias.ToString());
                    }

                    using (IWebDriver webDriver = new ChromeDriver(assetPath))
                    {
                        actionCode.BrowserReady(webDriver, hpCode, client);

                        hpCode.RandomPause(1);

                        actionCode.SignIn(webDriver, hpCode, adminUser, adminPwd);

                        hpCode.RandomPause(1);

                        actionCode.CreateUser(webDriver, hpCode, makeNewUser, ref createdAccount);

                        hpCode.RandomPause(1);

                        actionCode.GetUsrUrl(webDriver, hpCode, ref createdAccount);

                        hpCode.RandomPause(1);

                        actionCode.SignOff(webDriver, hpCode);

                        actionCode.RegNewUsrViaUrl(webDriver, hpCode, ref createdAccount);

                        hpCode.RandomPause(1);

                        actionCode.FirstUsrLogIn(webDriver, hpCode, ref createdAccount);

                        hpCode.RandomPause(1);

                        actionCode.SignOff(webDriver, hpCode);

                        hpCode.RandomPause(3);
                    }

                    Console.WriteLine("... END ...");
                }

                Console.WriteLine("...");
            }
            else
            {
                Console.WriteLine("End HERE... did nothing there is no file. ");
            }
            Console.Write("...END...");
        } // EOM