caifara-rSquery 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +21 -13
  2. data/VERSION.yml +1 -1
  3. data/lib/rSquery/jquery.rb +1 -1
  4. metadata +2 -2
@@ -1,17 +1,18 @@
1
1
  = rSquery
2
2
 
3
- This project aims to reduce the difficulties involved in writing selenium tests in rspec environments for webapps that use jquery.
3
+ This project aims to reduce the difficulties involved in writing selenium tests in cucumber environments for webapps that use jQuery.
4
4
 
5
5
  The project contains several methods to help you with writing javascript commands for selenium and javascript based tests for cucumber or maybe even rSpec.
6
6
 
7
7
  == What does the name stand for:
8
- r - rspec
9
- S - Selenium
10
- query - jQuery
8
+
9
+ - r - rspec
10
+ - S - Selenium
11
+ - query - jQuery
11
12
 
12
13
  == History
13
14
 
14
- The project's origin lies in a project we work on at by2.be which makes use of jQuery for most of its tasks. Selenium tests were the only way to test this bugger (as webrat isn't an option to test js actions) and these tests were taking all the speed and fun out of the project. Testing with jquery matchers instead of those provided by selenium sounded very handy and after some hours of frustration we hacked these few lines together and because of the enormous speed enhancements in writing tests I decided to wrap things up in a gem and release them to whoever would like to use jquery matchers in an easy way to handle tests.
15
+ The project's origin lies in a project we work on at by2.be which makes use of jQuery for most of its tasks. Selenium tests were the only way to test this application (as webrat isn't an option to test js actions) and writing these tests were taking all the speed and fun out of the project. Testing with jquery matchers instead of those provided by selenium sounded very handy and after some hours of frustration we hacked these few lines together and because we noticed enormous speed enhancements in writing tests, I decided to wrap things up in a gem and release it to whoever would like to use jQuery matchers in an easy way to handle tests.
15
16
 
16
17
  == How it works
17
18
 
@@ -21,13 +22,13 @@ Everything works around a central jquery matcher you call with 'jquery(matcher)'
21
22
 
22
23
  The matcher must match exactly one element or it will raise an error. This behaviour makes testing easier for me, but I'm still in search for a better idea here. For now it does the job.
23
24
 
24
- You can call methods upon the matched jquery object: 'wait_for_element(matcher)', 'wait_for_text(text)', 'wait_for_visible', 'wait_for_invisible'.
25
+ You can call methods upon the matched jquery object: 'wait_for_element(matcher)', 'wait_for_no_element(matcher), 'wait_for_text(text)', 'wait_for_visible', 'wait_for_invisible'.
25
26
 
26
- Other methods will call that same method upon the jquery. Example: jquery("#content").html will call '$("#content").html()' in the page you're testing and return what that method returns.
27
+ Other methods will call that same method upon the jQuery wrapper. Example: jquery("#content").html will call '$("#content").html()' in the page you're testing and return whatever that method returns as a string.
27
28
 
28
29
  == Examples
29
30
 
30
- Using the gem in a project with jquery you can use lines like these inside tests:
31
+ Using the gem in a project with jQuery enables stuff like:
31
32
 
32
33
  - jquery("#content").wait_for_visible
33
34
  - jquery("#dialog button:contains(Ok)").click
@@ -39,6 +40,13 @@ Using the gem in a project with jquery you can use lines like these inside tests
39
40
  - jquery("#dialog").should be_visible
40
41
  - jquery("#dialog") # page must have an element with id 'dialog'
41
42
 
43
+ == Install
44
+
45
+ - if you didn't run this allready: gem sources -a http://gems.github.com
46
+ - sudo gem install caifara-rSquery
47
+
48
+ - in features/support/selenium_env.rb add `require "rSquery"`
49
+
42
50
  == Pitfalls
43
51
 
44
52
  - rSquery only works if jquery is activated on the page you test (obviously).
@@ -46,10 +54,10 @@ Using the gem in a project with jquery you can use lines like these inside tests
46
54
 
47
55
  == requirements
48
56
 
49
- - rspec
50
- - cucumber
51
- - webapp using jquery
52
- - selenium-client
57
+ - rspec (gem)
58
+ - cucumber (gem)
59
+ - webapp using jQuery
60
+ - selenium-client (gem)
53
61
 
54
62
  == testing
55
63
 
@@ -61,7 +69,7 @@ In order to run the tests as described you'll need:
61
69
 
62
70
  A directory called test contains the html page on which the features will run. To start a webserver in this directory you can use thin. cd to the test-dir and run 'thin -R ../features/support/static.ru -p 3002 start'.
63
71
 
64
- Run selenium in another terminal 'selenium -singleWindow -browserSessionreuse' should be ideal.
72
+ Run selenium in another terminal. 'selenium -singleWindow -browserSessionreuse' should be ideal.
65
73
 
66
74
  Run the features (rake features)
67
75
 
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
2
+ :patch: 2
3
3
  :major: 0
4
4
  :minor: 1
@@ -3,7 +3,7 @@ class JQ
3
3
  attr_accessor :selenium
4
4
 
5
5
  def initialize(jquery_matcher, selenium)
6
- @jquery_matcher = jquery_matcher
6
+ @jquery_matcher = jquery_matcher.gsub(/'/, "\"")
7
7
  @selenium = selenium
8
8
  @basic_command = "$('#{@jquery_matcher}')"
9
9
  check_me
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caifara-rSquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivo Dancet
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-15 00:00:00 -07:00
12
+ date: 2009-07-07 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15