test-page 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/CHANGES.md +5 -0
- data/LICENSE +1 -1
- data/README.md +103 -103
- data/Rakefile +2 -2
- data/lib/test/page/version.rb +1 -1
- data/spec/test/page_spec.rb +149 -149
- data/test-page.gemspec +2 -2
- metadata +22 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1aee53ea901cfd8fb18b0833628bce15db3c1f6
|
4
|
+
data.tar.gz: 01be9e6200e8a6fd60b49f65e029c5bde4bdd974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec73c9294a236f832d9034d4cc05f48ceab28fd8da7367b8e508c7222a4896690e6d546db86034e1f010596eeb3d3c49092f861d0cec635cd5e9e106a6423294
|
7
|
+
data.tar.gz: db26c6f80be63e3a9dc06117d6efe32f16bd4b15f2eb3c04da545d682a5153fd24f0d893315f4edec49b03c3c7024588d3effc81dbdcd8b058dbc9d52c0bc847
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,103 +1,103 @@
|
|
1
|
-
# test-page
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/test-page.png)](http://badge.fury.io/rb/test-page)
|
3
|
-
[![Build Status](https://
|
4
|
-
[![Coverage](https://coveralls.io/repos/jarmo/test-page/badge.png?branch=master)](https://coveralls.io/r/jarmo/test-page)
|
5
|
-
[![Dependency Status](https://gemnasium.com/jarmo/test-page.png)](https://gemnasium.com/jarmo/test-page)
|
6
|
-
[![Code Climate](https://codeclimate.com/github/jarmo/test-page.png)](https://codeclimate.com/github/jarmo/test-page)
|
7
|
-
|
8
|
-
test-page helps you to write easily maintainable integration tests by implementing [Page Objects](https://code.google.com/p/selenium/wiki/PageObjects) pattern.
|
9
|
-
|
10
|
-
Page Objects may be objects representing whole pages like LoginPage, ProfilePage or part of the pages like LoginForm, Header etc.
|
11
|
-
|
12
|
-
test-page can be described like:
|
13
|
-
|
14
|
-
* Is framework agnostic - you can use it with any library you want - [Watir](http://watir.com), [Selenium](http://seleniumhq.org/), [Capybara](https://github.com/jnicklas/capybara) etc.
|
15
|
-
* Has really [easy API](http://rubydoc.info/github/jarmo/test-page/frames) - you can start testing right away instead of spending too much time to learn new framework.
|
16
|
-
* Has really small codebase - even if you can't remember that small API you can dig right into the code - it's less than 100 lines!
|
17
|
-
* Despite of its name you may use it with [RSpec](http://rspec.info/), [Test::Unit](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/Test/Unit.html) or any other testing library.
|
18
|
-
|
19
|
-
## Installation
|
20
|
-
|
21
|
-
Add this line to your application's Gemfile:
|
22
|
-
|
23
|
-
gem 'test-page'
|
24
|
-
|
25
|
-
And then execute:
|
26
|
-
|
27
|
-
$ bundle
|
28
|
-
|
29
|
-
Or install it yourself as:
|
30
|
-
|
31
|
-
$ gem install test-page
|
32
|
-
|
33
|
-
## Usage
|
34
|
-
|
35
|
-
The following example uses Watir with RSpec, but you can use whichever library
|
36
|
-
you like.
|
37
|
-
|
38
|
-
[Check out Selenium example](https://github.com/jarmo/test-page/tree/master/examples) instead, if that's your flavor of choice.
|
39
|
-
|
40
|
-
This is the spec we are trying to run:
|
41
|
-
```ruby
|
42
|
-
# spec/search_spec.rb
|
43
|
-
require "test/page"
|
44
|
-
require "watir"
|
45
|
-
require File.expand_path("search_page", File.dirname(__FILE__))
|
46
|
-
|
47
|
-
describe "Bing" do
|
48
|
-
|
49
|
-
let(:browser) { Watir::Browser.new }
|
50
|
-
let(:search_page) { SearchPage.new }
|
51
|
-
|
52
|
-
before { Test::Page.browser = browser }
|
53
|
-
after { browser.close }
|
54
|
-
|
55
|
-
it "finds Google" do
|
56
|
-
results_page = search_page.search "google"
|
57
|
-
results_page.should have(10).results
|
58
|
-
results_page.results[0].should =~ /google/i
|
59
|
-
end
|
60
|
-
|
61
|
-
it "finds Bing itself" do
|
62
|
-
results_page = search_page.search "bing"
|
63
|
-
results_page.results.should be_any { |result| result =~ /Bing/ }
|
64
|
-
end
|
65
|
-
end
|
66
|
-
```
|
67
|
-
|
68
|
-
Let's create the SearchPage object:
|
69
|
-
```ruby
|
70
|
-
# spec/support/page/search_page.rb
|
71
|
-
require File.expand_path("results_page", File.dirname(__FILE__))
|
72
|
-
|
73
|
-
class SearchPage < Test::Page
|
74
|
-
element { browser.div(:id => "sbox") }
|
75
|
-
|
76
|
-
def setup
|
77
|
-
browser.goto "http://bing.com"
|
78
|
-
end
|
79
|
-
|
80
|
-
def search(term)
|
81
|
-
text_field(:id => "sb_form_q").set term
|
82
|
-
button(:id => "sb_form_go").click
|
83
|
-
redirect_to ResultsPage, browser.ul(:id => "wg0")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
```
|
87
|
-
|
88
|
-
Let's create the ResultsPage object:
|
89
|
-
```ruby
|
90
|
-
# spec/support/page/results_page.rb
|
91
|
-
class ResultsPage < Test::Page
|
92
|
-
def results
|
93
|
-
lis(:class => "sa_wr").map(&:text)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
```
|
97
|
-
|
98
|
-
There you have it, a fully functional spec using two page objects. Reference to the
|
99
|
-
[API documentation](http://rubydoc.info/github/jarmo/test-page/frames) for more usage information.
|
100
|
-
|
101
|
-
## License
|
102
|
-
|
103
|
-
Copyright (c) Jarmo Pertman (jarmo
|
1
|
+
# test-page
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/test-page.png)](http://badge.fury.io/rb/test-page)
|
3
|
+
[![Build Status](https://api.travis-ci.org/jarmo/test-page.png)](http://travis-ci.org/jarmo/test-page)
|
4
|
+
[![Coverage](https://coveralls.io/repos/jarmo/test-page/badge.png?branch=master)](https://coveralls.io/r/jarmo/test-page)
|
5
|
+
[![Dependency Status](https://gemnasium.com/jarmo/test-page.png)](https://gemnasium.com/jarmo/test-page)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/jarmo/test-page.png)](https://codeclimate.com/github/jarmo/test-page)
|
7
|
+
|
8
|
+
test-page helps you to write easily maintainable integration tests by implementing [Page Objects](https://code.google.com/p/selenium/wiki/PageObjects) pattern.
|
9
|
+
|
10
|
+
Page Objects may be objects representing whole pages like LoginPage, ProfilePage or part of the pages like LoginForm, Header etc.
|
11
|
+
|
12
|
+
test-page can be described like:
|
13
|
+
|
14
|
+
* Is framework agnostic - you can use it with any library you want - [Watir](http://watir.com), [Selenium](http://seleniumhq.org/), [Capybara](https://github.com/jnicklas/capybara) etc.
|
15
|
+
* Has really [easy API](http://rubydoc.info/github/jarmo/test-page/frames) - you can start testing right away instead of spending too much time to learn new framework.
|
16
|
+
* Has really small codebase - even if you can't remember that small API you can dig right into the code - it's less than 100 lines!
|
17
|
+
* Despite of its name you may use it with [RSpec](http://rspec.info/), [Test::Unit](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/Test/Unit.html) or any other testing library.
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
gem 'test-page'
|
24
|
+
|
25
|
+
And then execute:
|
26
|
+
|
27
|
+
$ bundle
|
28
|
+
|
29
|
+
Or install it yourself as:
|
30
|
+
|
31
|
+
$ gem install test-page
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
The following example uses Watir with RSpec, but you can use whichever library
|
36
|
+
you like.
|
37
|
+
|
38
|
+
[Check out Selenium example](https://github.com/jarmo/test-page/tree/master/examples) instead, if that's your flavor of choice.
|
39
|
+
|
40
|
+
This is the spec we are trying to run:
|
41
|
+
```ruby
|
42
|
+
# spec/search_spec.rb
|
43
|
+
require "test/page"
|
44
|
+
require "watir"
|
45
|
+
require File.expand_path("search_page", File.dirname(__FILE__))
|
46
|
+
|
47
|
+
describe "Bing" do
|
48
|
+
|
49
|
+
let(:browser) { Watir::Browser.new }
|
50
|
+
let(:search_page) { SearchPage.new }
|
51
|
+
|
52
|
+
before { Test::Page.browser = browser }
|
53
|
+
after { browser.close }
|
54
|
+
|
55
|
+
it "finds Google" do
|
56
|
+
results_page = search_page.search "google"
|
57
|
+
results_page.should have(10).results
|
58
|
+
results_page.results[0].should =~ /google/i
|
59
|
+
end
|
60
|
+
|
61
|
+
it "finds Bing itself" do
|
62
|
+
results_page = search_page.search "bing"
|
63
|
+
results_page.results.should be_any { |result| result =~ /Bing/ }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
Let's create the SearchPage object:
|
69
|
+
```ruby
|
70
|
+
# spec/support/page/search_page.rb
|
71
|
+
require File.expand_path("results_page", File.dirname(__FILE__))
|
72
|
+
|
73
|
+
class SearchPage < Test::Page
|
74
|
+
element { browser.div(:id => "sbox") }
|
75
|
+
|
76
|
+
def setup
|
77
|
+
browser.goto "http://bing.com"
|
78
|
+
end
|
79
|
+
|
80
|
+
def search(term)
|
81
|
+
text_field(:id => "sb_form_q").set term
|
82
|
+
button(:id => "sb_form_go").click
|
83
|
+
redirect_to ResultsPage, browser.ul(:id => "wg0")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
Let's create the ResultsPage object:
|
89
|
+
```ruby
|
90
|
+
# spec/support/page/results_page.rb
|
91
|
+
class ResultsPage < Test::Page
|
92
|
+
def results
|
93
|
+
lis(:class => "sa_wr").map(&:text)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
There you have it, a fully functional spec using two page objects. Reference to the
|
99
|
+
[API documentation](http://rubydoc.info/github/jarmo/test-page/frames) for more usage information.
|
100
|
+
|
101
|
+
## License
|
102
|
+
|
103
|
+
Copyright (c) Jarmo Pertman (jarmo@jarmopertman.com). See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
|
3
3
|
require 'rspec/core/rake_task'
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
6
|
task :default => :spec
|
7
|
-
task :
|
7
|
+
task 'release:source_control_push' => :spec
|
8
8
|
|
9
9
|
require 'yard'
|
10
10
|
YARD::Rake::YardocTask.new
|
data/lib/test/page/version.rb
CHANGED
data/spec/test/page_spec.rb
CHANGED
@@ -1,149 +1,149 @@
|
|
1
|
-
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
|
-
require File.expand_path("../../lib/test/page", File.dirname(__FILE__))
|
3
|
-
|
4
|
-
describe Test::Page do
|
5
|
-
let(:page_class) { Class.new(Test::Page) }
|
6
|
-
before { Test::Page.browser = nil }
|
7
|
-
|
8
|
-
context ".browser" do
|
9
|
-
it "sets the browser object for page" do
|
10
|
-
Test::Page.browser = "my browser"
|
11
|
-
Test::Page.browser.
|
12
|
-
end
|
13
|
-
|
14
|
-
it "does not set the browser object for sub-page class" do
|
15
|
-
Test::Page.browser = "your browser"
|
16
|
-
page_class.browser.
|
17
|
-
end
|
18
|
-
|
19
|
-
it "sets the browser object for sub-page instances" do
|
20
|
-
Test::Page.browser = "your browser"
|
21
|
-
page = page_class.new
|
22
|
-
page.browser.
|
23
|
-
end
|
24
|
-
|
25
|
-
it "can be overridden by sub-page" do
|
26
|
-
Test::Page.browser = "their browser"
|
27
|
-
page_class.browser = "my page browser"
|
28
|
-
page_class.browser.
|
29
|
-
Test::Page.browser.
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context ".element" do
|
34
|
-
before { page_class.browser = "foo" }
|
35
|
-
|
36
|
-
it "sets the element via block" do
|
37
|
-
page_class.element { "my element" }
|
38
|
-
page = page_class.new
|
39
|
-
page.element.
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "#initialize" do
|
44
|
-
it "allows to set element" do
|
45
|
-
page = page_class.new "my special element"
|
46
|
-
page.element.
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context "#element" do
|
51
|
-
it "evaluates element provided by the block only once per instance" do
|
52
|
-
page_class.browser = "foo"
|
53
|
-
block_called = false
|
54
|
-
page_class.element do
|
55
|
-
raise "block should have been called only once!" if block_called
|
56
|
-
block_called = true
|
57
|
-
"my element in block"
|
58
|
-
end
|
59
|
-
page = page_class.new
|
60
|
-
2.times { page.element.
|
61
|
-
block_called.
|
62
|
-
end
|
63
|
-
|
64
|
-
it "raises an exception if browser is not set" do
|
65
|
-
page_class.element { "whatever" }
|
66
|
-
|
67
|
-
expect {
|
68
|
-
page_class.new.element
|
69
|
-
}.to raise_error(Test::Page::NoBrowserSetException)
|
70
|
-
end
|
71
|
-
|
72
|
-
it "raises an exception if element is set via block without using browser" do
|
73
|
-
page_class.element { foo_bar }
|
74
|
-
page_class.browser = "foo"
|
75
|
-
|
76
|
-
expect {
|
77
|
-
page_class.new.element
|
78
|
-
}.to raise_error(Test::Page::InvalidElementDefinition)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context "#setup" do
|
83
|
-
it "is called only once if page has method defined" do
|
84
|
-
block_called = false
|
85
|
-
page_class.send :define_method, :setup do
|
86
|
-
raise "block should have been called only once!" if block_called
|
87
|
-
block_called = true
|
88
|
-
@element = "element via setup"
|
89
|
-
end
|
90
|
-
page = page_class.new
|
91
|
-
2.times { page.element.
|
92
|
-
block_called.
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
context "#redirect_to" do
|
97
|
-
it "returns the new page instance" do
|
98
|
-
second_page = Class.new(Test::Page)
|
99
|
-
page_class.send(:define_method, :redirect_me) { redirect_to second_page }
|
100
|
-
page_class.browser = "foo"
|
101
|
-
page = page_class.new
|
102
|
-
page.redirect_me.
|
103
|
-
end
|
104
|
-
|
105
|
-
it "is possible to specify new element" do
|
106
|
-
second_page = Class.new(Test::Page)
|
107
|
-
page_class.send(:define_method, :redirect_me) { redirect_to second_page, "new element" }
|
108
|
-
page = page_class.new "provided element"
|
109
|
-
redirected_page = page.redirect_me
|
110
|
-
redirected_page.element.
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
context "#method_missing" do
|
116
|
-
it "calls all missing methods on element object" do
|
117
|
-
page = page_class.new "element"
|
118
|
-
page.
|
119
|
-
page.size.
|
120
|
-
end
|
121
|
-
|
122
|
-
it "defines methods to the page class" do
|
123
|
-
page = page_class.new "element"
|
124
|
-
page.
|
125
|
-
page.size
|
126
|
-
page.
|
127
|
-
end
|
128
|
-
|
129
|
-
it "defined methods to the page class will invoke methods on new element instance too" do
|
130
|
-
page = page_class.new "element"
|
131
|
-
page.size
|
132
|
-
el = page.element
|
133
|
-
el.instance_eval do
|
134
|
-
singleton = class << self; self end
|
135
|
-
singleton.send(:define_method, :size) { raise "not expected to call this!" }
|
136
|
-
end
|
137
|
-
|
138
|
-
page.instance_variable_set :@element, "new element"
|
139
|
-
expect {
|
140
|
-
page.size
|
141
|
-
}.not_to raise_error
|
142
|
-
end
|
143
|
-
|
144
|
-
it "will raise a NoMethodError if no method is found on element" do
|
145
|
-
expect { page_class.new("element").foo }.to raise_error(NoMethodError)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
1
|
+
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
|
+
require File.expand_path("../../lib/test/page", File.dirname(__FILE__))
|
3
|
+
|
4
|
+
describe Test::Page do
|
5
|
+
let(:page_class) { Class.new(Test::Page) }
|
6
|
+
before { Test::Page.browser = nil }
|
7
|
+
|
8
|
+
context ".browser" do
|
9
|
+
it "sets the browser object for page" do
|
10
|
+
Test::Page.browser = "my browser"
|
11
|
+
expect(Test::Page.browser).to eq("my browser")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "does not set the browser object for sub-page class" do
|
15
|
+
Test::Page.browser = "your browser"
|
16
|
+
expect(page_class.browser).to be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it "sets the browser object for sub-page instances" do
|
20
|
+
Test::Page.browser = "your browser"
|
21
|
+
page = page_class.new
|
22
|
+
expect(page.browser).to eq("your browser")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "can be overridden by sub-page" do
|
26
|
+
Test::Page.browser = "their browser"
|
27
|
+
page_class.browser = "my page browser"
|
28
|
+
expect(page_class.browser).to eq("my page browser")
|
29
|
+
expect(Test::Page.browser).to eq("their browser")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context ".element" do
|
34
|
+
before { page_class.browser = "foo" }
|
35
|
+
|
36
|
+
it "sets the element via block" do
|
37
|
+
page_class.element { "my element" }
|
38
|
+
page = page_class.new
|
39
|
+
expect(page.element).to eq("my element")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "#initialize" do
|
44
|
+
it "allows to set element" do
|
45
|
+
page = page_class.new "my special element"
|
46
|
+
expect(page.element).to eq("my special element")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "#element" do
|
51
|
+
it "evaluates element provided by the block only once per instance" do
|
52
|
+
page_class.browser = "foo"
|
53
|
+
block_called = false
|
54
|
+
page_class.element do
|
55
|
+
raise "block should have been called only once!" if block_called
|
56
|
+
block_called = true
|
57
|
+
"my element in block"
|
58
|
+
end
|
59
|
+
page = page_class.new
|
60
|
+
2.times { expect(page.element).to eq("my element in block") }
|
61
|
+
expect(block_called).to be_truthy
|
62
|
+
end
|
63
|
+
|
64
|
+
it "raises an exception if browser is not set" do
|
65
|
+
page_class.element { "whatever" }
|
66
|
+
|
67
|
+
expect {
|
68
|
+
page_class.new.element
|
69
|
+
}.to raise_error(Test::Page::NoBrowserSetException)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "raises an exception if element is set via block without using browser" do
|
73
|
+
page_class.element { foo_bar }
|
74
|
+
page_class.browser = "foo"
|
75
|
+
|
76
|
+
expect {
|
77
|
+
page_class.new.element
|
78
|
+
}.to raise_error(Test::Page::InvalidElementDefinition)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "#setup" do
|
83
|
+
it "is called only once if page has method defined" do
|
84
|
+
block_called = false
|
85
|
+
page_class.send :define_method, :setup do
|
86
|
+
raise "block should have been called only once!" if block_called
|
87
|
+
block_called = true
|
88
|
+
@element = "element via setup"
|
89
|
+
end
|
90
|
+
page = page_class.new
|
91
|
+
2.times { expect(page.element).to eq("element via setup") }
|
92
|
+
expect(block_called).to be_truthy
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context "#redirect_to" do
|
97
|
+
it "returns the new page instance" do
|
98
|
+
second_page = Class.new(Test::Page)
|
99
|
+
page_class.send(:define_method, :redirect_me) { redirect_to second_page }
|
100
|
+
page_class.browser = "foo"
|
101
|
+
page = page_class.new
|
102
|
+
expect(page.redirect_me).to be_an_instance_of(second_page)
|
103
|
+
end
|
104
|
+
|
105
|
+
it "is possible to specify new element" do
|
106
|
+
second_page = Class.new(Test::Page)
|
107
|
+
page_class.send(:define_method, :redirect_me) { redirect_to second_page, "new element" }
|
108
|
+
page = page_class.new "provided element"
|
109
|
+
redirected_page = page.redirect_me
|
110
|
+
expect(redirected_page.element).to eq("new element")
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
context "#method_missing" do
|
116
|
+
it "calls all missing methods on element object" do
|
117
|
+
page = page_class.new "element"
|
118
|
+
expect(page).not_to respond_to(:size)
|
119
|
+
expect(page.size).to eq("element".size)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "defines methods to the page class" do
|
123
|
+
page = page_class.new "element"
|
124
|
+
expect(page).not_to respond_to(:size)
|
125
|
+
page.size
|
126
|
+
expect(page).to respond_to(:size)
|
127
|
+
end
|
128
|
+
|
129
|
+
it "defined methods to the page class will invoke methods on new element instance too" do
|
130
|
+
page = page_class.new "element"
|
131
|
+
page.size
|
132
|
+
el = page.element
|
133
|
+
el.instance_eval do
|
134
|
+
singleton = class << self; self end
|
135
|
+
singleton.send(:define_method, :size) { raise "not expected to call this!" }
|
136
|
+
end
|
137
|
+
|
138
|
+
page.instance_variable_set :@element, "new element"
|
139
|
+
expect {
|
140
|
+
page.size
|
141
|
+
}.not_to raise_error
|
142
|
+
end
|
143
|
+
|
144
|
+
it "will raise a NoMethodError if no method is found on element" do
|
145
|
+
expect { page_class.new("element").foo }.to raise_error(NoMethodError)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
data/test-page.gemspec
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/test/page/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Jarmo Pertman"]
|
6
|
-
gem.email = ["jarmo
|
6
|
+
gem.email = ["jarmo@jarmopertman.com"]
|
7
7
|
gem.description = %q{test-page helps you to write easily maintainable integration tests by using Watir, Selenium or any other testing library.}
|
8
8
|
gem.summary = %q{test-page helps you to write easily maintainable integration tests by using Watir, Selenium or any other testing library.}
|
9
9
|
gem.homepage = "https://github.com/jarmo/test-page"
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Test::Page::VERSION
|
17
17
|
|
18
|
-
gem.add_development_dependency "rspec", "~>
|
18
|
+
gem.add_development_dependency "rspec", "~>3.0"
|
19
19
|
gem.add_development_dependency "simplecov"
|
20
20
|
gem.add_development_dependency "yard"
|
21
21
|
gem.add_development_dependency "redcarpet"
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-page
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarmo Pertman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: simplecov
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: yard
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: redcarpet
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: test-page helps you to write easily maintainable integration tests by
|
84
84
|
using Watir, Selenium or any other testing library.
|
85
85
|
email:
|
86
|
-
- jarmo
|
86
|
+
- jarmo@jarmopertman.com
|
87
87
|
executables: []
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- .gitignore
|
92
|
-
- .rspec
|
93
|
-
- .travis.yml
|
94
|
-
- .yardopts
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- ".yardopts"
|
95
95
|
- CHANGES.md
|
96
96
|
- Gemfile
|
97
97
|
- LICENSE
|
@@ -117,17 +117,17 @@ require_paths:
|
|
117
117
|
- lib
|
118
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
|
-
- -
|
125
|
+
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.6.13
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: test-page helps you to write easily maintainable integration tests by using
|
@@ -135,4 +135,3 @@ summary: test-page helps you to write easily maintainable integration tests by u
|
|
135
135
|
test_files:
|
136
136
|
- spec/spec_helper.rb
|
137
137
|
- spec/test/page_spec.rb
|
138
|
-
has_rdoc:
|