cucumber

Cucumber with Guice - multiple guice injector

末鹿安然 提交于 2019-12-10 15:56:57
问题 I'm using Cucumber with Guice as DI. I've encountered following problem: I've got one step i.e. class MyStep() { @Inject private MyService myService; @Given("Some acction happen") public void sthHappen() { myService.doSth(); } } And I've got this class to run it as JUnit test @RunWith(Cucumber.class) @CucumberOptions(...) public class MyTest { } There is a class MyModule extends AbstractModule { @Override protected void configure() { bind(MyService.class).to(MyFirstService.class); } } which

How do I assert nil presence of flash variables with Cucumber-Capybara?

本小妞迷上赌 提交于 2019-12-10 15:53:46
问题 I'm running a Rails 3.0.7 project with Cucumber and Capybara and I have a step definition that checks if a flash[:error] exists: Then /^I should be able to see the main page properly$/ do current_path.should == "/" flash[:error].should == nil end When I run my cucumber test, I get an error And I should be able to see the main page properly # features/step_definitions/user_auth_steps.rb:17 undefined method `flash' for nil:NilClass (NoMethodError) ./features/step_definitions/user_auth_steps.rb

Is it possible to pass Java-Enum as argument from cucumber feature file

牧云@^-^@ 提交于 2019-12-10 15:15:38
问题 I am currently using selenium with Java,And want to implement cucumber to make test script more readable. Currently facing issue while passing argument to java method where Enum is expected as parameter. I would also like to know if there are any other known limitaions of cucumber-java befor migrating current framework. As i'm new on cucumber If any one knowing good source for learing cucumber in details please give me a link. 回答1: The answer is: Yes You can use all kind of different types in

Capybara can not find element by id

╄→尐↘猪︶ㄣ 提交于 2019-12-10 15:00:29
问题 Capybara is not able to find a <p> tag by it's id in my cucumber test. I'm able to see the element when I save_and_open_page . But I can't locate it with has_css? or find : pry(#<Object>)> page.html.scan(/notice_sent/).count => 1 pry(#<Object>)> page.html.scan(/id=\"notice_sent\"/).count => 1 pry(#<Object>)> 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

How can I test in Capybara that a page has *not* reloaded (JavaScript onClick intercept has worked)?

回眸只為那壹抹淺笑 提交于 2019-12-10 14:46:04
问题 I am using Capybara, Cucumber and Poltergeist. I am testing a JavaScript function that is attached to a form submit button, which is intended to catch the submit event and prevent it (doing an AJAX request in the background). With and without AJAX, the page will end up looking the same, but the AJAX approach is much faster and does not interrupt the browsing experience etc. What can I do to test that the form was indeed not submitted, and that the changes are the result of a dynamic AJAX call

Is it possible to turn off ActionMailer emails when cucumber testing is happening on development?

心已入冬 提交于 2019-12-10 14:37:46
问题 Currently, my local development environment is setup to be able to send out actual emails. Because of this, deliveries are being made, and nothing is kept in the ActionMailer::Base.deliveries table. Is it possible to disable email sending in cucumber tests? If so, what is the syntax to do this? Or is there a better way to test emails being sent? authentication_steps.rb: Then /^I should receive a confirmation email$/ do email = ActionMailer::Base.deliveries.last email.subject.should ==

Cucumber / Savon omit or remove logging output

社会主义新天地 提交于 2019-12-10 14:32:42
问题 While running a cucumber test I am getting (in addition to the test results) a lot of debug/log related output in the form: D, [2013-03-06T12:21:38.911829 #49031] DEBUG -- : SOAP request: D, [2013-03-06T12:21:38.911919 #49031] DEBUG -- : Pragma: no-cache, SOAPAction: "", Content-Type: text/xml;charset=UTF-8, Content-Length: 1592 W, [2013-03-06T12:21:38.912360 #49031] WARN -- : HTTPI executes HTTP POST using the httpclient adapter D, [2013-03-06T12:21:39.410335 #49031] DEBUG -- : <?xml version

redirect to a route alias on a form validation error

喜欢而已 提交于 2019-12-10 14:05:26
问题 If I'm on a route alias such as /register and I have a form error and I render :new, is it possible for the path to be /register still? At the moment it is rendering /new I could do a redirect_to register_path but then I would lose the params? It's making the following test fail: Scenario: Try registering with a bad staff number Given I am on the registration page When I fill in "email" with "kevin@acme.com" And I fill in "First Name" with "Kevin" And I fill in "last name" with "Monk" And I

IntelliJ - Cucumber step definition case

青春壹個敷衍的年華 提交于 2019-12-10 13:51:37
问题 Ever since I upgraded to latest community edition of IntelliJ 15.0.3, whenever I auto generate a step definition from the feature definition file using alt + enter , it creates the method in camel case rather than usual style with underscores. For e.g. it used to be generated like this @When("Cucumber is awesome") public void cucumber_is_awesome() {} But now it generates in usual camelCase convention: @When("Cucumber is awesome") public void cucumberIsAwesome() {} Is there any way to change

How to run cucumber selenium using Thin server instead of default Webrick?

别来无恙 提交于 2019-12-10 13:11:38
问题 my cucumber features with selenium runs (for Rails 3 app) using the default Webrick server. How can I force or setup to run with Thin server instead of Webrick? Any settings to put in env.rb file or else? 回答1: Two ways: 1) turn off capybara's built in server and run it yourself. 2) Looks like someone patched in the capability here https://github.com/jnicklas/capybara/pull/175 回答2: This is the new way to do this with recent capybara require "rack/handler/unicorn" Capybara.register_server(