Capybara:是否可以在场景中仅标记“@javascript”一步?不是整个场景?

时间:2013-06-29 10:45:56

标签: ruby-on-rails-3.2 capybara capybara-webkit

Capybara文档中的示例。他们标记整个场景:

You can switch to the Capybara.javascript_driver (:selenium by default) by tagging scenarios (or features) with @javascript:

@javascript
Scenario: do something Ajaxy
  When I click the Ajax link
  ...

但我想只标记一步:

Background:
    Given I am on the homepage
    And There is a button "Click me"
    When I click the button "Click me"
    @javascript
    Then I should see a js pop-up element "Hello" within "#hello .hello"

行为可接受吗?或者我是否需要为此单击操作创建单独的@javascript标记的方案?

1 个答案:

答案 0 :(得分:0)

似乎没有。 我得到Gherkin::Parser::ParseError

../features/deleting_tickets.feature: Parse error at ../features/deleting_tickets.feature:17. 

Found step when expecting one of: examples, feature, scenario, scenario_outline, tag.
(Current state: tag). (Gherkin::Parser::ParseError)

因此又遇到了另一个缺点。