/** * Initialise the screenshot capture and link to issue/test case id * * @param testMethod - Test method passed from the test script */ private static void initialiseNewScreenshotCapture(Method testMethod) { if (ScreenshotCapture.isRequired()) { String testID = "n/a"; try { testID = testMethod.getName(); } catch (NullPointerException e) { logger.debug("No test method defined."); } try { testID = testMethod.getAnnotation(Issue.class).value(); } catch (NullPointerException e) { logger.debug("No Issue defined."); } try { testID = testMethod.getAnnotation(TestCaseId.class).value(); } catch (NullPointerException e) { logger.debug("No Test Case ID defined."); } capture.set(new ScreenshotCapture(testID, driverType.get().getDriver())); } }
/** @return - Screenshot capture object for the current test */ public static ScreenshotCapture getCapture() { return capture.get(); }
/** * Returns the webdriver object for that given thread * * @return - WebDriver object */ public static WebDriverWrapper getDriver() { return driverType.get().getDriver(); }
/** Ran as part of the initialiseDriverObject, configures parts of the driver */ private static void configureDriverBasedOnParams() { requiresReset.set(driverType.get().resetBrowser(requiresReset.get())); driverType.get().maximiseBrowserWindow(); setUserAgent(); }