page_magic 2.0.4 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/page_magic/session.rb +12 -3
- metadata +55 -90
- data/.codeclimate.yml +0 -4
- data/.pullreview.yml +0 -14
- data/.rspec +0 -1
- data/.rubocop.yml +0 -39
- data/.simplecov +0 -10
- data/.zsh_config +0 -6
- data/Dockerfile +0 -11
- data/Gemfile +0 -24
- data/Gemfile.lock +0 -175
- data/Makefile +0 -17
- data/Rakefile +0 -32
- data/circle.yml +0 -8
- data/page_magic.gemspec +0 -128
- data/spec/lib/active_support/core_ext/object/to_query_test.rb +0 -78
- data/spec/page_magic/class_methods_spec.rb +0 -92
- data/spec/page_magic/comparator/fuzzy_spec.rb +0 -44
- data/spec/page_magic/comparator/literal_spec.rb +0 -41
- data/spec/page_magic/comparator/null_spec.rb +0 -35
- data/spec/page_magic/comparator/parameter_map_spec.rb +0 -75
- data/spec/page_magic/driver_spec.rb +0 -40
- data/spec/page_magic/drivers/poltergeist_spec.rb +0 -8
- data/spec/page_magic/drivers/rack_test_spec.rb +0 -8
- data/spec/page_magic/drivers/selenium_spec.rb +0 -15
- data/spec/page_magic/drivers_spec.rb +0 -48
- data/spec/page_magic/element/locators_spec.rb +0 -36
- data/spec/page_magic/element/not_found_spec.rb +0 -24
- data/spec/page_magic/element/query/multiple_results_spec.rb +0 -14
- data/spec/page_magic/element/query/single_result_spec.rb +0 -21
- data/spec/page_magic/element/query_spec.rb +0 -38
- data/spec/page_magic/element/selector_spec.rb +0 -166
- data/spec/page_magic/element_context_spec.rb +0 -72
- data/spec/page_magic/element_definition_builder_spec.rb +0 -19
- data/spec/page_magic/element_spec.rb +0 -256
- data/spec/page_magic/elements/config_spec.rb +0 -203
- data/spec/page_magic/elements_spec.rb +0 -125
- data/spec/page_magic/instance_methods_spec.rb +0 -90
- data/spec/page_magic/mapping_spec.rb +0 -181
- data/spec/page_magic/session_methods_spec.rb +0 -40
- data/spec/page_magic/session_spec.rb +0 -149
- data/spec/page_magic/transitions_spec.rb +0 -43
- data/spec/page_magic/utils/string_spec.rb +0 -29
- data/spec/page_magic/utils/url_spec.rb +0 -9
- data/spec/page_magic/wait_methods_spec.rb +0 -35
- data/spec/page_magic/watcher_spec.rb +0 -22
- data/spec/page_magic/watchers_spec.rb +0 -80
- data/spec/page_magic_spec.rb +0 -115
- data/spec/spec_helper.rb +0 -15
- data/spec/support/shared_contexts.rb +0 -5
- data/spec/support/shared_examples.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7479392917a1df729c82a8cc557edd634ac89269ac65e30d6143360f79cbb9f
|
4
|
+
data.tar.gz: 79f4b9ee519ffff34d6900f283c90d264783120483fadc510e8bce1b2e5fdd09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9af0ce24d67fccd4999621969469f6b40d2b4de5f1fc41c25d78c2e79f6f370bb57c784e878788fcd4362bd877015ab905c3063d94ef15bc402ae3e53c7e13f6
|
7
|
+
data.tar.gz: 265df8ff0500d4e39e547752ea06b72652df2a1c45a5ec9323e4e4b1348f843099c0670e489968c86ea99b08e2e8580976738155894f6623e794090c9ec277d5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.10
|
data/lib/page_magic/session.rb
CHANGED
@@ -18,6 +18,8 @@ module PageMagic
|
|
18
18
|
# Create a new session instance
|
19
19
|
# @param [Object] capybara_session an instance of a capybara session
|
20
20
|
# @param [String] base_url url to start the session at.
|
21
|
+
#
|
22
|
+
|
21
23
|
def initialize(capybara_session, base_url = nil)
|
22
24
|
@raw_session = capybara_session
|
23
25
|
@base_url = base_url
|
@@ -44,6 +46,12 @@ module PageMagic
|
|
44
46
|
@transitions = Transitions.new(transitions)
|
45
47
|
end
|
46
48
|
|
49
|
+
def is_a?(klass)
|
50
|
+
return true if klass == Capybara::Session
|
51
|
+
|
52
|
+
super
|
53
|
+
end
|
54
|
+
|
47
55
|
# proxies unknown method calls to the currently loaded page object
|
48
56
|
# @return [Object] returned object from the page object method call
|
49
57
|
def method_missing(name, *args, &block)
|
@@ -75,13 +83,14 @@ module PageMagic
|
|
75
83
|
# @raise [InvalidURLException] if a page is supplied and there isn't a mapped path for it
|
76
84
|
# @raise [InvalidURLException] if neither a page or url are supplied
|
77
85
|
# @raise [InvalidURLException] if the mapped path for a page is a Regexp
|
78
|
-
|
79
|
-
|
86
|
+
# @return [PageMagic::Session] - returns self
|
87
|
+
def visit(page_or_url = nil, url: nil)
|
88
|
+
url ||= page_or_url.is_a?(String) ? page_or_url : transitions.url_for(page_or_url, base_url: base_url)
|
80
89
|
|
81
90
|
raise InvalidURLException, URL_MISSING_MSG unless url
|
82
91
|
|
83
92
|
raw_session.visit(url)
|
84
|
-
@current_page = initialize_page(
|
93
|
+
@current_page = initialize_page(page_or_url) unless page_or_url.is_a?(String)
|
85
94
|
self
|
86
95
|
end
|
87
96
|
|
metadata
CHANGED
@@ -1,125 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page_magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leon Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6'
|
20
20
|
type: :runtime
|
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: '6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capybara
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3
|
33
|
+
version: '3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3
|
40
|
+
version: '3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: poltergeist
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1'
|
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
|
-
version: '
|
54
|
+
version: '1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: redcarpet
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3'
|
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
|
-
version: '
|
68
|
+
version: '3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3'
|
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
|
-
version: '
|
82
|
+
version: '3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '2'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '2'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: selenium-webdriver
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- - "
|
136
|
+
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
@@ -128,14 +142,14 @@ dependencies:
|
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0
|
145
|
+
version: '0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0
|
152
|
+
version: '0'
|
139
153
|
description: Framework for modeling and interacting with webpages which wraps capybara
|
140
154
|
email: info@lvl-up.uk
|
141
155
|
executables: []
|
@@ -143,21 +157,9 @@ extensions: []
|
|
143
157
|
extra_rdoc_files:
|
144
158
|
- README.md
|
145
159
|
files:
|
146
|
-
- ".codeclimate.yml"
|
147
|
-
- ".pullreview.yml"
|
148
|
-
- ".rspec"
|
149
|
-
- ".rubocop.yml"
|
150
|
-
- ".simplecov"
|
151
160
|
- ".yardopts"
|
152
|
-
- ".zsh_config"
|
153
|
-
- Dockerfile
|
154
|
-
- Gemfile
|
155
|
-
- Gemfile.lock
|
156
|
-
- Makefile
|
157
161
|
- README.md
|
158
|
-
- Rakefile
|
159
162
|
- VERSION
|
160
|
-
- circle.yml
|
161
163
|
- lib/active_support/core_ext/object/to_query.rb
|
162
164
|
- lib/page_magic.rb
|
163
165
|
- lib/page_magic/class_methods.rb
|
@@ -198,46 +200,9 @@ files:
|
|
198
200
|
- lib/page_magic/wait_methods.rb
|
199
201
|
- lib/page_magic/watcher.rb
|
200
202
|
- lib/page_magic/watchers.rb
|
201
|
-
-
|
202
|
-
- spec/lib/active_support/core_ext/object/to_query_test.rb
|
203
|
-
- spec/page_magic/class_methods_spec.rb
|
204
|
-
- spec/page_magic/comparator/fuzzy_spec.rb
|
205
|
-
- spec/page_magic/comparator/literal_spec.rb
|
206
|
-
- spec/page_magic/comparator/null_spec.rb
|
207
|
-
- spec/page_magic/comparator/parameter_map_spec.rb
|
208
|
-
- spec/page_magic/driver_spec.rb
|
209
|
-
- spec/page_magic/drivers/poltergeist_spec.rb
|
210
|
-
- spec/page_magic/drivers/rack_test_spec.rb
|
211
|
-
- spec/page_magic/drivers/selenium_spec.rb
|
212
|
-
- spec/page_magic/drivers_spec.rb
|
213
|
-
- spec/page_magic/element/locators_spec.rb
|
214
|
-
- spec/page_magic/element/not_found_spec.rb
|
215
|
-
- spec/page_magic/element/query/multiple_results_spec.rb
|
216
|
-
- spec/page_magic/element/query/single_result_spec.rb
|
217
|
-
- spec/page_magic/element/query_spec.rb
|
218
|
-
- spec/page_magic/element/selector_spec.rb
|
219
|
-
- spec/page_magic/element_context_spec.rb
|
220
|
-
- spec/page_magic/element_definition_builder_spec.rb
|
221
|
-
- spec/page_magic/element_spec.rb
|
222
|
-
- spec/page_magic/elements/config_spec.rb
|
223
|
-
- spec/page_magic/elements_spec.rb
|
224
|
-
- spec/page_magic/instance_methods_spec.rb
|
225
|
-
- spec/page_magic/mapping_spec.rb
|
226
|
-
- spec/page_magic/session_methods_spec.rb
|
227
|
-
- spec/page_magic/session_spec.rb
|
228
|
-
- spec/page_magic/transitions_spec.rb
|
229
|
-
- spec/page_magic/utils/string_spec.rb
|
230
|
-
- spec/page_magic/utils/url_spec.rb
|
231
|
-
- spec/page_magic/wait_methods_spec.rb
|
232
|
-
- spec/page_magic/watcher_spec.rb
|
233
|
-
- spec/page_magic/watchers_spec.rb
|
234
|
-
- spec/page_magic_spec.rb
|
235
|
-
- spec/spec_helper.rb
|
236
|
-
- spec/support/shared_contexts.rb
|
237
|
-
- spec/support/shared_examples.rb
|
238
|
-
homepage: https://github.com/ladtech/page_magic
|
203
|
+
homepage: https://github.com/lvl-up/page_magic
|
239
204
|
licenses:
|
240
|
-
-
|
205
|
+
- Ruby
|
241
206
|
metadata: {}
|
242
207
|
post_install_message:
|
243
208
|
rdoc_options: []
|
@@ -247,7 +212,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
212
|
requirements:
|
248
213
|
- - ">="
|
249
214
|
- !ruby/object:Gem::Version
|
250
|
-
version: '2.
|
215
|
+
version: '2.5'
|
251
216
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
217
|
requirements:
|
253
218
|
- - ">="
|
data/.codeclimate.yml
DELETED
data/.pullreview.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
---
|
2
|
-
languages:
|
3
|
-
- ruby
|
4
|
-
rules:
|
5
|
-
test_infection:
|
6
|
-
except:
|
7
|
-
- 'lib/page_magic/exceptions*'
|
8
|
-
missing_class_documentation:
|
9
|
-
except:
|
10
|
-
- 'lib/page_magic/element/query.rb'
|
11
|
-
- 'lib/page_magic/element/selector.rb'
|
12
|
-
- 'lib/page_magic/element/method_observer.rb'
|
13
|
-
- 'lib/page_magic/element.rb'
|
14
|
-
- 'lib/page_magic/session.rb'
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--require 'spec_helper'
|
data/.rubocop.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require: rubocop-rspec
|
2
|
-
|
3
|
-
Layout/LineLength:
|
4
|
-
Max: 120
|
5
|
-
|
6
|
-
AllCops:
|
7
|
-
NewCops: enable
|
8
|
-
TargetRubyVersion: 2.7
|
9
|
-
Exclude:
|
10
|
-
- 'lib/active_support/**/*'
|
11
|
-
- 'spec/lib/active_support/**/*'
|
12
|
-
- 'pkg/**/*'
|
13
|
-
- 'vendor/**/*'
|
14
|
-
- 'coverage/**/*'
|
15
|
-
- '.idea/**/*'
|
16
|
-
- '*.gemspec'
|
17
|
-
|
18
|
-
Metrics/ParameterLists:
|
19
|
-
CountKeywordArgs: false
|
20
|
-
|
21
|
-
Metrics/MethodLength:
|
22
|
-
Max: 11
|
23
|
-
|
24
|
-
#Style/MethodMissing:
|
25
|
-
# Enabled: false
|
26
|
-
|
27
|
-
Metrics/BlockLength:
|
28
|
-
Enabled: true
|
29
|
-
Exclude:
|
30
|
-
- 'spec/**/*'
|
31
|
-
|
32
|
-
Style/PercentLiteralDelimiters:
|
33
|
-
PreferredDelimiters:
|
34
|
-
default: ()
|
35
|
-
'%i': '[]'
|
36
|
-
'%I': '[]'
|
37
|
-
'%r': '{}'
|
38
|
-
'%w': '[]'
|
39
|
-
'%W': '[]'
|
data/.simplecov
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'pullreview/coverage'
|
4
|
-
|
5
|
-
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, PullReview::Coverage::Formatter]
|
6
|
-
|
7
|
-
SimpleCov.start do
|
8
|
-
add_filter '/spec/'
|
9
|
-
add_filter '/lib/active_support/core_ext/object/to_query.rb'
|
10
|
-
end
|
data/.zsh_config
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
alias bundle="docker run -v $(pwd):/page_magic -t lvl-up/page-magic bundle"
|
3
|
-
alias ruby="bundle exec ruby"
|
4
|
-
alias rake="bundle exec rake"
|
5
|
-
alias rubocop="bundle exec rubocop"
|
6
|
-
alias gem="docker run -v $(pwd):/page_magic -t lvl-up/page-magic gem"
|
data/Dockerfile
DELETED
data/Gemfile
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'activesupport'
|
6
|
-
gem 'capybara', '>=3.0'
|
7
|
-
|
8
|
-
group :test do
|
9
|
-
gem 'poltergeist'
|
10
|
-
gem 'rspec', require: 'rspec/core/rake_task'
|
11
|
-
gem 'selenium-webdriver'
|
12
|
-
gem 'simplecov', require: false
|
13
|
-
gem 'sinatra'
|
14
|
-
end
|
15
|
-
|
16
|
-
group :development do
|
17
|
-
gem 'github-markup'
|
18
|
-
gem 'jeweler'
|
19
|
-
gem 'redcarpet'
|
20
|
-
gem 'rubocop', require: 'rubocop/rake_task'
|
21
|
-
gem 'rubocop-rspec', require: false
|
22
|
-
gem 'ruby-debug-ide', require: false
|
23
|
-
gem 'yard', '~> 0.8'
|
24
|
-
end
|