public void FillLocationOfEvent(string location)
        {
            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#location")));
            wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#location")));
            bool      textNotEntered = true;
            Stopwatch timer          = new Stopwatch();

            timer.Start();
            while (textNotEntered)
            {
                locationOfEvent.SendKeys(location);
                try
                {
                    wait.Until(ExpectedConditions.TextToBePresentInElementValue(locationOfEvent, location));
                    textNotEntered = false;
                }
                catch (WebDriverTimeoutException t)
                {
                    locationOfEvent.Clear();
                }
                if (timer.Elapsed.Seconds > 10)
                {
                    textNotEntered = false;
                    ReportLog.Fail("Couldn't input location.");
                    throw new WebDriverTimeoutException("Couldn't input location.");
                }
            }
            Assert.AreEqual(location, locationOfEvent.GetAttribute("value"));
            ReportLog.Log("Filled location of event as: " + location);
        }
Exemplo n.º 2
0
        public ReportLog Update(ReportLog obj)
        {
            ReportLogBO reportlogBO = new ReportLogBO(obj);

            reportlogDao.Update(reportlogBO);
            return(obj);
        }
Exemplo n.º 3
0
 public void BeforeSetup()
 {
     testContext = TestContext.CurrentContext;
     _test       = _extent.CreateTest(testContext.Test.MethodName);
     TestLog     = ReportLog.InitializeTestReporting(testContext.Test.MethodName);
     driver      = Initialize(testContext);
 }
Exemplo n.º 4
0
        public void Cleanup()
        {
            if (testContext.Result.Outcome.Status.ToString() == "Passed")
            {
                TestLog.Log(Status.Pass, "Test passed");
            }
            else if (testContext.Result.Outcome.Status.ToString() == "Failed")
            {
                TestLog.Log(Status.Fail, "Test failed");

                try
                {
                    TestLog.Log(Status.Fail, "Error Message" + GetErrorMessage(context));
                }
                catch (Exception)
                {
                    TestLog.Log(Status.Fail, "Unable to capture error message");
                }

                try
                {
                    TestLog.Log(Status.Fail, "Stack Trace: " + GetStackTrace(context));
                }
                catch (Exception)
                {
                    TestLog.Log(Status.Fail, "Unable to capture stack trace");
                }
            }

            //Screenshot(TestContext);
            //Common.CloseApplication();
            ReportLog.Flush();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns a IFilesContainer that best fits the metadata object requirements.
        /// </summary>
        /// <param name="metadata">ReportLog object used to recover the IFilesContainer</param>
        /// <returns>The IFilesContainer object</returns>
        private IFilesContainer GetStorage(ReportLog metadata)
        {
            var    cf     = Catalog.Factory.Resolve <IConfig>();
            string tenant = string.Empty;

            if (!string.IsNullOrWhiteSpace(metadata.TenantRoute))
            {
                var tenantUri = new Uri(metadata.TenantRoute);
                tenant = tenantUri.Segments.Count() > 1 ? tenantUri.Segments[1] : string.Empty;
            }

            if (string.IsNullOrWhiteSpace(tenant))
            {
                tenant = "global";
            }

            var containerBase = cf.Get(CommonConfiguration.DistributedFileShare, DefaultBaseContainer);

            var container = cf.Get(ReportDataStorageLocalConfig.OptionalContainerName, DefaultContainer);

            var containerHost = Path.Combine(containerBase, container);

            var fc = Catalog.Preconfigure()
                     .Add(BlobContainerLocalConfig.ContainerHost, containerHost)
                     .Add(BlobContainerLocalConfig.ContainerName, tenant)
                     .ConfiguredResolve <IFilesContainer>();

            return(fc);
        }
Exemplo n.º 6
0
        public void validateLoadPage()
        {
            ReportLog.Log(LogStatus.Pass, "Test started");
            HomePage homepage = new HomePage(getDriver);

            Assert.IsTrue(homepage.getTitle().Text == "Become A Full-Stack .Net Developer", "Title not matched");
        }
Exemplo n.º 7
0
        public static void CreateCompositeReport(ReportLog whal, CancellationToken cancellationToken,
                                                 IDocumentSession ds, Guid subReportId, ReportPeriods subReportPeriod,
                                                 Action <ReportObject> compositeOperation)
        {
            var qry = from report in ds.Query <ReportLog>()
                      where report.Task.ReportPeriod == subReportPeriod &&
                      report.Task.TaskId == subReportId &&
                      report.StartingPeriod >= whal.StartingPeriod &&
                      report.EndingPeriod <= whal.EndingPeriod
                      orderby report.StartingPeriod
                      select report;

            var compositePartReports = qry.GetAllUnSafe();

            // TODO: doing this all in memory could easily get out of hand ...
            if (compositePartReports.Any())
            {
                var reportStorage = Catalog.Factory.Resolve <IReportDataStorage>();

                foreach (var it in compositePartReports)
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    var reportObject = reportStorage.LoadReportData(it);
                    compositeOperation(reportObject);
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates a list of T objects containing the data associated to a ReportLog object
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="reportLog">ReportLog Object from which the data will be recovered</param>
        /// <param name="tagFilter">Tag object to be used as filter.</param>
        /// <param name="tagCategoryColumn">Catagory of the tags that will re recovered</param>
        /// <param name="assignTag">Function that assign a Tag to the ReportLog object</param>
        /// <param name="getTags">Function that returns the tags of the T object</param>
        /// <returns></returns>
        private IEnumerable <T> FetchReportData <T>(ReportLog reportLog, Tag tagFilter, string tagCategoryColumn,
                                                    Action <T, string> assignTag, Func <T, IList <Tag> > getTags)
        {
            var rs           = Catalog.Factory.Resolve <IReportDataStorage>();
            var reportObject = rs.LoadReportData(reportLog);
            var data         = reportObject.ReportData as List <T>;

            if (null == data)
            {
                throw new InvalidOperationException(string.Format("Report data for report {0} is unexpectedly {1}", reportLog.Id, reportObject.ReportData.GetType()));
            }

            if (null != tagCategoryColumn)
            {
                ExtractTagValueToColumn(data, tagCategoryColumn, assignTag, getTags);
            }

            if (null == tagFilter)
            {
                return(data);
            }

            return(from it in data
                   where getTags(it).Any(tg => tg.Category.Name == tagFilter.Category.Name && tg.Value == tagFilter.Value)
                   select it);
        }
Exemplo n.º 9
0
        public static void CreateCompositeReport <T>(ReportLog whal, CancellationToken cancellationToken,
                                                     IDocumentSession ds, Guid subReportId, ReportPeriods subReportPeriod)
        {
            var qry = from report in ds.Query <ReportLog>()
                      where report.Task.ReportPeriod == subReportPeriod &&
                      report.Task.TaskId == subReportId &&
                      report.StartingPeriod >= whal.StartingPeriod &&
                      report.EndingPeriod <= whal.EndingPeriod
                      orderby report.StartingPeriod
                      select report;

            var compositePartReports = qry.GetAllUnSafe();

            // TODO: doing this all in memory could easily get out of hand ...
            if (compositePartReports.Any())
            {
                var reportStorage   = Catalog.Factory.Resolve <IReportDataStorage>();
                var compositeEvents = new List <T>();
                foreach (var it in compositePartReports)
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    var reportObject = reportStorage.LoadReportData(it);
                    var subReport    = reportObject.ReportData as List <T>;
                    compositeEvents.AddRange(subReport);
                }

                cancellationToken.ThrowIfCancellationRequested();

                reportStorage.StoreReportData(whal, compositeEvents);
                whal.DataType = typeof(T);
                ds.Store(whal);
                ds.SaveChanges();
            }
        }
        public void SelectPersonReporting()
        {
            var personReportingSelectElement = new SelectElement(this.personReportingSelect);

            personReportingSelectElement.SelectByIndex(1);
            Assert.AreEqual("Worker", personReportingSelectElement.SelectedOption.Text);
            ReportLog.Log("Selected Person Reporting as " + personReportingSelectElement.SelectedOption.Text);
        }
        public void ClickBurnAilment()
        {
            burnAilment.Click();
            var burn = driver.FindElement(By.CssSelector("#detail_desc_table > tbody > tr > td:nth-child(4)")).Text;

            Assert.AreEqual("Burn", burn);
            ReportLog.Log("Clicked burn ailment");
        }
Exemplo n.º 12
0
        /// <summary>
        /// Returns the ReportObject associated to ReportLog that was saved previously.
        /// </summary>
        /// <param name="metadata">Metadata object used to recover the ReportObject</param>
        /// <returns>ReportObject associated to the metadata</returns>
        public ReportObject LoadReportData(ReportLog metadata)
        {
            var fc  = this.GetStorage(metadata);
            var raw = fc.Get(metadata.Id);
            var ro  = this.Decompress(raw);

            return(ro);
        }
Exemplo n.º 13
0
 /// <summary>
 ///  Returns a IEnumerable of T object that implements from ITaggeable
 /// </summary>
 /// <typeparam name="T">T class must be a ITaggeable class</typeparam>
 /// <param name="reportLog">ReportLog object from which data will be recovered.</param>
 /// <param name="tagFilter">Tag object filter</param>
 /// <param name="tagCategoryColumn">String the tag category to be used as filter.</param>
 /// <returns></returns>
 public IEnumerable <T> GetCountData <T>(ReportLog reportLog,
                                         Tag tagFilter            = null,
                                         string tagCategoryColumn = null) where T : ITaggeable
 {
     return(this.FetchReportData <T>(reportLog, tagFilter, tagCategoryColumn,
                                     (sample, s) => sample.ReportTagValue = s,
                                     sample => (sample.ForTag == null) ? Enumerable.Empty <Tag>().ToList() : EnumerableEx.OfOne(sample.ForTag).ToList()));
 }
Exemplo n.º 14
0
 /// <summary>
 /// Returns an IEnumerable of T object that implement ITaggeableEvent
 /// </summary>
 /// <typeparam name="T">T class must implement the ItaggeableEvent interface</typeparam>
 /// <param name="reportLog">Report Object from which data will be recovered</param>
 /// <param name="tagFilter">Tag object to be used as filter</param>
 /// <param name="tagCategoryColumn">String containing the tag category filter</param>
 /// <returns></returns>
 public IEnumerable <T> GetReportData <T>(ReportLog reportLog,
                                          Tag tagFilter            = null,
                                          string tagCategoryColumn = null) where T : ITaggeableEvent
 {
     return(this.FetchReportData <T>(reportLog, tagFilter, tagCategoryColumn,
                                     (@event, s) => @event.ReportTagValue = s,
                                     @event => @event.DeviceTags));
 }
Exemplo n.º 15
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        try
        {
            ReportFuelService faqsBSO = new ReportFuelService();

            if (ReportId > 0)
            {
                string strPath = Server.MapPath("~/UserFile/Report/");
                if (fAttach.HasFile)
                {
                    try
                    {
                        Random rand        = new Random();
                        string strFilename = "";
                        strFilename = memVal.UserName + "_BC1_" + ReportYear + "_" + rand.Next(100) + System.IO.Path.GetExtension(fAttach.FileName).ToLower();

                        if (System.IO.File.Exists(strPath + strFilename))
                        {
                            strFilename = memVal.UserName + "_BC1_" + ReportYear + "_" + rand.Next(100) + System.IO.Path.GetExtension(fAttach.FileName).ToLower();
                        }
                        fAttach.PostedFile.SaveAs(strPath + strFilename);

                        ReportAttachFile reportAtt = new ReportAttachFile();
                        reportAtt.ReportId   = ReportId;
                        reportAtt.PathFile   = strFilename;
                        reportAtt.Created    = DateTime.Now;
                        reportAtt.ActionName = "DN đã gửi báo cáo cho SCT";
                        reportAtt.Comment    = txtContent.Text;
                        reportAtt.UserId     = memVal.UserId;
                        reportAtt.UserName   = memVal.UserName;
                        reportAtt.ReportType = Convert.ToInt32(LogType.ANNUALREPORT);
                        new ReportAttachFileService().Insert(reportAtt);
                    }
                    catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "sendreport", "ShowDialogSend();", true); return; }
                }

                if (faqsBSO.UpdateStatusEnterprise(ReportId, 1) != null)
                {
                    ReportLog log = new ReportLog();
                    log.ActionName = "DN đã gửi báo cáo cho SCT";
                    //log.Comment = txtNote.Text;
                    log.ReportId = ReportId;
                    log.Created  = DateTime.Now;
                    log.MemberId = memVal.UserId;
                    log.UserName = memVal.UserName;
                    log.Status   = "Đã gửi báo cáo";
                    log.LogType  = Convert.ToInt32(LogType.ANNUALREPORT);
                    new ReportLogService().Insert(log);
                    Response.Redirect(ResolveUrl("~") + "dn-su-dung-nang-luong.aspx");
                }
            }
        }
        catch (Exception ex)
        {
            clientview.Text = ex.Message.ToString();
        }
    }
        public void SetEventDate(string date)
        {
            eventDate.SendKeys(date);
            wait.Until(ExpectedConditions.TextToBePresentInElementValue(eventDate, date));
            var dateValue = eventDate.GetAttribute("value");

            Assert.AreEqual(date, dateValue);
            ReportLog.Log("Set event date as: " + date);
        }
        public void EditAnEventItem()
        {
            // Set up the test in ReportLog wrapper class.
            ReportLog.CreateTest("EditAnEventItem", "This is an end-to-end test case regarding the editing of an Event.");
            try
            {
                // Log in.
                LoginPage loginPage = new LoginPage(driver);
                loginPage.NavigateToLoginPage();
                ReportLog.Log("Navigated to Login Page.");
                loginPage.TypeUserName("plan.6");
                loginPage.TypePassword("plan01#");
                ReportLog.Log("Entered credentials.");

                // Go to home page.
                HomePage homePage = loginPage.ConfirmLoginAndGoBackToHomePage();
                homePage.WaitUntilHomePageLoadingComplete();
                ReportLog.Log("Login confirmed and redirected back to Home Page.");

                // Go to events page.
                EventsPage eventsPage = homePage.GoToEventsPage();
                eventsPage.WaitUntilEventsPageLoadingComplete();
                ReportLog.Log("Navigated to Events Page.");

                // Go to event item page of a specific item.
                EventsItemPage eventsItemPage = eventsPage.GoToSpecificEventsItemPage(0);
                eventsItemPage.WaitUntilEventsItemPageLoadingComplete();
                ReportLog.Log("Go to the editing page of a specific item.");

                // Input mandatory values, save changes and extract item reference ID.
                string referenceID = eventsItemPage.InputMandatoryChangesAndSave().Substring(13);
                ReportLog.Log("Mandatory fields inputted and changes saved.");

                // Search for this specific item.
                eventsPage.SearchByReferenceID(referenceID, false, true);
                try
                {
                    // Assertion.
                    eventsPage.ConfirmEventEdited(referenceID);
                    ReportLog.Pass("EditAnEventItem.");
                }
                catch (AssertionException a)
                {
                    // Test failed due to assertion error.
                    ReportLog.Fail(a.Message, ReportLog.TakeScreenShot("AddAnEventItemViaPortal", driver));
                    throw a;
                }
                driver.Quit();
            }
            catch (Exception e)
            {
                // Test failed due to unforeseen exception.
                ReportLog.Fail(e.Message + "\n" + e.StackTrace);
                ReportLog.Fail("UnforeseenException", ReportLog.TakeScreenShot("UnforeseenException", driver));
                throw e;
            }
        }
        public void SelectSubject()
        {
            var subjectSelectElement = new SelectElement(subjectSelect);

            subjectSelectElement.SelectByIndex(2);
            string selectedSubject = subjectSelectElement.SelectedOption.Text;

            Assert.AreEqual("Biological agencies", selectedSubject);
            ReportLog.Log("Selected the subject: Biological agencies.");
        }
 public void SelectPersonReportingName()
 {
     personReportingName.SendKeys("Charles Worker");
     Assert.AreEqual("Charles Worker", personReportingName.GetAttribute("value"));
     ReportLog.Log("Input name \"Charles Worker\".");
     wait.Until(ExpectedConditions.ElementIsVisible(By.PartialLinkText("Charles Worker")));
     driver.FindElement(By.PartialLinkText("Charles Worker")).Click();
     Assert.AreEqual("Charles Worker", personReportingName.GetAttribute("value"));
     ReportLog.Log("Selected person reporting name as: \"Charles Worker\"");
 }
        public void ClickRespiratoryRadioButton()
        {
            respiratoryRadioButtonLink.Click();
            wait.Until(ExpectedConditions.ElementIsVisible(
                           By.CssSelector("#body-area-data-table > tbody > tr.odd.active > td")));
            IWebElement lungs = driver.FindElement(By.CssSelector("#body-area-data-table > tbody > tr.odd.active > td"));

            Assert.AreEqual("Lungs", lungs.Text);
            ReportLog.Log("Clicked respiratory radio button");
        }
Exemplo n.º 21
0
 public void PurgeAllLogMessages()
 {
     MainLog.PurgeMessages();
     ChatLog.PurgeMessages();
     WhisperLog.PurgeMessages();
     CheatLog.PurgeMessages();
     AdminLog.PurgeMessages();
     ReportLog.PurgeMessages();
     MiscLog.PurgeMessages();
 }
        public void ClickSaveButton()
        {
            saveButton.Click();
            wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.CssSelector("#vaultModal > div > div > div.modal-header > h4")));
            string success = driver.FindElement(By.CssSelector("#vaultModal > div > div > div.modal-body > p")).Text;

            Assert.AreEqual("Thank you for submitting this event. Your Item Reference is:", success.Substring(0, 60));
            ReportLog.Log("Clicked save button.");
            referenceID = referenceIDElement.Text;
        }
Exemplo n.º 23
0
    protected void btnSaveFeedback_Click(object sender, EventArgs e)
    {
        ReportLog log = new ReportLog();

        log.ActionName = "DN gửi ý kiến";
        log.Comment    = txtFeedback.Text;
        log.ReportId   = ReportId;
        log.Created    = DateTime.Now;
        log.MemberId   = memVal.UserId;
        log.UserName   = memVal.UserName;
        log.Status     = "Gửi ý kiến";
        log.LogType    = Convert.ToInt32(LogType.ANNUALREPORT);
        if (new ReportLogService().Insert(log) > 0)
        {
            if (fAttachFeedback.HasFile)
            {
                string strPath = Server.MapPath("~/UserFile/Report/");
                try
                {
                    string strFilename = "";
                    strFilename = memVal.UserName + "_" + ReportYear + "_" + new Random(10).Next(100) + System.IO.Path.GetExtension(fAttachFeedback.FileName).ToLower();
                    if (System.IO.File.Exists(strPath + strFilename))
                    {
                        strFilename = memVal.UserName + "_" + ReportYear + "_" + new Random(10).Next(100) + System.IO.Path.GetExtension(fAttachFeedback.FileName).ToLower();
                    }
                    fAttachFeedback.PostedFile.SaveAs(strPath + strFilename);

                    ReportAttachFile reportAtt = new ReportAttachFile();
                    reportAtt.ReportId   = ReportId;
                    reportAtt.PathFile   = strFilename;
                    reportAtt.Created    = DateTime.Now;
                    reportAtt.ActionName = "SCT đã tải file báo cáo";
                    reportAtt.Comment    = txtFeedback.Text;
                    reportAtt.UserName   = memVal.UserName;
                    reportAtt.UserId     = memVal.UserId;
                    reportAtt.ReportType = Convert.ToInt32(LogType.ANNUALREPORT);
                    if (new ReportAttachFileService().Insert(reportAtt) > 0)
                    {
                        BindReportFile();
                    }
                }
                catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "sendreport", "sendreport();", true); return; }
            }
            BindLog();
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "sendFeedback", "ShowDialogFeedback();aler('Gửi không thành công, vui lòng thử lại.')", true);
        }
    }
Exemplo n.º 24
0
        static internal bool ToBoolean(string tf, ReportLog rl)
        {
            string low_tf = tf.ToLower();

            if (low_tf.CompareTo("true") == 0)
            {
                return(true);
            }
            if (low_tf.CompareTo("false") == 0)
            {
                return(false);
            }
            rl.LogError(4, "Unknown True/False value '" + tf + "'.  False assumed.");
            return(false);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Stores a ReportLog object and its object data into a IFilesContainer container.
        /// The ReportLog object and its data is stored into a ReportObject object.
        ///
        /// The Report object is compressed before it is saved.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="metadata">ReportLog object to saved</param>
        /// <param name="dataObject">Data associated to the ReportLog</param>
        public void StoreReportData <T>(ReportLog metadata, T dataObject)
        {
            if (string.IsNullOrEmpty(metadata.Id))
            {
                metadata.Id = Guid.NewGuid().ToString();
            }
            //fc is a local storage FileStoreBlobFileContainer
            var fc = this.GetStorage(metadata);
            var ro = new ReportObject
            {
                Metadata   = metadata,
                ReportData = dataObject
            };
            var compressed = this.Compress(ro);

            //save into local disk
            fc.Save(metadata.Id, compressed);
        }
 public void AddAnEventItemViaPortal()
 {
     // Set up the test in ReportLog wrapper class.
     ReportLog.CreateTest("AddAnEventItemViaPortal",
                          "This is an end-to-end test case regarding the adding of an Event via the Portal.");
     try
     {
         // Add from portal.
         var portalPage = new PortalPage(driver);
         portalPage.NavigateToPortalPage();
         // Fill out and save a new report.
         portalPage.ReportAnInjury();
         // Login in order to check Event has been added.
         var loginPage = new LoginPage(driver);
         loginPage.NavigateToLoginPage();
         var homePage = loginPage.LoginWithCredentials("plan.8", "plan01#");
         ReportLog.Log("Submitted login details.");
         // Now check if the event has been added.
         var eventsPage = new EventsPage(driver);
         eventsPage.NavigateToEventsPage();
         ReportLog.Log("Navigated to Events page.");
         eventsPage.SearchByReferenceID(portalPage.GetReferenceID(), true, true);
         ReportLog.Log("Searched for reference ID: " + portalPage.GetReferenceID());
         try
         {
             // Confirm Event has been added.
             eventsPage.ConfirmEventAdded(portalPage.GetReferenceID());
             ReportLog.Pass("AddAnEventItemViaPortal Test Passed.");
         }
         catch (AssertionException a)
         {
             // Test failed due to assertion error.
             ReportLog.Fail(a.Message + "\n" + a.StackTrace, ReportLog.TakeScreenShot("AddAnEventItemViaPortal", driver));
             throw a;
         }
         driver.Quit();
     }
     catch (Exception e)
     {
         // Test failed due to unforeseen exception.
         ReportLog.Fail(e.Message + "\n" + e.StackTrace, ReportLog.TakeScreenShot("UnforeseenException", driver));
         throw e;
     }
 }
 public void ReportAnInjury()
 {
     ClickReportInjuryArrowButton();
     SelectPersonReporting();
     SelectPersonReportingName();
     ClickPersonInvolved();                       // This fills person involved automatically as above.
     FillLocationOfEvent("TEST location");
     SetEventDate("02/05/2018");
     SetEventTime("12:05");
     SelectSubject();
     FillWhatHappened("TEST what happened");
     FillWhoElseWasInvolved("TEST who else was involved");
     FillInitialActions("TEST initial actions");
     ClickRespiratoryRadioButton();
     ClickMouthBodyArea();
     ClickBurnAilment();
     ClickSaveButton();
     ReportLog.Log("Filled out report an injury.");
 }
Exemplo n.º 28
0
        /// <summary>
        /// Serializes this instance.
        /// </summary>
        public virtual void Serialize()
        {
            if (!_isStarted)
            {
                return;
            }

            TimeSpan elapsed = EndTime.Subtract(StartTime);

            Logger.Info(".......................................");
            Logger.Info(string.Format("{0,-18} : {1}", "Task Name", Name));
            if (!ShowOnlyElapsedTime)
            {
                Logger.Info(string.Format("{0,-18} : {1}", "Start Time", StartTime.ToLongTimeString()));
                Logger.Info(string.Format("{0,-18} : {1}", "End Time", EndTime.ToLongTimeString()));
            }
            Logger.Info(string.Format("{0,-18} : {1} ms", "Elapsed Time", elapsed.TotalMilliseconds));

            Fields.ForEach(item =>
            {
                if (null != item)
                {
                    Logger.Info(string.Format("{0,-18} : {1}", item.Name, item.Value));
                }
            }
                           );

            SerializeMessages();

            if (SyncLogger.EnableReportLog)
            {
                // Serialize the logs for Test Reports
                string reportLog = string.Format("{0,-40} | {1,-12} | {2,-12} | {3,-12}", Name,
                                                 StartTime.ToLongTimeString(),
                                                 EndTime.ToLongTimeString(),
                                                 elapsed.TotalMilliseconds);
                ReportLog.Dump(reportLog);
            }

            SubTasks.ForEach(item => item.Serialize());
        }
        public void CheckBusFareTestCase1()
        {
            ReportLog.CreateTest("CheckBusFares", "This is an end-to-end test case with fixed parameter values.");
            try
            {
                HomePage homePage     = new HomePage(driver);
                string   email        = "*****@*****.**";
                string   password     = "******";
                string   fromLocation = "65 Victoria St, Wellington, 6011";
                string   toLocation   = "104 Moorefield Road, Johnsonville, Wellington, New Zealand";

                // define the test steps
                void TestSteps(string from_Location, string to_Location, IWebDriver driver)
                {
                    // Log in
                    homePage.EnterCredentials(email, password);

                    // Input the journey
                    homePage.CheckPrice(from_Location, to_Location);

                    // Check the fares
                    homePage.TellPrice(from_Location, to_Location);

                    // Reset the input fields
                    homePage.ClearJourneyPlan();

                    driver.Quit();
                }

                // run test steps
                TestSteps(fromLocation, toLocation, driver);
            }
            catch (Exception e)
            {
                // Test failed due to unforeseen exception.
                ReportLog.Fail(e.Message + "\n" + e.StackTrace);
                ReportLog.Fail("UnforeseenException", ReportLog.TakeScreenShot("UnforeseenException", driver));
                throw e;
            }
        }
Exemplo n.º 30
0
 public void ConfirmEventEdited(string id)
 {
     string[] expected =
     {
         id,
         "whatever",
         "Biological agencies",
         "02/05/2018",
         "Injury",
         "Strain",
         "Worker",
         "Jack Brazier",
         "Brisbane Office",
         "No Pending",
         "Not Started"
     };
     for (int i = 0; i < expected.Length; i++)
     {
         Assert.AreEqual(expected[i], singleRowSearchResult[i]);
         ReportLog.Pass(" " + labels[i] + " matched.");
     }
 }