Code Monkey home page Code Monkey logo

kameleon's Introduction

CS3B ๐Ÿ‘‹

Metrics

kameleon's People

Contributors

alexparamonov avatar cs3b avatar hpmcz avatar markburns avatar sevos avatar simon2k avatar tbprojects avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kameleon's Issues

garbage_collector sometimes crashes tests suite

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'

Problem with spec 'dsl/see/special_selectors_spec.rb' on Selenium Driver.

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

see number of things where things could be defined in defined areas

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

checking oreder

uniq is not the best to remove duplicates - we should only remove two in a row

methed can_fill? makes problem when using selenium

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

Creating multiple sessions at once.

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_see dsl word improvement

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.

fill_in with symbols

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"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.