@Test public void if_a_screenshot_is_identical_to_the_previous_one_in_the_step_it_wont_be_added() throws IOException { TestStep step = new TestStep("a narrative description"); File screenshot = temporaryFolder.newFile("screenshot.png"); File source = temporaryFolder.newFile("screenshot.html"); step.addScreenshot(new ScreenshotAndHtmlSource(screenshot, source)); step.addScreenshot(new ScreenshotAndHtmlSource(screenshot, source)); assertThat(step.getScreenshots().size(), is(1)); }
@Test public void the_test_step_can_have_an_illustration() throws IOException { TestStep step = new TestStep("a narrative description"); File screenshot = temporaryFolder.newFile("screenshot.png"); File source = temporaryFolder.newFile("screenshot.html"); assertThat(step.hasScreenshots(), is(false)); step.addScreenshot(new ScreenshotAndHtmlSource(screenshot, source)); assertThat(step.hasScreenshots(), is(true)); assertThat(step.getScreenshots().get(0).getScreenshot(), is(screenshot)); assertThat(step.getScreenshots().get(0).getHtmlSource().get(), is(source)); }
@Test public void the_test_step_can_have_more_than_one_illustration() throws IOException { TestStep step = new TestStep("a narrative description"); step.addScreenshot( forScreenshotWithImage("/screenshots/google_page_1.png") .and() .withSource("screenshot.html")); step.addScreenshot( forScreenshotWithImage("/screenshots/google_page_2.png") .and() .withSource("screenshot2.html")); ScreenshotAndHtmlSource screenshot1 = step.getScreenshots().get(0); ScreenshotAndHtmlSource screenshot2 = step.getScreenshots().get(1); assertThat(screenshot1.getScreenshot().getName(), is("google_page_1.png")); assertThat(screenshot1.getHtmlSource().get().getName(), is("screenshot.html")); assertThat(screenshot2.getScreenshot().getName(), is("google_page_2.png")); assertThat(screenshot2.getHtmlSource().get().getName(), is("screenshot2.html")); assertThat(screenshot1.hashCode(), is(not(screenshot2.hashCode()))); }