public static JobConfig exampleConfig() { return exampleConfigBuilder().build(); }
public static Builder urlConfigBuilder() { return new Builder().withHttpCheck(new HttpCheckConfig()); }
public JobConfig build() { return new JobConfig(this); } }
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(); }
public static JobConfig defaultConfig(String url) { return configBuilder().withUrls(ImmutableMap.of(url, new UrlConfig())).build(); }
@Test public void shouldGetFirefoxDriver() { final JobConfig jobConfig = configBuilder().withBrowser(FIREFOX).build(); assertSetDriverType(jobConfig, FirefoxDriver.class); }
@Test(expected = BrowserNotInstalledException.class) public void shouldThrowBrowserNotInstalledException() throws BrowserNotInstalledException { // Given JobConfig jobConfig = copyOfBuilder(exampleConfig()) .withBrowser(FIREFOX) .build(); //When jLineupRunnerFactory.sanitizeJobConfig(jobConfig); }
public static UrlConfig getExpectedUrlConfigForOttoDe() { return new UrlConfig(ImmutableList.of("/", "multimedia"), 0.05f, ImmutableList.of(new Cookie("testcookie1", "true"), new Cookie("testcookie2", "1")), ImmutableMap.of("live", "www"), ImmutableMap.of("teststorage", "{'testkey':{'value':true,'timestamp':9467812242358}}"), ImmutableMap.of("testsession", "{'testkey':{'value':true,'timestamp':9467812242358}}"), ImmutableList.of(600, 800, 1200), 50000, 2, 1, 0, 3, "console.log('Moin!');", 0, new HttpCheckConfig(), 1, false); }
@Test public void shouldNotCheckHttpStatusCodeErrorIfNotConfigured() throws ConfigValidationException { UrlConfig urlConfig = UrlConfig.urlConfigBuilder() .withHttpCheck(new HttpCheckConfig(false)) .withPaths(ImmutableList.of("/")).build(); JobConfig jobConfig = localTestConfig("500", Browser.Type.CHROME_HEADLESS, false, urlConfig); runJLineup(jobConfig, Step.before); //no exception }
@Test public void shouldNotAppendSlashToDomain() throws ConfigValidationException { UrlConfig urlConfig = UrlConfig.urlConfigBuilder().withCookie(new Cookie("CookieName", "CookieValue")).build(); JobConfig jobConfig = localTestConfig("params?param1=1¶m2=2", Browser.Type.CHROME_HEADLESS, true, urlConfig); runJLineup(jobConfig, Step.before); }
public static UrlConfig getExpectedUrlConfigForGoogleDe() { return new UrlConfig(ImmutableList.of("/"), 0.05f, null, null, null, null, ImmutableList.of(1200), 100000, 0, 0, 0, 0, null, 0, new HttpCheckConfig(), 1, false); }
public UrlConfig build() { return new UrlConfig(this); } }
public JobConfig() { this(configBuilder()); }
@Test public void shouldReadConfigFromDifferentPathThanWorkingDir() throws FileNotFoundException { JobConfig jobConfig = JobConfig.readConfig("someWorkingDir", "src/test/resources/lineup_test.json"); assertThatConfigContentsAreCorrect(jobConfig); }
public static JobConfig defaultConfig() { return defaultConfig(EXAMPLE_URL); }
public static Builder configBuilder() { return new Builder(); }
@Test public void shouldGetChromeDriver() { final JobConfig jobConfig = configBuilder().withBrowser(CHROME).build(); assertSetDriverType(jobConfig, ChromeDriver.class); }
@Test public void shouldSetCookieOnCorrectPath() throws ConfigValidationException { UrlConfig urlConfig = UrlConfig.urlConfigBuilder() .withCookie(new Cookie("CookieName", "CookieValue")) .withPaths(ImmutableList.of("/")).build(); JobConfig jobConfig = localTestConfig("somerootpath/somevalidsubpath", Browser.Type.CHROME_HEADLESS, true, urlConfig); runJLineup(jobConfig, Step.before); }
@Test public void shouldReadConfig() throws FileNotFoundException { JobConfig jobConfig = JobConfig.readConfig("src/test/resources/", "lineup_test.json"); assertThatConfigContentsAreCorrect(jobConfig); }