运行 使用黄瓜 - 水豚 - 硒进行测试时,不会创建魅力报告

Allure Reports are not getting created when running the tests with cucumber - capybara - selenium

我正在尝试 运行 黄瓜测试用例以及水豚和 selenium webdriver。虽然 运行ning 我收到以下错误,即使所有测试用例都通过了。结果,黄瓜詹金斯的工作失败了。当我尝试打开魅力报告时,它是空白的。

谁能帮我解决这个问题?

日志跟踪:

3 scenarios (0 failed, 3 passed) 12 steps (0 failed, 12 passed) 1m8.278s

wrong number of arguments (given 1, expected 0) (ArgumentError) /Users/user/.rvm/gems/ruby-2.6.0/gems/capybara-3.12.0/lib/capybara/node/document.rb:31:in title' /Users/user/.rvm/gems/ruby-2.6.0/gems/capybara-3.12.0/lib/capybara/session.rb:738:in block (2 levels) in class:Session' /Users/user/.rvm/gems/ruby-2.6.0/gems/capybara-3.12.0/lib/capybara/dsl.rb:51:in block (2 levels) in ' /Users/user/.rvm/gems/ruby-2.6.0/gems/allure-ruby-adaptor-api-0.7.2/lib/allure-ruby-adaptor-api/builder.rb:128:in block (3 levels) in build!' /Users/user/.rvm/gems/ruby-2.6.0/gems/nokogiri-1.10.1/lib/nokogiri/xml/builder.rb:391:in insert' /Users/user/.rvm/gems/ruby-2.6.0/gems/nokogiri-1.10.1/lib/nokogiri/xml/builder.rb:375:in method_missing' /Users/user/.rvm/gems/ruby-2.6.0/gems/allure-ruby-adaptor-api-0.7.2/lib/allure-ruby-adaptor-api/builder.rb:126:in block (2 levels) in build!' /Users/user/.rvm/gems/ruby-2.6.0/gems/nokogiri-1.10.1/lib/nokogiri/xml/builder.rb:293:in initialize' /Users/user/.rvm/gems/ruby-2.6.0/gems/allure-ruby-adaptor-api-0.7.2/lib/allure-ruby-adaptor-api/builder.rb:125:in new' /Users/user/.rvm/gems/ruby-2.6.0/gems/allure-ruby-adaptor-api-0.7.2/lib/allure-ruby-adaptor-api/builder.rb:125:in block in build!' /Users/user/.rvm/gems/ruby-2.6.0/gems/allure-ruby-adaptor-api-0.7.2/lib/allure-ruby-adaptor-api/builder.rb:124:in each' /Users/user/.rvm/gems/ruby-2.6.0/gems/allure-ruby-adaptor-api-0.7.2/lib/allure-ruby-adaptor-api/builder.rb:124:in build!' /Users/user/.rvm/gems/ruby-2.6.0/gems/allure-cucumber-0.6.1/lib/allure-cucumber/formatter.rb:144:in after_features' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-3.1.2/lib/cucumber/formatter/ignore_missing_messages.rb:11:in method_missing' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-3.1.2/lib/cucumber/formatter/legacy_api/adapter.rb:136:in after' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-3.1.2/lib/cucumber/formatter/legacy_api/adapter.rb:41:in block in initialize' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/event_bus.rb:34:in block in broadcast' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/event_bus.rb:34:in each' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/event_bus.rb:34:in broadcast' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/event_bus.rb:40:in method_missing' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-3.1.2/lib/cucumber/configuration.rb:33:in notify' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:76:in run!' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in execute!' /Users/user/.rvm/gems/ruby-2.6.0/gems/cucumber-3.1.2/bin/cucumber:9:in ' /Users/user/.rvm/gems/ruby-2.6.0/bin/cucumber:23:in load' /Users/user/.rvm/gems/ruby-2.6.0/bin/cucumber:23:in

' /Users/user/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:24:in eval' /Users/user/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:24:in ' Took 70 seconds (1:10) cucumbers Failed

这里的问题是您将 Capybara::DSL 包括在全局范围内。任何相对现代的 Capybara 版本都会向控制台打印一条警告,例如 "including Capybara::DSL in the global scope is not recommended!",特别是因为它会产生各种奇怪的副作用。这是因为当你只是做

include Capybara::DSL

在任何 类 或模块之外,您最终会在项目中的每个对象上包含所有 Capybaras 方法。那不是你想要的。不看你的项目就不可能准确地说出你需要把什么放在哪里,但假设你有一个正常的项目,你可能想放

World(Capybara::DSL)
World(Capybara::RSpecMatchers)

在您的 env.rb 中,或者只需要 'capybara/cucumber' 按照指示 - https://github.com/teamcapybara/capybara#using-capybara-with-cucumber - 这将正确设置。