Tag: 黄瓜

我可以在网页上复制文本并将其粘贴到文本文件中吗?

我有一个网页,动态显示我想要使用watir-webdriver或任何其他gem复制到文本文件中的文本。 可能吗?? 如果是的话,怎么样? 提前致谢..

变换后的Cucumber :: ArityMismatchError错误

我的步骤定义 Transform /^user “([^”]*)”$/ do | email | Person.find_by_email(email) end Given /^login as (user “([^”]*)”)$/ do | user | login_as email end 我的特色 login as user “ca@example.org” 我收到了这个错误 And user “ca@example.org” has security role “contact” # features/step_definitions/security_role_steps.rb:14 And login as user “ca@example.org” # features/step_definitions/security_role_steps.rb:10 Your block takes 1 argument, but the Regexp matched 2 arguments. […]

黄瓜矛盾的错误信息

问题背景:“使用web_steps.rb进行黄瓜声明性步骤定义”Stack Overflow Question 在对问题进行故障排除时,会出现两个相互矛盾的错误消息; 声明: When /^(?:|I )uncheck “([^”]*)”$/ do |field| check(field) end 添加到’features / step_definitions / movie_steps.rb’执行’bundle exec cucumber features / filter_movie_list.feature’会导致: Ambiguous match of “I uncheck “ratings_G””: features/step_definitions/movie_steps.rb:65:in ‘/^(?:|I )uncheck “([^”]*)”$/ features/step_definitions/web_steps.rb:65:in ‘/^(?:|I )uncheck “([^”]*)”$/ 但是,删除该步骤不会导致使用’web_steps.rb’中的步骤定义; 相反,会显示不同的错误消息: When I uncheck the following ratings: G, PG-13 # features/step_definitions/movie_steps.rb:44 Undefined step: “When I uncheck “ratings_G”” […]

黄瓜色输出根据我打印文本的位置而变化

当我直接从黄瓜的Given / When / Then语句打印输出时,它以漂亮的蓝色文本打印,但是如果我调用任何其他function并在那里打印,它会以红色打印(而不是缩进) 样品特征: Feature: Foo Scenario: Foo2 Given something Then something else 示例step_def: Given /^something$/ do puts “Pretty blue” end class AnyClass def doSomething puts “Scary red” end end Then /^something else$/ do AnyClass.new.doSomething end 在下面的示例输出中,“可怕的红色”是红色的,根本没有缩进,实际上在黄瓜步骤之前打印(“Then”子句)。 “漂亮的蓝色”是蓝色,适当缩进,并在黄瓜步骤后输出。 Feature: Foo Scenario: Foo2 Given something Pretty blue Scary red Then something else 1 scenario […]

无法安装gem ffi – Windows 7 64位

我是学习Cucumber / Ruby的新手。 我曾尝试安装gem’ffi’但是当我从控制台执行此操作时,我收到以下消息: 安装ffi时出错:ffi(> = 0)的最后一个版本支持你的Ruby和RubyGems使用gem install ffi -v 1.9.18 ffi gem install ffi -v 1.9.18它需要Ruby版本 = 2.0。 目前的ruby版本为2.5.0。

调试器(Intellij IDEA)在遇到断点时失败(黄瓜,ruby,rspec,水豚)

尝试在IntelliJ(11.1.5)中调试黄瓜场景时,遇到第一个断点时失败并出现以下错误。 如果我删除所有断点,它会成功运行。 gem list capybara (2.0.2, 1.1.4) cucumber (1.2.3, 1.2.1) rspec (2.13.0) ruby-debug-base (0.10.3.4 java) ruby-debug-ide (0.4.17.beta9) Testing started at 1:12 PM … Fast Debugger (ruby-debug-ide 0.4.17.beta9, ruby-debug-base 0.10.3.4) listens on 127.0.0.1:60409 Using the default profile… file:/Users/user1456/.rvm/rubies/jruby-1.7.2/lib/jruby.jar!/jruby/java/java_package_module_template.rb:11 warning: `eval’ should not be aliased including Capybara::DSL in the global scope is not recommended! /Users/user1456/.rvm/gems/jruby-1.7.2@andise-payables/gems/cucumber-1.2.3/bin/../lib/cucumber/parser/gherkin_builder.rb:120 warning: singleton […]

当input.file具有动态ID时,如何附加文件?

我遇到了动态ID问题。 attach_file命令需要输入type =“file”的id名称。 问题是id是动态的 (id=”document_22″) #indicating the 22nd document uploaded to this section. 有没有办法获得元素的id? 就像是… attach_file(find(:xpath, “.//input[@name=’file_upload’]”).get(‘@id’), ‘C:\\Users\\testbox\\Documents\\testdoc.xls’)

Ruby可以动态增加文件大小以进行测试

这可能听起来很奇怪,或者你为什么要那样做。 我正在尝试编写一个黄瓜function来测试上传大图像文件(> 16M)因此,我不想将大文件存储在github或我的项目中。 我正在使用imagemagick创建一个图像,但据我所知,只有1M。 我可以在ruby中增加文件大小吗? 我不关心文件内的内容,只关心文件大小。 谢谢,无论如何我可以欺骗黄瓜相信我,我上传的文件很大? 谢谢

Capybara找不到id的元素

在我的黄瓜测试中,Capybara无法通过它的id找到 标签。 我在save_and_open_page时能够看到元素。 但我无法用has_css?找到它has_css? 或者find : pry(#)> page.html.scan(/notice_sent/).count => 1 pry(#)> page.html.scan(/id=\”notice_sent\”/).count => 1 pry(#)> page.find(‘#notice_sent’) Capybara::ElementNotFound: Unable to find css “#notice_sent” from /Users/me/.gem/ruby/2.1.7/gems/capybara-2.4.4/lib/capybara/node/finders.rb:41:in ‘block in find’ 我错过了什么?

如何在每个场景之前输出黄瓜后台步骤?

通常,Cucumber将输出后台步骤,使其与您在要素文件中定义的相同(一次在顶部)。 $ bundle exec cucumber –color –format pretty Feature: Something Background: Given step 1 And step 2 Scenario: a scenario When I do step 3 Then it works Scenario: another scenario When I do a different step 3 Then it works 如果您始终可以在场景开头显示步骤,则可以更轻松地查看后台步骤何时成功执行。 我该如何启用此行为? Feature: Something Scenario: a scenario Given step 1 And step 2 When […]