watir_css 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6f07dd5e75eeda87032565d7a935dd18dd81f20
4
- data.tar.gz: b430308783605df302565a8184735645b7250f28
3
+ metadata.gz: 86ee5dfc4cf6b5cf4af5885b2975a37ecea4cad5
4
+ data.tar.gz: d783387eeb3daefc8c682fd31104c115e82f8599
5
5
  SHA512:
6
- metadata.gz: ea6d64b1471d18104fd43ff246f6244c0439b8ecadf419b1c64b24c37ddc45417ec2f0128a78d0a0ec49f86fe437d7c8fbd51c365824c9cc0d8fd49c178f3fad
7
- data.tar.gz: bcadc60e3fc40afb296fe3db22d1aa212fd18883c0f53c6a6f30ea23b00da3f06bf370b4dd7ae554fe9b85b0e0167092bbec59336aa9e3180a33c9c662c91c39
6
+ metadata.gz: e8439dbc8ba086941e46ac6371fac7f5797ee1bd6e1be0bb48c929b9ec45095bad4160aeb57ee89797ce46ef3b6ab6bf2ce88225326236fca615bee37300ac16
7
+ data.tar.gz: 4e53c1df3f7e2b90936bf196a8c06f5ac435614c4ee701cf8f5df494242dfbcfd0ff0056c3cbb6e5edf1815e4d630d46484512172206a5a1ce2d1cc64c088a05
@@ -1,4 +1,8 @@
1
+ sudo: false
1
2
  language: ruby
2
3
  rvm:
3
- - 2.3.0
4
- before_install: gem install bundler -v 1.11.2
4
+ - 2.4.1
5
+ before_install:
6
+ - export DISPLAY=:99
7
+ - sh -e /etc/init.d/xvfb start
8
+ - export PATH=~/.webdrivers:$PATH
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # WatirCss
2
2
 
3
- CSS-based locator engine for [watir-webdriver](https://github.com/watir/watir-webdriver).
3
+ A CSS based locator engine for [watir](https://github.com/watir/watir).
4
+
5
+ By default Watir translates location approaches into XPath. This gem will replace XPath calls
6
+ with CSS calls where possible.
7
+
8
+ Some locator strategies supported by Watir cannot be reimplemented with watir_css.
9
+ In such cases, it falls back to the XPath implementation in Watir.
4
10
 
5
11
  ## Installation
6
12
 
@@ -24,50 +30,13 @@ $ gem install watir_css
24
30
 
25
31
  ## Usage
26
32
 
27
- Require after watir-webdriver, the rest should just work.
28
-
29
33
  ```ruby
30
- require 'watir-webdriver'
31
34
  require 'watir_css'
32
35
  ```
33
36
 
34
- ## Comparison with default watir-webdriver locator
35
-
36
- By default Watir converts calls into XPath; this gem will replace XPath calls
37
- with CSS calls where possible.
38
-
39
- This functionality used to be present directly in watir-webdriver. During
40
- the transition to Watir 6.0, a hook was included in the repository to
41
- allow for alternate locator strategies.
42
-
43
- This gem replaces:
44
-
45
- ```ruby
46
- Watir.prefer_css
47
- ```
48
-
49
- ## Limitations
50
-
51
- Some watir-webdriver locators cannot be reimplemented with watir_css. In such cases,
52
- it fall backs to watir-webdriver, so you should be able to migrate pretty easily.
53
-
54
- ## Development
55
-
56
- To install this gem onto your local machine, run `bundle exec rake install`.
57
- To release a new version, update the version number in `version.rb`,
58
- and then run `bundle exec rake release`, which will create a git tag for the version,
59
- push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
60
-
61
37
  ## Specs
62
38
 
63
- Watir_css uses [watirspec](https://github.com/watir/watirspec) for testing, so
64
- you should first fetch it:
65
-
66
- ```bash
67
- $ git submodule init && git submodule update
68
- ```
69
-
70
- Now, you can run all specs:
39
+ WatirCss will run watirspecs from Watir project:
71
40
 
72
41
  ```bash
73
42
  $ bundle exec rake spec
data/Rakefile CHANGED
@@ -3,4 +3,7 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ require 'watirspec/rake_tasks'
7
+ WatirSpec::RakeTasks.new
8
+
9
+ task default: %i[spec watirspec:run]
@@ -4,11 +4,10 @@ require 'watir_css/locators/element/locator'
4
4
  require 'watir_css/locators/element/selector_builder'
5
5
  require 'watir_css/locators/element/selector_builder/css'
6
6
  require 'watir_css/locators/element/validator'
7
- require 'watir_css/version'
8
7
 
9
8
  Watir.locator_namespace = WatirCss::Locators
10
9
 
11
- WatirCss::Locators::Button = Watir::Locators::Button
10
+ WatirCss::Locators::Button = Watir::Locators::Button
12
11
  WatirCss::Locators::Cell = Watir::Locators::Cell
13
12
  WatirCss::Locators::Row = Watir::Locators::Row
14
13
  WatirCss::Locators::TextArea = Watir::Locators::TextArea
@@ -10,12 +10,12 @@ module WatirCss
10
10
  private
11
11
 
12
12
  def build_wd_selector(selectors)
13
- unless selectors.values.any? { |e| e.is_a? Regexp }
14
- build_css(selectors) || build_xpath(selectors)
15
- end
13
+ return if selectors.values.any? { |e| e.is_a? Regexp }
14
+ build_css(selectors) || build_xpath(selectors)
16
15
  end
17
16
 
18
17
  def build_css(selectors)
18
+ return if selectors.values.any? { |e| e.is_a?(Symbol) || e.is_a?(TrueClass) || e.is_a?(FalseClass)}
19
19
  css_builder.build(selectors)
20
20
  end
21
21
 
@@ -1,11 +1,10 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'watir_css/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "watir_css"
8
- spec.version = WatirCss::VERSION
7
+ spec.version = "0.2.0"
9
8
  spec.authors = ["Titus Fortner"]
10
9
  spec.email = ["titusfortner@gmail.com"]
11
10
 
@@ -23,9 +22,10 @@ DESCRIPTION_MESSAGE
23
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
23
  spec.require_paths = ["lib"]
25
24
 
26
- spec.add_dependency 'watir', '>= 6.0.0.beta2'
27
25
  spec.add_development_dependency "bundler", "~> 1.11"
28
26
  spec.add_development_dependency "rake", "~> 10.0"
29
27
  spec.add_development_dependency "rspec", "~> 3.0"
30
- spec.add_development_dependency 'sinatra' # watirspec
28
+ spec.add_development_dependency "webdrivers", "~> 3.0"
29
+
30
+ spec.add_runtime_dependency "watir", "~> 6.8", ">= 6.8.1"
31
31
  end
metadata CHANGED
@@ -1,59 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Titus Fortner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-11 00:00:00.000000000 Z
11
+ date: 2017-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: watir
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.0.beta2
20
- type: :runtime
19
+ version: '1.11'
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: 6.0.0.beta2
26
+ version: '1.11'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.11'
33
+ version: '10.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
- version: '1.11'
40
+ version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '3.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
- version: '10.0'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: webdrivers
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
@@ -67,19 +67,25 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: sinatra
70
+ name: watir
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '6.8'
73
76
  - - ">="
74
77
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
78
+ version: 6.8.1
79
+ type: :runtime
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '6.8'
80
86
  - - ">="
81
87
  - !ruby/object:Gem::Version
82
- version: '0'
88
+ version: 6.8.1
83
89
  description: |
84
90
  By default Watir converts calls into XPath; this gem will replace XPath calls
85
91
  with CSS calls where possible.
@@ -102,7 +108,6 @@ files:
102
108
  - lib/watir_css/locators/element/selector_builder.rb
103
109
  - lib/watir_css/locators/element/selector_builder/css.rb
104
110
  - lib/watir_css/locators/element/validator.rb
105
- - lib/watir_css/version.rb
106
111
  - watir_css.gemspec
107
112
  homepage: https://github.com/watir/watir_css
108
113
  licenses:
@@ -124,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
129
  version: '0'
125
130
  requirements: []
126
131
  rubyforge_project:
127
- rubygems_version: 2.4.5.1
132
+ rubygems_version: 2.6.11
128
133
  signing_key:
129
134
  specification_version: 4
130
135
  summary: CSS locator engine for Watir
@@ -1,3 +0,0 @@
1
- module WatirCss
2
- VERSION = "0.1.0"
3
- end