public void CheckHeartbeat() { //search for heartbeat with time near the current date time /* * Validate.Exists(repo.DellApplicationWebServiceDAWS.TdTagApplicationHeartbeat); * // move to element * repo.DellApplicationWebServiceDAWS.TdTagApplicationHeartbeat.MoveTo(); * ATag link = repo.DellApplicationWebServiceDAWS.TdTagApplicationHeartbeat.FindSingle<ATag>("./preceding-sibling::td[1]/a"); * link.MoveTo(Location.UpperRight); * link.Click(Location.UpperRight); */ // int repeat = 3; int step = 0; bool found = false; do { try{ IList <TrTag> trList = repo.DellApplicationWebServiceDAWS.Self.Find <TrTag>(@".//div[#'daws-body']/table//td[@innertext~'Learning Center']/following-sibling::td[@innertext~'ApplicationHeartbeat']/parent::tr"); TrTag lastTr = trList[trList.Count - 1]; lastTr.MoveTo(); ATag link = lastTr.FindSingle <ATag>("./td[1]/a"); link.MoveTo(); link.Click(Location.UpperRight); found = true; break; } catch (Exception) { // delay then refresh Delay.Milliseconds(5000); Keyboard.Press("{F5}"); Delay.Milliseconds(10000); step++; } }while(step < 3); if (found) { Report.Success("ApplicationHeartbeat Event is exist."); } else { Report.Failure("ApplicationHeartbeat Event is not exist."); } //Report.Log((found==true)?ReportLevel.Success:ReportLevel.Failure, "Check if ApplicationHeartbeat Event exist"); Delay.Seconds(5); }
public void CheckLaunchMoreThan1() { //TODO search for the last item match IList <TrTag> trList = repo.DellApplicationWebServiceDAWS.Self.Find <TrTag>(@".//div[#'daws-body']/table//td[@innertext~'Learning Center']/following-sibling::td[@innertext~'CustomEvent']/parent::tr"); try{ TrTag lastTr = trList[trList.Count - 1]; lastTr.MoveTo(); ATag link = lastTr.FindSingle <ATag>("./td[1]/a"); link.MoveTo(); link.Click(Location.UpperRight); DdTag ddtag = repo.DellApplicationWebServiceDAWS.DtTagAdditionalData1.FindSingle <DdTag>("./following-sibling::dd[][1]"); ddtag.MoveTo(); string ddtext = ddtag.InnerText.Trim(); Validate.AreEqual(ddtext, "Launch > 1", "Check Custom Event has AdditionalData1 = Launch > 1, actual = {0}, expect = {1}"); }catch { Report.Failure("No event 'CustomEvent' sented."); } Delay.Seconds(5); }
public void CheckSearchFailed() { //TODO search for the last item match IList <TrTag> trList = repo.DellApplicationWebServiceDAWS.Self.Find <TrTag>(@".//div[#'daws-body']/table//td[@innertext~'Learning Center']/following-sibling::td[@innertext~'CustomEvent']/parent::tr"); try { TrTag lastTr = trList[trList.Count - 1]; lastTr.MoveTo(); ATag link = lastTr.FindSingle <ATag>("./td[1]/a"); link.MoveTo(); link.Click(Location.UpperRight); }catch (Exception) { Report.Failure("There are no event for check Service Tag - ApplicationName - AppVersion - EventTypeName - EventCreateDateTime - Event DateTime."); return; } DdTag ddtag = repo.DellApplicationWebServiceDAWS.DtTagAdditionalData1.FindSingle <DdTag>("./following-sibling::dd[][1]"); ddtag.MoveTo(); string ddtext = ddtag.InnerText.Trim(); Validate.AreEqual(ddtext, "Search item not found", "Check Custom Event has AdditionalData1, actual = {0}, expect = {1}"); // event details // service tag try { ATag atag = repo.DellApplicationWebServiceDAWS.DtTagServiceTag.FindSingle <ATag>("./following-sibling::dd[][1]/a"); atag.MoveTo(); string atext = atag.InnerText.Trim(); Validate.AreEqual(atext, TestSuite.Current.Parameters["serviceTag"].ToString(), "Check Custom Event Service tag, actual = {0}, expect = {1}"); }catch (Exception) { } // application name try { ddtag = repo.DellApplicationWebServiceDAWS.DtTagApplicationName.FindSingle <DdTag>("./following-sibling::dd[][1]"); ddtag.MoveTo(); ddtext = ddtag.InnerText.Trim(); Validate.AreEqual(ddtext, varApplicationName, "Check Custom Event ApplicationName, actual = {0}, expect = {1}"); }catch (Exception) { } // appversion try { ddtag = repo.DellApplicationWebServiceDAWS.DtTagAppVersion.FindSingle <DdTag>("./following-sibling::dd[][1]"); ddtag.MoveTo(); ddtext = ddtag.InnerText.Trim(); Validate.AreEqual(ddtext, varAppVersion, "Check Custom Event AppVersion, actual = {0}, expect = {1}"); }catch (Exception) { } // EventTypeName try { ddtag = repo.DellApplicationWebServiceDAWS.DtTagEventTypeName.FindSingle <DdTag>("./following-sibling::dd[][1]"); ddtag.MoveTo(); ddtext = ddtag.InnerText.Trim(); Validate.AreEqual(ddtext, TestSuite.Current.Parameters["eventTypeName"].ToString(), "Check Custom Event Type Name, actual = {0}, expect = {1}"); }catch (Exception) { } //Event Created Date Time try { ddtag = repo.DellApplicationWebServiceDAWS.DtTagEventCreatedDateTime.FindSingle <DdTag>("./following-sibling::dd[][1]"); ddtag.MoveTo(); ddtext = ddtag.InnerText.Trim(); //convert ddtext to date string[] arrListStr = ddtext.Split(' '); ddtext = Convert.ToDateTime(arrListStr[0]).ToString("dd/MM/yyyy"); //Report.Failure(ddtext+TestSuite.Current.Parameters["eventTypeName"].ToString()); //DateTime datetoday = DateTime.Today; string dateTime = System.DateTime.Today.ToString("dd/MM/yyyy"); Validate.AreEqual(ddtext, dateTime, "Check Event Created Date Time, actual = {0}, expect = {1}"); }catch (Exception) { } //Event Date Time try { ddtag = repo.DellApplicationWebServiceDAWS.DtTagEventDateTime.FindSingle <DdTag>("./following-sibling::dd[][1]"); ddtag.MoveTo(); ddtext = ddtag.InnerText.Trim(); //convert ddtext to date string[] arrListStr = ddtext.Split(' '); ddtext = Convert.ToDateTime(arrListStr[0]).ToString("dd/MM/yyyy"); string dateTime = System.DateTime.Today.ToString("dd/MM/yyyy"); Validate.AreEqual(ddtext, dateTime, "Check Event Date Time, actual = {0}, expect = {1}"); }catch (Exception) { } Delay.Seconds(5); }