kikonen / capybara-ng Goto Github PK
View Code? Open in Web Editor NEWAngularJS bindings for Capybara
License: MIT License
AngularJS bindings for Capybara
License: MIT License
I'm using capybara with poltergeist geckodriver .
Have Following rspec
require 'rails_helper'
RSpec.describe "Article Listing", type: :feature, js: true do
include Angular::DSL
context "when viewed by a site admin" do
before do
create(:published_article)
sign_in_as_a_site_admin
visit '/articles/browse'
ng_wait
end
it "should list articles" do
wait_for_ajax
expect(page).to have_content('topic channel')
end
end
end
and getting error
Failure/Error: ng_wait
Selenium::WebDriver::Error::UnknownError:
Failed to find value field
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/response.rb:69:in `assert_ok'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/response.rb:32:in `initialize'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/http/common.rb:81:in `new'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/http/common.rb:81:in `create_response'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/http/default.rb:86:in `request'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/w3c_bridge.rb:659:in `raw_execute'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/w3c_bridge.rb:634:in `execute'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/w3c_bridge.rb:365:in `execute_script'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/common/driver.rb:215:in `execute_script'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/capybara-2.4.4/lib/capybara/selenium/driver.rb:84:in `evaluate_script'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/capybara-2.4.4/lib/capybara/session.rb:527:in `evaluate_script'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/capybara-ng-0.2.7/lib/angular/setup.rb:110:in `block in install'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/capybara-ng-0.2.7/lib/angular/setup.rb:109:in `each'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/capybara-ng-0.2.7/lib/angular/setup.rb:109:in `install'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/capybara-ng-0.2.7/lib/angular/setup.rb:12:in `ng_wait'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/capybara-ng-0.2.7/lib/angular/setup.rb:66:in `make_call'
# /Users/rtcoms/.rvm/gems/ruby-2.2.1@learninglabs/gems/capybara-ng-0.2.7/lib/angular/dsl.rb:52:in `ng_location_abs'
# ./spec/features/articles/article_listing_spec.rb:18:in `block (3 levels) in <top (required)>'
Not sure if issue is related to capybara-ng or selenium. None of the capybara-ng DSL is working , Although is rendering find without capybara-ng by using wait for ajax.
C:\dev\workspace\iautomation (master)
λ cucumber features\specifications\implementsapp\login.feature
undefined method seconds' for 2:Fixnum Did you mean? send (NoMethodError) C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/capybara-ng-0.2.7/lib/angular.rb:6:in
module:Angular'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/capybara-ng-0.2.7/lib/angular.rb:5:in <top (required)>' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/capybara-ng-0.2.7/lib/capybara-ng.rb:1:in
require_relative'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/capybara-ng-0.2.7/lib/capybara-ng.rb:1:in <top (required)>' C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in
require'
C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in rescue in require' C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in
require'
C:/dev/workspace/iautomation/features/support/env.rb:6:in <top (required)>' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in
load'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in load_code_file' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:142:in
load_file'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:84:in block in load_files!' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in
each'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in load_files!' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:253:in
load_step_definitions'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:61:in run!' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/lib/cucumber/cli/main.rb:32:in
execute!'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/cucumber-2.4.0/bin/cucumber:8:in <top (required)>' C:/Ruby23-x64/bin/cucumber:22:in
load'
C:/Ruby23-x64/bin/cucumber:22:in `
Please @kikonen, can you help me?
In DSL methods use option maps instead of default valued parameters for extra params.
I've just started using this library to try to help resolve some issues with an testing angularjs app from Cucumber.
However I'm still getting some problems so have been trying to debug what the library is doing.
I've noticed two unexpected things.
var el = document.querySelector(selector);
This is an awesome gem, full of potential! But...
On a simple test I am getting this error:
Failure/Error: ng_wait
NoMethodError:
undefined method `size' for :FN_waitForAngular:Symbol
# /home/vagrant/.rvm/gems/ruby-2.2.0/gems/capybara-ng-0.2.1/lib/angular/client_script.rb:769:in `block in functions'
# /home/vagrant/.rvm/gems/ruby-2.2.0/gems/capybara-ng-0.2.1/lib/angular/client_script.rb:768:in `map'
# /home/vagrant/.rvm/gems/ruby-2.2.0/gems/capybara-ng-0.2.1/lib/angular/client_script.rb:768:in `functions'
# /home/vagrant/.rvm/gems/ruby-2.2.0/gems/capybara-ng-0.2.1/lib/angular/client_script.rb:789:in `window_scripts'
# /home/vagrant/.rvm/gems/ruby-2.2.0/gems/capybara-ng-0.2.1/lib/angular/setup.rb:109:in `install'
# /home/vagrant/.rvm/gems/ruby-2.2.0/gems/capybara-ng-0.2.1/lib/angular/setup.rb:12:in `ng_wait'
# /home/vagrant/.rvm/gems/ruby-2.2.0/gems/capybara-ng-0.2.1/lib/angular/dsl.rb:41:in `ng_wait'
# ./spec/features/login_spec.rb:9:in `block (2 levels) in <top (required)>'```
My test starts with:
scenario "Show ", js: true do
select_page = select_bank_page
ng_wait
I am including everything which is required and checked your examples too.
Any clue?
Capybara.default_wait_time
is deprecated, as used here. Use Capybara.default_max_wait_time
I use Capybara with the webkit driver to test AngularJS on my application. When I fill in a form and pressing submit, it seems as if Capybara does not wait for Angular to bind the value to the corresponding model. Does this gem provide a method for this kind of waiting? Can I tell Capybara to wait until Angular has done all bindings? Or can I tell Capybara to wait until a specific binding is done?
Should have "has_ng_xxx" / "have_ng_xxx" support to match existing DSL in capybara.
I'm getting the following when I use capybara-ng
/Users/myuser/legion/spec/spec_helper.rb:19:in `block in <top (required)>': uninitialized constant Angular (NameError)
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core.rb:81:in `configure'
from /Users/myuser/legion/spec/spec_helper.rb:18:in `<top (required)>'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1072:in `require'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1072:in `block in requires='
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1072:in `each'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1072:in `requires='
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration_options.rb:103:in `block in process_options_into'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration_options.rb:102:in `each'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration_options.rb:102:in `process_options_into'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration_options.rb:22:in `configure'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:95:in `setup'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:84:in `run'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke'
from /Users/myuser/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec:4:in `<top (required)>'
from /Users/myuser/.rbenv/versions/2.1.5/bin/rspec:23:in `load'
from /Users/myuser/.rbenv/versions/2.1.5/bin/rspec:23:in `<main>'
gemfile
group :test do
gem "factory_girl_rails"
gem "capybara"
gem 'capybara-ng'
gem "guard-rspec"
gem 'vcr'
gem 'webmock'
gem 'database_cleaner'
gem 'launchy'
gem 'capybara-email'
gem 'timecop'
end
spec_helper.rb
RSpec.configure do |config|
config.include ::Angular::DSL
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
=begin
config.filter_run :focus
config.run_all_when_everything_filtered = true
config.disable_monkey_patching!
if config.files_to_run.one?
config.default_formatter = 'doc'
end
config.profile_examples = 10
config.order = :random
Kernel.srand config.seed
=end
end
Thanks in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.