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
@@ -0,0 +1,12 @@
1
+ Feature: Gmail Login mobile web
2
+
3
+ Scenario: valid credentials login
4
+ Given I navigate to "http://www.gmail.com"
5
+ Then I wait for 5 sec
6
+ Then I enter "your_email" into input field having id "Email"
7
+ Then I enter "your_password" into input field having id "Passwd"
8
+ When I click on element having id "signIn"
9
+ And I wait for 10 sec
10
+ Then element having xpath "//*[@id='tltbt']/div[3]/div/div" should be present
11
+ And I wait for 5 sec
12
+ Then I close browser
@@ -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,51 @@
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
+ }
36
+
37
+ begin
38
+ $driver = Appium::Driver.new(desired_caps).start_driver
39
+ rescue Exception => e
40
+ puts e.message
41
+ Process.exit(0)
42
+ end
43
+ else # else create driver instance for desktop browser
44
+ begin
45
+ $driver = Selenium::WebDriver.for(:"#{$browser_type}")
46
+ $driver.manage().window().maximize()
47
+ rescue Exception => e
48
+ puts e.message
49
+ Process.exit(0)
50
+ end
51
+ end
@@ -0,0 +1,27 @@
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
27
+
@@ -0,0 +1,9 @@
1
+ Feature: Gmail_login
2
+
3
+ Scenario: Valid_gmail_login
4
+ Given I navigate to "http://www.gmail.com"
5
+ And I enter "abc@gmail.com" into input field having id "Email"
6
+ And I enter "!password*" into input field having id "Passwd"
7
+ When I click on element having id "signIn"
8
+ And I wait for 10 sec
9
+ Then I close browser
@@ -0,0 +1,21 @@
1
+ Feature: Gmail_login
2
+
3
+ Scenario: Open gmail
4
+ Given I navigate to "http://www.gmail.com"
5
+
6
+ Scenario Outline: In-valid Login
7
+ Then I clear input field having id "Email"
8
+ And I enter <username> into input field having id "Email"
9
+ Then I clear input field having id "Passwd"
10
+ And I enter <password> into input field having id "Passwd"
11
+ When I click on element having id "signIn"
12
+ Then element having id "errormsg_0_Passwd" should be present
13
+
14
+ Examples:
15
+ | username | password |
16
+ |"test1" |"password1" |
17
+ |"test2" |"password2" |
18
+ |"test3" |"password3" |
19
+
20
+ Scenario: close gmail
21
+ Then I close browser
@@ -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,51 @@
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
+ }
36
+
37
+ begin
38
+ $driver = Appium::Driver.new(desired_caps).start_driver
39
+ rescue Exception => e
40
+ puts e.message
41
+ Process.exit(0)
42
+ end
43
+ else # else create driver instance for desktop browser
44
+ begin
45
+ $driver = Selenium::WebDriver.for(:"#{$browser_type}")
46
+ $driver.manage().window().maximize()
47
+ rescue Exception => e
48
+ puts e.message
49
+ Process.exit(0)
50
+ end
51
+ 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
@@ -0,0 +1,5 @@
1
+ Feature: Login feature
2
+
3
+ Scenario: As a valid user I can log into my web app
4
+ When I press "Login"
5
+ Then I see "Welcome to coolest web app ever"
@@ -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,104 @@
1
+ require "rubygems"
2
+ require "itms_automation"
3
+ require "httparty"
4
+ require "cucumber"
5
+
6
+ $browser_type = ENV["BROWSER"] || "firefox"
7
+ $platform = ENV["PLATFORM"] || "desktop"
8
+ $os_version = ENV["OS_VERSION"]
9
+ $device_name = ENV["DEVICE_NAME"]
10
+ $udid = ENV["UDID"]
11
+ $app_path = ENV["APP_PATH"]
12
+
13
+ # check for valid parameters
14
+ validate_parameters $platform, $browser_type, $app_path
15
+
16
+ # If platform is android or ios create driver instance for mobile browser
17
+ if $platform == "android" or $platform == "iOS"
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
+ # }
36
+ # appium_url = 'http://localhost:4723/wd/hub'
37
+ # opts = {
38
+ # desired_capabilities: { # or { caps: {....} }
39
+ # platformName: :android,
40
+ # deviceName: 'Android Simulator',
41
+ # app: "WikipediaSample.apk"
42
+ # },
43
+ # appium_lib: {
44
+ # wait: 30
45
+ # }
46
+ # }
47
+
48
+ opts = {
49
+ desired_capabilities: { # or { caps: {....} }
50
+ platformName: $platform,
51
+ browserName: $browser_type,
52
+ deviceName: $device_name,
53
+ versionNumber: $os_version,
54
+ app: "WikipediaSample.apk",
55
+ },
56
+ appium_lib: {
57
+ wait: 30,
58
+ },
59
+ }
60
+
61
+ begin
62
+ # $driver = Appium::Driver.new(desired_caps, url: appium_url).start_driver
63
+
64
+ # $driver = Selenium::WebDriver.for(:remote, :url => appium_url, :desired_capabilities => desired_caps)
65
+ @core = Appium::Core.for(opts) # create a core driver with `opts`
66
+ $driver = @core.start_driver
67
+ rescue Exception => e
68
+ puts e.message
69
+ Process.exit(0)
70
+ end
71
+ else # else create driver instance for desktop browser
72
+ begin
73
+ $driver = case $browser_type
74
+ when "chrome"
75
+ Selenium::WebDriver.for(:chrome)
76
+ when "safari"
77
+ Selenium::WebDriver.for(:safari)
78
+ when "internet_explorer"
79
+ Selenium::WebDriver.for(:internet_explorer)
80
+ when "chrome_headless"
81
+ Selenium::WebDriver.for(:chrome, :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w(headless) }))
82
+ when "remote"
83
+ if ENV["SERVER_URL"].nil? || ENV["REMOTE_BROWSER"].nil?
84
+ puts "\nMissing SERVER_URL : SERVER_URL=http//SERVER_URL:4444/wd/hub"
85
+ puts "\nMissing REMOTE_BROWSER: REMOTE_BROWSER=browser_name"
86
+ Process.exit(0)
87
+ else
88
+ caps = Selenium::WebDriver::Remote::Capabilities.new
89
+ caps["browserName"] = ENV["REMOTE_BROWSER"]
90
+ Selenium::WebDriver.for(:remote, :url => ENV["SERVER_URL"], :desired_capabilities => caps)
91
+ end
92
+ else
93
+ Selenium::WebDriver.for(:firefox)
94
+ end
95
+ $driver.manage().window().maximize()
96
+ p "session_id: #{$driver.session_id}"
97
+ if ENV["UPDATE_SESSION_ID_API"]
98
+ HTTParty.post(ENV["UPDATE_SESSION_ID_API"], body: { session_id: $driver.session_id })
99
+ end
100
+ rescue Exception => e
101
+ puts e.message
102
+ Process.exit(0)
103
+ end
104
+ end
@@ -0,0 +1,74 @@
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
27
+
28
+
29
+ AfterConfiguration do
30
+ $OBJECT = loadYAMLfile("features/step_definitions/repositories/project_object.yml")
31
+ end
32
+
33
+ def loadYAMLfile(filename)
34
+ begin
35
+ return YAML.load_file(filename)
36
+ rescue Psych::SyntaxError => ex
37
+ raise "❌ SyntaxError when reading file: #{ex}"
38
+ end
39
+ end
40
+
41
+ def validate_params_exist
42
+ raise "❌ ERROR: Missing param SERVER_URL." if ENV['SERVER_URL'].nil?
43
+ raise "❌ ERROR: Missing param BROWSER." if ENV['BROWSER'].nil?
44
+ if ENV['REPORT']
45
+ raise "❌ ERROR: Missing param TESTSUITE." if ENV['TESTSUITE'].nil?
46
+ raise "❌ ERROR: Missing param TESTCASE_REPORT_NAME." if ENV['TESTCASE_REPORT_NAME'].nil?
47
+ $report_path = "Reports/#{ENV['TESTSUITE']}"
48
+ $testcase_report_name = ENV['TESTCASE_REPORT_NAME']
49
+ end
50
+ end
51
+
52
+ at_exit do
53
+ if ENV['REPORT']
54
+ begin
55
+ # validateReport
56
+ time = Time.now.getutc
57
+ ReportBuilder.configure do |config|
58
+ config.report_path = "#{$report_path}/#{$testcase_report_name}"
59
+ config.input_path = "#{$report_path}/#{$testcase_report_name}.json"
60
+ config.report_types = [:json, :html]
61
+ config.color = 'blue'
62
+ config.additional_info = {
63
+ 'Browser' => $browser_type,
64
+ 'Platform' => $platform ,
65
+ 'OS Version' => $os_version,
66
+ 'Report Generated' => time
67
+ }
68
+ end
69
+ options = { report_title: "INFODation - Test Management System" }
70
+ ReportBuilder.build_report options
71
+ rescue NoMethodError
72
+ end
73
+ end
74
+ end
@@ -1,3 +1 @@
1
- require 'cucumber_priority'
2
- require "itms_automation/version"
3
- Dir[File.dirname(__FILE__) + '/itms_automation/*.rb'].each { |file| require file }
1
+ Dir[File.dirname(__FILE__) + '/itms_automation/methods/*.rb'].each { |file| require file }
@@ -0,0 +1,68 @@
1
+ # require 'cucumber'
2
+ # require_relative 'methods/assertion_methods'
3
+
4
+ # # page title checking
5
+ # Then(/^I should\s*((?:not)?)\s+see page title as "(.*?)"$/) do |present, title|
6
+ # check_title(title, present.empty?)
7
+ # end
8
+
9
+ # Then(/^I should\s*((?:not)?)\s+see page title having partial text as "(.*?)"$/) do |present, partial_text_title|
10
+ # check_partial_title(partial_text_title, present.empty?)
11
+ # end
12
+
13
+ # # step to check element text
14
+ # Then(/^element "([^\"]*)" should\s*((?:not)?)\s+have text as "(.*?)"$/) do |element, present, value |
15
+ # check_element_text(element, value, present.empty?)
16
+ # end
17
+
18
+ # # step to check element partial text
19
+ # Then(/^element "([^\"]*)" should\s*((?:not)?)\s+have partial text as "(.*?)"$/) do |element, present, value |
20
+ # check_element_partial_text(element, value, present.empty?)
21
+ # end
22
+
23
+ # # step to check attribute value
24
+ # Then(/^element "([^\"]*)" should\s*((?:not)?)\s+have attribute "(.*?)" with value "(.*?)"$/) do |element, present, attrb, value|
25
+ # check_element_attribute(element, attrb, value, present.empty?)
26
+ # end
27
+
28
+ # # step to check element enabled or not
29
+ # Then(/^element "([^\"]*)" should\s*((?:not)?)\s+be (enabled|disabled)$/) do |element, present, state|
30
+ # flag = state == 'enabled'
31
+ # flag = !flag unless present.empty?
32
+ # check_element_enable(element, flag)
33
+ # end
34
+
35
+ # # step to check element present or not
36
+ # Then(/^element "(.*?)" should\s*((?:not)?)\s+be present$/) do |element, present|
37
+ # check_element_presence(element, present.empty?)
38
+ # end
39
+
40
+ # # step to assert checkbox is checked or unchecked
41
+ # Then(/^checkbox "(.*?)" should be (checked|unchecked)$/) do |element, state|
42
+ # flag = state == 'checked'
43
+ # is_checkbox_checked(element, flag)
44
+ # end
45
+
46
+ # # steps to assert radio button checked or unchecked
47
+ # Then(/^radio button"(.*?)" should be (selected|unselected)$/) do |element, state|
48
+ # flag = state == 'selected'
49
+ # is_radio_button_selected(element, flag)
50
+ # end
51
+
52
+ # # steps to assert option by text from radio button group selected/unselected
53
+ # Then(/^option "(.*?)" by (.+) from radio button group "(.*?)" should be (selected|unselected)$/) do |option, attrb, element, state|
54
+ # flag = state == 'selected'
55
+ # is_option_from_radio_button_group_selected(element, attrb, option, flag)
56
+ # end
57
+
58
+ # # step to assert javascript pop-up alert text
59
+ # Then(/^I should see alert text as "(.*?)"$/) do |actual_value|
60
+ # check_alert_text(actual_value)
61
+ # end
62
+
63
+ # # step to assert dropdown list
64
+ # Then(/^option "(.*?)" by (.+) from dropdown "(.*?)" should be (selected|unselected)$/) do |option, by, element, state|
65
+ # flag = state == 'selected'
66
+ # is_option_from_dropdown_selected(element, by, option, state)
67
+ # end
68
+