itms_automation 2.5 → 2.6.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.
Files changed (78) 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 +106 -0
  30. data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +38 -0
  31. data/{project → features-skeleton}/Gemfile +0 -0
  32. data/features-skeleton/Gemfile.lock +63 -0
  33. data/features-skeleton/README.md +132 -0
  34. data/{project → features-skeleton}/cucumber.yml +0 -0
  35. data/features-skeleton/my_first.feature +10 -0
  36. data/features-skeleton/screenshots/test.png +0 -0
  37. data/features-skeleton/step_definitions/custom_steps.rb +5 -0
  38. data/features-skeleton/step_definitions/repositories/project_object.yml +1 -0
  39. data/features-skeleton/support/env.rb +105 -0
  40. data/features-skeleton/support/hooks.rb +38 -0
  41. data/lib/itms_automation.rb +1 -3
  42. data/lib/itms_automation/assertion_steps.rb +68 -0
  43. data/lib/itms_automation/click_elements_steps.rb +24 -0
  44. data/lib/itms_automation/configuration_steps.rb +7 -0
  45. data/lib/itms_automation/input_steps.rb +59 -0
  46. data/lib/itms_automation/javascript_handling_steps.rb +10 -0
  47. data/lib/itms_automation/methods/assertion_methods.rb +333 -0
  48. data/lib/itms_automation/methods/click_elements_methods.rb +22 -0
  49. data/lib/itms_automation/methods/configuration_methods.rb +35 -0
  50. data/lib/itms_automation/methods/error_handling_methods.rb +93 -0
  51. data/lib/itms_automation/methods/input_methods.rb +69 -0
  52. data/lib/itms_automation/methods/javascript_handling_methods.rb +9 -0
  53. data/lib/itms_automation/methods/misc_methods.rb +63 -0
  54. data/lib/itms_automation/methods/navigate_methods.rb +123 -0
  55. data/lib/itms_automation/methods/progress_methods.rb +15 -0
  56. data/lib/itms_automation/methods/required_files.rb +9 -0
  57. data/lib/itms_automation/methods/screenshot_methods.rb +6 -0
  58. data/lib/itms_automation/navigation_steps.rb +79 -0
  59. data/lib/itms_automation/progress_steps.rb +17 -0
  60. data/lib/itms_automation/screenshot_steps.rb +6 -0
  61. data/lib/itms_automation/version.rb +5 -3
  62. metadata +89 -75
  63. data/bin/console +0 -14
  64. data/bin/documentation_generator.rb +0 -119
  65. data/bin/setup +0 -8
  66. data/lib/itms_automation/all_steps.rb +0 -8
  67. data/lib/itms_automation/assertion_helper.rb +0 -29
  68. data/lib/itms_automation/auto_util.rb +0 -707
  69. data/lib/itms_automation/database_steps_helper.rb +0 -125
  70. data/lib/itms_automation/web_steps_helper.rb +0 -867
  71. data/project/Gemfile.lock +0 -92
  72. data/project/README.md +0 -34
  73. data/project/Rakefile +0 -24
  74. data/project/features/TestSuite/WebGUI.feature +0 -5
  75. data/project/features/step_definitions/lib_steps/steps_definition.rb +0 -46
  76. data/project/features/step_definitions/repositories/project_object.yml +0 -26
  77. data/project/features/support/env.rb +0 -9
  78. 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,106 @@
1
+ require 'rubygems'
2
+ # require 'itms_automation'
3
+ require_relative '../../../lib/itms_automation.rb'
4
+ # require 'appium_lib'
5
+ require 'appium_lib_core'
6
+ # Store command line arguments
7
+ $browser_type = ENV['BROWSER'] || 'firefox'
8
+ $platform = ENV['PLATFORM'] || 'desktop'
9
+ $os_version = ENV['OS_VERSION']
10
+ $device_name = ENV['DEVICE_NAME']
11
+ $udid = ENV['UDID']
12
+ $app_path = ENV['APP_PATH']
13
+
14
+ # check for valid parameters
15
+ validate_parameters $platform, $browser_type, $app_path
16
+
17
+ # If platform is android or ios create driver instance for mobile browser
18
+ if $platform == 'android' or $platform == 'iOS'
19
+
20
+ if $browser_type == 'native'
21
+ $browser_type = "Browser"
22
+ end
23
+
24
+ if $platform == 'android'
25
+ $device_name, $os_version = get_device_info
26
+ end
27
+
28
+ # desired_caps = {
29
+ # caps: {
30
+ # platformName: $platform,
31
+ # browserName: $browser_type,
32
+ # versionNumber: $os_version,
33
+ # deviceName: $device_name,
34
+ # udid: $udid,
35
+ # app: ".//#{$app_path}"
36
+ # }
37
+ # }
38
+ # appium_url = 'http://localhost:4723/wd/hub'
39
+ # opts = {
40
+ # desired_capabilities: { # or { caps: {....} }
41
+ # platformName: :android,
42
+ # deviceName: 'Android Simulator',
43
+ # app: "WikipediaSample.apk"
44
+ # },
45
+ # appium_lib: {
46
+ # wait: 30
47
+ # }
48
+ # }
49
+
50
+ opts = {
51
+ desired_capabilities: { # or { caps: {....} }
52
+ platformName: $platform,
53
+ browserName: $browser_type,
54
+ deviceName: $device_name,
55
+ versionNumber: $os_version,
56
+ app: "WikipediaSample.apk"
57
+ },
58
+ appium_lib: {
59
+ wait: 30
60
+ }
61
+ }
62
+
63
+ begin
64
+ # $driver = Appium::Driver.new(desired_caps, url: appium_url).start_driver
65
+
66
+ # $driver = Selenium::WebDriver.for(:remote, :url => appium_url, :desired_capabilities => desired_caps)
67
+ @core = Appium::Core.for(opts) # create a core driver with `opts`
68
+ $driver = @core.start_driver
69
+
70
+ rescue Exception => e
71
+ puts e.message
72
+ Process.exit(0)
73
+ end
74
+ else # else create driver instance for desktop browser
75
+ begin
76
+ $driver = case $browser_type
77
+ when "chrome"
78
+ Selenium::WebDriver.for(:chrome)
79
+ when "safari"
80
+ Selenium::WebDriver.for(:safari)
81
+ when "internet_explorer"
82
+ Selenium::WebDriver.for(:internet_explorer)
83
+ when "chrome_headless"
84
+ Selenium::WebDriver.for(:chrome, :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w(headless) }))
85
+ when "remote"
86
+ if ENV['SERVER_URL'].nil? || ENV['REMOTE_BROWSER'].nil?
87
+ puts "\nMissing SERVER_URL : SERVER_URL=http//SERVER_URL:4444/wd/hub"
88
+ puts "\nMissing REMOTE_BROWSER: REMOTE_BROWSER=browser_name"
89
+ Process.exit(0)
90
+ else
91
+ caps = Selenium::WebDriver::Remote::Capabilities.new
92
+ caps["browserName"] = ENV['REMOTE_BROWSER']
93
+ Selenium::WebDriver.for(:remote, :url => ENV['SERVER_URL'], :desired_capabilities => caps)
94
+ end
95
+
96
+ else
97
+ Selenium::WebDriver.for(:firefox)
98
+ end
99
+ $driver.manage().window().maximize()
100
+ p "session_id: #{$driver.session_id}"
101
+ rescue Exception => e
102
+ puts e.message
103
+ Process.exit(0)
104
+ end
105
+ end
106
+
@@ -0,0 +1,38 @@
1
+ def validate_params_exist
2
+ raise "❌ ERROR: Missing param SERVER_URL." if ENV['SERVER_URL'].nil?
3
+ raise "❌ ERROR: Missing param BROWSER." if ENV['BROWSER'].nil?
4
+ if ENV['REPORT']
5
+ raise "❌ ERROR: Missing param TESTSUITE." if ENV['TESTSUITE'].nil?
6
+ raise "❌ ERROR: Missing param TESTCASE_REPORT_NAME." if ENV['TESTCASE_REPORT_NAME'].nil?
7
+ $report_path = "Reports/#{ENV['TESTSUITE']}"
8
+ $testcase_report_name = ENV['TESTCASE_REPORT_NAME']
9
+ end
10
+ end
11
+
12
+ at_exit do
13
+ # quite driver
14
+ $driver.close()
15
+ if ENV['REPORT']
16
+ begin
17
+ # validateReport
18
+ time = Time.now.getutc
19
+ ReportBuilder.configure do |config|
20
+ config.report_path = "#{$report_path}/#{$testcase_report_name}"
21
+ config.input_path = "#{$report_path}/#{$testcase_report_name}.json"
22
+ config.report_types = [:json, :html]
23
+ config.color = 'blue'
24
+ config.additional_info = {
25
+ 'Browser' => $browser_type,
26
+ 'Platform' => $platform ,
27
+ 'OS Version' => $os_version,
28
+ 'Report Generated' => time
29
+ }
30
+ end
31
+ options = { report_title: "INFODation - Test Management System" }
32
+ ReportBuilder.build_report options
33
+ rescue Exception => e
34
+ puts e.message
35
+ Process.exit( 0 )
36
+ end
37
+ end
38
+ end
File without changes
@@ -0,0 +1,63 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ appium_lib_core (3.10.1)
5
+ faye-websocket (~> 0.10.0)
6
+ selenium-webdriver (~> 3.14, >= 3.14.1)
7
+ backports (3.18.1)
8
+ builder (3.2.4)
9
+ childprocess (3.0.0)
10
+ cucumber (3.1.2)
11
+ builder (>= 2.1.2)
12
+ cucumber-core (~> 3.2.0)
13
+ cucumber-expressions (~> 6.0.1)
14
+ cucumber-wire (~> 0.0.1)
15
+ diff-lcs (~> 1.3)
16
+ gherkin (~> 5.1.0)
17
+ multi_json (>= 1.7.5, < 2.0)
18
+ multi_test (>= 0.1.2)
19
+ cucumber-core (3.2.1)
20
+ backports (>= 3.8.0)
21
+ cucumber-tag_expressions (~> 1.1.0)
22
+ gherkin (~> 5.0)
23
+ cucumber-expressions (6.0.1)
24
+ cucumber-tag_expressions (1.1.1)
25
+ cucumber-wire (0.0.1)
26
+ diff-lcs (1.4.4)
27
+ eventmachine (1.2.7)
28
+ faye-websocket (0.10.9)
29
+ eventmachine (>= 0.12.0)
30
+ websocket-driver (>= 0.5.1)
31
+ gherkin (5.1.0)
32
+ httparty (0.13.7)
33
+ json (~> 1.8)
34
+ multi_xml (>= 0.5.2)
35
+ itms_automation (2.6.1)
36
+ appium_lib_core (~> 3.10.1, >= 3.10.1)
37
+ cucumber (~> 3.1.2, >= 3.1.2)
38
+ httparty (~> 0.13.7, >= 0.13.7)
39
+ report_builder (~> 1.8, >= 1.8)
40
+ selenium-webdriver (~> 3.14, >= 3.14.1)
41
+ json (1.8.6)
42
+ multi_json (1.14.1)
43
+ multi_test (0.1.2)
44
+ multi_xml (0.6.0)
45
+ report_builder (1.8)
46
+ json (>= 1.8.1)
47
+ rubyzip (2.3.0)
48
+ selenium-webdriver (3.142.7)
49
+ childprocess (>= 0.5, < 4.0)
50
+ rubyzip (>= 1.2.2)
51
+ websocket-driver (0.7.2)
52
+ websocket-extensions (>= 0.1.0)
53
+ websocket-extensions (0.1.5)
54
+
55
+ PLATFORMS
56
+ ruby
57
+
58
+ DEPENDENCIES
59
+ itms_automation
60
+ report_builder
61
+
62
+ BUNDLED WITH
63
+ 2.0.2
@@ -0,0 +1,132 @@
1
+ Welcome to itms_automation
2
+ =================
3
+
4
+ itms_automation : Automation Tesing Using Ruby
5
+
6
+ itms_automation is a behavior driven development (BDD) approach to write automation test script to test Web and Android Apps.
7
+ It enables you to write and execute automated acceptance/unit tests.
8
+ It is cross-platform, open source and free.
9
+ Automate your test cases with minimal coding.
10
+
11
+ itms_automation Ruby API's
12
+ ============================
13
+
14
+ If you are writing code for your custom steps you can use the following methods :
15
+
16
+ Note : For some of the API paramtere values are fixed. Such values for paramaters are mentioned below.
17
+
18
+ Navigation API's
19
+ ----------------
20
+
21
+ navigate_to("link")
22
+
23
+ navigate(direction) # direction => "back" / "forward"
24
+
25
+ close_driver()
26
+
27
+
28
+ Browser Interaction API's
29
+ -------------------------
30
+
31
+ resize_browser(width, height)
32
+
33
+ scroll_page(to) # to => "top" / "end"
34
+
35
+ scroll_to_element(by, access_value)
36
+
37
+ zoom_in_out(in_out) # in_out => "add" / "subtract"
38
+
39
+ zoom_in_out_till_element_display(by, in_out, access_value) # in_out => "add" / "subtract"
40
+
41
+
42
+ Input API's
43
+ ------------
44
+
45
+ click(element)
46
+
47
+ double_click(element)
48
+
49
+ click_forcefully(element)
50
+
51
+ enter_text(element, text)
52
+
53
+ clear_text(element)
54
+
55
+ check_checkbox(element)
56
+
57
+ uncheck_checkbox(element)
58
+
59
+ toggle_checkbox(element)
60
+
61
+ select_radio_button(element)
62
+
63
+ get_page_title()
64
+
65
+ get_element_text(element)
66
+
67
+ get_element_attribute(element, attribute)
68
+
69
+ is_element_enabled(element)
70
+
71
+ is_element_displayed(element)
72
+
73
+ hover_over_element(element)
74
+
75
+ by => "locators type" ("id", "name", "class", "xpath", "css")
76
+
77
+ access_value => "locator value"
78
+
79
+
80
+ Javascript Handling API
81
+ -----------------------
82
+
83
+ handle_alert(decision) # decision => "accept" / "dismiss"
84
+
85
+ get_alert_text
86
+
87
+
88
+ Progress API's
89
+ --------------
90
+
91
+ wait(time_in_sec)
92
+
93
+ wait_for_element_to_display(element, duration)
94
+
95
+ wait_for_element_to_enable(element, duration)
96
+
97
+
98
+ by => "locators type" ("id", "name", "class", "xpath", "css")
99
+
100
+ access_value => "locator value"
101
+
102
+ duration => duration in seconds.
103
+
104
+
105
+ Screenshot API
106
+ --------------
107
+ take_screenshots
108
+
109
+
110
+ Configuration API
111
+ -----------------
112
+
113
+ print_congifugartion
114
+
115
+
116
+ Usage: itms_automation <command-name> [parameters] [options]
117
+
118
+ <command-name> can be one of
119
+ help
120
+ gen
121
+ version
122
+
123
+ Commands:
124
+ help : prints more detailed help information.
125
+
126
+ gen : creates a skeleton features dir. This is usually used once when
127
+ setting up selnium-cucumber to ensure that the features folder contains
128
+ the right step definitions and environment to run with cucumber.
129
+
130
+ version : prints the gem version
131
+
132
+ Options: -v, --verbose Turns on verbose logging