WaitThenClickElement() public method

public WaitThenClickElement ( By by ) : bool
by OpenQA.Selenium.By
return bool
示例#1
0
        public void SeEmployer_Create_workorder_copyinfo()
        {
            //Arrange
            var _emp = frb.CloneEmployer();
            var _wo  = frb.CloneWorkOrder();

            //Act
            ui.employerCreate(_emp);
            ui.WaitThenClickElement(By.Id("workOrderCreateTab_" + _emp.ID));
            ui.WaitThenClickElement(By.Id("WO0-copyEmployerInfo"));
            ui.SelectOptionByIndex(By.Id("WO0-transportMethodID"), 1);
            ui.WaitThenClickElement(By.Id("WO0-SaveBtn"));
            //_wo.ID = ui.getSelectedTabRecordID("WO");
            _wo.contactName      = _emp.name;
            _wo.workSiteAddress1 = _emp.address1;
            _wo.workSiteAddress2 = _emp.address2;
            _wo.city             = _emp.city;
            _wo.state            = _emp.state;
            _wo.zipcode          = _emp.zipcode;
            _wo.phone            = _emp.phone;
            _wo.description      = "";
            _wo.statusID         = HttpClientUtil.GetLookup(LCategory.orderstatus, LOrderStatus.Pending);
            _wo.ID = ui.getSelectedTabRecordID("WO");
            //Assert
            ui.workOrderValidate(_wo);
        }
示例#2
0
        public void SeActivity_unauth_maxtabs()
        {
            // Verify maxTabs
            // Open activity table, click List Activities, open another activity, make sure there is only one activity tab open

            //Arrange

            // creates an activity within the hour
            frb.AddActivity(startTime: DateTime.Now, endTime: DateTime.Now.AddHours(1));
            Thread.Sleep(1000); //prevent race condition
            frb.AddActivity(startTime: DateTime.Now, endTime: DateTime.Now.AddHours(1));


            //Act
            ui.activityMenuLink(); //Find Activity menu link and click
            ui.WaitAndDoubleClick(By.XPath("//table[@id='activityTable']/tbody/tr[1]"));

            //get current activity tab ID
            Thread.Sleep(1000); //prevent race condition
            var activityTabSelected   = ui.WaitForElement(By.CssSelector(".ui-tabs-selected"));
            var activityTabSelectedID = activityTabSelected.GetAttribute("id");

            //go back to List Activities
            //driver.FindElement(By.LinkText("List Activities")).Click();
            //Thread.Sleep(1000); //prevent race condition
            ui.WaitThenClickElement(By.Id("activityListTab"));

            // open a different record
            Thread.Sleep(1000); //prevent race condition
            var activityNewRecord   = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr[2]"));
            int activityNewID       = Convert.ToInt32(activityNewRecord.GetAttribute("recordid"));
            var activityNewIDString = "activity" + activityNewID + "-EditTab";

            ui.WaitAndDoubleClick(By.XPath("//table[@id='activityTable']/tbody/tr[2]"));

            //get NEW current activity tab ID
            var activityNewTabSelected   = ui.WaitForElement(By.CssSelector(".ui-tabs-selected"));
            var activityNewTabSelectedID = activityNewTabSelected.GetAttribute("id");

            //Assert
            // old tab doesn't exist
            //Assert.IsNull(ui.WaitForElement(By.Id(activityTabSelectedID)));
            Assert.IsFalse(ui.elementExists(By.Id(activityTabSelectedID)));

            // new tab does exist
            // activityNewIDString;
            Assert.IsNotNull(ui.WaitForElement(By.Id(activityNewIDString)));
            //Assert.IsTrue(ui.elementExists(By.Id(activityNewIDString)));
        }
示例#3
0
        public void SeActivity_Create_ManySignins()
        {
            //Arrange
            int    rowcount = 1;
            Random rand     = new Random();

            if (frb.ToFactory().Workers.Select(q => q.dwccardnum).Distinct().Count() <= 10)
            {
                frb.AddWorker();
            }
            //
            //
            IEnumerable <int> list = frb.ToFactory().Workers.Select(q => q.dwccardnum).Distinct().ToList();
            var count               = list.Count();
            int numberOfSignins     = rand.Next(count / 10) + 1; //+1 will never lead to zero here
            int numberSignedIn      = numberOfSignins;
            IEnumerable <int> list1 = list.Take <int>(numberOfSignins);
            var _act = (Web.ViewModel.Activity)ViewModelRecords.activity.Clone();

            //Act
            ui.activityCreate(_act);
            var idPrefix = "asi" + _act.ID + "-";

            for (var i = 0; i < numberOfSignins; i++)
            {
                int cardNum = list1.ElementAt(i);
                ui.activitySignIn(idPrefix, cardNum);
                Thread.Sleep(1000);//prevent race condition
                if (ui.activitySignInIsSanctioned())
                {
                    --numberSignedIn;
                    continue;
                }

                //Assert
                Thread.Sleep(1000);//prevent race condition
                Assert.IsTrue(ui.activitySignInValidate(idPrefix, cardNum, rowcount), "Sign in for worker " + i + " with cardNum " + cardNum + " failed!");

                //This line ensures the test doesn't break if we try to sign in an ID that has multiple workers attached to it.
                //rowcount increments by the number of records found in the database matching that cardNum
                rowcount += frb.ToFactory().Workers.Where(q => q.dwccardnum == cardNum).Count();
            }
            ui.WaitThenClickElement(By.Id("activityListTab"));
            //ui.SelectOption(By.XPath("//*[@id='activityTable_length']/label/select"), "100");

            //Assert

            // Chaim 4/2/2014
            // This isn't working because I disabled auto-reload. It was making
            // the table appear strangely when I disabled pagination. I did that
            // because pagination was unpopular with users.

            // Todo: Either make auto-reload work or find another way of reloading
            // the page.

            //Locate record within activitylist datatable and compare the count (column 4) with numberSignedIn
            Assert.AreEqual(numberSignedIn.ToString(), ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr[@recordid='" + _act.ID + "']/td[4]")).Text);

            //walk through pagination to search for recordid
            //var activityRecordCount = "what";
            //bool tableRecordMatch = false;
            //while (tableRecordMatch == false) {
            //    if (ui.WaitForElementExists(By.XPath("//table[@id='activityTable']/tbody/tr[@recordid='" + _act.ID + "']"))) {
            //        tableRecordMatch = true;
            //        activityRecordCount = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr[@recordid='" + _act.ID + "']/td[4]")).Text;
            //    } else {
            //check for #activityTable_next.paginate_disabled_next
            //Assert.IsTrue(ui.WaitThenClickElement(By.CssSelector("#activityTable_next.paginate_enabled_next")), "Could not locate record in table pagination");
            //}
            //}

            //Assert.AreEqual(numberSignedIn.ToString(), activityRecordCount);
        }