Example #1
0
        public void Create_random_class()
        {
            //Used once to create dummy data to support report creation
            // requires change in app.config to point test database to production
            IEnumerable <int> cardlist  = frb.ToRepoWorker().GetAllQ().Select(q => q.dwccardnum).Distinct();
            IEnumerable <int> classlist = frb.ToRepoLookup().GetAllQ().Where(l => l.category == "activityName").Select(q => q.ID);
            Activity          a         = new Activity();
            //random date, within last 30 days
            Random   rand  = new Random();
            DateTime today = DateTime.Today.AddDays(-rand.Next(40));

            a.dateStart = today.AddHours(7 + rand.Next(5));
            a.dateEnd   = a.dateStart.AddHours(1.5);
            a.nameID    = classlist.ElementAt(rand.Next(classlist.Count()));
            a.typeID    = 101; //type==class
            a.teacher   = "UnitTest script";
            a.notes     = "From Integration_Activity_Service";
            frb.ToServActivity().Create(a, "TestScript");
            int rAttendance = rand.Next(cardlist.Count() / 10);

            for (var i = 0; i < rAttendance; i++)
            {
                ActivitySignin asi = (ActivitySignin)Records.activitysignin.Clone();
                asi.dateforsignin = today;
                asi.activityID    = a.ID;
                asi.dwccardnum    = cardlist.ElementAt(rand.Next(cardlist.Count()));
                frb.ToServActivitySignin().CreateSignin(asi, "TestScript");
            }
            //a.
        }
Example #2
0
        public void SeActivity_test_search()
        {
            // Arrange
            FluentRecordBase SeDB = new FluentRecordBase();
            int count             = SeDB.ToServActivity().GetAll().Count();

            if (count < 20)
            {
                Activity _activity = (Activity)Records.activity.Clone();
                SeDB.ToServActivity().Create(_activity, "ME");
            }

            // Act
            ui.WaitThenClickElement(By.Id("menulinkactivity"));

            // Test bad search first
            ui.WaitForElement(By.Id("activityTable_searchbox")).SendKeys("bk45kjdsgjk4j3lkt6j3lkjgre");
            bool result = ui.WaitForElementValue(By.XPath("//table[@id='activityTable']/tbody/tr/td[1]"), "No matching records found");

            Assert.IsTrue(result, "Activity search results should be empty");

            // Test good search first
            ui.WaitForElement(By.Id("activityTable_searchbox")).Clear();
            ui.WaitForElement(By.Id("activityTable_searchbox")).SendKeys("jadmin");
            result = ui.WaitForElementValue(By.XPath("//table[@id='activityTable']/tbody/tr[5]/td[3]"), "jadmin");
            Assert.IsTrue(result, "Activities search not returning proper results");
        }
Example #3
0
        public void SeActivity_test_record_limit()
        {
            // Arrange
            int count = frb.ToServActivity().GetAll().Count();

            while (count < 100)
            {
                Activity _activity = (Activity)Records.activity.Clone();
                frb.ToServActivity().Create(_activity, "ME");
                count = frb.ToServActivity().GetAll().Count();
            }

            // Act
            ui.WaitThenClickElement(By.Id("menulinkactivity"));

            // Test default
            ui.WaitForText("Showing (1 to 10)");
            //Thread.Sleep(3000); //prevent race condition
            int recCount = ui._d.FindElements(By.XPath("//table[@id='activityTable']/tbody/tr")).Count;

            Assert.AreEqual(recCount, 10, "Default record limiter is not set to 10");

            // Test 25
            ui.SelectOption(By.XPath("//*[@id='activityTable_length']/label/select"), "25");
            Thread.Sleep(1000); //prevent race condition
            recCount = ui._d.FindElements(By.XPath("//table[@id='activityTable']/tbody/tr")).Count;
            Assert.AreEqual(recCount, 25, "Record limiter set to 25 is not working");

            // Test 50
            ui.SelectOption(By.XPath("//*[@id='activityTable_length']/label/select"), "50");
            Thread.Sleep(1000); //prevent race condition
            recCount = ui._d.FindElements(By.XPath("//table[@id='activityTable']/tbody/tr")).Count;
            Assert.AreEqual(recCount, 50, "Record limiter set to 50 is not working");

            // Test 100
            ui.SelectOption(By.XPath("//*[@id='activityTable_length']/label/select"), "100");
            Thread.Sleep(1000); //prevent race condition
            recCount = ui._d.FindElements(By.XPath("//table[@id='activityTable']/tbody/tr")).Count;
            Assert.AreEqual(recCount, 100, "Record limiter set to 100 is not working");
        }
Example #4
0
        public void SeActivity_test_pagination()
        {
            // Arrange
            FluentRecordBase SeDB = new FluentRecordBase();
            int count             = SeDB.ToServActivity().GetAll().Count();

            if (count < 20)
            {
                Person _person = (Person)Records.person.Clone();
                SeDB.ToServPerson().Create(_person, "ME");
            }

            // Act
            ui.WaitThenClickElement(By.Id("menulinkactivity"));
            var recordID = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr")).GetAttribute("recordid");

            ui.WaitThenClickElement(By.CssSelector("#activityTable_next.paginate_enabled_next"));
            Thread.Sleep(1000); // Prevent race condition
            var recordIDPage = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr")).GetAttribute("recordid");

            // Assert
            Assert.AreNotEqual(recordID, recordIDPage, "Pagination for Activities List appears to not be working");
        }
Example #5
0
        public void SeActivity_test_search()
        {
            // Arrange
            FluentRecordBase SeDB = new FluentRecordBase();
            int count = SeDB.ToServActivity().GetAll().Count();
            if (count < 20)
            {
                Activity _activity = (Activity)Records.activity.Clone();
                SeDB.ToServActivity().Create(_activity, "ME");
            }

            // Act
            ui.WaitThenClickElement(By.Id("menulinkactivity"));

            // Test bad search first
            ui.WaitForElement(By.Id("activityTable_searchbox")).SendKeys("bk45kjdsgjk4j3lkt6j3lkjgre");
            bool result =ui.WaitForElementValue(By.XPath("//table[@id='activityTable']/tbody/tr/td[1]"), "No matching records found");
            Assert.IsTrue(result, "Activity search results should be empty");

            // Test good search first
            ui.WaitForElement(By.Id("activityTable_searchbox")).Clear();
            ui.WaitForElement(By.Id("activityTable_searchbox")).SendKeys("jadmin");
            result = ui.WaitForElementValue(By.XPath("//table[@id='activityTable']/tbody/tr[5]/td[3]"), "jadmin");
            Assert.IsTrue(result, "Activities search not returning proper results");
        }
Example #6
0
        public void SeActivity_test_pagination()
        {
            // Arrange
            FluentRecordBase SeDB = new FluentRecordBase();
            int count = SeDB.ToServActivity().GetAll().Count();
            if (count < 20)
            {
                Person _person = (Person)Records.person.Clone();
                SeDB.ToServPerson().Create(_person, "ME");
            }

            // Act
            ui.WaitThenClickElement(By.Id("menulinkactivity"));
            var recordID = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr")).GetAttribute("recordid");
            ui.WaitThenClickElement(By.CssSelector("#activityTable_next.paginate_enabled_next"));
            Thread.Sleep(1000); // Prevent race condition
            var recordIDPage = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr")).GetAttribute("recordid");

            // Assert
            Assert.AreNotEqual(recordID, recordIDPage, "Pagination for Activities List appears to not be working");
        }