public void SeActivity_test_search() { // Arrange FluentRecordBase SeDB = FluentRecordBaseFactory.Get(); int count = SeDB.ToServ <IActivityService>().GetAll().Count(); if (count < 20) { var _activity = (Domain.Activity)Records.activity.Clone(); SeDB.ToServ <IActivityService>().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"); }
public void SeActivity_unauth_worker_signin() { // example from ActivityTests.cs -- SeActivity_Create_signin_simple() // Arrange // creates one activity within the hour frb.AddActivity(startTime: DateTime.Now, endTime: DateTime.Now.AddHours(1)); Random rand = new Random(); int rowcount = 1; var workers = frb.ToFactory().Workers; Activity _act = (Activity)Records.activity.Clone(); ActivitySignin _asi = (ActivitySignin)Records.activitysignin.Clone(); IEnumerable <int> cardlist = frb.ToFactory().Workers.Select(q => q.dwccardnum).Distinct(); int firstCardNum = workers.First().dwccardnum; // Act //ui.activityCreate(_act); ui.activityMenuLink(); //Find Activity menu link and click var activityRecord = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr[1]")); var activityRecordID = Convert.ToInt32(activityRecord.GetAttribute("recordid")); var idPrefix = "asi" + activityRecordID + "-"; ui.WaitAndDoubleClick(By.XPath("//table[@id='activityTable']/tbody/tr[1]")); // ui.activitySignIn("asi" + activityRecordID + "-dwccardnum", firstCardNum); ui.activitySignIn(idPrefix, firstCardNum); // Assert // borrowed from sharedUI.cs -- activitySignInValidate() Assert.IsNotNull(ui.WaitForElementValue(By.XPath("//table[@id='asi" + activityRecordID + "-asiTable']/tbody/tr[" + rowcount + "]/td[2]"), firstCardNum.ToString()), "Did not find added record number in signin table"); }
public void SeEmployer_Create_and_move_Workorder() { var _emp1 = frb.CloneEmployer(); var _emp2 = frb.CloneEmployer(); var _wo = frb.CloneWorkOrder(); _wo.contactName = ui.RandomString(10); // create first worker ui.employerCreate(_emp1); // create 2nd worker ui.employerCreate(_emp2); // create workorder for employer 2 ui.workOrderCreate(_emp2, _wo); // // string prefix = "WO" + _wo.ID + "-"; // click change button Thread.Sleep(3000); ui.WaitThenClickElement(By.Id(prefix + "changeEmployerBtn")); // find new employer ui.WaitForElement(By.Id("employerSelectTable_searchbox")).SendKeys(_emp1.name); // check for name in popup table column ui.WaitForElementValue(By.XPath("//table[@id='employerSelectTable']/tbody/tr/td[2]"), _emp1.name); // doubleclick on row (using elem 6 b/c first elems might be off screen) ui.WaitAndDoubleClick(By.XPath("//table[@id='employerSelectTable']/tbody/tr/td[6]")); // // confirm dialog ui.WaitThenClickElement(By.Id("popup_ok")); ui.WaitThenClickElement(By.Id("employerListTab")); ui.WaitForElement(By.Id("employerTable_searchbox")).SendKeys(_emp1.name); // search for employer 1 ui.WaitForElementValue(By.XPath("//table[@id='employerTable']/tbody/tr/td[2]"), _emp1.name); ui.WaitAndDoubleClick(By.XPath("//table[@id='employerTable']/tbody/tr/td[6]")); Thread.Sleep(5000); var selectedTab = ui.WaitForElement(By.CssSelector("li.employer.ui-tabs-selected a")); var recID = Convert.ToInt32(selectedTab.GetAttribute("recordid")); ui.WaitForElement(By.Id("workOrderListTab_" + _emp1.ID)); Assert.IsTrue(ui.WaitForElementValue(By.XPath("//table[@id='workOrderTable_" + recID.ToString() + "']/tbody/tr/td[5]"), _wo.contactName)); }