sparkling_watir 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8be8569b5d465e5b41cb77eebbab26537fdb755db47a0e486245e236535123fb
4
+ data.tar.gz: 2b5d78461d1c67bb27a01137f6cb549cac39265c675e88e6690fc66e56cfd390
5
+ SHA512:
6
+ metadata.gz: d9c368c193abb1b26507a8598ce60afb25a7de718e9325c0e5cb2254169ce7a5cf9cc5582fa2b9a67236cc29da60a1bc516bdf4a89a267c0b37318a99288a0f3
7
+ data.tar.gz: c2e9f30535754c03a862274c6360d8b76a13b5a139b3d32baf5eb65663615796d871d8d859b3b7c305e713002d2b31f0e390b458e28f7db668612a18fe6ffbe7
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .idea
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-3.1.0" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/sparkling_watir.iml" filepath="$PROJECT_DIR$/.idea/sparkling_watir.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.17, RVM: ruby-3.1.0) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-3.1.0) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-3.1.0) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.93.1, RVM: ruby-3.1.0) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="watir (v7.1.0, RVM: ruby-3.1.0) [gem]" level="application" />
19
+ </component>
20
+ <component name="RakeTasksCache">
21
+ <option name="myRootTask">
22
+ <RakeTaskImpl id="rake" />
23
+ </option>
24
+ </component>
25
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rubocop.yml ADDED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,79 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sparkling_watir (0.0.1)
5
+ appium_lib_core (~> 5.3.0)
6
+ watir (~> 7.1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ appium_lib_core (5.3.0)
12
+ faye-websocket (~> 0.11.0)
13
+ selenium-webdriver (~> 4.2, < 4.5)
14
+ ast (2.4.2)
15
+ childprocess (4.1.0)
16
+ diff-lcs (1.5.0)
17
+ eventmachine (1.2.7)
18
+ faye-websocket (0.11.1)
19
+ eventmachine (>= 0.12.0)
20
+ websocket-driver (>= 0.5.1)
21
+ parallel (1.22.1)
22
+ parser (3.1.2.1)
23
+ ast (~> 2.4.1)
24
+ rainbow (3.1.1)
25
+ rake (13.0.6)
26
+ regexp_parser (2.5.0)
27
+ rexml (3.2.5)
28
+ rspec (3.11.0)
29
+ rspec-core (~> 3.11.0)
30
+ rspec-expectations (~> 3.11.0)
31
+ rspec-mocks (~> 3.11.0)
32
+ rspec-core (3.11.0)
33
+ rspec-support (~> 3.11.0)
34
+ rspec-expectations (3.11.0)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.11.0)
37
+ rspec-mocks (3.11.1)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.11.0)
40
+ rspec-support (3.11.0)
41
+ rubocop (0.93.1)
42
+ parallel (~> 1.10)
43
+ parser (>= 2.7.1.5)
44
+ rainbow (>= 2.2.2, < 4.0)
45
+ regexp_parser (>= 1.8)
46
+ rexml
47
+ rubocop-ast (>= 0.6.0)
48
+ ruby-progressbar (~> 1.7)
49
+ unicode-display_width (>= 1.4.0, < 2.0)
50
+ rubocop-ast (1.21.0)
51
+ parser (>= 3.1.1.0)
52
+ ruby-progressbar (1.11.0)
53
+ rubyzip (2.3.2)
54
+ selenium-webdriver (4.4.0)
55
+ childprocess (>= 0.5, < 5.0)
56
+ rexml (~> 3.2, >= 3.2.5)
57
+ rubyzip (>= 1.2.2, < 3.0)
58
+ websocket (~> 1.0)
59
+ unicode-display_width (1.8.0)
60
+ watir (7.1.0)
61
+ regexp_parser (>= 1.2, < 3)
62
+ selenium-webdriver (~> 4.0)
63
+ websocket (1.2.9)
64
+ websocket-driver (0.7.5)
65
+ websocket-extensions (>= 0.1.0)
66
+ websocket-extensions (0.1.5)
67
+
68
+ PLATFORMS
69
+ arm64-darwin-21
70
+
71
+ DEPENDENCIES
72
+ bundler (~> 2.3.17)
73
+ rake (~> 13.0.6)
74
+ rspec (~> 3.11.0)
75
+ rubocop (~> 0.50)
76
+ sparkling_watir!
77
+
78
+ BUNDLED WITH
79
+ 2.3.17
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # SparklingWatir
2
+
3
+ Watir for testing your Mobile Devices. Powered by Appium.
4
+ This project is a revamp of Tap watir https://github.com/watir/tap_watir.
5
+
6
+ All the inspiration from this project is taking from Tap Watir, so all the credit goes
7
+ to the original creators and contributors
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'sparkling_watir'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install sparkling_watir
24
+
25
+ ## License
26
+
27
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
File without changes
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SparklingWatir
4
+
5
+ #
6
+ # This is a element in the native app context
7
+ #
8
+ class Element
9
+ def initialize(driver, selector)
10
+ @driver = driver
11
+ @selector = selector
12
+ end
13
+
14
+ def wd
15
+ @element || locate
16
+ end
17
+
18
+ def exists?
19
+ assert_exists
20
+ true
21
+ rescue Watir::Exception::UnknownObjectException
22
+ false
23
+ end
24
+ alias exist? exists?
25
+
26
+ def present?
27
+ assert_exists
28
+ @element.displayed?
29
+ rescue Watir::Exception::UnknownObjectException
30
+ false
31
+ end
32
+ alias visible? present?
33
+
34
+ def enabled?
35
+ assert_exists
36
+ @element.enabled?
37
+ rescue Watir::Exception::UnknownObjectException
38
+ false
39
+ end
40
+
41
+ def coordinates
42
+ @element.location
43
+ end
44
+ alias location coordinates
45
+
46
+ def size
47
+ @element.size
48
+ end
49
+
50
+ def bounds
51
+ {x: coordinates.x + size.width, y: coordinates.y + size.height}
52
+ end
53
+
54
+ private
55
+
56
+ def locate
57
+ @element = @driver.find_element(@selector.keys.first, @selector.values.first)
58
+ rescue Selenium::WebDriver::Error::NoSuchElementError
59
+ nil
60
+ end
61
+
62
+ def assert_exists
63
+ locate unless @element
64
+ return if @element
65
+
66
+ raise Watir::Exception::UnknownObjectException
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,37 @@
1
+ require 'appium_lib_core'
2
+ require 'watir'
3
+
4
+ module SparklingWatir
5
+ #
6
+ # For driving a native application or a native app context
7
+ #
8
+ class App
9
+ attr_accessor :driver
10
+
11
+ def initialize(opts)
12
+ url = opts[:caps].delete(:url)
13
+ @driver = Appium::Core::Driver.for(opts).start_driver(server_url: url)
14
+ end
15
+
16
+ def quit
17
+ @driver.quit
18
+ end
19
+ alias close quit
20
+
21
+ def element(selector)
22
+ Element.new(driver, selector)
23
+ end
24
+
25
+ def method_missing(method_name, *arguments, &block)
26
+ if driver.respond_to? method_name
27
+ driver.send method_name, *arguments, &block
28
+ else
29
+ super
30
+ end
31
+ end
32
+
33
+ def respond_to_missing?(method_name, include_private = false)
34
+ driver.respond_to?(method_name) || super
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'sparkling_watir'
8
+ spec.version = '0.0.1'
9
+ spec.authors = ['Agustin Pequeno']
10
+ spec.email = ['agustin.pe94@gmail.com']
11
+
12
+ spec.summary = 'A watir adaptation for testing your native mobile apps'
13
+ spec.description = 'Sparkling watir takes heavy inspiration from tap watir and tries to provide a mobile adaptation of watir'
14
+ spec.license = 'MIT'
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+
22
+ spec.require_paths = ['lib']
23
+ spec.required_ruby_version = '>= 2.7.0'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 2.3.17'
26
+ spec.add_development_dependency 'rake', '~> 13.0.6'
27
+ spec.add_development_dependency 'rspec', '~> 3.11.0'
28
+ spec.add_development_dependency 'rubocop', '~> 0.50'
29
+
30
+ spec.add_dependency 'appium_lib_core', '~>5.3.0 '
31
+ spec.add_dependency 'watir', '~> 7.1.0'
32
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sparkling_watir
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Agustin Pequeno
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-08-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.3.17
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.3.17
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 13.0.6
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 13.0.6
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.11.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.11.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.50'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.50'
69
+ - !ruby/object:Gem::Dependency
70
+ name: appium_lib_core
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 5.3.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 5.3.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: watir
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 7.1.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 7.1.0
97
+ description: Sparkling watir takes heavy inspiration from tap watir and tries to provide
98
+ a mobile adaptation of watir
99
+ email:
100
+ - agustin.pe94@gmail.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".idea/.gitignore"
107
+ - ".idea/misc.xml"
108
+ - ".idea/modules.xml"
109
+ - ".idea/sparkling_watir.iml"
110
+ - ".idea/vcs.xml"
111
+ - ".rubocop.yml"
112
+ - Gemfile
113
+ - Gemfile.lock
114
+ - README.md
115
+ - Rakefile
116
+ - lib/sparkling_watir.rb
117
+ - lib/sparkling_watir/element.rb
118
+ - sparkling_watir.gemspec
119
+ homepage:
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.7.0
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubygems_version: 3.3.3
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: A watir adaptation for testing your native mobile apps
142
+ test_files: []