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.
- data/README.rdoc +21 -13
- data/VERSION.yml +1 -1
- data/lib/rSquery/jquery.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
= rSquery
|
2
2
|
|
3
|
-
This project aims to reduce the difficulties involved in writing selenium tests in
|
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
|
-
|
9
|
-
|
10
|
-
|
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
|
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
|
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
|
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
|
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
|
|
data/VERSION.yml
CHANGED
data/lib/rSquery/jquery.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2009-07-07 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|