String fullUrlWithPath = BrowserUtils.buildUrl(url, path, urlConfig.envMapping); final List<String> beforeFileNamesList = fileService.getFilenamesForStep(path, url, BEFORE); final List<String> afterFileNamesList = new ArrayList<>(); beforeFileNamesList.forEach(filename -> afterFileNamesList.add(switchAfterWithBeforeInFileName(filename))); final Set<String> afterFileNamesSet = new HashSet<>(fileService.getFilenamesForStep(path, url, AFTER));
when(fileService.getFilenamesForStep("/", "http://url", "before")).thenReturn(ImmutableList.of("http_url_root_ff3c40c_1001_02002_before.png")); when(fileService.getFilenamesForStep("/", "http://url", "after")).thenReturn(ImmutableList.of("http_url_root_ff3c40c_1001_02002_after.png", "http_url_root_ff3c40c_1001_03003_after.png")); BufferedImage beforeBuffer = ImageIO.read(new File("src/test/resources/screenshots/http_url_root_ff3c40c_1001_02002_before.png")); when(fileService.readScreenshot("http_url_root_ff3c40c_1001_02002_before.png")).thenReturn(
@Test public void shouldFindBeforeImages() throws IOException { runStepConfig = jLineupRunConfigurationBuilder() .withWorkingDirectory("src/test/resources") .withScreenshotsDirectory("screenshots") .withReportDirectory("report") .build(); FileService fileService = new FileService(runStepConfig); //when List<String> beforeFiles = fileService.getFilenamesForStep("/", "http://url", BEFORE); //then assertThat(beforeFiles, is(ImmutableList.of("http_url_root_ff3c40c_1001_02002_before.png"))); }
@Test public void shouldFindAfterImages() throws IOException { runStepConfig = jLineupRunConfigurationBuilder() .withWorkingDirectory("src/test/resources") .withScreenshotsDirectory("screenshots") .withReportDirectory("report") .build(); FileService fileService = new FileService(runStepConfig); //when List<String> afterFiles = fileService.getFilenamesForStep("/", "http://url", AFTER); //then assertThat(afterFiles, is(ImmutableList.of("http_url_root_ff3c40c_1001_02002_after.png", "http_url_root_ff3c40c_1001_03003_after.png"))); }