cs3b / kameleon Goto Github PK
View Code? Open in Web Editor NEWhigh abstraction dsl for tests (from end user perspective) [kameleon - mean chameleon, from polish]
License: MIT License
high abstraction dsl for tests (from end user perspective) [kameleon - mean chameleon, from polish]
License: MIT License
Please add to gem description that using your garbage_collector requires greater RAM space (2GB is not enough). This garbage_collector may crash tests suite and cause lots of unnecessary debuging (there is not message pointing the problem).
Instead of
require 'kameleon/ext/rspec/all'
it is safer to do
require 'kameleon/ext/rspec/dsl'
require 'kameleon/ext/rspec/headless'
fill_in select: {inactive: 'q_active_eq'}
Failure/Error: fill_in select: {inactive: 'q_active_eq'}
Capybara::ElementNotFound:
Unable to find option :inactive
would be useful in testing ember.js / backbone.js apps
Here's my solution:
def touch(*text)
Array(text).each do |label|
find(:css, "a:contains('#{label}')").click
end
end
they have no impact on sorting
expected: ["Abernathy", "Graham", "Heathcote", "Herman"]
got: ["Abernathy", "Graham", "Heathcote", "Herman", "Herman"] (using ==)
Failures:
1) #see special selectors in tables when in column when scoped by full text should see full text
Failure/Error: see "13.00", "2.00", "0.00"
expected #has_content?("13.00") to return true, got false
# ./lib/kameleon/dsl/see.rb:9:in `see'
# ./lib/kameleon/dsl/see.rb:12:in `block in see'
# ./lib/kameleon/dsl/see.rb:11:in `each'
# ./lib/kameleon/dsl/see.rb:11:in `see'
# ./spec/unit/dsl/see/special_selectors_spec.rb:28:in `block (5 levels) in <top (required)>'
# ./lib/kameleon/user/abstract.rb:61:in `instance_eval'
# ./lib/kameleon/user/abstract.rb:61:in `block in within'
# ./lib/kameleon/user/abstract.rb:39:in `within'
# ./lib/kameleon/user/abstract.rb:60:in `within'
# ./spec/unit/dsl/see/special_selectors_spec.rb:27:in `block (4 levels) in <top (required)>'
2) #see special selectors in tables when in column when scoped by full text should see partial text
Failure/Error: see "13", "2", "0"
expected #has_content?("13") to return true, got false
# ./lib/kameleon/dsl/see.rb:9:in `see'
# ./lib/kameleon/dsl/see.rb:12:in `block in see'
# ./lib/kameleon/dsl/see.rb:11:in `each'
# ./lib/kameleon/dsl/see.rb:11:in `see'
# ./spec/unit/dsl/see/special_selectors_spec.rb:34:in `block (5 levels) in <top (required)>'
# ./lib/kameleon/user/abstract.rb:61:in `instance_eval'
# ./lib/kameleon/user/abstract.rb:61:in `block in within'
# ./lib/kameleon/user/abstract.rb:39:in `within'
# ./lib/kameleon/user/abstract.rb:60:in `within'
# ./spec/unit/dsl/see/special_selectors_spec.rb:33:in `block (4 levels) in <top (required)>'
3) #see special selectors in tables when in column when scoped by partial text should see full text
Failure/Error: see "13.00", "2.00", "0.00"
expected #has_content?("13.00") to return true, got false
# ./lib/kameleon/dsl/see.rb:9:in `see'
# ./lib/kameleon/dsl/see.rb:12:in `block in see'
# ./lib/kameleon/dsl/see.rb:11:in `each'
# ./lib/kameleon/dsl/see.rb:11:in `see'
# ./spec/unit/dsl/see/special_selectors_spec.rb:42:in `block (5 levels) in <top (required)>'
# ./lib/kameleon/user/abstract.rb:61:in `instance_eval'
# ./lib/kameleon/user/abstract.rb:61:in `block in within'
# ./lib/kameleon/user/abstract.rb:39:in `within'
# ./lib/kameleon/user/abstract.rb:60:in `within'
# ./spec/unit/dsl/see/special_selectors_spec.rb:41:in `block (4 levels) in <top (required)>'
4) #see special selectors in tables when in column when scoped by partial text should see partial text
Failure/Error: see "13", "2", "0"
expected #has_content?("13") to return true, got false
# ./lib/kameleon/dsl/see.rb:9:in `see'
# ./lib/kameleon/dsl/see.rb:12:in `block in see'
# ./lib/kameleon/dsl/see.rb:11:in `each'
# ./lib/kameleon/dsl/see.rb:11:in `see'
# ./spec/unit/dsl/see/special_selectors_spec.rb:48:in `block (5 levels) in <top (required)>'
# ./lib/kameleon/user/abstract.rb:61:in `instance_eval'
# ./lib/kameleon/user/abstract.rb:61:in `block in within'
# ./lib/kameleon/user/abstract.rb:39:in `within'
# ./lib/kameleon/user/abstract.rb:60:in `within'
# ./spec/unit/dsl/see/special_selectors_spec.rb:47:in `block (4 levels) in <top (required)>'
rspec ./spec/unit/dsl/see/special_selectors_spec.rb:26 # #see special selectors in tables when in column when scoped by full text should see full text
rspec ./spec/unit/dsl/see/special_selectors_spec.rb:32 # #see special selectors in tables when in column when scoped by full text should see partial text
rspec ./spec/unit/dsl/see/special_selectors_spec.rb:40 # #see special selectors in tables when in column when scoped by partial text should see full text
rspec ./spec/unit/dsl/see/special_selectors_spec.rb:46 # #see special selectors in tables when in column when scoped by partial text should see partial text
Probably this problem is in file lib/kameleon/user/abstract.rb:
def initialize(rspec_world, options={})
@rspec_world = rspec_world
@driver_name = options.delete(:driver)
@session_name = options.delete(:session_name)
@options = options
set_session
session.instance_eval do
def within(*args)
new_scope = if args.size == 1 && Capybara::Node::Base === args.first
args.first
elsif args.last == :select_multiple
case driver
when Capybara::Selenium::Driver
all(*args[0..-2])
when Capybara::RackTest::Driver
node = find(*args)
native = Nokogiri::HTML.parse(html).xpath(args[1])
base = Capybara::RackTest::Node.new(driver, native)
::Capybara::Node::Element.new(self,
base,
node.parent,
node.instance_variable_get(:@selector))
end
else
find(*args)
end
begin
scopes.push(*new_scope)
yield
ensure
scopes.pop
end
end
end
yield if block_given?
after_initialization
end
not included in master:
e.g.
see 1 => :row
solution might look like
class Quantity
attr_reader :conditions
attr_reader :quantity
def initialize(quantity, params)
@conditions = []
@quantity = quantity
parse_params(params)
end
private
def parse_params(params)
if params === Array && params.first == Array
params.each { |param| parse_params(param) }
elsif params.is_a?(Symbol)
parse_params(Kameleon::DSL::Context::Scope.new(params).selector)
else
#! refactor
selector = prepare_query(params).selector
conditions << Condition.new(prepare_method(selector), selector.last, :count => quantity)
end
end
def prepare_query(selector)
Context::Scope.new(selector)
end
#! refactor - delagate to Context::Scope class
def prepare_method(query)
query.first == :xpath ?
:have_xpath :
:have_css
end
end
see %(one two three)
will be taken as array of arrays and fail into infinity loop
uniq is not the best to remove duplicates - we should only remove two in a row
first it never allow ot fill in data in form
second it looks like it is modifying something in forms send metod
def can_fill?(locators)
locators.values.each do |loc|
locators = loc.respond_to?(:values) ? loc.values : loc
one_or_all(locators).each do |locator|
return false if unmodifiable?(locator)
end
end
end
Sometimes is good to create multiple sessions at once.. for example when I want to operate on 3 sessions, I have to call
create_session(:admin)
create_session(:customer)
create_session(:client)
When simpler is call one method - i.e. #create_sessions with 3 params:
create_sessions(:admin, :customer, :client)
And the active session will be the last, which was created (in above example - :client)
not in the master:
Hey, I've noticed that not_see is incomplete in comparison to the see method.
For example I can construct"I can see an image on page", but I cannot construct "I don't see image on page" because not_see method isn't aware of image type.
TODO: add tests for directories path
TODO: make directories configurable outside kameleon
fill_in name => :country_name
fill_in "AA" => :country_code
fill_in "1" => :country_lng
fill_in "1" => :country_lat
Fills in all values to "country_name". Looks like some issue with symbols. Without symbols, it works fine:
fill_in name => "country_name"
fill_in "AA" => "country_code"
fill_in "1" => "country_lng"
fill_in "1" => "country_lat"
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.