public bool MyLoadsValidations() { try { Assert.IsTrue(VerifyTextClass()); if (_DashboardData.Entity == Constants.Entity_Carrier) { MyTasksPage objMyTasksPage = new MyTasksPage(this.testConfig); Assert.IsTrue(CheckPickupWeekData()); objMyTasksPage.Navigate(); Assert.IsTrue(CheckDeliveryWeekData()); objMyTasksPage.Navigate(); } else { Assert.IsTrue(CheckPickupWeekData()); CLAW objClaw = new CLAW(testConfig, testData); objClaw.NavigateTo("HOME"); Assert.IsTrue(CheckDeliveryWeekData()); objClaw.NavigateTo("HOME"); } return(true); } catch (Exception) { return(false); } }
private bool CheckPickupWeekData() { DateTime fromDate; DateTime toDate; string dateRange = string.Empty; bool result = false; CLAW objClaw = new CLAW(testConfig, testData); Assert.IsTrue(_DashboardPage.Picking_Up_This_Week.Click()); _DashboardPage.My_Loads_Search_Results_Headers.WaitUntilDisplayed(30); try { dateRange = _DashboardPage.My_Loads_Search_Pickup_Date.GetAllText()[0]; if (!string.IsNullOrWhiteSpace(dateRange)) { dateRange = dateRange.ToLower().Replace("pickup is", string.Empty).Trim(); MyLogger.Log("Date range is ::: " + dateRange); } string[] arrDates = dateRange.Split(new string[] { " – " }, StringSplitOptions.None); if (arrDates.Length > 0) { fromDate = Convert.ToDateTime(arrDates[0]); toDate = Convert.ToDateTime(arrDates[1]); Assert.IsTrue(fromDate.DayOfWeek.Equals(DayOfWeek.Sunday)); Assert.IsTrue(toDate.DayOfWeek.Equals(DayOfWeek.Saturday)); Assert.IsTrue(GetDateDiffInDays(fromDate, toDate).Equals(6)); MyLogger.Log("First day of date range is ::: " + fromDate.DayOfWeek); MyLogger.Log("Last day of date range is ::: " + toDate.DayOfWeek); MyLogger.Log("Difference of date range is ::: " + Convert.ToString(GetDateDiffInDays(fromDate, toDate))); result = true; } else { result = false; } } catch (Exception) { MyLogger.Log("Exception in date range"); result = false; } return(result); }
private bool VerifyMyLoadsCount(UIItem item, string count) { try { Assert.IsTrue(item.Click()); _DashboardPage.My_Loads_Search_Results_Headers.WaitUntilDisplayed(30); UIItem TotalResults = new UIItem("MyLoads>> Total results>>", byTotalResults, driver); UIItem CountResults = new UIItem("MyLoads>> Total results>>", byCountResults, driver); if (TotalResults.IsDisplayed()) { Assert.IsTrue(TotalResults.UIVerify("HasText." + count)); } else { Assert.IsTrue(CountResults.UIVerify("HasText." + count)); } if (_entityname == Constants.Entity_Carrier) { MyTasksPage objToNavigate = new MyTasksPage(this.testConfig); objToNavigate.Navigate(); } else { CLAW objToNavigate = new CLAW(testConfig, testData); objToNavigate.NavigateTo("HOME"); } return(true); } catch { return(false); } }