cucumber

How do I have a negative scenario with Cucumber in Rails?

戏子无情 提交于 2019-12-24 10:55:39
问题 I have a negative scenario to test with Cucumber. Specifically, I want to make sure that when someone posts a URL with an invalid handle then the site returns an error. My scenario looks like: Scenario: create person with too short a handle When person named "Fred" with handle "tooshort" updates Then I should get a 500 error My step looks like When /^person named "(. )" with handle "(. )" updates$/ do |name, handle| visit "/mobile/update?handle=#{udid}&name=#{name}" When I run the scenario,

How to make Cucumber features run in an Android project as local unit tests?

家住魔仙堡 提交于 2019-12-24 10:27:28
问题 I have an Android project written in Java that I'm working on in Android Studio. I'd like to use Cucumber for integration testing of some internal components (note: I know this is not the BDD way, nonetheless useful to me). I want the tests to run as local unit tests (without Instrumentation) using gradlew test because the components under test do not interact with the Android SDK. My problem is that the Cucumber features are not recognized by Gradle and do not run when I run gradlew test .

How to generate skeleton using cucumber feature file

久未见 提交于 2019-12-24 09:29:40
问题 We have tried below steps: on node command prompt we tried exciting below commands Npm install -g cucumber Also we tried npm install -g protractor-cucumber cucumber --version Above command opening webstorm editor. We have created feature file(feature/testfeature.feature) Now to generate skeleton we tried running below command on cmd prompt. Cucumber.js It is opening webstorm editor We are not able to see skeleton file Could you please suggest if we are missing anything We should be able to

Can I copy a text on a webpage and paste it in a text file?

天大地大妈咪最大 提交于 2019-12-24 09:15:08
问题 I have a webpage which dynamically displays a text which I want to copy into a text file using watir-webdriver or any other additional gems. Is it possible?? If yes, how?? Thanks in advance.. 回答1: If you are talking about web-scraping try Nokogiri 回答2: I will assume that you you have HMTL like this: <div id="tehcodez">teh codez</div> This would save text teh codez to file tehcodez.txt (not tested): text = browser.div(:id => "tehcodez").text File.open("tehcodez.txt", "w") {|file| file.write

Cucumber capybara stubbing

拥有回忆 提交于 2019-12-24 08:35:01
问题 I have an index action in a rails controller called images_controller.rb that fetches images from an external service. I am trying to write cucumber scenarios and am struggling with how to write/stub out my visit index page step. How could I stub out the images it fetches without it making the request? Feature: Scenario: Image Index Given an image exists on the image server When I am on the images page Then I should see images Steps so far: Given(/^an image exists on the image server$/) do

How to have multiple Cucumber step definitions in the same project for testing product variants

二次信任 提交于 2019-12-24 08:25:39
问题 I'm working on an automation project for a mobile app in ios and android. I'm using Java-Appium-Cucumber framework for writing tests. Below shows my project structure src android features step_definitions ios features step_definitions I need a step "User logins to the app" for both android and ios. But the implementation in android and ios are different. So I wrote two step definitions in android > step_definitions and in ios > step_definitions. But this results in duplicate step definition

function timed out after 5000 milliseconds - Angular 4 - Protractor & cucumber

我怕爱的太早我们不能终老 提交于 2019-12-24 08:20:42
问题 I am automating an angular 4 application with protractor & cucumber framework. Getting error for a simple button click. (Not all the times) 1) Scenario: Scenario 2 - features\Home.feature:9 Step: Then Click on edit button - features\Home.feature:11 Step Definition: stepDefinitions\FirstStep.ts:31 Message: Error: function timed out after 5000 milliseconds at Timeout.<anonymous> (C:\MyWorkspace\protractor-cucumber-final\protractor-cucumber-final\node_modules\cucumber\lib\user_code_runner.js:91

Cannot Install gem ffi - Windows 7 64bit

寵の児 提交于 2019-12-24 07:57:58
问题 I am new to learning Cucumber/Ruby. I have tried to install the gem 'ffi' however when I do so from the console I get the following message: Error installing ffi: The last version of ffi (>= 0) to support your Ruby & RubyGems nstalling it with gem install ffi -v 1.9.18 ffi requires Ruby version < 2.5, >= 2.0. The current ruby version 2.5.0. 回答1: There is an open pull request to update ffi for Ruby 2.5. You will need to wait for this update, roll back to ruby Ruby <= 2.4.x, or try to install

Cannot Install gem ffi - Windows 7 64bit

爱⌒轻易说出口 提交于 2019-12-24 07:57:31
问题 I am new to learning Cucumber/Ruby. I have tried to install the gem 'ffi' however when I do so from the console I get the following message: Error installing ffi: The last version of ffi (>= 0) to support your Ruby & RubyGems nstalling it with gem install ffi -v 1.9.18 ffi requires Ruby version < 2.5, >= 2.0. The current ruby version 2.5.0. 回答1: There is an open pull request to update ffi for Ruby 2.5. You will need to wait for this update, roll back to ruby Ruby <= 2.4.x, or try to install

Cucumber duplicate class problem: AssociationTypeMismatch

我的未来我决定 提交于 2019-12-24 06:39:05
问题 I am having a problem with Cucumber when there is a reference to self in a model callback method. Code example below. The error is like: Person(#26738680) expected, got Person(#29003170) (ActiveRecord::AssociationTypeMismatch) class Person < ActiveRecord::Base has_one :person_profile accepts_nested_attributes_for : person_profile after_create :new_person_profile private def new_person_profile person_profile = PersonProfile.new( ..., :person => self # <--- this causes the error in cucumber )