用于crossbrowser测试的Behat配置behat

时间:2015-09-07 10:34:46

标签: drupal-7 cross-browser behat

我正在使用behat 3.我的behat.yml如下所示

default:
  suites:
    default:
      contexts:
        - Drupal\DrupalExtension\Context\MinkContext
        - FeatureContext
extensions:
  Behat\MinkExtension:
    goutte: ~
    selenium2: ~
    javascript_session:  'selenium2'
    browser_name: chrome
  Drupal\DrupalExtension:
    blackbox: ~
    region_map:
      search: ".form-search"
    api_driver: "drupal"
    selectors:
      message_selector: '.messages'
      error_message_selector: '.messages.messages-error'
      success_message_selector: '.messages.messages-status'
imports:
  - behat.local.yml

behat.local.yml看起来像:

default:
  extensions:
    Behat\MinkExtension:
      # Replace with your real URL.
      base_url: http://website.com
    Drupal\DrupalExtension:
      drupal:
        drupal_root: "/home/website"

如何针对Internet Explorer运行此操作? Fyi我使用phantomjs伪造服务器上的浏览器。

1 个答案:

答案 0 :(得分:0)

在谷歌搜索后,我发现你可以通过以下方式复制配置文件:

default:
  suites:
    default:
      contexts:
        - FeatureContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MarkupContext
      filters:
        tags: "@blackbox"
      extensions:
        Behat\MinkExtension:
          goutte: ~
          zombie: ~
          base_url: http://drupal.org
          javascript_session: zombie
        Drupal\DrupalExtension:
          blackbox: ~
          region_map:
            content: "#content"
            footer: "#footer"
            left header: "#header-left"
            right header: "#header-right"
            right sidebar: "#aside-region"
          selectors:
            message_selector: '.messages'
            error_message_selector: '.messages.error'
            success_message_selector: '.messages.status'
            warning_message_selector: '.messages.warning'

# Separate profile for testing using the api driver. This assumes a
# stock Drupal 6 install.
drupal6:
  suites:
    default:
      contexts:
        - FeatureContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MarkupContext
      filters:
      tags: "@d6"
    extensions:
      Behat\MinkExtension:
        base_url: http://127.0.0.1:8888
      Drupal\DrupalExtension:
        api_driver: "drupal"
        drupal:
        # Change this to the absolute path to Drupal install.
          drupal_root: "drupal"
        region_map:
          left sidebar: "#sidebar-first"

选中此drupalextension blob