public UrlConfig build() { return new UrlConfig(this); } }
@Test public void shouldCheckCustomHttpStatusCodes() throws ConfigValidationException { UrlConfig urlConfig = UrlConfig.urlConfigBuilder() .withHttpCheck(new HttpCheckConfig(true, ImmutableList.of(304))) .withPaths(ImmutableList.of("/")).build(); JobConfig jobConfig = localTestConfig("200", Browser.Type.CHROME_HEADLESS, false, urlConfig); try { runJLineup(jobConfig, Step.before); fail(); } catch (Exception e) { assertThat(e.getCause().getCause().getCause().getMessage(), containsString("Accessibility check")); assertThat(e.getCause().getCause().getCause().getMessage(), containsString("returned status code 200")); } }
@Test public void shouldCheckHttpStatusCodeError() { UrlConfig urlConfig = UrlConfig.urlConfigBuilder() .withHttpCheck(new HttpCheckConfig(true)) .withPaths(ImmutableList.of("/")).build(); JobConfig jobConfig = localTestConfig("500", Browser.Type.CHROME_HEADLESS, false, urlConfig); try { runJLineup(jobConfig, Step.before); fail(); } catch (Exception e) { assertThat(e.getCause().getCause().getCause().getMessage(), containsString("Accessibility check")); assertThat(e.getCause().getCause().getCause().getMessage(), containsString("returned status code 500")); } }
public static JobConfig defaultConfig(String url) { return configBuilder().withUrls(ImmutableMap.of(url, new UrlConfig())).build(); }
@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 }
private JobConfig localTestConfig(String endpoint, Browser.Type browser, boolean checkForErrors) { return localTestConfig(endpoint, browser, checkForErrors, new UrlConfig()); }
@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); }
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); }
@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 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); }
private JobConfig createTestConfig() { return configBuilder() .withUrls(ImmutableMap.of("http://www.example.com", new UrlConfig( ImmutableList.of("/"), 0, ImmutableList.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of(600), 100000, 0, 0, 0, DEFAULT_WARMUP_BROWSER_CACHE_TIME, null, 0, new HttpCheckConfig(), 0, false ))) .build(); } }
private JobConfig createJobConfigWithUrlAndName(String url, String name) { return configBuilder() .withName(name) .withUrls(ImmutableMap.of(url, new UrlConfig( ImmutableList.of("/"), 0, ImmutableList.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of(600), 100000, 0, 0, 0, DEFAULT_WARMUP_BROWSER_CACHE_TIME, null, 0, new HttpCheckConfig(), 0, false ))) .build(); } }
@Before public void setup() { initMocks(this); runConfig = RunStepConfig.jLineupRunConfigurationBuilder().withWorkingDirectory("src/test/resources").build(); jobConfig = configBuilder() .withUrls(ImmutableMap.of( "http://url", new UrlConfig(ImmutableList.of("/"), 0.05f, null, null, null, null, ImmutableList.of(1001), 10000, 2, 0, 0, 0, null, 5, new HttpCheckConfig(),0, false))) .withWindowHeight(WINDOW_HEIGHT) .build(); testee = new ScreenshotsComparator(runConfig, jobConfig, fileService, imageService); }
final Long pageHeight = 2000L; UrlConfig urlConfig = new UrlConfig( ImmutableList.of("/"), 0f,
new Cookie("testcookiename3", "testcookievalue3") ); UrlConfig urlConfig = new UrlConfig( ImmutableList.of("/"), 0f,
); UrlConfig urlConfig = new UrlConfig( ImmutableList.of("/"), 0f,
final Long pageHeight = 2000L; UrlConfig urlConfig = new UrlConfig( ImmutableList.of("/"), 0f,