testa_appium_driver 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.idea/deployment.xml +21 -0
  4. data/.idea/inspectionProfiles/Project_Default.xml +9 -0
  5. data/.idea/misc.xml +6 -0
  6. data/.idea/modules.xml +8 -0
  7. data/.idea/runConfigurations/Android_Test.xml +42 -0
  8. data/.idea/sshConfigs.xml +10 -0
  9. data/.idea/vcs.xml +6 -0
  10. data/.idea/webServers.xml +14 -0
  11. data/.rspec +3 -0
  12. data/.rubocop.yml +13 -0
  13. data/CHANGELOG.md +5 -0
  14. data/CODE_OF_CONDUCT.md +102 -0
  15. data/Gemfile +12 -0
  16. data/LICENSE.txt +21 -0
  17. data/README.md +52 -0
  18. data/Rakefile +12 -0
  19. data/bin/console +17 -0
  20. data/bin/setup +8 -0
  21. data/lib/testa_appium_driver.rb +6 -0
  22. data/lib/testa_appium_driver/android/class_selectors.rb +353 -0
  23. data/lib/testa_appium_driver/android/driver.rb +52 -0
  24. data/lib/testa_appium_driver/android/locator.rb +115 -0
  25. data/lib/testa_appium_driver/android/locator/attributes.rb +116 -0
  26. data/lib/testa_appium_driver/android/scroll_actions/uiautomator_scroll_actions.rb +77 -0
  27. data/lib/testa_appium_driver/android/selenium_element.rb +8 -0
  28. data/lib/testa_appium_driver/common/bounds.rb +150 -0
  29. data/lib/testa_appium_driver/common/constants.rb +33 -0
  30. data/lib/testa_appium_driver/common/exceptions/strategy_mix_exception.rb +12 -0
  31. data/lib/testa_appium_driver/common/helpers.rb +242 -0
  32. data/lib/testa_appium_driver/common/locator.rb +371 -0
  33. data/lib/testa_appium_driver/common/locator/scroll_actions.rb +287 -0
  34. data/lib/testa_appium_driver/common/scroll_actions.rb +253 -0
  35. data/lib/testa_appium_driver/common/scroll_actions/json_wire_scroll_actions.rb +4 -0
  36. data/lib/testa_appium_driver/common/scroll_actions/w3c_scroll_actions.rb +261 -0
  37. data/lib/testa_appium_driver/driver.rb +226 -0
  38. data/lib/testa_appium_driver/ios/driver.rb +35 -0
  39. data/lib/testa_appium_driver/ios/locator.rb +40 -0
  40. data/lib/testa_appium_driver/ios/locator/attributes.rb +79 -0
  41. data/lib/testa_appium_driver/ios/selenium_element.rb +7 -0
  42. data/lib/testa_appium_driver/ios/type_selectors.rb +167 -0
  43. data/lib/testa_appium_driver/version.rb +5 -0
  44. data/testa_appium_driver.gemspec +40 -0
  45. data/testa_appium_driver.iml +79 -0
  46. metadata +147 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: de964b80dabf1bc1507dcca4f28803c392f7b2da2cc6f8863479550ad55d49f2
4
+ data.tar.gz: 1555d6350706198af6a082cc0010295aabf07cebb7bc2527704c69fbbe96efd0
5
+ SHA512:
6
+ metadata.gz: f4a5426075f7a95d195e841f6b2043e0ac0401b4df7cefafab1c205f5fc5288c0cd56bdc5ab7cd64a55d1d7aa62b2b97467edc181c2c767ac8f01f0fa18161c0
7
+ data.tar.gz: 776de44ceaf20140dc3e414a6ee66b05bb7b74356196f9a644b4f88539c17fe8c68dcfce59bf2115bcda1e3424ee0aa54130f323a2d97c1ada405a2218027f59
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ /.idea/workspace.xml
14
+ /.idea/misc.xml
15
+ Gemfile.lock
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PublishConfigData" autoUpload="On explicit save action" promptOnRemoteOverwrite="CHECK_CONTENT" serverName="supertesta.com" createEmptyFolders="true" remoteFilesAllowedToDisappearOnAutoupload="false" autoUploadExternalChanges="true">
4
+ <serverData>
5
+ <paths name="supertesta.com">
6
+ <serverdata>
7
+ <mappings>
8
+ <mapping deploy="/testa_docker/path_data\testa_appium_driver" local="$PROJECT_DIR$" web="/" />
9
+ </mappings>
10
+ <excludedPaths>
11
+ <excludedPath local="true" path="$PROJECT_DIR$/.idea" />
12
+ <excludedPath local="true" path="$PROJECT_DIR$/tmp" />
13
+ <excludedPath local="true" path="$PROJECT_DIR$/testa_appium_driver.iml" />
14
+ <excludedPath local="true" path="$PROJECT_DIR$/Gemfile.lock" />
15
+ </excludedPaths>
16
+ </serverdata>
17
+ </paths>
18
+ </serverData>
19
+ <option name="myAutoUpload" value="ON_EXPLICIT_SAVE" />
20
+ </component>
21
+ </project>
@@ -0,0 +1,9 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ <inspection_tool class="RubyClassMethodNamingConvention" enabled="true" level="WARNING" enabled_by_default="true">
6
+ <option name="m_maxLength" value="40" />
7
+ </inspection_tool>
8
+ </profile>
9
+ </component>
data/.idea/misc.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.6.5-p114" project-jdk-type="RUBY_SDK">
4
+ <output url="file://$PROJECT_DIR$/out" />
5
+ </component>
6
+ </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$/testa_appium_driver.iml" filepath="$PROJECT_DIR$/testa_appium_driver.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,42 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Android Test" type="RSpecRunConfigurationType" factoryName="RSpec">
3
+ <module name="testa_appium_driver" />
4
+ <predefined_log_file enabled="true" id="RUBY_RSPEC" />
5
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
6
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
7
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
8
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
9
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
10
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
11
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
12
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" ENABLE_FORKED_COVERAGE="true" />
13
+ <EXTENSION ID="net.ashald.envfile">
14
+ <option name="IS_ENABLED" value="false" />
15
+ <option name="IS_SUBST" value="false" />
16
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
17
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
18
+ <option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
19
+ <ENTRIES>
20
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
21
+ </ENTRIES>
22
+ </EXTENSION>
23
+ <EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
24
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
25
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$PROJECT_DIR$/spec/testa_appium_driver_android_spec.rb" />
26
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATHS" VALUE="$PROJECT_DIR$/spec/testa_appium_driver_android_spec.rb" />
27
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
28
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
29
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
30
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
31
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
32
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="3.10.1" />
33
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
34
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
35
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
36
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
37
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
38
+ <method v="2">
39
+ <option name="Make" enabled="true" />
40
+ </method>
41
+ </configuration>
42
+ </component>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="SshConfigs">
4
+ <configs>
5
+ <sshConfig authType="PASSWORD" host="supertesta.com" id="ea45cb27-d516-4292-a1f7-430f02857685" port="22" customName="Supertesta.com" nameFormat="CUSTOM" username="testa">
6
+ <option name="customName" value="Supertesta.com" />
7
+ </sshConfig>
8
+ </configs>
9
+ </component>
10
+ </project>
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="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="WebServers">
4
+ <option name="servers">
5
+ <webServer id="b1f6f214-0ed7-4869-998b-43dc6e5c154a" name="supertesta.com">
6
+ <fileTransfer rootFolder="/ruby_apps" accessType="SFTP" host="supertesta.com" port="22" sshConfigId="ea45cb27-d516-4292-a1f7-430f02857685" sshConfig="Supertesta.com">
7
+ <advancedOptions>
8
+ <advancedOptions dataProtectionLevel="Private" keepAliveTimeout="0" passiveMode="true" shareSSLContext="true" />
9
+ </advancedOptions>
10
+ </fileTransfer>
11
+ </webServer>
12
+ </option>
13
+ </component>
14
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-08-13
4
+
5
+ - Initial release
@@ -0,0 +1,102 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for
6
+ everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity
7
+ and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion,
8
+ or sexual identity and orientation.
9
+
10
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to a positive environment for our community include:
15
+
16
+ * Demonstrating empathy and kindness toward other people
17
+ * Being respectful of differing opinions, viewpoints, and experiences
18
+ * Giving and gracefully accepting constructive feedback
19
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
20
+ * Focusing on what is best not just for us as individuals, but for the overall community
21
+
22
+ Examples of unacceptable behavior include:
23
+
24
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
25
+ * Trolling, insulting or derogatory comments, and personal or political attacks
26
+ * Public or private harassment
27
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
28
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take
33
+ appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive,
34
+ or harmful.
35
+
36
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
37
+ issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for
38
+ moderation decisions when appropriate.
39
+
40
+ ## Scope
41
+
42
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing
43
+ the community in public spaces. Examples of representing our community include using an official e-mail address, posting
44
+ via an official social media account, or acting as an appointed representative at an online or offline event.
45
+
46
+ ## Enforcement
47
+
48
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible
49
+ for enforcement at karlo.razumovic@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
50
+
51
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
52
+
53
+ ## Enforcement Guidelines
54
+
55
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem
56
+ in violation of this Code of Conduct:
57
+
58
+ ### 1. Correction
59
+
60
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the
61
+ community.
62
+
63
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation
64
+ and an explanation of why the behavior was inappropriate. A public apology may be requested.
65
+
66
+ ### 2. Warning
67
+
68
+ **Community Impact**: A violation through a single incident or series of actions.
69
+
70
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including
71
+ unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding
72
+ interactions in community spaces as well as external channels like social media. Violating these terms may lead to a
73
+ temporary or permanent ban.
74
+
75
+ ### 3. Temporary Ban
76
+
77
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
78
+
79
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified
80
+ period of time. No public or private interaction with the people involved, including unsolicited interaction with those
81
+ enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
82
+
83
+ ### 4. Permanent Ban
84
+
85
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate
86
+ behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
87
+
88
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
89
+
90
+ ## Attribution
91
+
92
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available
93
+ at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
94
+
95
+ Community Impact Guidelines were inspired
96
+ by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
97
+
98
+ [homepage]: https://www.contributor-covenant.org
99
+
100
+ For answers to common questions about this code of conduct, see the FAQ at
101
+ https://www.contributor-covenant.org/faq. Translations are available
102
+ at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in testa_appium_driver.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 karlo.razumovic
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # TestaAppiumDriver
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
4
+ into a gem. Put your Ruby code in the file `lib/testa_appium_driver`. To experiment with that code, run `bin/console`
5
+ for an interactive prompt.
6
+
7
+ TODO: Delete this and the text above, and describe your gem
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'testa_appium_driver'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install testa_appium_driver
24
+
25
+ ## Usage
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
32
+ also run `bin/console` for an interactive prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
35
+ version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
36
+ push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/testa_appium_driver. This project
41
+ is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
42
+ the [code of conduct](https://github.com/[USERNAME]/testa_appium_driver/blob/master/CODE_OF_CONDUCT.md).
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
47
+
48
+ ## Code of Conduct
49
+
50
+ Everyone interacting in the TestaAppiumDriver project's codebases, issue trackers, chat rooms and mailing lists is
51
+ expected to follow
52
+ the [code of conduct](https://github.com/[USERNAME]/testa_appium_driver/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+
6
+ #noinspection RubyResolve
7
+ require "testa_appium_driver"
8
+
9
+ # You can add fixtures and/or initialization code here to make experimenting
10
+ # with your gem easier. You can also use a different console, if you like.
11
+
12
+ # (If you use this, don't forget to add pry to your Gemfile!)
13
+ # require "pry"
14
+ # Pry.start
15
+
16
+ require "irb"
17
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'testa_appium_driver/common/constants'
4
+ require_relative 'testa_appium_driver/driver'
5
+ require_relative 'testa_appium_driver/version'
6
+
@@ -0,0 +1,353 @@
1
+ module TestaAppiumDriver
2
+ #noinspection ALL
3
+ module ClassSelectors
4
+
5
+ # @return [TestaAppiumDriver::Locator]
6
+ def add_selector(*args, &block)
7
+ # if class selector is executed from driver, create new locator instance
8
+ if self.kind_of?(TestaAppiumDriver::Driver) || self.instance_of?(Selenium::WebDriver::Element)
9
+ args.last[:default_find_strategy] = @default_find_strategy
10
+ args.last[:default_scroll_strategy] = @default_scroll_strategy
11
+ if self.instance_of?(Selenium::WebDriver::Element)
12
+ driver = self.get_driver
13
+ else
14
+ driver = self
15
+ end
16
+ Locator.new(driver, self, *args)
17
+ else
18
+ # class selector is executed from locator, just add child selector criteria
19
+ self.add_child_selector(*args)
20
+ end
21
+ end
22
+
23
+ # @param selectors [Hash]
24
+ # @return [TestaAppiumDriver::Locator] first element
25
+ def element(selectors = {})
26
+ add_selector(selectors)
27
+ end
28
+
29
+ # @param params [Hash]
30
+ # @return [TestaAppiumDriver::Locator] all elements that match given selectors
31
+ def elements(params = {})
32
+ params[:single] = false
33
+ add_selector(params)
34
+ end
35
+
36
+
37
+ # @param selectors [Hash]
38
+ # @return [TestaAppiumDriver::Locator] first scrollable element
39
+ def scrollable(selectors = {})
40
+ selectors[:scrollable] = true
41
+ add_selector(selectors)
42
+ end
43
+
44
+ # @param params [Hash]
45
+ # @return [TestaAppiumDriver::Locator] first scrollable element
46
+ def scrollables(params = {})
47
+ params[:scrollable] = true
48
+ params[:single] = false
49
+ add_selector(params)
50
+ end
51
+
52
+
53
+ # @return [TestaAppiumDriver::Locator]
54
+ def image_view(params = {})
55
+ params[:class] = "android.widget.ImageView"
56
+ add_selector(params)
57
+ end
58
+
59
+ # @return [TestaAppiumDriver::Locator]
60
+ def image_views(params = {})
61
+ params[:class] = "android.widget.ImageView"
62
+ params[:single] = false
63
+ add_selector(params)
64
+ end
65
+
66
+ # @return [TestaAppiumDriver::Locator]
67
+ def frame_layout(params = {})
68
+ params[:class] = "android.widget.FrameLayout"
69
+ add_selector(params)
70
+ end
71
+
72
+ # @return [TestaAppiumDriver::Locator]
73
+ def frame_layouts(params = {})
74
+ params[:class] = "android.widget.FrameLayout"
75
+ params[:single] = false
76
+ add_selector(params)
77
+ end
78
+
79
+ # @return [TestaAppiumDriver::Locator]
80
+ def linear_layout(params = {})
81
+ params[:class] = "android.widget.LinearLayout"
82
+ add_selector(params)
83
+ end
84
+
85
+ # @return [TestaAppiumDriver::Locator]
86
+ def linear_layouts(params = {})
87
+ params[:class] = "android.widget.LinearLayout"
88
+ params[:single] = false
89
+ add_selector(params)
90
+ end
91
+
92
+ # @return [TestaAppiumDriver::Locator]
93
+ def view(params = {})
94
+ params[:class] = "android.view.View"
95
+ add_selector(params)
96
+ end
97
+
98
+ # @return [TestaAppiumDriver::Locator]
99
+ def views(params = {})
100
+ params[:class] = "android.view.View"
101
+ params[:single] = false
102
+ add_selector(params)
103
+ end
104
+
105
+ # @return [TestaAppiumDriver::Locator]
106
+ def edit_text(params = {})
107
+ params[:class] = "android.widget.EditText"
108
+ add_selector(params)
109
+ end
110
+
111
+ # @return [TestaAppiumDriver::Locator]
112
+ def edit_texts(params = {})
113
+ params[:class] = "android.widget.EditText"
114
+ params[:single] = false
115
+ add_selector(params)
116
+ end
117
+
118
+ # @return [TestaAppiumDriver::Locator]
119
+ def view_group(params = {})
120
+ params[:class] = "android.widget.ViewGroup"
121
+ add_selector(params)
122
+ end
123
+
124
+ # @return [TestaAppiumDriver::Locator]
125
+ def view_groups(params = {})
126
+ params[:class] = "android.widget.ViewGroup"
127
+ params[:single] = false
128
+ add_selector(params)
129
+ end
130
+
131
+ # @return [TestaAppiumDriver::Locator]
132
+ def relative_layout(params = {})
133
+ params[:class] = "android.widget.RelativeLayout"
134
+ add_selector(params)
135
+ end
136
+
137
+ # @return [TestaAppiumDriver::Locator]
138
+ def relative_layouts(params = {})
139
+ params[:class] = "android.widget.RelativeLayout"
140
+ params[:single] = false
141
+ add_selector(params)
142
+ end
143
+
144
+ # @return [TestaAppiumDriver::Locator]
145
+ def recycler_view(params = {})
146
+ params[:class] = "androidx.recyclerview.widget.RecyclerView"
147
+ add_selector(params)
148
+ end
149
+
150
+ # @return [TestaAppiumDriver::Locator]
151
+ def recycler_views(params = {})
152
+ params[:class] = "androidx.recyclerview.widget.RecyclerView"
153
+ params[:single] = false
154
+ add_selector(params)
155
+ end
156
+
157
+ # @return [TestaAppiumDriver::Locator]
158
+ def button(params = {})
159
+ params[:class] = "android.widget.Button"
160
+ add_selector(params)
161
+ end
162
+
163
+ # @return [TestaAppiumDriver::Locator]
164
+ def buttons(params = {})
165
+ params[:class] = "android.widget.Button"
166
+ params[:single] = false
167
+ add_selector(params)
168
+ end
169
+
170
+ # @return [TestaAppiumDriver::Locator]
171
+ def image_button(params = {})
172
+ params[:class] = "android.widget.ImageButton"
173
+ add_selector(params)
174
+ end
175
+
176
+ # @return [TestaAppiumDriver::Locator]
177
+ def image_buttons(params = {})
178
+ params[:class] = "android.widget.ImageButton"
179
+ params[:single] = false
180
+ add_selector(params)
181
+ end
182
+
183
+ # @return [TestaAppiumDriver::Locator]
184
+ def horizontal_scroll_view(params = {})
185
+ params[:class] = "android.widget.HorizontalScrollView"
186
+ add_selector(params)
187
+ end
188
+
189
+ # @return [TestaAppiumDriver::Locator]
190
+ def horizontal_scroll_views(params = {})
191
+ params[:class] = "android.widget.HorizontalScrollView"
192
+ params[:single] = false
193
+ add_selector(params)
194
+ end
195
+
196
+ # @return [TestaAppiumDriver::Locator]
197
+ def scroll_view(params = {})
198
+ params[:class] = "android.widget.ScrollView"
199
+ add_selector(params)
200
+ end
201
+
202
+ # @return [TestaAppiumDriver::Locator]
203
+ def scroll_views(params = {})
204
+ params[:class] = "android.widget.ScrollView"
205
+ params[:single] = false
206
+ add_selector(params)
207
+ end
208
+
209
+ # @return [TestaAppiumDriver::Locator]
210
+ def view_pager(params = {})
211
+ params[:class] = "androidx.viewpager.widget.ViewPager"
212
+ add_selector(params)
213
+ end
214
+
215
+ # @return [TestaAppiumDriver::Locator]
216
+ def view_pagers(params = {})
217
+ params[:class] = "androidx.viewpager.widget.ViewPager"
218
+ params[:single] = false
219
+ add_selector(params)
220
+ end
221
+
222
+ # @return [TestaAppiumDriver::Locator]
223
+ def check_box(params = {})
224
+ params[:class] = "android.widget.CheckBox"
225
+ add_selector(params)
226
+ end
227
+
228
+ # @return [TestaAppiumDriver::Locator]
229
+ def check_boxes(params = {})
230
+ params[:class] = "android.widget.CheckBox"
231
+ params[:single] = false
232
+ add_selector(params)
233
+ end
234
+
235
+ # @return [TestaAppiumDriver::Locator]
236
+ def list_view(params = {})
237
+ params[:class] = "android.widget.ListView"
238
+ add_selector(params)
239
+ end
240
+
241
+ # @return [TestaAppiumDriver::Locator]
242
+ def list_views(params = {})
243
+ params[:class] = "android.widget.ListView"
244
+ params[:single] = false
245
+ add_selector(params)
246
+ end
247
+
248
+ # @return [TestaAppiumDriver::Locator]
249
+ def progress_bar(params = {})
250
+ params[:class] = "android.widget.ProgressBar"
251
+ add_selector(params)
252
+ end
253
+
254
+ # @return [TestaAppiumDriver::Locator]
255
+ def progress_bars(params = {})
256
+ params[:class] = "android.widget.ProgressBar"
257
+ params[:single] = false
258
+ add_selector(params)
259
+ end
260
+
261
+ # @return [TestaAppiumDriver::Locator]
262
+ def radio_button(params = {})
263
+ params[:class] = "android.widget.RadioButton"
264
+ add_selector(params)
265
+ end
266
+
267
+ # @return [TestaAppiumDriver::Locator]
268
+ def radio_buttons(params = {})
269
+ params[:class] = "android.widget.RadioButton"
270
+ params[:single] = false
271
+ add_selector(params)
272
+ end
273
+
274
+ # @return [TestaAppiumDriver::Locator]
275
+ def radio_group(params = {})
276
+ params[:class] = "android.widget.RadioGroup"
277
+ add_selector(params)
278
+ end
279
+
280
+ # @return [TestaAppiumDriver::Locator]
281
+ def radio_groups(params = {})
282
+ params[:class] = "android.widget.RadioGroup"
283
+ params[:single] = false
284
+ add_selector(params)
285
+ end
286
+
287
+ # @return [TestaAppiumDriver::Locator]
288
+ def search_view(params = {})
289
+ params[:class] = "android.widget.SearchView"
290
+ add_selector(params)
291
+ end
292
+
293
+ # @return [TestaAppiumDriver::Locator]
294
+ def search_views(params = {})
295
+ params[:class] = "android.widget.SearchView"
296
+ params[:single] = false
297
+ add_selector(params)
298
+ end
299
+
300
+ # @return [TestaAppiumDriver::Locator]
301
+ def spinner(params = {})
302
+ params[:class] = "android.widget.Spinner"
303
+ add_selector(params)
304
+ end
305
+
306
+ # @return [TestaAppiumDriver::Locator]
307
+ def spinners(params = {})
308
+ params[:class] = "android.widget.Spinner"
309
+ params[:single] = false
310
+ add_selector(params)
311
+ end
312
+
313
+ # @return [TestaAppiumDriver::Locator]
314
+ def toast(params = {})
315
+ params[:class] = "android.widget.Toast"
316
+ add_selector(params)
317
+ end
318
+
319
+ # @return [TestaAppiumDriver::Locator]
320
+ def toasts(params = {})
321
+ params[:class] = "android.widget.Toast"
322
+ params[:single] = false
323
+ add_selector(params)
324
+ end
325
+
326
+ # @return [TestaAppiumDriver::Locator]
327
+ def toolbar(params = {})
328
+ params[:class] = "android.widget.Toolbar"
329
+ add_selector(params)
330
+ end
331
+
332
+ # @return [TestaAppiumDriver::Locator]
333
+ def toolbars(params = {})
334
+ params[:class] = "android.widget.Toolbar"
335
+ params[:single] = false
336
+ add_selector(params)
337
+ end
338
+
339
+ # @return [TestaAppiumDriver::Locator]
340
+ def text_view(params = {})
341
+ params[:class] = "android.widget.TextView"
342
+ add_selector(params)
343
+ end
344
+
345
+ # @return [TestaAppiumDriver::Locator]
346
+ def text_views(params = {})
347
+ params[:class] = "android.widget.TextView"
348
+ params[:single] = false
349
+ add_selector(params)
350
+ end
351
+
352
+ end
353
+ end