testimonium 0.1.8.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7ea1172299455bf2f567e668935e486f0083596cde9c18a712d8dfe05430c98a
4
+ data.tar.gz: 83a31af4c097b0190a8ed63dd836738481286446f3bd5438f60bfcb8777215cd
5
+ SHA512:
6
+ metadata.gz: 541004e4b15ec3ef3f13dbd220ba43af9a93458c998dafad296c9110576e8fbfb2c4e63dcb9ac13acaa2add4ac9c49aea6889bd23e161acc236d9bd539d78a4b
7
+ data.tar.gz: acbc68065e3a4673f6d21c5bfcbb8e292804c235e46e706f24c3d3cb408d0721a98d1943fca0332aee396399ab407249d04cfa37bfc1787877b8e6ec38564deb
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 M2mobi
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.
@@ -0,0 +1,20 @@
1
+ # Testimonium
2
+
3
+ Solution for Acceptance Testing of Native Mobile Apps with Cucumber.
4
+
5
+ ## Installation
6
+
7
+ **Testimonium** can be installed through rubygems:
8
+
9
+ ```sh
10
+ gem install testimonium
11
+ ```
12
+
13
+ ## Author
14
+
15
+ Shahin Mirza
16
+ M2mobi, info@m2mobi.com
17
+
18
+ ## License
19
+
20
+ Testimonium is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'testimonium'
4
+
5
+ Testimonium::CLI::CLI.new(ARGV).evaluate
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Testimonium module
4
+ module Testimonium
5
+ require 'testimonium/cli'
6
+ require 'testimonium/version'
7
+ require 'testimonium/iosHelpFunctions'
8
+ require 'testimonium/tapFunctions'
9
+ require 'testimonium/validateFunctions'
10
+ require 'testimonium/findFunctions'
11
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Testimonium
4
+ # CLI module
5
+ module CLI
6
+ require 'testimonium/cli/create'
7
+ require 'testimonium/cli/helpers'
8
+ require 'testimonium/cli/run'
9
+
10
+ # The CLI is a class, entry point for CLI commands
11
+ class CLI
12
+ include Testimonium::CLI::Create
13
+ include Testimonium::CLI::Helpers
14
+ include Testimonium::CLI::Run
15
+
16
+ def initialize(arguments)
17
+ @arguments = arguments.dup
18
+ end
19
+
20
+ def evaluate
21
+ parse_arguments!
22
+ end
23
+
24
+ def parse_arguments!
25
+ argument = @arguments.shift
26
+
27
+ begin
28
+ case argument
29
+ when 'create'
30
+ parse_create_arguments!
31
+ when 'run'
32
+ parse_run_arguments!
33
+ when 'version'
34
+ puts Testimonium::VERSION
35
+ when 'help'
36
+ print_usage
37
+ when nil
38
+ print_usage
39
+ else
40
+ fail("Invalid command #{argument}.\nFor help use 'testimonium help'")
41
+ end
42
+ rescue => e
43
+ puts e.message.to_s
44
+ exit 1
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber'
4
+
5
+ module Testimonium
6
+ module CLI
7
+ # Create a new test project
8
+ module Create
9
+ def parse_create_arguments!
10
+ Cucumber::ProjectInitializer.new.run
11
+
12
+ env_path = File.join(Dir.getwd, 'features', 'support', 'env.rb')
13
+
14
+ Kernel.exit(0) unless File.read(env_path).empty?
15
+
16
+ env_template_path = File.join(File.dirname(__FILE__), 'templates', 'env.rb.template')
17
+ env_template = File.read(env_template_path)
18
+
19
+ File.open(File.join(Dir.getwd, 'features', 'support', 'env.rb'), 'w') do |file|
20
+ file.write(env_template)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Testimonium
4
+ module CLI
5
+ # Contains helper functions for CLI scripts
6
+ module Helpers
7
+ def print_usage(output = STDOUT)
8
+ output.write <<~EOF
9
+ testimonium [options] <command-name> [command specific options]
10
+ EOF
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber'
4
+
5
+ module Testimonium
6
+ module CLI
7
+ # Create a new test project
8
+ module Run
9
+ def parse_run_arguments!
10
+ Cucumber::Cli::Main.new(@arguments).execute!
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1 @@
1
+ require 'testimonium/android/env'
@@ -0,0 +1,46 @@
1
+ ############
2
+ ### Find ###
3
+ ############
4
+
5
+ # Find element by xpath
6
+ def find_element_by_xpath(path, timeout = 2, retries = 5)
7
+ element = nil
8
+
9
+ retries.times do
10
+ sleep timeout
11
+
12
+ begin
13
+ element = find_element(:xpath, path)
14
+ rescue Selenium::WebDriver::Error::NoSuchElementError
15
+ end
16
+
17
+ return element if element
18
+ end
19
+
20
+ false
21
+ end
22
+
23
+ # Find element by element resource-id (Android only)
24
+ #
25
+ # Needs app package name set as const. _ANDROID_PACKAGE_
26
+ def find_element_by_resourceid(id, timeout = 2, retries = 5)
27
+ find_element_by_xpath("//*[@resource-id='#{ANDROID_PACKAGE}:id/#{ id }']", timeout, retries)
28
+ end
29
+
30
+ # Find element by element id
31
+ def find_element_by_id(idString, timeout = 2, retries = 5)
32
+ if ENV['PLATFORM'] == 'android'
33
+ find_element_by_xpath("//*[@id='#{ idString }']", timeout, retries)
34
+ elsif ENV['PLATFORM'] == 'ios'
35
+ find_id_ios(idString)
36
+ end
37
+ end
38
+
39
+ # Find element by text
40
+ def find_element_by_text(textString, timeout = 2, retries = 5)
41
+ if ENV['PLATFORM'] == 'android'
42
+ find_element_by_xpath("//*[@text='#{ textString }']", timeout, retries)
43
+ elsif ENV['PLATFORM'] == 'ios'
44
+ find_text_ios(textString)
45
+ end
46
+ end
@@ -0,0 +1,25 @@
1
+ def find_text_ios(parameter, timeout = 2, retries = 5)
2
+ findFunctionForIos('text', parameter)
3
+ end
4
+
5
+ def find_id_ios(parameter, timeout = 2, retries = 5)
6
+ findFunctionForIos('id', parameter)
7
+ end
8
+
9
+ def findFunctionForIos(functionType, parameter, timeout = 2, retries = 5)
10
+ element = nil
11
+
12
+ retries.times do
13
+ sleep timeout
14
+
15
+ begin
16
+ element = id(parameter) if functionType.eql?('id')
17
+ element = text(parameter) if functionType.eql?('text')
18
+ rescue Selenium::WebDriver::Error::NoSuchElementError
19
+ end
20
+
21
+ return element if element
22
+ end
23
+
24
+ false
25
+ end
@@ -0,0 +1,33 @@
1
+ ############
2
+ ### TAP ###
3
+ ############
4
+
5
+ # Tap element by element id
6
+ def tap_element_by_id(idString, timeout = 2, retries = 5)
7
+ if ENV['PLATFORM'] == 'android'
8
+ find_element_by_id(idString, timeout, retries).click
9
+ elsif ENV['PLATFORM'] == 'ios'
10
+ find_id_ios(idString).click
11
+ end
12
+ end
13
+
14
+ # Tap element by resource-id (Android only)
15
+ #
16
+ # Needs app package name set as const. _ANDROID_PACKAGE_
17
+ def tap_element_by_resourceid(id, timeout = 2, retries = 5)
18
+ find_element_by_resourceid(id, timeout, retries).click
19
+ end
20
+
21
+ # Tap element by text
22
+ def tap_element_by_text(textString, timeout = 2, retries = 5)
23
+ if ENV['PLATFORM'] == 'android'
24
+ find_element_by_text(textString, timeout, retries).click
25
+ elsif ENV['PLATFORM'] == 'ios'
26
+ find_text_ios(textString).click
27
+ end
28
+ end
29
+
30
+ # Tap element by xpath
31
+ def tap_element_by_xpath(path, timeout = 2, retries = 5)
32
+ find_element_by_xpath(path, timeout, retries).click
33
+ end
@@ -0,0 +1,39 @@
1
+ ################
2
+ ### Validate ###
3
+ ################
4
+
5
+ # Validate element by element id
6
+ def validate_element_by_id(id, timeout = 2, retries = 5)
7
+ unless find_element_by_id(id, timeout, retries)
8
+ raise Selenium::WebDriver::Error::NoSuchElementError
9
+ end
10
+ end
11
+
12
+ # Validate element by resource-id (Android only)
13
+ #
14
+ # Needs app package name set as const. _ANDROID_PACKAGE_
15
+ def validate_element_by_resourceid(id, timeout = 2, retries = 5)
16
+ unless find_element_by_resourceid(id, timeout, retries)
17
+ raise Selenium::WebDriver::Error::NoSuchElementError
18
+ end
19
+ end
20
+
21
+ # Validate element by text
22
+ def validate_element_by_text(text, timeout = 2, retries = 5)
23
+ if ENV['PLATFORM'] == 'android'
24
+ unless find_element_by_text(text, timeout, retries)
25
+ raise Selenium::WebDriver::Error::NoSuchElementError
26
+ end
27
+ elsif ENV['PLATFORM'] == 'ios'
28
+ unless find_text_ios(text, timeout, retries)
29
+ raise Selenium::WebDriver::Error::NoSuchElementError
30
+ end
31
+ end
32
+ end
33
+
34
+ # Validate element by xpath
35
+ def validate_element_by_xpath(path, timeout = 2, retries = 5)
36
+ unless find_element_by_xpath(path, timeout, retries)
37
+ raise Selenium::WebDriver::Error::NoSuchElementError
38
+ end
39
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Current version
4
+ module Testimonium
5
+ VERSION = '0.1.8.2'
6
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: testimonium
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.8.2
5
+ platform: ruby
6
+ authors:
7
+ - M2mobi
8
+ - Shahin Mirza
9
+ - Koen Woortman
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2019-08-08 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: appium_lib_core
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: cucumber
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ description: Solution for Acceptance Testing of Native Mobile Apps
44
+ email: s.mirza@m2mobi.com
45
+ executables:
46
+ - testimonium
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - LICENSE
51
+ - README.md
52
+ - bin/testimonium
53
+ - lib/testimonium.rb
54
+ - lib/testimonium/cli.rb
55
+ - lib/testimonium/cli/create.rb
56
+ - lib/testimonium/cli/helpers.rb
57
+ - lib/testimonium/cli/run.rb
58
+ - lib/testimonium/cli/templates/env.rb.template
59
+ - lib/testimonium/findFunctions.rb
60
+ - lib/testimonium/iosHelpFunctions.rb
61
+ - lib/testimonium/tapFunctions.rb
62
+ - lib/testimonium/validateFunctions.rb
63
+ - lib/testimonium/version.rb
64
+ homepage:
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '2.3'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubygems_version: 3.0.3
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: testimonium-0.1.8.2
87
+ test_files: []