forked from despo/prickle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
source :rubygems | ||
|
||
group :development do | ||
gem 'capybara' | ||
gem 'rspec' | ||
gem 'sinatra' | ||
end | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,70 @@ | ||
![](http://github.com/despo/prickle/raw/master/prickle.png) | ||
|
||
## Configuration | ||
|
||
To install prickle execute | ||
|
||
```ruby | ||
gem install prickle | ||
``` | ||
|
||
and to configure | ||
|
||
```ruby | ||
require 'prickle/capybara' | ||
|
||
World do | ||
include Capybara::DSL | ||
include Prickle::Capybara #include it after Capybara | ||
end | ||
``` | ||
|
||
## Usage | ||
|
||
### Find elements by any html tag(s) | ||
|
||
```ruby | ||
element(:href => "http://google.com") | ||
element(:name => "blue") | ||
element(:id => "key") | ||
element(:class => "key", :id => "button") | ||
``` | ||
|
||
### Find elements by type and html tag(s) | ||
|
||
```ruby | ||
element(:link,:href => "http://google.com") | ||
element(:input, :name => "blue") | ||
`` | ||
|
||
### Apply a search, a click or a text matcher | ||
|
||
``ruby | ||
|
||
element(:name => "flower")*.exists?* | ||
element(:name => "flower")*.click* | ||
element(:name => "flower")*.contains_text? "Roses"* | ||
``` | ||
|
||
## Alternative syntax | ||
|
||
### Find | ||
|
||
```ruby | ||
find_by_name "green" | ||
|
||
find_button_by_name "green" #find_<element_tag>_by_name "<name>" | ||
``` | ||
|
||
## Click | ||
|
||
```ruby | ||
click_by_name "blue" | ||
click_input_by_name "blue" #click_<element_tag>_by_name "<name>" | ||
`` | ||
|
||
### Match text | ||
|
||
```ruby | ||
div_contains_text? "text" #<element_tag>_contains_text? "text" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Prickle | ||
VERSION = '0.0.1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "prickle/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "prickle" | ||
s.version = Prickle::VERSION | ||
s.platform = Gem::Platform::RUBY | ||
s.author = "Despo Pentara" | ||
s.email = "despo@extractmethod.com" | ||
s.homepage = "https://github.com/ExtractMethod/prickle" | ||
s.summary = "A simple DSL wrapped around Capybara for matching elements using html tags." | ||
s.description = "A simple DSL wrapped around Capybara for matching elements using html tags." | ||
s.required_ruby_version = '>= 1.9.2' | ||
|
||
s.licenses = ["MIT"] | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {spec}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
s.add_dependency "capybara" | ||
|
||
s.add_development_dependency "capybara" | ||
s.add_development_dependency "rspec", "~> 2.8.0" | ||
s.add_development_dependency "sinatra", "~> 1.3.2" | ||
end | ||
|