itms_automation 2.5 → 2.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/bin/generate.rb +3 -37
  3. data/bin/helper.rb +23 -10
  4. data/bin/itms_automation +18 -23
  5. data/doc/installation.md +16 -0
  6. data/doc/itms-automation-API.md +103 -0
  7. data/doc/itms-automation-help.md +18 -0
  8. data/example/android/android_app/android_app_calculator.zip +0 -0
  9. data/example/android/android_app/android_app_calculator/AndroidCalculator.apk +0 -0
  10. data/example/android/android_app/android_app_calculator/features/calculator.feature +36 -0
  11. data/example/android/android_app/android_app_calculator/features/my_first.feature +13 -0
  12. data/example/android/android_app/android_app_calculator/features/screenshots/test.png +0 -0
  13. data/example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb +5 -0
  14. data/example/android/android_app/android_app_calculator/features/support/env.rb +52 -0
  15. data/example/android/android_app/android_app_calculator/features/support/hooks.rb +26 -0
  16. data/example/android/android_web/android_web_gmail_login.zip +0 -0
  17. data/example/android/android_web/android_web_gmail_login/features/gmail_login.feature +12 -0
  18. data/example/android/android_web/android_web_gmail_login/features/my_first.feature +1 -0
  19. data/example/android/android_web/android_web_gmail_login/features/screenshots/test.png +0 -0
  20. data/example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
  21. data/example/android/android_web/android_web_gmail_login/features/support/env.rb +51 -0
  22. data/example/android/android_web/android_web_gmail_login/features/support/hooks.rb +27 -0
  23. data/example/desktop web/desktop_web_gmail_login.zip +0 -0
  24. data/example/desktop web/desktop_web_gmail_login/features/gmail_login.feature +9 -0
  25. data/example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature +21 -0
  26. data/example/desktop web/desktop_web_gmail_login/features/my_first.feature +1 -0
  27. data/example/desktop web/desktop_web_gmail_login/features/screenshots/test.png +0 -0
  28. data/example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
  29. data/example/desktop web/desktop_web_gmail_login/features/support/env.rb +51 -0
  30. data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +26 -0
  31. data/features-skeleton/my_first.feature +5 -0
  32. data/features-skeleton/screenshots/test.png +0 -0
  33. data/features-skeleton/step_definitions/custom_steps.rb +5 -0
  34. data/features-skeleton/support/env.rb +104 -0
  35. data/features-skeleton/support/hooks.rb +74 -0
  36. data/lib/itms_automation.rb +1 -3
  37. data/lib/itms_automation/assertion_steps.rb +68 -0
  38. data/lib/itms_automation/click_elements_steps.rb +24 -0
  39. data/lib/itms_automation/configuration_steps.rb +7 -0
  40. data/lib/itms_automation/input_steps.rb +59 -0
  41. data/lib/itms_automation/javascript_handling_steps.rb +10 -0
  42. data/lib/itms_automation/methods/assertion_methods.rb +344 -0
  43. data/lib/itms_automation/methods/click_elements_methods.rb +23 -0
  44. data/lib/itms_automation/methods/configuration_methods.rb +35 -0
  45. data/lib/itms_automation/methods/error_handling_methods.rb +87 -0
  46. data/lib/itms_automation/methods/input_methods.rb +69 -0
  47. data/lib/itms_automation/methods/javascript_handling_methods.rb +9 -0
  48. data/lib/itms_automation/methods/misc_methods.rb +47 -0
  49. data/lib/itms_automation/methods/navigate_methods.rb +123 -0
  50. data/lib/itms_automation/methods/progress_methods.rb +15 -0
  51. data/lib/itms_automation/methods/required_files.rb +9 -0
  52. data/lib/itms_automation/methods/screenshot_methods.rb +6 -0
  53. data/lib/itms_automation/navigation_steps.rb +79 -0
  54. data/lib/itms_automation/progress_steps.rb +17 -0
  55. data/lib/itms_automation/screenshot_steps.rb +6 -0
  56. data/lib/itms_automation/version.rb +5 -3
  57. metadata +84 -95
  58. data/bin/console +0 -14
  59. data/bin/documentation_generator.rb +0 -119
  60. data/bin/setup +0 -8
  61. data/lib/itms_automation/all_steps.rb +0 -8
  62. data/lib/itms_automation/assertion_helper.rb +0 -29
  63. data/lib/itms_automation/auto_util.rb +0 -707
  64. data/lib/itms_automation/database_steps_helper.rb +0 -125
  65. data/lib/itms_automation/web_steps_helper.rb +0 -867
  66. data/project/Gemfile +0 -3
  67. data/project/Gemfile.lock +0 -92
  68. data/project/README.md +0 -34
  69. data/project/Rakefile +0 -24
  70. data/project/cucumber.yml +0 -4
  71. data/project/features/TestSuite/WebGUI.feature +0 -5
  72. data/project/features/step_definitions/lib_steps/steps_definition.rb +0 -46
  73. data/project/features/step_definitions/repositories/project_object.yml +0 -26
  74. data/project/features/support/env.rb +0 -9
  75. data/project/features/support/hooks.rb +0 -122
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c949a4fee0d3f3f851f06b470d163e1236a12a293660d69540c3eae8f1fd5697
4
- data.tar.gz: 5debc5fedc12757ad0b6269df5781e5b00cb7e6feb16ce6d3ad038a20f93297c
3
+ metadata.gz: 583b36e2ec92b94f520492dc60d2e6664b258f37033c793a6b5898aabca7685b
4
+ data.tar.gz: ee00d5a2d671302e486317afbd252014a12ef04ed64fe707ec5cf2ba166fc9ce
5
5
  SHA512:
6
- metadata.gz: 72e9ad58e4ce0e62a773a33775988570bf219ef23ef216ef97e5e5523359a9bbddd9b7095e7b468f2d9f711da4f84583c3b4c0b45a5102d3d57623bfdcb4feb1
7
- data.tar.gz: 555252c6ab5940546771d2bb240e5182884ff2d7cde227cb975859013532e25fc0b06360e179714d0cbcde70cad3ff512b34138b6b280b5ce32b94b26c9b4ec7
6
+ metadata.gz: 50903bb26b4a64cac5b3fe53e14851de2917462605d52eba2e54c8ebfc9a2146440be7bb3f85ee7f61a7b099c395d0b44a5920cfede8a153f2f5323ac992d397
7
+ data.tar.gz: 6aaf390948a96cbb711e3a04e14e9002ec3c3dc2c26457ceaa8fc4a790d977cd95cd1123b36b6ff830b145a36c3d873982bc32e2f8d7a9924764ada53dce56e1
@@ -1,7 +1,6 @@
1
-
2
1
  def itms_automation_scaffold
3
2
  if File.exists?(@features_dir)
4
- puts 'There is already cucumber directory. Please move existing cucumber directory to carry on '
3
+ puts "A features directory already exists. Stopping..."
5
4
  exit 1
6
5
  end
7
6
  msg("Question") do
@@ -13,41 +12,8 @@ def itms_automation_scaffold
13
12
 
14
13
  FileUtils.cp_r(@source_dir, @features_dir)
15
14
 
16
- msg('Info') do
17
- puts "iTMS Automation is creating 'cucumber' framework. Please have a look which files are being created\n"
18
- end
19
- msg('Gemfile') do
20
- puts "iTMS Automation created Gemfile containing all required Gems\n"
21
- end
22
- msg('cucumber.yml') do
23
- puts "iTMS Automation created cucumber.yml file with profiles of all needed configurations\n"
24
- end
25
- msg('config/chrome_headless_options.yaml') do
26
- puts "iTMS Automation created chrome_headless_options.yml file with profiles of all needed configurations\n"
27
- end
28
- msg('config/firefox_headless_options.yaml') do
29
- puts "iTMS Automation created firefox_headless_options.yml file with profiles of all needed configurations\n"
30
- end
31
- msg('config/chrome_options.yaml') do
32
- puts "iTMS Automation created chrome_options.yml file with profiles of all needed configurations\n"
33
- end
34
- msg('config/firefox_options.yaml') do
35
- puts "iTMS Automation created firefox_options.yml file with profiles of all needed configurations\n"
36
- end
37
- msg('config/ie_options.yaml') do
38
- puts "iTMS Automation created ie_options.yml file with profiles of all needed configurations\n"
39
- end
40
- msg('config/remote_options.yaml') do
41
- puts "iTMS Automation created remote_options.yml file with profiles of all needed configurations\n"
42
- end
43
- msg('config/safari_options.yaml') do
44
- puts "iTMS Automation created safari_options.yml file with profiles of all needed configurations\n"
45
- end
46
- msg('README.md') do
47
- puts "iTMS Automation created README.md file with template usage\n"
48
- end
49
- msg('Info') do
50
- puts "All Config files created. \n"
15
+ msg("Info") do
16
+ puts "features subdirectory created. \n"
51
17
  end
52
18
 
53
19
  end
@@ -3,15 +3,31 @@ require 'json'
3
3
  require "rubygems"
4
4
 
5
5
  def msg(title, &block)
6
- puts "\n" + '-' * 10 + title + '-' * 10
7
- yield
8
- puts '-' * 10 + '-------' + '-' * 10 + "\n"
9
- sleep 1
6
+ puts "\n" + "-"*10 + title + "-"*10
7
+ block.call
8
+ puts "-"*10 + "-------" + "-"*10 + "\n"
9
+ end
10
+
11
+ def print_usage
12
+ puts <<EOF
13
+
14
+ Usage: itms_automation <command-name> [parameters] [options]
15
+
16
+ <command-name> can be one of
17
+ help
18
+ prints more detailed help information.
19
+ gen
20
+ generate a features folder structure.
21
+ version
22
+ prints the gem version
23
+
24
+ <options> can be
25
+ -v, --verbose Turns on verbose logging
26
+ EOF
10
27
  end
11
28
 
12
29
  def print_help
13
30
  puts <<EOF
14
- Author: iTMS
15
31
 
16
32
  Usage: itms_automation <command-name> [parameters] [options]
17
33
 
@@ -19,19 +35,16 @@ def print_help
19
35
  help
20
36
  gen
21
37
  version
22
- ls
23
38
 
24
39
  Commands:
25
40
  help : prints more detailed help information.
26
41
 
27
- gen : creates a features dir. This is usually used once when
28
- setting up itms_automation to ensure that the features folder contains
42
+ gen : creates a skeleton features dir. This is usually used once when
43
+ setting up selnium-cucumber to ensure that the features folder contains
29
44
  the right step definitions and environment to run with cucumber.
30
45
 
31
46
  version : prints the gem version
32
47
 
33
- ls: list all steps name of itms_automation framework
34
-
35
48
  <Options>
36
49
  -v, --verbose Turns on verbose logging
37
50
  EOF
@@ -1,32 +1,27 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  require_relative 'helper.rb'
3
4
  require_relative 'generate.rb'
4
- require_relative 'documentation_generator.rb'
5
5
  require 'itms_automation/version'
6
6
 
7
- @features_dir = File.join(FileUtils.pwd, "project")
8
- @source_dir = File.join(File.dirname(__FILE__), '..', 'project')
9
-
10
- search_string = ARGV.shift
11
- case search_string
12
- when /version/
13
- puts ItmsAutomation::VERSION
14
- when /gen/
15
- itms_automation_scaffold
16
- when /ls/
17
- ORDERED_KINDS = %w[Given When Then]
18
- heading = 'All itms_automation steps'
7
+ @features_dir = File.join(FileUtils.pwd, "features")
8
+ @support_dir = File.join(@features_dir, "support")
9
+ @support_dir = File.join(@features_dir, "screenshots")
10
+ @source_dir = File.join(File.dirname(__FILE__), '..', 'features-skeleton')
19
11
 
20
- # collect
21
- steps_glob = File.expand_path('../../lib/itms_automation/*_steps.rb', __FILE__)
22
- step_names = `cat #{steps_glob}`.split($/).select { |line| line =~ /^\s*(Given|When|Then)/ }
12
+ if (ARGV.length == 0)
13
+ print_usage
14
+ else
15
+ cmd = ARGV.shift
23
16
 
24
- # Output
25
- puts "\e[4;34m\n# #{heading}\e[0m" # blue underline
26
- puts step_names
27
- else
28
- print_help
17
+ if cmd == "help"
18
+ print_help
19
+ elsif cmd == "gen"
20
+ itms_automation_scaffold
21
+ elsif cmd == "version"
22
+ puts ITMS::Automation::VERSION
23
+ else
24
+ print_usage
25
+ end
29
26
  end
30
27
 
31
-
32
-
@@ -0,0 +1,16 @@
1
+ Installation
2
+ ============
3
+ ### Prerequisites
4
+ You need to have Ruby installed.
5
+ Verify your installation by running ruby -v in a terminal - it should print "ruby 1.9.3" (or higher).
6
+
7
+ You need to have DevKit installed.
8
+
9
+ You can get Ruby and DevKit from [RubyInstaller.org](http://rubyinstaller.org/)
10
+
11
+ ### Installation
12
+
13
+ Install `itms_automation` gem by running
14
+
15
+ - `gem install itms_automation`
16
+
@@ -0,0 +1,103 @@
1
+ itms_automation Ruby API's
2
+ ============================
3
+
4
+ If you are writing code for your custom steps you can use the following methods :
5
+
6
+ Note : For some of the API paramtere values are fixed. Such values for paramaters are mentioned below.
7
+
8
+ Navigation API's
9
+ ----------------
10
+
11
+ navigate_to("link")
12
+
13
+ navigate(direction) # direction => "back" / "forward"
14
+
15
+ close_driver()
16
+
17
+
18
+ Browser Interaction API's
19
+ -------------------------
20
+
21
+ resize_browser(width, height)
22
+
23
+ scroll_page(to) # to => "top" / "end"
24
+
25
+ scroll_to_element(by, access_value)
26
+
27
+ zoom_in_out(in_out) # in_out => "add" / "subtract"
28
+
29
+ zoom_in_out_till_element_display(by, in_out, access_value) # in_out => "add" / "subtract"
30
+
31
+
32
+ Input API's
33
+ ------------
34
+
35
+ click(element)
36
+
37
+ double_click(element)
38
+
39
+ click_forcefully(element)
40
+
41
+ enter_text(element, text)
42
+
43
+ clear_text(element)
44
+
45
+ check_checkbox(element)
46
+
47
+ uncheck_checkbox(element)
48
+
49
+ toggle_checkbox(element)
50
+
51
+ select_radio_button(element)
52
+
53
+ get_page_title()
54
+
55
+ get_element_text(element)
56
+
57
+ get_element_attribute(element, attribute)
58
+
59
+ is_element_enabled(element)
60
+
61
+ is_element_displayed(element)
62
+
63
+ hover_over_element(element)
64
+
65
+ by => "locators type" ("id", "name", "class", "xpath", "css")
66
+
67
+ access_value => "locator value"
68
+
69
+
70
+ Javascript Handling API
71
+ -----------------------
72
+
73
+ handle_alert(decision) # decision => "accept" / "dismiss"
74
+
75
+ get_alert_text
76
+
77
+
78
+ Progress API's
79
+ --------------
80
+
81
+ wait(time_in_sec)
82
+
83
+ wait_for_element_to_display(element, duration)
84
+
85
+ wait_for_element_to_enable(element, duration)
86
+
87
+
88
+ by => "locators type" ("id", "name", "class", "xpath", "css")
89
+
90
+ access_value => "locator value"
91
+
92
+ duration => duration in seconds.
93
+
94
+
95
+ Screenshot API
96
+ --------------
97
+ take_screenshots
98
+
99
+
100
+ Configuration API
101
+ -----------------
102
+
103
+ print_congifugartion
@@ -0,0 +1,18 @@
1
+
2
+ Usage: itms_automation <command-name> [parameters] [options]
3
+
4
+ <command-name> can be one of
5
+ help
6
+ gen
7
+ version
8
+
9
+ Commands:
10
+ help : prints more detailed help information.
11
+
12
+ gen : creates a skeleton features dir. This is usually used once when
13
+ setting up selnium-cucumber to ensure that the features folder contains
14
+ the right step definitions and environment to run with cucumber.
15
+
16
+ version : prints the gem version
17
+
18
+ Options: -v, --verbose Turns on verbose logging
@@ -0,0 +1,36 @@
1
+ Feature: Verify Calculator functionalities
2
+
3
+ Scenario: Click on OK button
4
+ Then I click on element having id "com.android2.calculator3:id/cling_dismiss"
5
+
6
+ Scenario: Addirion
7
+ Then I click on element having id "com.android2.calculator3:id/digit5"
8
+ Then I click on element having id "com.android2.calculator3:id/plus"
9
+ Then I click on element having id "com.android2.calculator3:id/digit9"
10
+ When I click on element having id "com.android2.calculator3:id/equal"
11
+ Then element having xpath "//android.widget.EditText[@index=0]" should have text as "14"
12
+
13
+
14
+ Scenario: Substraction
15
+ Then I click on element having id "com.android2.calculator3:id/digit9"
16
+ Then I click on element having id "com.android2.calculator3:id/minus"
17
+ Then I click on element having id "com.android2.calculator3:id/digit5"
18
+ When I click on element having id "com.android2.calculator3:id/equal"
19
+ Then element having xpath "//android.widget.EditText[@index=0]" should have text as "4"
20
+
21
+ Scenario: Multiplication
22
+ Then I click on element having id "com.android2.calculator3:id/digit9"
23
+ Then I click on element having id "com.android2.calculator3:id/mul"
24
+ Then I click on element having id "com.android2.calculator3:id/digit5"
25
+ When I click on element having id "com.android2.calculator3:id/equal"
26
+ Then element having xpath "//android.widget.EditText[@index=0]" should have text as "45"
27
+
28
+ Scenario: Division
29
+ Then I click on element having id "com.android2.calculator3:id/digit8"
30
+ Then I click on element having id "com.android2.calculator3:id/div"
31
+ Then I click on element having id "com.android2.calculator3:id/digit2"
32
+ When I click on element having id "com.android2.calculator3:id/equal"
33
+ Then element having xpath "//android.widget.EditText[@index=0]" should have text as "4"
34
+
35
+ Scenario: Clear output
36
+ Then I click on element having id "com.android2.calculator3:id/clear"
@@ -0,0 +1,13 @@
1
+ #Scenario: Division
2
+ # Then I click on element having id "com.android2.calculator3:id/digit8"
3
+ # Then I click on element having id "com.android2.calculator3:id/div"
4
+ # Then I click on element having id "com.android2.calculator3:id/digit4"
5
+ # When I click on element having id "com.android2.calculator3:id/equal"
6
+ # Then element having xpath "//android.widget.EditText[@index=0]" should have text as "2"
7
+
8
+ # Scenario: Multiplication
9
+ # Then I click on element having id "com.android2.calculator3:id/digit6"
10
+ # Then I click on element having id "com.android2.calculator3:id/mul"
11
+ # Then I click on element having id "com.android2.calculator3:id/digit5"
12
+ # When I click on element having id "com.android2.calculator3:id/equal"
13
+ # Then element having xpath "//android.widget.EditText[@index=0]" should have text as "30"
@@ -0,0 +1,5 @@
1
+ require 'itms_automation'
2
+
3
+ # Do Not Remove This File
4
+ # Add your custom steps here
5
+ # $driver is instance of webdriver use this instance to write your custom code
@@ -0,0 +1,52 @@
1
+ require 'rubygems'
2
+ require 'itms_automation'
3
+
4
+ # Store command line arguments
5
+ $browser_type = ENV['BROWSER'] || 'ff'
6
+ $platform = ENV['PLATFORM'] || 'desktop'
7
+ $os_version = ENV['OS_VERSION']
8
+ $device_name = ENV['DEVICE_NAME']
9
+ $udid = ENV['UDID']
10
+ $app_path = ENV['APP_PATH']
11
+
12
+ # check for valid parameters
13
+ validate_parameters $platform, $browser_type, $app_path
14
+
15
+ # If platform is android or ios create driver instance for mobile browser
16
+ if $platform == 'android' or $platform == 'iOS'
17
+
18
+ if $browser_type == 'native'
19
+ $browser_type = "Browser"
20
+ end
21
+
22
+ if $platform == 'android'
23
+ $device_name, $os_version = get_device_info
24
+ end
25
+
26
+ desired_caps = {
27
+ caps: {
28
+ platformName: $platform,
29
+ browserName: $browser_type,
30
+ versionNumber: $os_version,
31
+ deviceName: $device_name,
32
+ udid: $udid,
33
+ app: ".//#{$app_path}"
34
+ },
35
+ appium_lib: { server_url: 'http://localhost:4723/wd/hub' }
36
+ }
37
+
38
+ begin
39
+ $driver = Appium::Driver.new(desired_caps).start_driver
40
+ rescue Exception => e
41
+ puts e.message
42
+ Process.exit(0)
43
+ end
44
+ else # else create driver instance for desktop browser
45
+ begin
46
+ $driver = Selenium::WebDriver.for(:"#{$browser_type}")
47
+ $driver.manage().window().maximize()
48
+ rescue Exception => e
49
+ puts e.message
50
+ Process.exit(0)
51
+ end
52
+ end
@@ -0,0 +1,26 @@
1
+ #Cucumber provides a number of hooks which allow us to run blocks at various points in the Cucumber test cycle
2
+
3
+ Before do
4
+ # Do something before each scenario.
5
+ end
6
+
7
+ Before do |scenario|
8
+ # The +scenario+ argument is optional, but if you use it, you can get the title,
9
+ # description, or name (title + description) of the scenario that is about to be
10
+ # executed.
11
+ end
12
+
13
+ After do
14
+ # Do something after each scenario.
15
+ end
16
+
17
+ After do |scenario|
18
+ # Do something after each scenario.
19
+ # The +scenario+ argument is optional, but
20
+ # if you use it, you can inspect status with
21
+ # the #failed?, #passed? and #exception methods.
22
+
23
+ if(scenario.failed?)
24
+ #Do something if scenario fails.
25
+ end
26
+ end