behat-screenshot icon indicating copy to clipboard operation
behat-screenshot copied to clipboard

Screenshot only works on javascript scenarios?

Open golddragon007 opened this issue 6 years ago • 5 comments

I have this settings:

  extensions:
    Behat\MinkExtension:
      browser_name: 'chrome'
      goutte: ~
      selenium2:
        wd_host: 'http://localhost:4444/wd/hub'
        browser: 'chrome'
        capabilities:
          browser: 'chrome'
          chrome:
            switches:
            - "--headless"
            - "--disable-gpu"
      javascript_session: 'selenium2'
      base-url: 'http://localhost:8080/my-site'
      files_path: '/home/user/environment/my-site'
    Drupal\DrupalExtension:
      api_driver: 'drupal'
      blackbox: ~
      drupal:
        drupal_root: '/home/user/environment/my-site'
      selectors:
        message_selector: '.messages'
        error_message_selector: '.messages.error'
        success_message_selector: '.messages.status'
      subcontexts:
        paths:
        - '/home/user/environment/my-site/sites/default'
      drush:
        alias: 'default'
        binary: '/home/user/environment/my-site/vendor/package/toolkit/bin/drush'
      region_map:
        header: "#layout-header"
        featured: ".region-featured-wrapper"
        content_top: ".content-top"
        content: "#content-wrapper"
        left sidebar: "#sidebar-left"
        right sidebar: "#sidebar-right"
        footer: "#layout-footer"
    Bex\Behat\ScreenshotExtension:
      screenshot_taking_mode: failed_scenarios
      image_drivers:
        local:
          screenshot_directory: '/home/user/environment/my-site/tests/screenshots'
          clear_screenshot_directory: true
  formatters:
    pretty: ~

And I noticed it only creates screenshots from the failed scenarios if the scenario is annotated as a javascript scenario. It's not possible to create screenshot if it's not annotated like that? And some why on the screenshot I can see only the text without css... But form the browser it works...

golddragon007 avatar Dec 20 '18 09:12 golddragon007

Yup, only @javascript for now. See #44 and #45.

normanlolx avatar Dec 20 '18 09:12 normanlolx

Hmmm.. it strange, if I set browser_name: 'selenium2' and I delete goutte: ~ then it makes from the non JS scenarios too.

golddragon007 avatar Dec 20 '18 12:12 golddragon007

Seems you made Selenium default, no?

normanlolx avatar Dec 20 '18 12:12 normanlolx

Probably yes, I don't know too much from these options.

golddragon007 avatar Dec 20 '18 13:12 golddragon007

@golddragon007 Your default mink driver is goutte and that driver doesn't support screenshot taking... when you use the @javascript tag then the selenium2 is used which supports screenshot taking therefore you see screenshots.

One possible solution is to set selenium as default driver. See this comment for more detail: https://github.com/elvetemedve/behat-screenshot/issues/38#issuecomment-315193651

Also related: https://github.com/elvetemedve/behat-screenshot/issues/22

tkotosz avatar Dec 22 '18 10:12 tkotosz