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 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 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;
            }
        }
        public void CheckBusFareTestCase2(string from_Location, string to_Location)
        {
            ReportLog.CreateTest("CheckBusFares", "This is a parameterized Test.");
            try
            {
                HomePage homePage = new HomePage(driver);
                string   email    = "*****@*****.**";
                string   password = "******";

                void TestSteps(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();
                }

                TestSteps(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;
            }
        }