page_magic 2.0.3 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/page_magic/drivers/selenium.rb +1 -1
  4. data/lib/page_magic/session.rb +12 -3
  5. metadata +55 -90
  6. data/.codeclimate.yml +0 -4
  7. data/.pullreview.yml +0 -14
  8. data/.rspec +0 -1
  9. data/.rubocop.yml +0 -39
  10. data/.simplecov +0 -10
  11. data/.zsh_config +0 -6
  12. data/Dockerfile +0 -11
  13. data/Gemfile +0 -24
  14. data/Gemfile.lock +0 -178
  15. data/Makefile +0 -17
  16. data/Rakefile +0 -32
  17. data/circle.yml +0 -8
  18. data/page_magic.gemspec +0 -128
  19. data/spec/lib/active_support/core_ext/object/to_query_test.rb +0 -78
  20. data/spec/page_magic/class_methods_spec.rb +0 -92
  21. data/spec/page_magic/comparator/fuzzy_spec.rb +0 -44
  22. data/spec/page_magic/comparator/literal_spec.rb +0 -41
  23. data/spec/page_magic/comparator/null_spec.rb +0 -35
  24. data/spec/page_magic/comparator/parameter_map_spec.rb +0 -75
  25. data/spec/page_magic/driver_spec.rb +0 -40
  26. data/spec/page_magic/drivers/poltergeist_spec.rb +0 -8
  27. data/spec/page_magic/drivers/rack_test_spec.rb +0 -8
  28. data/spec/page_magic/drivers/selenium_spec.rb +0 -15
  29. data/spec/page_magic/drivers_spec.rb +0 -48
  30. data/spec/page_magic/element/locators_spec.rb +0 -36
  31. data/spec/page_magic/element/not_found_spec.rb +0 -24
  32. data/spec/page_magic/element/query/multiple_results_spec.rb +0 -14
  33. data/spec/page_magic/element/query/single_result_spec.rb +0 -21
  34. data/spec/page_magic/element/query_spec.rb +0 -38
  35. data/spec/page_magic/element/selector_spec.rb +0 -166
  36. data/spec/page_magic/element_context_spec.rb +0 -72
  37. data/spec/page_magic/element_definition_builder_spec.rb +0 -19
  38. data/spec/page_magic/element_spec.rb +0 -256
  39. data/spec/page_magic/elements/config_spec.rb +0 -203
  40. data/spec/page_magic/elements_spec.rb +0 -125
  41. data/spec/page_magic/instance_methods_spec.rb +0 -90
  42. data/spec/page_magic/mapping_spec.rb +0 -181
  43. data/spec/page_magic/session_methods_spec.rb +0 -40
  44. data/spec/page_magic/session_spec.rb +0 -149
  45. data/spec/page_magic/transitions_spec.rb +0 -43
  46. data/spec/page_magic/utils/string_spec.rb +0 -29
  47. data/spec/page_magic/utils/url_spec.rb +0 -9
  48. data/spec/page_magic/wait_methods_spec.rb +0 -35
  49. data/spec/page_magic/watcher_spec.rb +0 -22
  50. data/spec/page_magic/watchers_spec.rb +0 -80
  51. data/spec/page_magic_spec.rb +0 -115
  52. data/spec/spec_helper.rb +0 -15
  53. data/spec/support/shared_contexts.rb +0 -5
  54. data/spec/support/shared_examples.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1a9811611ede317ffdd2a0bbc3a611f6eed20c8c23bd5bd7cbd355f0c66d660
4
- data.tar.gz: 728d6cda028973338f615612b213f22c8954ea7e18322d6b4cdb078c7a9e8a9a
3
+ metadata.gz: b7c8b3d02f0d8ca42e539f1a7eb0166409efa99434f9bc1ebc814779bd639829
4
+ data.tar.gz: 5de8035527039cd66515208e996322c51f0646649a09f9a5a6fd3cf7c77e753b
5
5
  SHA512:
6
- metadata.gz: 756ebdd5a0d88342fe934ef27abc8cf96bdb5ac2478dd89b421ff4d5343812d1aca9e5fde7b19bad993101f38c9ed44ecfa0a8d6d0eb8319ba87604d42da60f0
7
- data.tar.gz: 44e72e003481db7ea23ec3716ce36f6fc8f767d805effef34c3f094c08f2ebbe3ace017bf080d56bb067653b46d4fa334d22bfdac4fe81ca98472f1a8fba9f61
6
+ metadata.gz: 7c120360eb3dd528b9f9292d07af056a7a2e27789d51474871820be2193a06360bd4b36e2e29ec654ef20b5b67f56ec7374f07803ad2a6ac0d581bbf9c1ea7c1
7
+ data.tar.gz: a8b5880ed40b04d1158895db11113e8554a014031dc2c52c06724b52a9c2fb7e9bc1e0c22b53cb9031466ff9d1d76de7700a01f8df3ea356f4e9babde2ed3a9d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.3
1
+ 2.0.9
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  PageMagic::Drivers::Selenium = PageMagic::Driver.new(:chrome, :firefox) do |app, options, browser|
4
- require 'watir'
4
+ require 'capybara/selenium/driver'
5
5
  Capybara::Selenium::Driver.new(app, **options.dup.merge(browser: browser))
6
6
  end
@@ -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
- def visit(page = nil, url: nil)
79
- url ||= transitions.url_for(page, base_url: base_url)
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(page) if 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.3
4
+ version: 2.0.9
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-04 00:00:00.000000000 Z
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: '0'
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: '0'
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.0'
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.0'
40
+ version: '3'
41
41
  - !ruby/object:Gem::Dependency
42
- name: github-markup
42
+ name: poltergeist
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
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: '0'
54
+ version: '1'
55
55
  - !ruby/object:Gem::Dependency
56
- name: jeweler
56
+ name: redcarpet
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
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: '0'
68
+ version: '3'
69
69
  - !ruby/object:Gem::Dependency
70
- name: redcarpet
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
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: '0'
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: '0'
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: '0'
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: '0'
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: '0'
110
+ version: '2'
111
111
  - !ruby/object:Gem::Dependency
112
- name: ruby-debug-ide
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.8'
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.8'
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
- - page_magic.gemspec
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
- - ruby
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.1'
215
+ version: '2.5'
251
216
  required_rubygems_version: !ruby/object:Gem::Requirement
252
217
  requirements:
253
218
  - - ">="
data/.codeclimate.yml DELETED
@@ -1,4 +0,0 @@
1
- languages:
2
- Ruby: true
3
- exclude_paths:
4
- - "spec/*"
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
@@ -1,11 +0,0 @@
1
- FROM ruby:2.7.2-alpine
2
-
3
- ENV APP_HOME /page_magic
4
- RUN mkdir $APP_HOME
5
-
6
- COPY . $APP_HOME
7
- WORKDIR $APP_HOME
8
-
9
- RUN apk --update --no-cache add build-base git
10
- RUN bundle install
11
- RUN rm -rf $APP_HOME
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 'simplecov', require: false
12
- gem 'sinatra'
13
- gem 'watir'
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