touch_action 0.1.0 → 1.0.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: 9d3e2af6c99f3deef3611b2c7110b26f780d8dea
4
- data.tar.gz: 165fa9f2bf25346239a51b0f6fd663f1b0c61213
3
+ metadata.gz: 82ee1d3a90e1ca9e06b82b6a4b71b597c6baf5a1
4
+ data.tar.gz: d8e5b90ae5abfd37fd42bb6f7df90e427f32d0da
5
5
  SHA512:
6
- metadata.gz: 0e3e0e96f9665c9b4ff044b4e0852a3328abc5c538f14872c32dbeeced283b904aecffba0f1251e221e59b296714a705b6f74c44180ded05221f7d3e25be7657
7
- data.tar.gz: c52e192b96ac4af15786162ac6f7729cf10bc0bb2cd5b528ded46789c27cfa023aba196158bfe43dddbac5c788ae0b17ef2ae6d687c2cc382b3c60d19c7bd8e0
6
+ metadata.gz: f8dc130beeb23e82ac238cb02e86abdd44a2184f9d483ed5114070f8044ac33dc7e693ce4a83097c0fbb536af806a2fabf28b69293f0ddcfc1c295a540b665c2
7
+ data.tar.gz: 19fd3f00fb2a2165e53dc665960d44878602fcadf9cd1ea0490e010bf28610c4f25c1f7f6d1384cca8b57d84bc3849f83242393c80d69db26e934adc526055be
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+ before_install:
5
+ - gem install bundler --pre
6
+ before_script:
7
+ - "export DISPLAY=:99.0"
8
+ - "sh -e /etc/init.d/xvfb start"
9
+ - sleep 3 # give xvfb some time to start
10
+ - gem install bundler --pre
11
+ script:
12
+ - bundle exec rspec
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # TouchAction
2
+ [![Build Status](https://travis-ci.org/Ricardonacif/touch_action.svg?branch=master)](https://travis-ci.org/Ricardonacif/touch_action)
3
+ [![Code Climate](https://codeclimate.com/github/Ricardonacif/touch_action/badges/gpa.svg)](https://codeclimate.com/github/Ricardonacif/touch_action)
2
4
 
3
- Touch Action is a Ruby Gem used to add touch gestures simulation to the Watir-webdriver (and Selenium in the near future) in order to perform automated tests on mobile websites that requires those type of actions. It encapsulates the touch action library of [YUI JS](http://yuilibrary.com/yui/docs/event/simulate.html#simulating-touch-gestures). Very useful for example when testing mobile websites using [Appium](http://appium.io).
5
+ Touch Action is a Ruby Gem used to add touch gestures simulation to the Watir-WebDriver and Selenium-WebDriver in order to perform automated tests on mobile websites that requires those type of actions. It encapsulates the touch action library of [YUI JS](http://yuilibrary.com/yui/docs/event/simulate.html#simulating-touch-gestures). Very useful for example when testing mobile websites using [Appium](http://appium.io).
4
6
 
5
7
  ## Installation
6
8
 
@@ -1,3 +1,3 @@
1
1
  module TouchAction
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/touch_action.rb CHANGED
@@ -1,7 +1,13 @@
1
1
  require 'erb'
2
2
  require 'ostruct'
3
3
  require "touch_action/version"
4
- require 'watir-webdriver'
4
+
5
+ if Gem::Specification::find_all_by_name('watir-webdriver').any?
6
+ require 'watir-webdriver'
7
+ elsif Gem::Specification::find_all_by_name('selenium-webdriver').any?
8
+ require 'selenium-webdriver'
9
+ end
10
+
5
11
 
6
12
  module TouchAction
7
13
 
@@ -22,7 +28,11 @@ module TouchAction
22
28
  options = default_options.merge options
23
29
  script = File.read(File.expand_path("../touch_action/javascripts/#{action.to_s}.js.erb", __FILE__))
24
30
  final_script = render_erb(script, options)
25
- browser.execute_script( final_script, self )
31
+ if self.class == Selenium::WebDriver::Element
32
+ bridge.executeScript( final_script, self )
33
+ else
34
+ browser.execute_script( final_script, self )
35
+ end
26
36
  end
27
37
 
28
38
  private
@@ -33,4 +43,12 @@ private
33
43
 
34
44
  end
35
45
 
36
- Watir::Element.class_eval { include TouchAction }
46
+ if Gem::Specification::find_all_by_name('watir-webdriver').any?
47
+ Watir::Element.class_eval { include TouchAction }
48
+ elsif Gem::Specification::find_all_by_name('selenium-webdriver').any?
49
+ Selenium::WebDriver::Element.class_eval { include TouchAction }
50
+ end
51
+
52
+
53
+
54
+
data/spec/spec_helper.rb CHANGED
@@ -48,6 +48,7 @@ RSpec.configure do |config|
48
48
  @browser = Watir::Browser.new(Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => ENV['appium_url']))
49
49
  else
50
50
  @browser = Watir::Browser.new ENV['browser']
51
+ # @browser = Selenium::WebDriver.for :firefox
51
52
  end
52
53
  end
53
54
  config.after(:each) do
data/touch_action.gemspec CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = TouchAction::VERSION
9
9
  spec.authors = ["Ricardo Nacif"]
10
10
  spec.email = ["nacif.ricardo@gmail.com"]
11
- spec.summary = "Adds touch gestures to Watir and Selenium using YUI JS."
11
+ spec.summary = "Adds touch gestures to Watir-WebDriver and Selenium-WebDriver using YUI JS."
12
12
  spec.description = "Adds touch gestures to Watir and Selenium using YUI JS."
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/Ricardonacif/touch_action"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "watir-webdriver"
21
+ spec.add_development_dependency "watir-webdriver"
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.7"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: touch_action
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Nacif
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-21 00:00:00.000000000 Z
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir-webdriver
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -116,6 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
+ - ".travis.yml"
119
120
  - CHANGELOG.md
120
121
  - Gemfile
121
122
  - LICENSE.txt
@@ -153,7 +154,7 @@ files:
153
154
  - spec/support/static_website/rack_app.rb
154
155
  - spec/unit/watir-webdriver/element_spec.rb
155
156
  - touch_action.gemspec
156
- homepage: ''
157
+ homepage: https://github.com/Ricardonacif/touch_action
157
158
  licenses:
158
159
  - MIT
159
160
  metadata: {}
@@ -173,10 +174,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
174
  version: '0'
174
175
  requirements: []
175
176
  rubyforge_project:
176
- rubygems_version: 2.2.2
177
+ rubygems_version: 2.4.2
177
178
  signing_key:
178
179
  specification_version: 4
179
- summary: Adds touch gestures to Watir and Selenium using YUI JS.
180
+ summary: Adds touch gestures to Watir-WebDriver and Selenium-WebDriver using YUI JS.
180
181
  test_files:
181
182
  - spec/features/doubletap_spec.rb
182
183
  - spec/features/flick_spec.rb