use of de.otto.jlineup.config.Config in project jlineup by otto-de.
the class Main method main.
public static void main(String[] args) throws Exception {
final Parameters parameters = new Parameters();
final JCommander jCommander = new JCommander(parameters);
jCommander.parse(args);
jCommander.setProgramName("JLineup");
if (parameters.isHelp()) {
jCommander.usage();
System.out.printf("Version: %s%n", Util.getVersion());
return;
}
if (parameters.isVersion()) {
System.out.printf("JLineup version %s", Util.getVersion());
return;
}
if (parameters.isDebug()) {
Util.setLogLevelToDebug();
}
Config config = null;
try {
config = buildConfig(parameters);
} catch (FileNotFoundException e) {
System.exit(1);
}
if (parameters.isPrintConfig()) {
System.out.println(Util.createPrettyConfigJson(config));
System.exit(0);
}
JLineupOptions jLineupOptions = new JLineupOptions(parameters);
JLineup jLineup = new JLineup(config, jLineupOptions);
int errorLevel = jLineup.run();
if (errorLevel != 0) {
System.exit(errorLevel);
}
}
use of de.otto.jlineup.config.Config in project jlineup by otto-de.
the class BrowserTest method shouldNotResizeWindowWhenDoingHeadless.
@Test
public void shouldNotResizeWindowWhenDoingHeadless() throws Exception {
// given
final Long viewportHeight = 500L;
final Long pageHeight = 2000L;
UrlConfig urlConfig = new UrlConfig(ImmutableList.of("/"), 0f, ImmutableList.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of(600, 800), 5000, 0, 0, 0, 3, null, 5);
Config config = configBuilder().withBrowser(CHROME_HEADLESS).withUrls(ImmutableMap.of("testurl", urlConfig)).withWindowHeight(100).build();
testee.close();
testee = new Browser(parameters, config, fileService, browserUtilsMock);
ScreenshotContext screenshotContext = ScreenshotContext.of("testurl", "/", 600, true, urlConfig);
ScreenshotContext screenshotContext2 = ScreenshotContext.of("testurl", "/", 800, true, urlConfig);
when(webDriverMock.executeScript(JS_DOCUMENT_HEIGHT_CALL)).thenReturn(pageHeight);
when(webDriverMock.executeScript(JS_CLIENT_VIEWPORT_HEIGHT_CALL)).thenReturn(viewportHeight);
when(webDriverMock.getScreenshotAs(OutputType.FILE)).thenReturn(new File("src/test/resources/screenshots/http_url_root_ff3c40c_1001_02002_before.png"));
when(webDriverMock.executeScript(JS_RETURN_DOCUMENT_FONTS_SIZE_CALL)).thenReturn(3L);
when(webDriverMock.executeScript(JS_RETURN_DOCUMENT_FONTS_STATUS_LOADED_CALL)).thenReturn(false).thenReturn(true);
// when
testee.takeScreenshots(ImmutableList.of(screenshotContext, screenshotContext2));
verifyNoMoreInteractions(webDriverWindowMock);
}
use of de.otto.jlineup.config.Config in project jlineup by otto-de.
the class BrowserTest method shouldGetChromeDriverForHeadlessChrome.
@Test
public void shouldGetChromeDriverForHeadlessChrome() throws Exception {
final Config config = configBuilder().withBrowser(CHROME_HEADLESS).build();
assertSetDriverType(config, ChromeDriver.class);
}
use of de.otto.jlineup.config.Config in project jlineup by otto-de.
the class BrowserTest method shouldGetPhantomJSDriver.
@Test
public void shouldGetPhantomJSDriver() throws InterruptedException {
final Config config = configBuilder().withBrowser(PHANTOMJS).build();
assertSetDriverType(config, PhantomJSDriver.class);
}
use of de.otto.jlineup.config.Config in project jlineup by otto-de.
the class BrowserUtilsTest method shouldGenerateScreenshotsParameters.
@Test
public void shouldGenerateScreenshotsParameters() throws FileNotFoundException {
// given
Parameters parameters = mock(Parameters.class);
Config config = Config.readConfig(".", "src/test/resources/lineup_test.json");
when(parameters.getWorkingDirectory()).thenReturn("some/working/dir");
when(parameters.getScreenshotDirectory()).thenReturn("screenshots");
when(parameters.getUrlReplacements()).thenReturn(ImmutableMap.of("google", "doodle"));
UrlConfig expectedUrlConfigForOttoDe = getExpectedUrlConfigForOttoDe();
UrlConfig expectedUrlConfigForGoogleDe = getExpectedUrlConfigForGoogleDe();
final List<ScreenshotContext> expectedScreenshotContextList = ImmutableList.of(ScreenshotContext.of("https://www.otto.de", "/", 600, true, expectedUrlConfigForOttoDe), ScreenshotContext.of("https://www.otto.de", "/", 800, true, expectedUrlConfigForOttoDe), ScreenshotContext.of("https://www.otto.de", "/", 1200, true, expectedUrlConfigForOttoDe), ScreenshotContext.of("https://www.otto.de", "multimedia", 600, true, expectedUrlConfigForOttoDe), ScreenshotContext.of("https://www.otto.de", "multimedia", 800, true, expectedUrlConfigForOttoDe), ScreenshotContext.of("https://www.otto.de", "multimedia", 1200, true, expectedUrlConfigForOttoDe), ScreenshotContext.of("http://www.doodle.de", "/", 1200, true, expectedUrlConfigForGoogleDe));
// when
final List<ScreenshotContext> screenshotContextList = BrowserUtils.buildScreenshotContextListFromConfigAndState(parameters, config, true);
// then
assertThat(screenshotContextList, containsInAnyOrder(expectedScreenshotContextList.toArray()));
}
Aggregations