.withBrowser(FIREFOX) .withUrls(ImmutableMap.of("http://testurl", urlConfig)) .withWindowHeight(100)
.withBrowser(CHROME_HEADLESS) .withUrls(ImmutableMap.of("testurl", urlConfig)) .withWindowHeight(100)
.withBrowser(FIREFOX) .withUrls(ImmutableMap.of("http://testurl", urlConfig)) .withWindowHeight(100)
.withBrowser(FIREFOX) .withUrls(ImmutableMap.of("http://testurl", urlConfig)) .withWindowHeight(100)
@Test public void shouldSanitizeJobConfig() throws BrowserNotInstalledException { //Given JobConfig evilJobConfig = copyOfBuilder(exampleConfig()) .withBrowser(CHROME_HEADLESS) .withThreads(Integer.MAX_VALUE) .withDebug(true) .withLogToFile(true) .withReportFormat(1) .build(); //When JobConfig sanitizedJobConfig = jLineupRunnerFactory.sanitizeJobConfig(evilJobConfig); //Then assertThat(sanitizedJobConfig.threads, is(jLineupWebProperties.getMaxThreadsPerJob())); assertThat(sanitizedJobConfig.debug, is(false)); assertThat(sanitizedJobConfig.logToFile, is(false)); assertThat(sanitizedJobConfig.reportFormat, is(DEFAULT_REPORT_FORMAT)); }
public static Builder copyOfBuilder(JobConfig jobConfig) { return configBuilder() .withName(jobConfig.name) .withUrls(jobConfig.urls) .withHttpCheck(jobConfig.httpCheck) .withBrowser(jobConfig.browser) .withGlobalWaitAfterPageLoad(jobConfig.globalWaitAfterPageLoad) .withPageLoadTimeout(jobConfig.pageLoadTimeout) .withWindowHeight(jobConfig.windowHeight) .withThreads(jobConfig.threads) .withScreenshotRetries(jobConfig.screenshotRetries) .withReportFormat(jobConfig.reportFormat) .withGlobalTimeout(jobConfig.globalTimeout) .withDebug(jobConfig.debug) .withLogToFile(jobConfig.logToFile) .withCheckForErrorsInLog(jobConfig.checkForErrorsInLog); }
private JobConfig localTestConfig(String endpoint, Browser.Type browser, boolean checkForErrors, UrlConfig urlConfig) { return JobConfig.configBuilder().withCheckForErrorsInLog(checkForErrors).withUrls(ImmutableMap.of("http://localhost:" + port + "/" + endpoint, urlConfig)).withBrowser(browser).build(); }
@Test public void shouldFailIfBrowserIsNotConfigured() { JobConfig jobConfig = copyOfBuilder(createTestConfig()).withBrowser(Browser.Type.FIREFOX).build(); expectStatusCodeForConfig(jobConfig, UNPROCESSABLE_ENTITY.value()); }
@Test public void shouldGetPhantomJSDriver() { final JobConfig jobConfig = configBuilder().withBrowser(PHANTOMJS).build(); assertSetDriverType(jobConfig, PhantomJSDriver.class); }
@Test public void shouldGetChromeDriverForHeadlessChrome() { final JobConfig jobConfig = configBuilder().withBrowser(CHROME_HEADLESS).build(); assertSetDriverType(jobConfig, ChromeDriver.class); }
@Test(expected = BrowserNotInstalledException.class) public void shouldThrowBrowserNotInstalledException() throws BrowserNotInstalledException { // Given JobConfig jobConfig = copyOfBuilder(exampleConfig()) .withBrowser(FIREFOX) .build(); //When jLineupRunnerFactory.sanitizeJobConfig(jobConfig); }
@Test public void shouldGetFirefoxDriver() { final JobConfig jobConfig = configBuilder().withBrowser(FIREFOX).build(); assertSetDriverType(jobConfig, FirefoxDriver.class); }
@Test public void shouldGetChromeDriver() { final JobConfig jobConfig = configBuilder().withBrowser(CHROME).build(); assertSetDriverType(jobConfig, ChromeDriver.class); }