public UrlConfig() { this.paths = of(DEFAULT_PATH); this.windowWidths = of(DEFAULT_WINDOW_WIDTH); this.maxDiff = DEFAULT_MAX_DIFF; this.cookies = null; this.localStorage = null; this.sessionStorage = null; this.maxScrollHeight = DEFAULT_MAX_SCROLL_HEIGHT; this.waitAfterPageLoad = DEFAULT_WAIT_AFTER_PAGE_LOAD; this.waitAfterScroll = DEFAULT_WAIT_AFTER_SCROLL; this.waitForNoAnimationAfterScroll = DEFAULT_WAIT_FOR_NO_ANIMATION_AFTER_SCROLL; this.envMapping = null; this.warmupBrowserCacheTime = DEFAULT_WARMUP_BROWSER_CACHE_TIME; this.javaScript = null; this.waitForFontsTime = DEFAULT_WAIT_FOR_FONTS_TIME; this.httpCheck = new HttpCheckConfig(); this.maxColorDiffPerPixel = DEFAULT_MAX_COLOR_DIFF_PER_PIXEL; this.hideImages = false; }
public static JobConfig.Builder exampleConfigBuilder() { return configBuilder() .withUrls(ImmutableMap.of("http://www.example.com", new UrlConfig( ImmutableList.of("/", "someOtherPath"), DEFAULT_MAX_DIFF, ImmutableList.of( new Cookie("exampleCookieName", "exampleValue", "http://www.example.com", "/", new Date(1000L), true) ), ImmutableMap.of("live", "www"), ImmutableMap.of("exampleLocalStorageKey", "value"), ImmutableMap.of("exampleSessionStorageKey", "value"), ImmutableList.of(600, 800, 1000), DEFAULT_MAX_SCROLL_HEIGHT, DEFAULT_WAIT_AFTER_PAGE_LOAD, DEFAULT_WAIT_AFTER_SCROLL, DEFAULT_WAIT_FOR_NO_ANIMATION_AFTER_SCROLL, DEFAULT_WARMUP_BROWSER_CACHE_TIME, "console.log('This is JavaScript!')", DEFAULT_WAIT_FOR_FONTS_TIME, new HttpCheckConfig(true), DEFAULT_MAX_COLOR_DIFF_PER_PIXEL, false ))); }
public static Builder urlConfigBuilder() { return new Builder().withHttpCheck(new HttpCheckConfig()); }
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 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 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")); } }
@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")); } }
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); }
null, 5, new HttpCheckConfig(), 0, false);
null, 5, new HttpCheckConfig(), 0, false);
null, 5, new HttpCheckConfig(), 0, false);
"testJS();", 5, new HttpCheckConfig(), 0, true);
@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 }