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