page_magic 0.11.0.alpha2 → 0.11.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +34 -7
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/lib/page_magic/element.rb +11 -1
- data/lib/page_magic/elements.rb +6 -4
- data/page_magic.gemspec +7 -10
- data/spec/element_context_spec.rb +9 -9
- data/spec/element_spec.rb +21 -7
- metadata +14 -41
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d1859255acffb538a691d28d73ce14bcf0725d6f
|
4
|
+
data.tar.gz: 3a64fd4a58dd5aa358bd5dcc15d5cf0108d94754
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 54fc9710a9013f621a4bec82eeec5da843070aba85b1d12e4259da4452b4e23648caf13c010615a4c942f36eb31ff95ffd4d1f215a893060e6c74502c090d818
|
7
|
+
data.tar.gz: 0b8801158b735c37b39101e26c604a4483f01c960c99d6d9ec35a3aa72c980face0b0143bea687da5a5c0a793d20490d9dc0719f9f6725def9fc4dfb70524e69
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
addressable (2.3.6)
|
5
|
+
builder (3.2.2)
|
4
6
|
capybara (2.1.0)
|
5
7
|
mime-types (>= 1.16)
|
6
8
|
nokogiri (>= 1.3.3)
|
@@ -11,19 +13,44 @@ GEM
|
|
11
13
|
ffi (~> 1.0, >= 1.0.11)
|
12
14
|
cliver (0.2.2)
|
13
15
|
diff-lcs (1.2.4)
|
16
|
+
faraday (0.8.9)
|
17
|
+
multipart-post (~> 1.2.0)
|
14
18
|
ffi (1.9.3)
|
15
|
-
git (1.2.
|
16
|
-
|
17
|
-
|
19
|
+
git (1.2.6)
|
20
|
+
github_api (0.10.2)
|
21
|
+
addressable
|
22
|
+
faraday (~> 0.8.7)
|
23
|
+
hashie (>= 1.2)
|
24
|
+
multi_json (~> 1.4)
|
25
|
+
nokogiri (~> 1.6.0)
|
26
|
+
oauth2
|
27
|
+
hashie (2.0.5)
|
28
|
+
highline (1.6.21)
|
29
|
+
jeweler (2.0.1)
|
30
|
+
builder
|
31
|
+
bundler (>= 1.0)
|
18
32
|
git (>= 1.2.5)
|
33
|
+
github_api
|
34
|
+
highline (>= 1.6.15)
|
35
|
+
nokogiri (>= 1.5.10)
|
19
36
|
rake
|
20
37
|
rdoc
|
21
|
-
json (1.
|
38
|
+
json (1.8.1)
|
39
|
+
jwt (0.1.11)
|
40
|
+
multi_json (>= 1.5)
|
22
41
|
mime-types (1.25)
|
23
42
|
mini_portile (0.5.1)
|
24
43
|
multi_json (1.7.3)
|
44
|
+
multi_xml (0.5.5)
|
45
|
+
multipart-post (1.2.0)
|
25
46
|
nokogiri (1.6.0)
|
26
47
|
mini_portile (~> 0.5.0)
|
48
|
+
oauth2 (0.9.3)
|
49
|
+
faraday (>= 0.8, < 0.10)
|
50
|
+
jwt (~> 0.1.8)
|
51
|
+
multi_json (~> 1.3)
|
52
|
+
multi_xml (~> 0.5)
|
53
|
+
rack (~> 1.2)
|
27
54
|
poltergeist (1.4.1)
|
28
55
|
capybara (~> 2.1.0)
|
29
56
|
cliver (~> 0.2.1)
|
@@ -34,8 +61,8 @@ GEM
|
|
34
61
|
rack
|
35
62
|
rack-test (0.6.2)
|
36
63
|
rack (>= 1.0)
|
37
|
-
rake (10.
|
38
|
-
rdoc (4.
|
64
|
+
rake (10.2.2)
|
65
|
+
rdoc (4.1.1)
|
39
66
|
json (~> 1.4)
|
40
67
|
rspec (2.14.1)
|
41
68
|
rspec-core (~> 2.14.0)
|
@@ -73,7 +100,7 @@ PLATFORMS
|
|
73
100
|
|
74
101
|
DEPENDENCIES
|
75
102
|
capybara
|
76
|
-
jeweler
|
103
|
+
jeweler
|
77
104
|
poltergeist
|
78
105
|
rspec
|
79
106
|
simplecov
|
data/Rakefile
CHANGED
@@ -12,7 +12,6 @@ Jeweler::Tasks.new do |gem|
|
|
12
12
|
gem.description = "Framework for modeling and interacting with webpages which wraps capybara"
|
13
13
|
gem.email = "info@lad-tech.com"
|
14
14
|
gem.authors = ["Leon Davis"]
|
15
|
-
gem.add_dependency "watir-webdriver"
|
16
15
|
end
|
17
16
|
|
18
17
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.0.
|
1
|
+
0.11.0.alpha3
|
data/lib/page_magic/element.rb
CHANGED
@@ -5,7 +5,17 @@ module PageMagic
|
|
5
5
|
|
6
6
|
include AjaxSupport, Elements
|
7
7
|
|
8
|
-
|
8
|
+
class << self
|
9
|
+
def inherited clazz
|
10
|
+
clazz.extend(Elements, AjaxSupport)
|
11
|
+
def clazz.selector selector=nil
|
12
|
+
return @selector unless selector
|
13
|
+
@selector = selector
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize name, parent_page_element, type=nil, selector, &block
|
9
19
|
if selector.is_a?(Hash)
|
10
20
|
@selector = selector
|
11
21
|
else
|
data/lib/page_magic/elements.rb
CHANGED
@@ -9,7 +9,9 @@ module PageMagic
|
|
9
9
|
|
10
10
|
def self.extended clazz
|
11
11
|
clazz.class_eval do
|
12
|
-
|
12
|
+
unless instance_methods.include?(:browser_element)
|
13
|
+
attr_reader :browser_element
|
14
|
+
end
|
13
15
|
|
14
16
|
def element_definitions
|
15
17
|
self.class.element_definitions
|
@@ -43,12 +45,12 @@ module PageMagic
|
|
43
45
|
section_class, name, selector = args
|
44
46
|
|
45
47
|
unless selector
|
46
|
-
selector =
|
47
|
-
name = section_class.name.to_snake_case
|
48
|
+
selector = section_class.selector
|
49
|
+
name = section_class.name.to_snake_case.to_sym
|
48
50
|
end
|
49
51
|
|
50
52
|
add_element_definition(name) do |parent_browser_element|
|
51
|
-
section_class.new(name, parent_browser_element, :section, selector)
|
53
|
+
section_class.new(name, parent_browser_element, :section, selector|| section_class.selector)
|
52
54
|
end
|
53
55
|
|
54
56
|
end
|
data/page_magic.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "page_magic"
|
8
|
-
s.version = "0.11.0.
|
8
|
+
s.version = "0.11.0.alpha3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Leon Davis"]
|
12
|
-
s.date = "2014-
|
12
|
+
s.date = "2014-04-05"
|
13
13
|
s.description = "Framework for modeling and interacting with webpages which wraps capybara"
|
14
14
|
s.email = "info@lad-tech.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -53,28 +53,25 @@ Gem::Specification.new do |s|
|
|
53
53
|
s.homepage = "https://github.com/ladtech/page_magic"
|
54
54
|
s.licenses = ["ruby"]
|
55
55
|
s.require_paths = ["lib"]
|
56
|
-
s.rubygems_version = "
|
56
|
+
s.rubygems_version = "2.0.3"
|
57
57
|
s.summary = "Framework for modeling and interacting with webpages"
|
58
58
|
|
59
59
|
if s.respond_to? :specification_version then
|
60
|
-
s.specification_version =
|
60
|
+
s.specification_version = 4
|
61
61
|
|
62
62
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
63
63
|
s.add_runtime_dependency(%q<capybara>, [">= 0"])
|
64
64
|
s.add_runtime_dependency(%q<wait>, [">= 0"])
|
65
|
-
s.add_development_dependency(%q<jeweler>, ["
|
66
|
-
s.add_runtime_dependency(%q<watir-webdriver>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
67
66
|
else
|
68
67
|
s.add_dependency(%q<capybara>, [">= 0"])
|
69
68
|
s.add_dependency(%q<wait>, [">= 0"])
|
70
|
-
s.add_dependency(%q<jeweler>, ["
|
71
|
-
s.add_dependency(%q<watir-webdriver>, [">= 0"])
|
69
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
72
70
|
end
|
73
71
|
else
|
74
72
|
s.add_dependency(%q<capybara>, [">= 0"])
|
75
73
|
s.add_dependency(%q<wait>, [">= 0"])
|
76
|
-
s.add_dependency(%q<jeweler>, ["
|
77
|
-
s.add_dependency(%q<watir-webdriver>, [">= 0"])
|
74
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
78
75
|
end
|
79
76
|
end
|
80
77
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe PageMagic::ElementContext do
|
2
2
|
|
3
3
|
include_context :webapp
|
4
4
|
|
@@ -33,12 +33,12 @@ describe 'Element Context' do
|
|
33
33
|
page = page1.new
|
34
34
|
page.visit
|
35
35
|
|
36
|
-
|
36
|
+
described_class.new(page, page.browser, self).next
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'should raise an error if an element is not found' do
|
41
|
-
expect {
|
41
|
+
expect { described_class.new(page1.new(session), session, self).missing_thing }.to raise_error PageMagic::ElementMissingException
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should attempt to execute method on page object it is defined' do
|
@@ -48,7 +48,7 @@ describe 'Element Context' do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
described_class.new(page1.new(session), session, self).page_method.should == :called
|
52
52
|
end
|
53
53
|
|
54
54
|
describe 'retrieving elements' do
|
@@ -56,7 +56,7 @@ describe 'Element Context' do
|
|
56
56
|
page = elements_page.new
|
57
57
|
page.visit
|
58
58
|
|
59
|
-
element =
|
59
|
+
element = described_class.new(page, page.browser, self).a_link
|
60
60
|
element.text.should == 'a link'
|
61
61
|
end
|
62
62
|
end
|
@@ -66,7 +66,7 @@ describe 'Element Context' do
|
|
66
66
|
page = page1.new
|
67
67
|
page.visit
|
68
68
|
|
69
|
-
|
69
|
+
described_class.new(page, page.browser, self).click_next
|
70
70
|
page.session.current_path.should == '/page2'
|
71
71
|
page.text.should == 'page 2 content'
|
72
72
|
end
|
@@ -86,7 +86,7 @@ describe 'Element Context' do
|
|
86
86
|
page = elements_page.new
|
87
87
|
page.visit
|
88
88
|
|
89
|
-
|
89
|
+
described_class.new(page, page.browser, self).form
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'they are clickable too' do
|
@@ -100,7 +100,7 @@ describe 'Element Context' do
|
|
100
100
|
page.visit
|
101
101
|
|
102
102
|
|
103
|
-
|
103
|
+
described_class.new(page, page.browser, self).click_section
|
104
104
|
page.session.current_path.should == '/page2'
|
105
105
|
end
|
106
106
|
|
@@ -134,7 +134,7 @@ describe 'Element Context' do
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
|
137
|
+
described_class.new(page, page.browser, self).create.click
|
138
138
|
end
|
139
139
|
|
140
140
|
end
|
data/spec/element_spec.rb
CHANGED
@@ -17,17 +17,31 @@ describe 'Page elements' do
|
|
17
17
|
Capybara.current_session.visit('/')
|
18
18
|
end
|
19
19
|
|
20
|
-
describe '
|
20
|
+
describe 'inheriting' do
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
include_context :webapp
|
23
|
+
|
24
|
+
it 'lets you create custom elements' do
|
25
|
+
custom_element = Class.new(PageMagic::Element) do
|
26
|
+
selector css: '.form'
|
27
|
+
|
28
|
+
link :form_link, id: 'form_link'
|
29
|
+
def self.name
|
30
|
+
'Form'
|
31
|
+
end
|
32
|
+
end
|
25
33
|
|
26
|
-
let(:selector) { {css: '.class_name'} }
|
27
34
|
|
28
|
-
|
29
|
-
|
35
|
+
page = Class.new do
|
36
|
+
include PageMagic
|
37
|
+
url '/elements'
|
38
|
+
section custom_element
|
39
|
+
end
|
30
40
|
|
41
|
+
page = page.new
|
42
|
+
page.visit
|
43
|
+
page.form.form_link.visible?.should be_true
|
44
|
+
end
|
31
45
|
end
|
32
46
|
|
33
47
|
describe 'browser_element' do
|
metadata
CHANGED
@@ -1,78 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page_magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.0.
|
5
|
-
prerelease: 7
|
4
|
+
version: 0.11.0.alpha3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Leon Davis
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-04-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: capybara
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: wait
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: jeweler
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 1.8.4
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.8.4
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: watir-webdriver
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
45
|
+
- - '>='
|
68
46
|
- !ruby/object:Gem::Version
|
69
47
|
version: '0'
|
70
|
-
type: :
|
48
|
+
type: :development
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
51
|
requirements:
|
75
|
-
- -
|
52
|
+
- - '>='
|
76
53
|
- !ruby/object:Gem::Version
|
77
54
|
version: '0'
|
78
55
|
description: Framework for modeling and interacting with webpages which wraps capybara
|
@@ -118,29 +95,25 @@ files:
|
|
118
95
|
homepage: https://github.com/ladtech/page_magic
|
119
96
|
licenses:
|
120
97
|
- ruby
|
98
|
+
metadata: {}
|
121
99
|
post_install_message:
|
122
100
|
rdoc_options: []
|
123
101
|
require_paths:
|
124
102
|
- lib
|
125
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
-
none: false
|
127
104
|
requirements:
|
128
|
-
- -
|
105
|
+
- - '>='
|
129
106
|
- !ruby/object:Gem::Version
|
130
107
|
version: '0'
|
131
|
-
segments:
|
132
|
-
- 0
|
133
|
-
hash: -3934135450792737396
|
134
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
109
|
requirements:
|
137
|
-
- -
|
110
|
+
- - '>'
|
138
111
|
- !ruby/object:Gem::Version
|
139
112
|
version: 1.3.1
|
140
113
|
requirements: []
|
141
114
|
rubyforge_project:
|
142
|
-
rubygems_version:
|
115
|
+
rubygems_version: 2.0.3
|
143
116
|
signing_key:
|
144
|
-
specification_version:
|
117
|
+
specification_version: 4
|
145
118
|
summary: Framework for modeling and interacting with webpages
|
146
119
|
test_files: []
|