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