Last modified: 2014-11-04 16:36:49 UTC
Reiterating Phabricator task T600 here by request. The following code within a step definition fails, raising an exception with the message TODO. The element referenced does not exist on the page, so since it is within a pending block, it should pass (unless I'm misunderstanding the use cases of pending). pending do on(HomePage) { |page| expect(page.big_image_element).to be_visible } end After taking a look at the StrictPending module within Selenium, it seems likely this is actually a Cucumber bug (since no todo statements are found), but it would be nice to have a workaround.
Can you link to the code for this test?
Also, please run cucumber with the --backtrace option and provide the backtrace. That will help in tracking down the strange TODO exception.
FWIW: in my Scenario I have a step Background: Given I am logged in And This is my step and I have put this in my steps file: Given(/^This is my step$/) do pending # express the regexp above with the code you wish you had end then when I run the test I see Background: Given I am logged in And This is my step TODO (Cucumber::Pending) ./features/step_definitions/action_menu_permalink_steps.rb:43:in `/^This is my step$/' features/action_menu_permalink.feature:6:in `And This is my step' and in the result I see: 3 scenarios (2 skipped, 1 pending) 28 steps (26 skipped, 1 pending, 1 passed) 0m19.235s
Sorry for the long delay in response to this, somehow the email slipped by me. I've uploaded the following patch as an example case of this bug: https://gerrit.wikimedia.org/r/#/c/170942/ And here is the result of running the command with "--backtrace" enabled; note that at the end I have a different result than the above comment with 1 failure and 0 pending: $ bundle exec cucumber features/news.feature --backtrace Feature: News Scenario: Content elements should be visible # features/news.feature:3 Given I am on the news page # features/step_definitions/news_steps.rb:1 Then I should see a carousel # features/step_definitions/news_steps.rb:5 TODO (MediawikiSelenium::StrictPending::Pending) /Library/Ruby/Gems/2.0.0/gems/mediawiki_selenium-0.4.0/lib/mediawiki_selenium/support/modules/strict_pending.rb:17:in `rescue in pending' /Library/Ruby/Gems/2.0.0/gems/mediawiki_selenium-0.4.0/lib/mediawiki_selenium/support/modules/strict_pending.rb:14:in `pending' /Users/jhobson/wmf/v/mediawiki/extensions/ZeroPortal/tests/browser/features/step_definitions/news_steps.rb:6:in `block in <top (required)>' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/core_ext/instance_exec.rb:48:in `block in cucumber_instance_exec' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/rb_support/rb_step_definition.rb:97:in `invoke' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/step_match.rb:25:in `invoke' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/step_invocation.rb:60:in `invoke' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/step_invocation.rb:38:in `accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:106:in `block in visit_step' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:170:in `broadcast' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:105:in `visit_step' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/step_collection.rb:19:in `block in accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/step_collection.rb:18:in `each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/step_collection.rb:18:in `accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:100:in `block in visit_steps' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:170:in `broadcast' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:99:in `visit_steps' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:15:in `block in execute' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:83:in `block (2 levels) in with_hooks' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:99:in `before_and_after' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:82:in `block in with_hooks' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:120:in `call' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:120:in `block (3 levels) in around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/language_support/language_methods.rb:9:in `block in around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/language_support/language_methods.rb:97:in `call' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/language_support/language_methods.rb:97:in `execute_around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/language_support/language_methods.rb:8:in `around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:119:in `block (2 levels) in around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:123:in `call' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:123:in `around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:94:in `around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:81:in `with_hooks' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:13:in `execute' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/scenario.rb:32:in `block in accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/scenario.rb:79:in `with_visitor' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/scenario.rb:31:in `accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:58:in `block in visit_feature_element' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:170:in `broadcast' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:57:in `visit_feature_element' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/feature.rb:38:in `block in accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/feature.rb:37:in `each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/feature.rb:37:in `accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:27:in `block in visit_feature' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:170:in `broadcast' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:26:in `visit_feature' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/features.rb:28:in `block in accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/features.rb:17:in `each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/features.rb:17:in `each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/features.rb:27:in `accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:21:in `block in visit_features' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:170:in `broadcast' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/ast/tree_walker.rb:20:in `visit_features' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:49:in `run!' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/lib/cucumber/cli/main.rb:47:in `execute!' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.17/bin/cucumber:13:in `<top (required)>' /usr/bin/cucumber:23:in `load' /usr/bin/cucumber:23:in `<main>' features/news.feature:5:in `Then I should see a carousel' And I should see some posts # features/step_definitions/news_steps.rb:11 And I should see a list of categories # features/step_definitions/news_steps.rb:17 And I should see the archives # features/step_definitions/news_steps.rb:23 And I should see contact info # features/step_definitions/news_steps.rb:29 Failing Scenarios: cucumber features/news.feature:3 # Scenario: Content elements should be visible 1 scenario (1 failed) 6 steps (1 failed, 4 skipped, 1 passed) 0m6.290s