GithubHelp home page GithubHelp logo

prickle's Introduction

Prickle

Build Status

Configuration

To install prickle execute

gem install prickle

Configure by updating the features/support/env.rb to include the following:

require 'prickle/capybara'    # require


World do
   include Capybara::DSL
   include Prickle::Capybara  # include  Prickle
end

Waiting for elements to become visible

To enable this feature you need to set the Prickle::Capybara.wait_time property.

Prickle::Capybara.wait_time = 5

If you only want to extend the wait time for a particular feature, then you need to reset the wait time using Prickle::Capybara = nil after your call..

Prickle::Capybara.wait_time = 5
element(:href => "http://google.com").click
Prickle::Capybara.wait_time = nil             # reset wait time

Usage

Find elements by any html tag(s)

element(:href => "http://google.com")
element(:name => "blue")
element(:id => "key")
element(:class => "key", :id => "button")

You can also find elements by a value contained in the identifier

element(:name.like => "blue") # will match <button name="blue_12345">

Find elements by type and html tag(s)

element(:link, :href => "http://google.com")    # you can also use link and paragraph (instead of a and p)
element(:input, :name => "blue")

Apply a search, a click or a text matcher

element(:name => "flower").exists?
element(:name => "flower").click
element(:name => "flower").contains_text? "Roses"
element(:name => "flower").has_text? "Anemone"  # exact match

Popup

Selenium

popup.confirm
popup.dismiss
popup.message

popup.contains_message? "<text>"

Webkit

popup.confirm {
  #block that triggers confirmation dialog
}

popup.dismiss {
  #block that triggers confirmation dialog
}

popup.accept {
  #block that triggers alert
}

Verifying popup messages

alert = popup.accept {
  #block that triggers alert
}

alert.contains_message? "<text>"

Alternative syntax

Find

find_by_name "green"
find_button_by_name "green" #find_<element_tag>_by_name "<name>"

Click

click_by_name "blue"
click_input_by_name "blue" #click_<element_tag>_by_name "<name>"

Match text

div_contains_text? "text" #<element_tag>_contains_text? "text"

Capturing screenshots

Configure the directory where you want the screenshots to be saved

Prickle::Capybara.image_dir = File.dirname(__FILE__) + "/screenshots/"
capture_screen
capture_screen "<file>"

prickle's People

Contributors

despo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.