itms_automation 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/console +14 -0
- data/bin/documentation_generator.rb +119 -0
- data/bin/generate.rb +53 -0
- data/bin/helper.rb +38 -0
- data/bin/itms_automation +32 -0
- data/bin/setup +8 -0
- data/lib/itms_automation.rb +3 -0
- data/lib/itms_automation/all_steps.rb +8 -0
- data/lib/itms_automation/auto_util.rb +133 -0
- data/lib/itms_automation/version.rb +3 -0
- data/lib/itms_automation/web_steps_helper.rb +994 -0
- data/project/Gemfile +3 -0
- data/project/README.md +34 -0
- data/project/Rakefile +24 -0
- data/project/config/chrome_headless_options.yaml +1 -0
- data/project/config/chrome_options.yaml +6 -0
- data/project/config/firefox_headless_options.yaml +1 -0
- data/project/config/firefox_options.yaml +1 -0
- data/project/config/ie_options.yaml +1 -0
- data/project/config/remote_options.yaml +6 -0
- data/project/config/safari_options.yaml +1 -0
- data/project/cucumber.yml +4 -0
- data/project/features/TestSuite/WebGUI.feature +4 -0
- data/project/features/step_definitions/lib_steps/steps_definition.rb +3 -0
- data/project/features/step_definitions/repositories/project_object.yml +2 -0
- data/project/features/support/env.rb +10 -0
- data/project/features/support/hooks.rb +130 -0
- metadata +194 -0
data/project/Gemfile
ADDED
data/project/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
###itms_automation gem
|
2
|
+
itms_automation is an open-source tool for automating GUI, RESTful, SOAP, Database and eMail.
|
3
|
+
Importantly, itms_automation is cross-platform, it allows you to write tests against multiple platforms (Linux, Windows, MacOS) on multiple browsers (chrome, firefox ...) using the same API.
|
4
|
+
|
5
|
+
###Getting Started
|
6
|
+
These instructions will get you a copy of the project up and running on your local machine for testing purposes. See deployment for notes on how to install itms_automation gem
|
7
|
+
###Prerequisites
|
8
|
+
- Ruby: 2.3+
|
9
|
+
###Installing
|
10
|
+
`$ gem install itms_automation`
|
11
|
+
System automatically fetch all relate automation libraries after install itms_automation gem
|
12
|
+
###Setup
|
13
|
+
`$ itms_automation gen`
|
14
|
+
This command help to create a set folder structure which followed the format of BDD Cucumber and itms_automation.
|
15
|
+
###Structure folder format
|
16
|
+
- Screenshot folder
|
17
|
+
Once your scenario failed, the screen will be captured and saved to this folder
|
18
|
+
|
19
|
+
- TestSuite folder
|
20
|
+
Place to store user's feature files.
|
21
|
+
|
22
|
+
- Step_definitions folder
|
23
|
+
- lib_steps
|
24
|
+
- actionword.rb
|
25
|
+
- steps.rb
|
26
|
+
two file help to create user custom steps
|
27
|
+
- repositories
|
28
|
+
- project_object.yml (all web objects will store in this file)
|
29
|
+
- support
|
30
|
+
- env.rb
|
31
|
+
- hook.rb
|
32
|
+
|
33
|
+
- config folder
|
34
|
+
All browser capabilities configuration
|
data/project/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'cucumber'
|
5
|
+
require 'cucumber/rake/task'
|
6
|
+
testsuite_name = ENV['TESTSUITE']
|
7
|
+
testcase_report_name = ENV['TESTCASE_REPORT_NAME']
|
8
|
+
report_path = "Reports/#{testsuite_name}"
|
9
|
+
debug_opts = [ "--format usage", "--out"]
|
10
|
+
report_opts = ["REPORT=true","--color", "--format junit", "--out #{report_path}", "--format json --out #{report_path}/#{testcase_report_name}.json"]
|
11
|
+
namespace :execute do
|
12
|
+
Cucumber::Rake::Task.new(:report, "Execute automation test with report output.") do |t|
|
13
|
+
t.cucumber_opts = [*report_opts, "--format progress"]
|
14
|
+
end
|
15
|
+
Cucumber::Rake::Task.new(:debug, "Debug automation test without report output.") do |t|
|
16
|
+
t.cucumber_opts = [*debug_opts]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
rescue LoadError
|
20
|
+
desc 'Cucumber rake task not available'
|
21
|
+
task :features do
|
22
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
args: ["--headless","--disable-gpu",--no-sandbox]
|
@@ -0,0 +1 @@
|
|
1
|
+
browser.download.downloadDir: '/home/seluser'
|
@@ -0,0 +1 @@
|
|
1
|
+
browser.download.downloadDir: '/home/seluser'
|
@@ -0,0 +1 @@
|
|
1
|
+
mobileEmulation: {deviceName: "iPhone X"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
args: ["--start-maximized","--disable-infobars","--incognito", "--user-agent='Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile /9A334 Safari/7534.48.3'"]
|
2
|
+
prefs: {
|
3
|
+
password_manager_enabled: false,
|
4
|
+
default_content_settings: {popups: 0},
|
5
|
+
content_settings: {pattern_pairs: {'*': {'multiple-automatic-downloads': 1}}}
|
6
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
mobileEmulation: {deviceName: "iPhone X"}
|
@@ -0,0 +1,130 @@
|
|
1
|
+
Before do |scenario|
|
2
|
+
$driver = getDriver
|
3
|
+
$wait_time = ENV["WAIT_TIME"] || 30
|
4
|
+
$print_log = ENV["PRINT_LOG"] || false
|
5
|
+
$browser_data = page.driver.browser.capabilities
|
6
|
+
end
|
7
|
+
|
8
|
+
AfterConfiguration do
|
9
|
+
$OBJECT = loadYAMLfile("features/step_definitions/repositories/project_object.yml")
|
10
|
+
validate_params_exist
|
11
|
+
if ENV['DELETE_COOKIE']
|
12
|
+
browser = Capybara.current_session.driver.browser
|
13
|
+
browser.manage.delete_all_cookies
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate_params_exist
|
19
|
+
raise "❌ ERROR: Missing param SERVER_URL." if ENV['SERVER_URL'].nil?
|
20
|
+
raise "❌ ERROR: Missing param BROWSER." if ENV['BROWSER'].nil?
|
21
|
+
if ENV['REPORT']
|
22
|
+
raise "❌ ERROR: Missing param TESTSUITE." if ENV['TESTSUITE'].nil?
|
23
|
+
raise "❌ ERROR: Missing param TESTCASE_REPORT_NAME." if ENV['TESTCASE_REPORT_NAME'].nil?
|
24
|
+
$report_path = "Reports/#{ENV['TESTSUITE']}"
|
25
|
+
$testcase_report_name = ENV['TESTCASE_REPORT_NAME']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def getDriver
|
30
|
+
case ENV['BROWSER']
|
31
|
+
when "chrome"
|
32
|
+
@chrome_options = loadYAMLfile('config/chrome_options.yaml')
|
33
|
+
Capybara.register_driver :selenium do |app|
|
34
|
+
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'],:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: @chrome_options))
|
35
|
+
end
|
36
|
+
Capybara.current_driver = :selenium
|
37
|
+
when "firefox"
|
38
|
+
@firefox_options = loadYAMLfile('config/firefox_options.yaml')
|
39
|
+
Capybara.register_driver :selenium do |app|
|
40
|
+
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox(firefoxOptions: @firefox_options))
|
41
|
+
end
|
42
|
+
Capybara.current_driver = :selenium
|
43
|
+
when "safari"
|
44
|
+
@safari_options = loadYAMLfile('config/safari_options.yaml')
|
45
|
+
Capybara.register_driver :selenium do |app|
|
46
|
+
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.safari(safariOptions: @safari_options))
|
47
|
+
end
|
48
|
+
Capybara.current_driver = :selenium
|
49
|
+
when "ie"
|
50
|
+
@ie_options = loadYAMLfile('config/ie_options.yaml')
|
51
|
+
Capybara.register_driver :selenium do |app|
|
52
|
+
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.internet_explorer(ieOptions: @ie_options))
|
53
|
+
end
|
54
|
+
Capybara.current_driver = :selenium
|
55
|
+
# when "chrome_headless"
|
56
|
+
# @chrome_headless_options = loadYAMLfile('config/chrome_headless_options.yaml')
|
57
|
+
# Capybara.register_driver :selenium do |app|
|
58
|
+
# Capybara::Selenium::Driver.new(app, :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: @chrome_headless_options))
|
59
|
+
# end
|
60
|
+
# Capybara.current_driver = :selenium_headless
|
61
|
+
# when "firefox_headless"
|
62
|
+
# @firefox_headless_options = loadYAMLfile('config/firefox_options.yaml')
|
63
|
+
# Capybara.register_driver :selenium do |app|
|
64
|
+
# Capybara::Selenium::Driver.new(app, :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox(firefoxOptions: @firefox_headless_options))
|
65
|
+
# end
|
66
|
+
# Capybara.current_driver = :selenium_headless
|
67
|
+
when "remote"
|
68
|
+
@capabilities = loadYAMLfile('config/remote_options.yaml')
|
69
|
+
Capybara.register_driver :selenium do |app|
|
70
|
+
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => @capabilities)
|
71
|
+
end
|
72
|
+
Capybara.current_driver = :selenium
|
73
|
+
else
|
74
|
+
raise "❌ ERROR: Unsupported browser: #{ENV['BROWSER']}. Available: chrome || firefox || safari || ie || remote"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def loadYAMLfile(filename)
|
79
|
+
begin
|
80
|
+
return YAML.load_file(filename)
|
81
|
+
rescue Psych::SyntaxError => ex
|
82
|
+
raise "❌ SyntaxError when reading file: #{ex}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
After do |scenario|
|
87
|
+
# save_screenshot = ENV['SCREENSHOT'] || false
|
88
|
+
# if save_screenshot == true
|
89
|
+
# file_name = 'failed_%s.png' % rand(1000).to_s
|
90
|
+
# page.save_screenshot($screenshot+file_name) if scenario.failed?
|
91
|
+
# begin
|
92
|
+
# Capybara.page.driver.quit
|
93
|
+
# Capybara.send(:session_pool).delete_if { |key, value| key =~ /selenium/i }
|
94
|
+
# rescue StandardError => myStandardError
|
95
|
+
# puts "❌ Error: #{myStandardError}"
|
96
|
+
# exit(1)
|
97
|
+
# end
|
98
|
+
# end
|
99
|
+
# $browser_data = page.driver.browser.capabilities
|
100
|
+
# p "$browser_data:#{$browser_data.inspect}"
|
101
|
+
end
|
102
|
+
|
103
|
+
at_exit do
|
104
|
+
if ENV['REPORT']
|
105
|
+
begin
|
106
|
+
# validateReport
|
107
|
+
time = Time.now.getutc
|
108
|
+
if $browser_data
|
109
|
+
browser_name = $browser_data[:browser_name]
|
110
|
+
browser_version = $browser_data[:browser_version]
|
111
|
+
platform = $browser_data[:platform_name]
|
112
|
+
end
|
113
|
+
ReportBuilder.configure do |config|
|
114
|
+
config.report_path = "#{$report_path}/#{$testcase_report_name}"
|
115
|
+
config.input_path = "#{$report_path}/#{$testcase_report_name}.json"
|
116
|
+
config.report_types = [:json, :html]
|
117
|
+
config.color = 'blue'
|
118
|
+
config.additional_info = {
|
119
|
+
'Browser' => browser_name || nil,
|
120
|
+
'Platform' => platform || nil,
|
121
|
+
'Browser Version' => browser_version || nil,
|
122
|
+
'Report Generated' => time
|
123
|
+
}
|
124
|
+
end
|
125
|
+
options = { report_title: "iTMS - Test Management System" }
|
126
|
+
ReportBuilder.build_report options
|
127
|
+
rescue NoMethodError
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
metadata
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: itms_automation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anh Pham
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: selenium-webdriver
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.6.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.6'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.6.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.6'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: cucumber
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.1'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.1'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: capybara
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.29.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.29.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 3.8.0
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '3.8'
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 3.8.0
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '3.8'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: parallel_tests
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2.7'
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.7.1
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '2.7'
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 2.7.1
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: report_builder
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '1.8'
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.8'
|
111
|
+
type: :runtime
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.8'
|
118
|
+
- - "~>"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '1.8'
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: cucumber_priority
|
123
|
+
requirement: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: 0.3.2
|
128
|
+
type: :runtime
|
129
|
+
prerelease: false
|
130
|
+
version_requirements: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - "~>"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 0.3.2
|
135
|
+
description: Behavior driven development (BDD) approach to write automation test script
|
136
|
+
to test GUI, RESTful, SOAP, Database, eMail.
|
137
|
+
email:
|
138
|
+
- anhpq.info@gmail.com
|
139
|
+
executables:
|
140
|
+
- itms_automation
|
141
|
+
extensions: []
|
142
|
+
extra_rdoc_files: []
|
143
|
+
files:
|
144
|
+
- bin/console
|
145
|
+
- bin/documentation_generator.rb
|
146
|
+
- bin/generate.rb
|
147
|
+
- bin/helper.rb
|
148
|
+
- bin/itms_automation
|
149
|
+
- bin/setup
|
150
|
+
- lib/itms_automation.rb
|
151
|
+
- lib/itms_automation/all_steps.rb
|
152
|
+
- lib/itms_automation/auto_util.rb
|
153
|
+
- lib/itms_automation/version.rb
|
154
|
+
- lib/itms_automation/web_steps_helper.rb
|
155
|
+
- project/Gemfile
|
156
|
+
- project/README.md
|
157
|
+
- project/Rakefile
|
158
|
+
- project/config/chrome_headless_options.yaml
|
159
|
+
- project/config/chrome_options.yaml
|
160
|
+
- project/config/firefox_headless_options.yaml
|
161
|
+
- project/config/firefox_options.yaml
|
162
|
+
- project/config/ie_options.yaml
|
163
|
+
- project/config/remote_options.yaml
|
164
|
+
- project/config/safari_options.yaml
|
165
|
+
- project/cucumber.yml
|
166
|
+
- project/features/TestSuite/WebGUI.feature
|
167
|
+
- project/features/step_definitions/lib_steps/steps_definition.rb
|
168
|
+
- project/features/step_definitions/repositories/project_object.yml
|
169
|
+
- project/features/support/env.rb
|
170
|
+
- project/features/support/hooks.rb
|
171
|
+
homepage: http://rubygems.org/gems/itms_automation
|
172
|
+
licenses:
|
173
|
+
- MIT
|
174
|
+
metadata: {}
|
175
|
+
post_install_message: Thank you for installing itms_automation gem.
|
176
|
+
rdoc_options: []
|
177
|
+
require_paths:
|
178
|
+
- lib
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubygems_version: 3.0.6
|
191
|
+
signing_key:
|
192
|
+
specification_version: 4
|
193
|
+
summary: SELENIUM WEBDRIVER WITH RUBY & CUCUMBER
|
194
|
+
test_files: []
|