Don't show "Screenshots: " in the error log when screenshots are disa… #357

Merged
merged 1 commit into from Jul 6, 2016

Projects

None yet

2 participants

@BorisOsipov
Contributor

When screenshots are disabled isn't added empty record in error log like this one:

Element not found {By.xpath: //div[@class='dataTables_scrollBody']}
Expected: exist

Screenshot:
Timeout: 5 s.
Caused by: NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class='dataTables_scrollBody']"}

@asolntsev asolntsev merged commit eb51f12 into codeborne:master Jul 6, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@asolntsev
Member

@BorisOsipov Thank you for the PR!

@asolntsev asolntsev added this to the 3.7 milestone Jul 6, 2016
@asolntsev asolntsev added a commit that referenced this pull request Jul 6, 2016
@asolntsev asolntsev #357 fix formatting 0e82f93
@asolntsev asolntsev added a commit that referenced this pull request Jul 6, 2016
@asolntsev asolntsev #357 add missing unit-test 269bd4e
@asolntsev
Member

@BorisOsipov I also added unit-test demonstrating the behaviour change:

com.codeborne.selenide.ex.ErrorMessagesTest

  @Test
  public void doesNotAddScreenshot_if_screenshotsAreDisabled() {
    Configuration.screenshots = false;

    String screenshot = ErrorMessages.screenshot();
    assertEquals("", screenshot);
    verify(screenshots, never()).takeScreenShot();
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment