Code Monkey home page Code Monkey logo

gizmo's Introduction

Hello ๐Ÿ‘‹, I'm Luke!


๐Ÿ“ˆ ย  Stats, Stats, Stats.


๐Ÿ› ๏ธ ย  Some of the things I love to work with.


Typescript Node JS React Gatsby JS Vite JS Tailwind CSS Ruby Rails Heroku Firebase AWS GraphQL HTML5 CSS3

๐Ÿ”— ย  Some places you can find me.


gizmo's People

Contributors

icaruswings 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gizmo's Issues

Gizmo with Celerity

hey Luke, Is it possible to use Gizmo with Celerity?
I am trying but I got an error in the method "on_page" in the helpers.rb.

cheers
Leonardo

using webrat (and other) methods from Gizmo::Page for better encapsulation

I was just trying out gizmo on a project, and had an idea. What if, during your on_page_with block, you had helper methods that abstracted actions on the page?

Imagine doing this:

on_page_with :login do |page|
  page.login '[email protected]', 'test'
end

This is a pretty simple case, but I think it has a lot of potential to reduce the unDRYness of integration tests that happens so often.

It's actually not far of implementation-wise. Gizmo::Page instances already have a copy of driver/spec/etc they are running from, and store that as @browser. Using this, I was able to implement that page as:

module PageWithLogin

  def valid?
    has_selector?('#session_email') && has_selector?('#session_password')
  end

  def login(email, password)
    @browser.fill_in 'Email', :with => email
    @browser.fill_in 'Password', :with => password
    @browser.click_button 'Login'
  end

end

It's probably not a great idea to be using an instance variable here, so an attr reader would be more appropriate. Or... even crazier, maybe method_missing could try passing stuff to browser, or less crazy, could delegate known methods to it.

Thoughts?

page's method_missing doesn't forward code blocks

Pretty much what the title says. The Page class's implementation of method_missing doesn't forward the code block. This stops Capybara's "within" method from working. It looks like this can easily be fixed by adding it to the list of parameters, and passing it in the send method:

def method_missing name, *args, &block
  method_name = name.to_sym
  return super unless browser.respond_to?(method_name)
  browser.send(method_name, *args, &block)
end

This works in a simple trial, but I haven't checked anything else.

(Nice framework, btw)

Thanks
Matt

missing gem dependency

Just started using the gem and am liking it. Since I started with a blank gemfile and worked my way up from there I found that the term-ansicolor gem which is required in lib/gizmo.rb is not a dependency in version 0.1.1. Easy enough to work around, but I thought I'd mention it anyway.

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.