watir-device 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/lib/watir-device.rb +5 -0
- data/lib/watir-device/device.rb +39 -0
- data/lib/watir-device/version.rb +5 -0
- data/screenshot.png +0 -0
- data/watir-device.gemspec +26 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5a88d59a32832ae710aae68b6a11121611fb9dce
|
4
|
+
data.tar.gz: 5e5bbfcac8e6c8fb28b174dcc2548494f410e397
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5aeb5129001b535c0091a9ed64c72dc315299851bd511ae77f8d192ad8429beac9d78131f827744fb8b90a9e2109ce692d9954974f8df4a25b25cdc46bd82a4f
|
7
|
+
data.tar.gz: d45a75f1d45608f5d789a10247ca0529736b3211adf538511f64a33a1f0ce1addc08e788e2e15bc965df835d26221c5037beba5279dddd295f8a0c431207f158
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Johnson Denen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Watir::Device
|
2
|
+
|
3
|
+
Automate Chrome Developer Tools' device emulation with watir-webdriver.
|
4
|
+
|
5
|
+
![screenshot](screenshot.png)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'watir-device'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install watir-device
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Instantiate an emulated device much like you would a `Watir::Browser` object. Just pass it a valid device string:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'watir-device'
|
29
|
+
device = Watir::Device.new "Samsung Galaxy Note 3"
|
30
|
+
device.goto "www.google.com"
|
31
|
+
```
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
require 'watir-device'
|
35
|
+
device = Watir::Device.start "www.google.com", "Samsung Galaxy Note 3"
|
36
|
+
```
|
37
|
+
|
38
|
+
#### Methods
|
39
|
+
|
40
|
+
All methods you normally use with `Watir::Browser` are available to your `Watir::Device` object. The `Watir::Browser` object itself is available via `Watir::Device#browser`, though you shouldn't need to access it.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
device = Watir::Device.new "Samsung Galaxy Note 3"
|
44
|
+
device.browser
|
45
|
+
#=> <Watir::Browser:0x...>
|
46
|
+
```
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
1. Fork it ( https://github.com/[my-github-username]/watir-device/fork )
|
51
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
52
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
54
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/watir-device.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'watir-webdriver'
|
2
|
+
|
3
|
+
module Watir
|
4
|
+
class Device
|
5
|
+
attr_reader :device_name, :driver, :browser
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def start url, device_name, *args
|
9
|
+
new(device_name, *args).tap { |dev| dev.goto url }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize device_name, *args
|
14
|
+
@driver = device_driver(device_name)
|
15
|
+
@device_name = device_name
|
16
|
+
@browser = Watir::Browser.new driver
|
17
|
+
end
|
18
|
+
|
19
|
+
def device
|
20
|
+
device_name
|
21
|
+
end
|
22
|
+
|
23
|
+
def device_driver name
|
24
|
+
opts = {
|
25
|
+
"mobileEmulation" => {
|
26
|
+
"deviceName" => name
|
27
|
+
}
|
28
|
+
}
|
29
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => opts)
|
30
|
+
Selenium::WebDriver.for(:chrome, desired_capabilities: capabilities)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def method_missing mthd, *args
|
36
|
+
browser.send(mthd, *args)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/screenshot.png
ADDED
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'watir-device/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "watir-device"
|
8
|
+
spec.version = Watir::WatirDevice::VERSION
|
9
|
+
spec.authors = ["Johnson Denen"]
|
10
|
+
spec.email = ["johnson.denen@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Automate Chrome Developer Tools' device emulation with watir-webdriver}
|
13
|
+
spec.description = %q{Automate Chrome Developer Tools' device emulation with watir-webdriver}
|
14
|
+
spec.homepage = "https://github.com/jdenen/watir-device"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "watir-webdriver", "~> 0.8.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "simplecov", "~> 0.10"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: watir-device
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Johnson Denen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: watir-webdriver
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.9'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.10'
|
69
|
+
description: Automate Chrome Developer Tools' device emulation with watir-webdriver
|
70
|
+
email:
|
71
|
+
- johnson.denen@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/watir-device.rb
|
82
|
+
- lib/watir-device/device.rb
|
83
|
+
- lib/watir-device/version.rb
|
84
|
+
- screenshot.png
|
85
|
+
- watir-device.gemspec
|
86
|
+
homepage: https://github.com/jdenen/watir-device
|
87
|
+
licenses: []
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.4.6
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Automate Chrome Developer Tools' device emulation with watir-webdriver
|
109
|
+
test_files: []
|
110
|
+
has_rdoc:
|